grassp.ds.gene_sets_uniprot_sl

grassp.ds.gene_sets_uniprot_sl#

gene_sets_uniprot_sl(species='hsap', *, root=None, min_genes=None)[source]#

The full UniProt subcellular-location vocabulary, one term per node.

Where gene_sets_curated() collapses the vocabulary onto compartments an experiment can resolve, this keeps every fine-grained term as its own set: 240 terms for human, 241 for mouse, 107 for yeast. Use it when a coarse annotation is already in place and a specific sub-compartment question needs finer terms. Be aware that many of these terms are not separable in a fractionation profile – Nucleolus and Nucleoplasm co-migrate – so an assignment to one of them is a statement about the annotation, not about the data.

Terms are dropped from the raw vocabulary when they are host-cell locations, viral particles, structures absent from the species, or generic containers broad enough to absorb most of the proteome (Membrane, Endomembrane system). Terms with no reviewed protein in the species are dropped too, which removes organelles the species does not have – plastids for the mammals, and conversely keeps Vacuole and the spindle pole body for yeast.

Parameters:
species Literal['hsap', 'mmus', 'scer'] (default: 'hsap')

One of "hsap", "mmus" or "scer".

root str | None (default: None)

Keep only the terms at or below this one in the hierarchy, given as an SL term name ("Nucleus") or accession ("SL-0191"). Both is-a and part-of edges are followed. None (default) returns every term.

min_genes int | None (default: None)

Drop terms with fewer than this many genes. Worth setting here: the full vocabulary contains many terms with a handful of members, which are unstable under enrichment testing.

Return type:

dict[str, list[str]]

Returns:

dict[str, list[str]] Mapping of SL term name to gene names.

See also

gene_sets_curated

the coarse, experiment-resolvable compartments to start from.

grassp.datasets.uniprot_cc.uniprot_subcellular_vocabulary

the term definitions and hierarchy behind these sets.

Examples

>>> import grassp as gr
>>> len(gr.ds.gene_sets_uniprot_sl())
240
>>> nuclear = gr.ds.gene_sets_uniprot_sl(root="Nucleus")
>>> sorted(nuclear)[:4]
['Cajal body', 'Gem', 'Nuclear body', 'Nuclear pore complex']
>>> len(gr.ds.gene_sets_uniprot_sl(root="Mitochondrion", min_genes=100))
7

Notes

Membership comes from UniProt’s cc_scl_term query, which matches down the hierarchy: the genes listed for Nucleus include those annotated only to Nucleolus. Terms therefore contain their descendants rather than partitioning them, so treating the sets as disjoint classes, or as independent draws in a leave-one-out evaluation, leaks membership between parent and child.

Vendored build: 2026-09-24, from UniProt release 2026_03. As for gene_sets_curated(), UniProt cannot be pinned to a release on retrieval, so the build records the release it saw rather than requesting one. grassp.datasets.gene_sets.provenance() returns the full record per species.

Regenerated by python marker_curation/fetch_hierarchical_goterms.py.