pybedtools.bedtool.BedTool.truncate_to_chrom¶
- BedTool.truncate_to_chrom(genome)[source]¶
Ensure all features fall within chromosome limits.
Some peak-callers extend peaks such that the boundaries overstep chromosome coordinates. Upon uploading such a file to a genome browser like UCSC, this results in an error like:
Error line 101 of custom track: chromEnd larger than chrom chr2 size
Use this method to clean your file, truncating any out-of-bounds features to fit within the chromosome coordinates of
genome
.genome
can be either an assembly name (‘dm3’) or a dictionary where keys are chrom and values are (start, stop) tuples.