Added parser for AIT files - #90
Open
puja-trivedi wants to merge 4 commits into
Open
Conversation
…, macaque, and marmoset
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parsing Allen Institute Taxonomy (AIT) .h5ad files
What these are: The BICAN/HMBA basal-ganglia taxonomies (Human, Macaque, Marmoset) are released as AIT files in .h5ad (AnnData) format — the same format scrattch produces. Each file is an HDF5 container holding a cell×gene expression matrix plus the cell-type taxonomy.
The key insight: These files are huge (Human 105 GB, Macaque 32 GB, Marmoset 30 GB), but almost all of that is the expression matrix (X). The taxonomy itself is tiny and lives in the uns group:
Because .h5ad is HDF5, we can open a file and read only those small groups using HTTP range requests — so we never download the full file and never load the expression matrix. Reading a 30 GB remote file takes seconds.
The tool: bkbit/data_translators/ait_taxonomy_parser.py (an AITTaxonomy class). It's read-only, works on local paths or https:///s3:// URLs, and returns pandas DataFrames or writes CSV.
Usage:
summary, no download:
python -m bkbit.data_translators.ait_taxonomy_parser --no-obs
export taxonomy table to CSV:
python -m bkbit.data_translators.ait_taxonomy_parser --no-obs --out out.csv
Dependencies: anndata, h5py, fsspec, aiohttp.
Output so far: CSVs of the per-cluster taxonomy table for all three species:
Next steps:
Align columns across species into one schema, and/or emit BICAN taxonomy JSON-LD objects (like the existing translators).