Genome Utilities¶
- class finaletoolkit.genome.GenomeGaps(gaps_bed=None)[source]¶
Telomere/centromere/short-arm intervals for a reference genome.
Construct from a BED4 gap file, or use the
ucsc_hg19()/b37()/hg38()classmethods for the bundled UCSC tracks.- Parameters:
gaps_bed (Union[PathLike, str, None])
- classmethod ucsc_hg19()[source]¶
GenomeGaps for UCSC hg19 (
chr-prefixed, GRCh37-based).- Return type:
- classmethod b37()[source]¶
GenomeGaps for Broad b37 (UCSC hg19 track with
chrstripped).An ad-hoc approximation; other hg19/b37 differences are not accounted for.
- Return type:
- in_tcmere(contig, start, stop)[source]¶
Return whether an interval overlaps a centromere or telomere.
Returns
Noneif the contig has no centromere annotation.
- overlaps_gap(contig, start, stop)[source]¶
Return whether an interval overlaps any gap (
Noneif none).
- get_arm(contig, start, stop)[source]¶
Return the chromosome arm (e.g.
"1p") or"NOARM".- Raises:
ValueError – If
stop < start.- Parameters:
- Return type:
- get_contig_gaps(contig)[source]¶
Return a
ContigGapsforcontig(Noneif no centromere).- Parameters:
contig (str)
- Return type:
ContigGaps | None
- class finaletoolkit.genome.ContigGaps(contig, centromere, telomeres, has_short_arm=False)[source]¶
Centromere/telomere intervals for a single contig.
- Parameters:
- in_tcmere(start, stop)[source]¶
Return whether an interval overlaps the centromere or a telomere.
Notes
The telomere test uses
all()(an interval must overlap every telomere). This matches the original implementation and is preserved deliberately: the bundled DELFI reference outputs were generated with this behavior, so changing it toany()would alter DELFI results.
- in_gap(start, stop)[source]¶
Alias of
in_tcmere()(preserved for compatibility).
- finaletoolkit.genome.ucsc_hg19_gap_bed(output_file)[source]¶
Write a BED4 of UCSC hg19 centromeres/telomeres/short arms.