Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gaddamshreya1 committed Aug 22, 2022
2 parents c4ad9bf + 3c62abc commit a7220a7
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 27 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ If you have questions, please contact the authors of the method:
- Gabriele Scalia - <[email protected]>

PyPI maintainer:
- Hejin Huang - <[email protected]>
- Shreya Gaddam - <[email protected]>
- Tommaso Biancalani - <[email protected]>
- Ziqing Lu - <[email protected]>

The artwork has been curated by:
- Anna Hupalowska <[email protected]>
- Anna Hupalowska <[email protected]>
21 changes: 11 additions & 10 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):
def pp_adatas(adata_sc, adata_sp, genes=None, gene_to_lowercase = True):
"""
Pre-process AnnDatas so that they can be mapped. Specifically:
- Remove genes that all entries are zero
Expand All @@ -36,23 +36,24 @@ def pp_adatas(adata_sc, adata_sp, genes=None):
update adata_sp by creating `uns` `training_genes` `overlap_genes` fields and creating `obs` `rna_count_based_density` & `uniform_density` field
"""

# put all var index to lower case to align
adata_sc.var.index = [g.lower() for g in adata_sc.var.index]
adata_sp.var.index = [g.lower() for g in adata_sp.var.index]

adata_sc.var_names_make_unique()
adata_sp.var_names_make_unique()

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

if genes is None:
# Use all genes
genes = [g.lower() for g in adata_sc.var.index]
else:
genes = adata_sc.var.index

# put all var index to lower case to align
if gene_to_lowercase:
adata_sc.var.index = [g.lower() for g in adata_sc.var.index]
adata_sp.var.index = [g.lower() for g in adata_sp.var.index]
genes = list(g.lower() for g in genes)

adata_sc.var_names_make_unique()
adata_sp.var_names_make_unique()


# Refine `marker_genes` so that they are shared by both adatas
genes = list(set(genes) & set(adata_sc.var.index) & set(adata_sp.var.index))
# logging.info(f"{len(genes)} shared marker genes.")
Expand Down
20 changes: 14 additions & 6 deletions tutorial_tangram_with_squidpy.ipynb

Large diffs are not rendered by default.

49 changes: 39 additions & 10 deletions tutorial_tangram_without_squidpy.ipynb

Large diffs are not rendered by default.

0 comments on commit a7220a7

Please sign in to comment.