Skip to content

Commit

Permalink
Fixes for parallell runs (#115)
Browse files Browse the repository at this point in the history
* Fixes for parallell runs

* dependencies fixes

---------

Co-authored-by: Parashar <[email protected]>
  • Loading branch information
oskbor and parashardhapola authored May 22, 2024
1 parent 440bab1 commit 2a1b6e5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ numcodecs
umap-learn
scikit-learn
scikit-network
scipy
scipy==1.11.0
statsmodels
seaborn
tqdm
Expand Down
13 changes: 8 additions & 5 deletions scarf/datastore/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,13 @@ def run_marker_search(
if n_threads is None:
n_threads = self.nthreads
assay = self._get_assay(from_assay)

slot_name = f"{cell_key}__{group_key}"
z = self.zw[assay.name]
if "markers" not in z:
z.create_group("markers")
group = z["markers"].create_group(slot_name, overwrite=True)

markers = find_markers_by_rank(
assay=assay,
group_key=group_key,
Expand All @@ -385,11 +392,7 @@ def run_marker_search(
n_threads=n_threads,
**norm_params,
)
z = self.zw[assay.name]
slot_name = f"{cell_key}__{group_key}"
if "markers" not in z:
z.create_group("markers")
group = z["markers"].create_group(slot_name, overwrite=True)

for i in markers:
g = group.create_group(i)
vals = markers[i]
Expand Down
6 changes: 5 additions & 1 deletion scarf/metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Contains the MetaData class, which is used for storing metadata about cells
and features."""

import re
from typing import List, Iterable, Any, Dict, Tuple, Optional, Union
import numpy as np
Expand Down Expand Up @@ -61,7 +62,10 @@ def _get_size(self, zgrp: zarrGroup, strict_mode: bool = False) -> int:
"""
sizes = []
for i in zgrp.keys():
sizes.append(zgrp[i].shape[0])
try:
sizes.append(zgrp[i].shape[0])
except Exception:
pass
if len(sizes) > 0:
if len(set(sizes)) != 1:
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion scarf/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def _scatter_fix_mask(v: pd.Series, mask_vals: list, mask_name: str) -> pd.Serie
def _scatter_make_colors(
v: pd.Series, cmap, color_key: Optional[dict], mask_color: str, mask_name: str
):
from matplotlib.cm import get_cmap
from matplotlib.pyplot import get_cmap

na_idx = v == mask_name
uv = v[~na_idx].unique()
Expand Down

0 comments on commit 2a1b6e5

Please sign in to comment.