pub struct PloidyMap { /* private fields */ }Expand description
Maps genomic positions to ploidy values, supporting a global default with per-contig and per-region overrides.
Overrides are processed in order and use last-writer-wins semantics: later entries override earlier ones for overlapping positions. This allows patterns like:
--ploidy 2 --ploidy-override chrX=1 --ploidy-override chrX:10001-2781479=2which sets diploid genome-wide, then haploid chrX, then diploid PAR1 on chrX.
Implementations§
Source§impl PloidyMap
impl PloidyMap
Sourcepub fn new(default_ploidy: u8, override_specs: &[String]) -> Result<Self>
pub fn new(default_ploidy: u8, override_specs: &[String]) -> Result<Self>
Create a new ploidy map with the given default and overrides.
Override strings have the format CONTIG=PLOIDY (whole contig) or
CONTIG:START-END=PLOIDY (1-based inclusive coordinates, converted
internally to 0-based half-open).
§Errors
Returns an error if any override string is malformed.
Sourcepub fn ploidy_at(&self, contig: &str, position: u32) -> u8
pub fn ploidy_at(&self, contig: &str, position: u32) -> u8
Look up the ploidy for a specific contig and 0-based position.
Returns the last matching override, or the default if no override applies.
Sourcepub fn default_ploidy(&self) -> u8
pub fn default_ploidy(&self) -> u8
Return the default ploidy.