Skip to content

Commit 65503d3

Browse files
committed
fixed a few bugs for release 0.2.7
1 parent 8f74486 commit 65503d3

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

scanpy/api/pp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# TODO: this duplicates scanpy.preprocessing.__init__
12
from ..preprocessing.recipes import recipe_zheng17, recipe_weinreb16
23
from ..preprocessing.simple import filter_cells, filter_genes, filter_genes_dispersion
34
from ..preprocessing.simple import log1p, pca, normalize_per_cell, regress_out, scale, subsample

scanpy/plotting/ann_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def add_centroid(centroids, name, Y, mask):
209209
for i, icolor_key in enumerate(categoricals):
210210
palette = palettes[i]
211211
color_key = color_keys[icolor_key]
212-
if len(adata.add[color_key + '_order']) != np.unique(adata.smp[color_key]):
212+
if len(adata.add[color_key + '_order']) != len(np.unique(adata.smp[color_key])):
213213
from ..utils import unique_categories
214214
adata.add[color_key + '_order'] = unique_categories(adata.smp[color_key])
215215
if (not color_key + '_colors' in adata.add or not palette_was_none
@@ -226,7 +226,7 @@ def add_centroid(centroids, name, Y, mask):
226226
mask_remaining[mask] = False
227227
if legend_loc == 'on data': add_centroid(centroids, name, Y, mask)
228228
else:
229-
for name in names:
229+
for name in groups:
230230
if name not in set(adata.add[color_key + '_order']):
231231
raise ValueError('"' + name + '" is invalid!'
232232
+ ' specify valid name, one of '

scanpy/preprocessing/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# this duplicates scanpy.api.pp
2+
from ..preprocessing.recipes import recipe_zheng17, recipe_weinreb16
3+
from ..preprocessing.simple import filter_cells, filter_genes, filter_genes_dispersion
4+
from ..preprocessing.simple import log1p, pca, normalize_per_cell, regress_out, scale, subsample

scanpy/readwrite.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ def postprocess_reading(key, value):
716716
if value.dtype.kind == 'S':
717717
value = value.astype(str)
718718
# recover a dictionary that has been stored as a string
719-
if value[0] == '{' and value[-1] == '}': value = eval(value)
719+
if len(value) > 0:
720+
if value[0] == '{' and value[-1] == '}': value = eval(value)
720721
if (key != 'smp' and key != 'var'
721722
and not isinstance(value, dict) and value.dtype.names is not None):
722723
# TODO: come up with a better way of solving this, see also below
@@ -797,7 +798,12 @@ def write_dict_to_file(filename, d, ext='h5'):
797798
if not os.path.exists(dirname): os.makedirs(dirname)
798799
if not os.path.exists(dirname + 'add'): os.makedirs(dirname + 'add')
799800
from pandas import DataFrame
801+
not_yet_raised_data_graph_warning = True
800802
for key, value in d_write.items():
803+
if key.startswith('data_graph') and not_yet_raised_data_graph_warning:
804+
logg.warn('Omitting to write neighborhood graph (`adata.add[\'data_graph...\']`).')
805+
not_yet_raised_data_graph_warning = False
806+
continue
801807
filename = dirname
802808
if key not in {'X', 'var', 'smp'}: filename += 'add/'
803809
filename += key + '.' + ext

scanpy/tools/sim.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ def sim(model,
8181
else:
8282
params = locals()
8383
adata = sample_dynamic_data(params)
84-
if 'tools' not in adata.add:
85-
adata.add['tools'] = np.array([], dtype=str)
8684
adata.add['xroot'] = adata.X[0]
8785
return adata
8886

0 commit comments

Comments
 (0)