Extractor Module¶
VCF field extraction utilities
Field extraction module.
This module uses SnpSift extractFields to extract specific fields from VCF records and save the result to the specified output file.
- variantcentrifuge.extractor.extract_fields(variant_file, fields, cfg, output_file)[source]¶
Extract specified fields from variant records.
Write them directly to output_file, controlling the SnpSift field separator if needed.
- Parameters:
variant_file (str) – Path to the VCF file from which fields should be extracted.
fields (str) – A space-separated list of fields to extract (e.g. “CHROM POS REF ALT DP AD”).
cfg (dict) –
Configuration dictionary that may include tool paths, parameters, etc.
- ”extract_fields_separator”: str
The separator for multi-sample fields when using SnpSift -s …. Often a comma “,”. Defaults to “,” if not present.
- ”debug_level”: str or None
Optional debug level to control how much we log.
output_file (str) – Path to the final TSV file where extracted fields will be written.
- Returns:
The same output_file path that now contains the extracted fields (TSV).
- Return type:
- Raises:
RuntimeError – If the field extraction command fails.