Skip to content

Commit

Permalink
A few minor style changes via pyupgrade (scverse#971)
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp A <[email protected]>
  • Loading branch information
chris-rands and flying-sheep authored Aug 5, 2020
1 parent f6212ce commit 090d577
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scanpy/plotting/_anndata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,7 @@ def _prepare_dataframe(
if gene_symbols is not None:
# translate the column names to the symbol names
obs_tidy.rename(
columns=dict([(var_names[x], symbols[x]) for x in range(len(var_names))]),
columns={var_names[x]: symbols[x] for x in range(len(var_names))},
inplace=True,
)
categories = obs_tidy.index.categories
Expand Down
4 changes: 2 additions & 2 deletions scanpy/preprocessing/_deprecated/highly_variable_genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ def filter_genes_dispersion(
with warnings.catch_warnings():
warnings.simplefilter('ignore')
disp_mad_bin = disp_grouped.apply(robust.mad)
df['dispersion_norm'] = np.abs((
df['dispersion_norm'] = np.abs(
df['dispersion'].values
- disp_median_bin[df['mean_bin'].values].values
)) / disp_mad_bin[df['mean_bin'].values].values
) / disp_mad_bin[df['mean_bin'].values].values
else:
raise ValueError('`flavor` needs to be "seurat" or "cell_ranger"')
dispersion_norm = df['dispersion_norm'].values.astype('float32')
Expand Down
2 changes: 1 addition & 1 deletion scanpy/preprocessing/_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def top_segment_proportions_dense(
sums = mtx.sum(axis=1)
partitioned = np.apply_along_axis(np.partition, 1, mtx, mtx.shape[1] - ns)[:, ::-1][:, :ns[-1]]
values = np.zeros((mtx.shape[0], len(ns)))
acc = np.zeros((mtx.shape[0]))
acc = np.zeros(mtx.shape[0])
prev = 0
for j, n in enumerate(ns):
acc += partitioned[:, prev:n].sum(axis=1)
Expand Down
1 change: 0 additions & 1 deletion scanpy/sim_models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion scanpy/tests/notebooks/test_pbmc3k.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding: utf-8
# *First compiled on May 5, 2017. Updated August 14, 2018.*
# # Clustering 3k PBMCs following a Seurat Tutorial
#
Expand Down
2 changes: 1 addition & 1 deletion scanpy/tools/_dpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class DPT(Neighbors):

def __init__(self, adata, n_dcs=None, min_group_size=0.01,
n_branchings=0, allow_kendall_tau_shift=False, neighbors_key=None):
super(DPT, self).__init__(adata, n_dcs=n_dcs, neighbors_key=neighbors_key)
super().__init__(adata, n_dcs=n_dcs, neighbors_key=neighbors_key)
self.flavor = 'haghverdi16'
self.n_branchings = n_branchings
self.min_group_size = min_group_size if min_group_size >= 1 else int(min_group_size * self._adata.shape[0])
Expand Down

0 comments on commit 090d577

Please sign in to comment.