Skip to content

Allow different criteria to select genes #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tangram/mapping_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
logging.getLogger().setLevel(logging.INFO)


def pp_adatas(adata_sc, adata_sp, genes=None, gene_to_lowercase = True):
def pp_adatas(adata_sc, adata_sp, genes=None, gene_to_lowercase = True, min_cells=1):
"""
Pre-process AnnDatas so that they can be mapped. Specifically:
- Remove genes that all entries are zero
Expand All @@ -37,8 +37,8 @@ def pp_adatas(adata_sc, adata_sp, genes=None, gene_to_lowercase = True):
"""

# remove all-zero-valued genes
sc.pp.filter_genes(adata_sc, min_cells=1)
sc.pp.filter_genes(adata_sp, min_cells=1)
sc.pp.filter_genes(adata_sc, min_cells=min_cells)
sc.pp.filter_genes(adata_sp, min_cells=min_cells)

if genes is None:
# Use all genes
Expand Down
4 changes: 2 additions & 2 deletions tangram/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def deconvolve_cell_annotations(adata_sp, filter_cell_annotation=None):
return adata_segment


def project_genes(adata_map, adata_sc, cluster_label=None, scale=True):
def project_genes(adata_map, adata_sc, cluster_label=None, scale=True, min_cells=1):
"""
Transfer gene expression from the single cell onto space.

Expand All @@ -359,7 +359,7 @@ def project_genes(adata_map, adata_sc, cluster_label=None, scale=True):
adata_sc.var_names_make_unique()

# remove all-zero-valued genes
sc.pp.filter_genes(adata_sc, min_cells=1)
sc.pp.filter_genes(adata_sc, min_cells=min_cells)

if cluster_label:
adata_sc = mu.adata_to_cluster_expression(adata_sc, cluster_label, scale=scale)
Expand Down