Skip to main content

load_variants_for_contig

Function load_variants_for_contig 

Source
pub fn load_variants_for_contig(
    path: &Path,
    contig_name: &str,
    sample_name: Option<&str>,
    _dict: &SequenceDictionary,
) -> Result<Vec<VariantRecord>>
Expand description

Load variant records from a VCF for a given sample and contig.

Reads all records for contig_name, parses the GT field for the selected sample, and returns a sorted list of VariantRecords. Records where the sample’s genotype is homozygous reference or entirely missing are skipped.

§Arguments

  • path — Path to the VCF file.
  • contig_name — Name of the contig to load variants for.
  • sample_name — Sample name, or None to use the only sample in the VCF.
  • _dict — Sequence dictionary (reserved for future validation).

§Errors

Returns an error if the VCF cannot be read, the sample is not found, or GT fields are missing or malformed.