Skip to content

Commit 70cc545

Browse files
add support for mitochondrial DNA
1 parent 1032e78 commit 70cc545

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/anyvlm/utils/types.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ def is_valid_chromosome_name(chromosome_name: str) -> bool:
3838
"""Checks whether or not a provided chromosome name is valid.
3939
4040
:param chromosome_name: The chromosome name to validate.
41-
:return: `True` if the chromosome name is a number between 1-22, or the values "X" or "Y"; else `False`.
41+
:return: `True` if the chromosome name is a number between 1-22, or the values "X", "Y", or "MT"; else `False`.
4242
"""
4343
min_chromosome_number = 1
4444
max_chromosome_number = 22
4545
try:
4646
return (
47-
chromosome_name in {"X", "Y"}
47+
chromosome_name in {"X", "Y", "MT"}
4848
or min_chromosome_number <= int(chromosome_name) <= max_chromosome_number
4949
)
5050
except ValueError:
@@ -67,9 +67,7 @@ def _normalize_chromosome_name(chromosome_name: str) -> str:
6767

6868
if is_valid_chromosome_name(chromosome_name):
6969
return chromosome_name
70-
error_message = (
71-
"Invalid chromosome. Must be 1-22, 'X', or 'Y'; with optional 'chr' prefix."
72-
)
70+
error_message = "Invalid chromosome. Must be either a number between 1-22, or the values 'X', 'Y', or 'MT'; with optional 'chr' prefix."
7371
raise ValueError(error_message)
7472

7573

0 commit comments

Comments
 (0)