GenomeLifter

A handy function to lift genomic coordinates between genome versions.

GenomeLifter.genome_lifter(regions, input_version, output_version, same_chr=True, size_change=2)

Takes a list of regions and returns a list of all successful lifted regions, based on the converter object given. Strand is not considered. The chr can be w/ or w/o the ‘chr’ prefix, the original chr will be retained.

Parameters:
  • regions – Either the path to a bed-file (without header or with the first line starting with #), a BedTool’s objects or a list of regions with [chr, start, end, …]. Any additional columns are kept.

  • input_version – Genome version of the entries in region_list. E.g., “hg19”.

  • output_version – Genome version region_list should be lifted to. E.g., “hg38”.

  • same_chr – Boolean if regions should only be lifted if they remain on the same chromosome. Yes, lifting may change the chromosome.

  • size_change – Multiplier by how much the original region size is allowed to change. E.g., 2 means that a 100 bp region is allowed to be 200 bp after lifting, the region will be skipped otherwise.

Returns:

  • lifted_regions: List of regions lifted to output_version.

  • unliftable: List of regions that could not be lifted with their coordinates still in the input genome version.

Return type:

tuple

*GenomeLifter.genome_lifter*
hg38 coordinates:
chr21   42974618        42975047        Peak_188        726     .       14.39915        72.61232        67.44043        198
chr21   41677496        41679127        Peak_197        720     .       12.03953        72.01997        66.87104        1339
chr21   37366735        37369006        Peak_285        669     .       13.00772        66.95300        61.99598        190
hg19 coordinates:
[['chr21', '44394728', '44395157', 'Peak_188', '726', '.', '14.39915', '72.61232', '67.44043', '198'], ['chr21', '43097656', '43099287', 'Peak_197', '720', '.', '12.03953', '72.01997', '66.87104', '1339'], ['chr21', '38739037', '38741308', 'Peak_285', '669', '.', '13.00772', '66.95300', '61.99598', '190']]