AllenInstitute / AllenInstitute/cell_type_mapper

RuntimeError when trying to run online MapMyCells mouse brain taxonomy programmatically

Open
#26 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
55
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Hi there,
First off, I'd like to say thank you for making this wonderful tool!

I'm having an issue where I am trying to run MapMyCells using the code from this repo, and I am trying to do so with the online 10x Whole Mouse Brain taxonomy (CCN20230722) that is used on the MapMyCells website. I am also trying to do so programmatically so I don't have to use the otherwise unwieldy command line expression to run it. My python code to perform a test run looks like this (I am also using the sample mouse brain h5ad file provided on the website to test it out):

from cell_type_mapper.cli.from_specified_markers import (
    FromSpecifiedMarkersRunner
)

config = {
    'precomputed_stats': {
        'path': '/Users/ariandjahed/LocalRepos/Other/cell_type_mapper/taxonomies/10x_Whole_Mouse_Brain_taxonomy_(CCN20230722)/precomputed_stats_ABC_revision_230821.h5'
    },
    'query_markers': {
        'serialized_lookup': '/Users/ariandjahed/LocalRepos/Other/cell_type_mapper/taxonomies/10x_Whole_Mouse_Brain_taxonomy_(CCN20230722)/mouse_markers_230821.json'
    },
    'type_assignment': {
        'n_processors': 4,
        'normalization': 'raw'
    },
    'query_path': 'wholemousebrain_ccn20230722_example_10kcells_550genes.h5ad',
    'extended_result_path': 'mapping_output.json',
    'csv_result_path': 'mapping_output.csv',
    'drop_level': 'CCN20230722_SUPT',
    'cloud_safe': False
}

mapping_runner = FromSpecifiedMarkersRunner(
    args=[], input_data=config)

mapping_runner.run()

However, I am getting the following error, and I can't seem to figure out what is causing it:

Traceback (most recent call last):
  File "/Users/ariandjahed/LocalRepos/SharedRepos/Bonsai_SpatialTranscriptomics/mapmycells_data/test_with_local_repo/mapmycellstest.py", line 26, in <module>
    mapping_runner.run()
  File "/Users/ariandjahed/LocalRepos/Other/cell_type_mapper/src/cell_type_mapper/cli/from_specified_markers.py", line 71, in run
    run_mapping(
  File "/Users/ariandjahed/LocalRepos/Other/cell_type_mapper/src/cell_type_mapper/cli/from_specified_markers.py", line 144, in run_mapping
    output = _run_mapping(
             ^^^^^^^^^^^^^
  File "/Users/ariandjahed/LocalRepos/Other/cell_type_mapper/src/cell_type_mapper/cli/from_specified_markers.py", line 310, in _run_mapping
    create_marker_cache_from_specified_markers(
  File "/Users/ariandjahed/LocalRepos/Other/cell_type_mapper/src/cell_type_mapper/type_assignment/marker_cache_v2.py", line 115, in create_marker_cache_from_specified_markers
    marker_lookup = validate_marker_lookup(
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ariandjahed/LocalRepos/Other/cell_type_mapper/src/cell_type_mapper/type_assignment/marker_cache_v2.py", line 775, in validate_marker_lookup
    raise RuntimeError(error_msg)
RuntimeError: After comparing query data to reference data, no valid marker genes could be found at any level in the taxonomy.
Example of genes in query set:
['2900052N01Rik', '4930509J09Rik', '9330158H04Rik', 'A630012P03Rik', 'A830036E02Rik']

What would you advise? Any help would be appreciated.
Thank you so much in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cell_type_mapper/cli/from_specified_markers.py and the failing validate_marker_lookup path in cell_type_mapper/type_assignment/marker_cache_v2.py. Compare the query genes, reference files, and configuration used by the sample run; done means the programmatic example completes without the no-valid-marker-genes RuntimeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.