Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:KrishnaswamyLab/MAGIC into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Dager committed Jul 9, 2018
2 parents 270fb17 + 34f1e82 commit d35764f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/magic/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,20 @@ def transform(self, X=None, genes=None, t_max=20,
"""
try:
if isinstance(X, anndata.AnnData):
if (genes is None or (isinstance(genes, str)
and genes in ['all_genes', 'pca_only'])):
# special names
pass
else:
# ensure the genes is a 1D ndarray
genes = np.array([genes]).flatten()
if issubclass(genes.dtype.type, numbers.Integral):
# integer indices
pass
else:
# names
genes = np.argwhere(np.isin(X.var_names,
genes)).flatten()
X = X.X
except NameError:
# anndata not installed
Expand Down

0 comments on commit d35764f

Please sign in to comment.