Skip to content

Make get_chromosomes species-agnostic with optional genome parameter#185

Open
LiudengZhang wants to merge 1 commit intoGenentech:mainfrom
LiudengZhang:feat/species-agnostic-chromosomes
Open

Make get_chromosomes species-agnostic with optional genome parameter#185
LiudengZhang wants to merge 1 commit intoGenentech:mainfrom
LiudengZhang:feat/species-agnostic-chromosomes

Conversation

@LiudengZhang
Copy link

Closes #167.

get_chromosomes("autosomes") currently returns hardcoded human chromosomes (chr1-chr22), which is incorrect for other species (e.g. mouse only has chr1-chr19).

This adds an optional genome parameter. When provided, chromosome names are read from the genome's sizes file and filtered by pattern (chr\d+ for autosomes), so the function works correctly for any species. When omitted, it falls back to the existing human defaults for backward compatibility.

Updated the two call sites in preprocess.py that already have genome objects loaded (get_gc_matched_intervals, make_insertion_bigwig) to pass the genome through.

Tests added:

  • test_get_chromosomes_with_genome: uses a fake mouse genome (chr1-19 + chrX/Y/M) to verify all three shortcuts resolve correctly
  • Existing tests unchanged (verify human defaults still work without genome)

Add an optional genome parameter to get_chromosomes() so that shortcut
names like "autosomes" resolve to the actual chromosomes in the genome
(e.g. chr1-chr19 for mouse) instead of hardcoded human chr1-chr22.

When no genome is provided, the function falls back to the existing
human defaults for backward compatibility.

Updated the two call sites in preprocess.py that already have genome
objects (get_gc_matched_intervals, make_insertion_bigwig) to pass
the genome through.

Closes Genentech#167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The function get_chromosomes("autosomes") is not species agnostic.

1 participant