Skip to content

Commit

Permalink
put coordinates into ad.obsm
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Obermayer committed Aug 18, 2021
1 parent 1db2609 commit 1677836
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scelvis/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@ def update_filter_cells_controls(
+ hidden_rangeslider
)
else:
range_min = values.min()
range_max = values.max()
range_min = values.dropna().min()
range_max = values.dropna().max()
if attribute in filters:
val_min = filters[attribute][0]
val_max = filters[attribute][1]
Expand Down
7 changes: 6 additions & 1 deletion scelvis/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import attr
import scanpy as sc
import scipy.sparse
import re
import scipy.io
import pandas as pd
from logzero import logger
Expand Down Expand Up @@ -321,9 +322,13 @@ def _load_expression(self, coords, annotation, markers):
logger.info("Combining data")
ad = sc.AnnData(
X=X,
obs=pd.concat([coords.loc[cells], annotation.loc[cells]], axis=1),
obs=annotation.loc[cells],
var=pd.DataFrame([], index=genes),
)
coords_types = set([re.sub('[-_][0-9]*$','',c).upper() for c in coords.columns])
for ct in coords_types:
ct_cols = [c for c in coords.columns if ct in c.upper()]
ad.obsm['X_'+ct] = coords.loc[cells, ct_cols].values
for col in markers.columns:
ad.uns["marker_" + col] = markers[col].values

Expand Down
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ passenv =
CI
TRAVIS*
py36: CODACY_PROJECT_TOKEN
py37: CODACY_PROJECT_TOKEN
deps =
-r{toxinidir}/requirements/test.txt
py36: -r{toxinidir}/requirements/test_black.txt
py37: -r{toxinidir}/requirements/test_black.txt
commands =
pip install -U pip
xvfb-run pytest
py36: flake8 .
py36: black -l 100 --check .
py36: python setup.py check -r -s
py36: python-codacy-coverage -r coverage.xml
py37: flake8 .
py37: black -l 100 --check .
py37: python setup.py check -r -s
py37: python-codacy-coverage -r coverage.xml

0 comments on commit 1677836

Please sign in to comment.