get_chromosome_number

pylluminator.utils.get_chromosome_number(chromosome_id: str | list[str] | Series, convert_string=False) list[int] | int | None

From a string representing the chromosome ID, get the chromosome number. E.g. ‘chr22’ -> 22. If the input is not a numbered chromosome, return np.nan. The string part has to be only ‘chr’, not case-sensitive

Parameters:
  • chromosome_id (str | list[str] | pandas.Series) – input string(s) to extract the number from

  • convert_string (bool) – convert any non-numbered chromosome to a number. Gives X the ID 98, Y the ID 99. Any other string will be given the ID 100. Default: False

Returns:

the chromosome(s) number(s) as an integer, or None if not applicable

Return type:

list[int] | int | None