Output related functions.
More...
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <assert.h>
#include <libxml/tree.h>
#include <jwsc/base/error.h>
#include <jwsc/vector/vector.h>
#include <jwsc/matblock/matblock.h>
Go to the source code of this file.
Enumerations |
enum | Haplo_output_format { HAPLO_OUTPUT_TXT,
HAPLO_OUTPUT_CSV,
HAPLO_OUTPUT_XML
} |
| Types of output file format to generate. More...
|
enum | Haplo_field_sep { HAPLO_SEP_PREFIX,
HAPLO_SEP_SUFFIX,
HAPLO_SEP_BOTH,
HAPLO_SEP_NONE
} |
| Types of field separation in an output file. More...
|
Functions |
Error * | open_output (FILE **fp_out, xmlDoc **xml_doc_out, const char *xml_name, const char *xml_dtd, const char *fname) |
| Open an output file for writing.
|
Error * | close_output (FILE *fp, xmlDoc *doc, const char *fname) |
| Close a file used for output writing.
|
void | write_ids (const Matblock_u8 *ids, uint32_t i, Haplo_field_sep field_sep, FILE *fp, xmlNode *xml_node) |
| Writes a sample ids to a file or an xml node.
|
void | write_label (const Vector_u32 *labels, uint32_t i, Haplo_field_sep field_sep, FILE *fp, xmlNode *xml_node) |
| Writes a sample label to a file or an xml node.
|
void | write_conf (const Vector_d *confs, uint32_t i, Haplo_field_sep field_sep, FILE *fp, xmlNode *xml_node) |
| Writes a label confidence value to a file stream.
|
void | write_prediction (const char *type, const Vector_u32 *labels, const Vector_d *confs, uint32_t i, Haplo_field_sep field_sep, FILE *fp, xmlNode *xml_node) |
| Writes a prediction.
|
void | write_ancestor_label (const Vector_u32 *ancestor_types, const Vector_u32 *ancestor_labels, uint32_t i, Haplo_field_sep field_sep, FILE *fp, xmlNode *xml_node) |
| Writes the ancestor to a file stream.
|
Detailed Description
Output related functions.
- Author:
- Joseph Schlecht
- License:
- Creative Commons BY-NC-SA 3.0
Definition in file output.h.
Enumeration Type Documentation
Types of output file format to generate.
- Enumerator:
HAPLO_OUTPUT_TXT |
|
HAPLO_OUTPUT_CSV |
|
HAPLO_OUTPUT_XML |
|
Definition at line 65 of file output.h.
Types of field separation in an output file.
- Enumerator:
HAPLO_SEP_PREFIX |
|
HAPLO_SEP_SUFFIX |
|
HAPLO_SEP_BOTH |
|
HAPLO_SEP_NONE |
|
Definition at line 75 of file output.h.
Function Documentation
Error* open_output |
( |
FILE ** |
fp_out, |
|
|
xmlDoc ** |
xml_doc_out, |
|
|
const char * |
xml_name, |
|
|
const char * |
xml_dtd, |
|
|
const char * |
fname |
|
) |
| |
Open an output file for writing.
Depending on the value of opts.output_format, either *fp_out or *doc_out will be initialized.
- Parameters:
-
fp_out | Result parameter. Contains the file stream pointer. |
xml_doc_out | Result parameter. Contains the xml document pointer. Can be NULL, in which case the (xml) function is a NOOP. |
xml_name | Name of the document type and root node. |
xml_dtd | Name of the document type definition file to use. |
fname | File name to open for writing. |
Definition at line 83 of file output.c.
Error* close_output |
( |
FILE * |
fp, |
|
|
xmlDoc * |
xml_doc, |
|
|
const char * |
fname |
|
) |
| |
Close a file used for output writing.
Depending on the value of opts.output_format, either fp or doc will be closed.
- Parameters:
-
fp | File stream pointer. |
xml_doc | Xml document pointer. Can be NULL, in which case the (xml) functions is a NOOP. |
fname | File name to close that was used for writing. |
Definition at line 128 of file output.c.
Writes a sample ids to a file or an xml node.
- Parameters:
-
ids | Set of predicted haplo labels. |
i | Index of the haplo label in labels to write. |
field_sep | Type of field separation to maintain. |
fp | File stream to write to. |
xml_node | Parent xml node to attach a label node to. |
Definition at line 167 of file output.c.
Writes a sample label to a file or an xml node.
- Parameters:
-
labels | Set of predicted haplo labels. |
i | Index of the haplo label in labels to write. |
field_sep | Type of field separation to maintain. |
fp | File stream to write to. |
xml_node | Parent xml node to attach a label node to. |
Definition at line 237 of file output.c.
Writes a label confidence value to a file stream.
- Parameters:
-
confs | Set of predicted haplo label confidence values. |
i | Index of the haplo label confidence in confs to write. |
field_sep | Type of field separation to maintain. |
fp | File stream to write to. |
xml_node | Parent xml node to attach a label node to. |
Definition at line 305 of file output.c.
Writes a prediction.
- Parameters:
-
type | Name of this type of prediction. |
labels | Set of predicted haplo labels. |
confs | Set of predicted haplo label confidence values. |
i | Index of the haplo label confidence in confs to write. |
field_sep | Type of field separation to maintain. |
fp | File stream to write to. |
xml_node | Parent xml node to attach a label node to. |
Definition at line 370 of file output.c.
Writes the ancestor to a file stream.
- Parameters:
-
ancestor_types | Types of ancestor relationship per label. |
ancestor_labels | Set of ancestors. |
i | Index of the ancestor to write. |
field_sep | Type of field separation to maintain. |
fp | File stream to write to. |
xml_node | Parent xml node to attach a label node to. |
Definition at line 405 of file output.c.