cool_seq_tool.utils#
Provide a small set of general helper functions.
- cool_seq_tool.utils.get_inter_residue_pos(start_pos, end_pos, residue_mode)[source]#
Return equivalent inter-residue position.
Generally, we prefer to work with inter-residue coordinates where possible. Our rationale is detailed in an appendix to the VRS docs. This function is used internally to shift user-provided coordinates accordingly.
>>> from cool_seq_tool.utils import get_inter_residue_pos >>> from cool_seq_tool.schemas import ResidueMode >>> get_inter_residue_pos(10, ResidueMode.RESIDUE) ((9, 9), None)
- Parameters:
start_pos (
int) – Start positionend_pos (
int) – End positionresidue_mode (
ResidueMode) – Residue mode for start_pos and end_pos
- Return type:
tuple[int,int]- Returns:
Inter-residue coordinates
- cool_seq_tool.utils.process_chromosome_input(chromosome, context='')[source]#
Perform processing on a chromosome arg.
E.g.
>>> from cool_seq_tool.utils import process_chromosome_input >>> process_chromosome_input("7") 'chr7' >>> process_chromosome_input("x") 'chrX' >>> process_chromosome_input("chr7") 'chr7'
In the future, we could also use this method to be more opinionated about legal chromosome values, or throw exceptions in the event of invalid or unrecognized terms.
- Parameters:
chromosome (
str) – user-provided chromosome inputcontext (
str) – calling context to provide in log
- Return type:
str- Returns:
processed chromosome value. Idempotent – returns original value if no changes needed.