cool_seq_tool.mappers.liftover#
Module for mapping to/from human genome assemblies.
Currently only supports GRCh37 <-> GRCh38
- class cool_seq_tool.mappers.liftover.LiftOver(chain_file_37_to_38=None, chain_file_38_to_37=None)[source]#
Class for mapping to/from human genome assemblies
Currently only supports GRCh37 <-> GRCh38
- __init__(chain_file_37_to_38=None, chain_file_38_to_37=None)[source]#
Initialize liftover class
- Parameters:
chain_file_37_to_38 (
Optional[str]) – Optional path to chain file for 37 to 38 assembly. This is used foragct. If this is not provided, will check to see ifLIFTOVER_CHAIN_37_TO_38env var is set. If neither is provided, will allowagctto download a chain file from UCSCchain_file_38_to_37 (
Optional[str]) – Optional path to chain file for 38 to 37 assembly. This is used foragct. If this is not provided, will check to see ifLIFTOVER_CHAIN_38_TO_37env var is set. If neither is provided, will allowagctto download a chain file from UCSC
- get_liftover(chromosome, pos, liftover_to_assembly)[source]#
Get new genome assembly data for a position on a chromosome.
Use a UCSC-style chromosome name:
>>> from cool_seq_tool.mappers import LiftOver >>> from cool_seq_tool.schemas import Assembly >>> lo = LiftOver() >>> lo.get_liftover("chr7", 140453136, Assembly.GRCH38) ('chr7', 140753336)
Chromosome names can also be NCBI-style, without prefixes:
>>> lo.get_liftover("7", 140453136, Assembly.GRCH38) ('chr7', 140753336)
- Parameters:
chromosome (
str) – The chromosome number, e.g."chr7","chrX","5".pos (
int) – Position on the chromosomeliftover_to_assembly (
Assembly) – Assembly to liftover to
- Return type:
Optional[tuple[str,int]]- Returns:
Target chromosome and target position for assembly