Skip to content

Commit

Permalink
bug, typing and docstring fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
parashardhapola committed May 22, 2023
1 parent de4e866 commit 5215769
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.28.0
0.28.1
2 changes: 1 addition & 1 deletion scarf/assay.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def iter_normed_feature_wise(
)
logger.debug("Will iterate over data of shape: ", data.shape)
chunks = np.array_split(
np.arange(0, data.shape[1]), int(data.shape[1] / batch_size)
np.arange(0, data.shape[1]), max(1, int(data.shape[1] / batch_size))
)
for chunk in tqdmbar(chunks, desc=msg, total=len(chunks)):
if as_dataframe:
Expand Down
10 changes: 5 additions & 5 deletions scarf/datastore/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .mapping_datastore import MappingDatastore
from ..writers import create_zarr_obj_array, create_zarr_dataset
from ..utils import tqdmbar, controlled_compute, ZARRLOC
from ..assay import RNAassay, ATACassay, ADTassay
from ..assay import RNAassay, ATACassay
from ..feat_utils import hto_demux

__all__ = ["DataStore"]
Expand Down Expand Up @@ -948,7 +948,7 @@ def make_bulk(
secondary_group_key: Name of the column in cell metadata table to be used for sub-grouping cells.
aggr_type: Type of aggregation to be used. Can be either 'mean' or 'sum'. (Default value: 'mean')
return_fraction: Return the fraction of cells expressing a gene in each group. (Default value: False)
feature_labels: The column in feature metadata table to use as row labels. (Default value: 'index')
feature_label: The column in feature metadata table to use as row labels. (Default value: 'index')
pseudo_reps: Within each group, cells will randomly be split into `pseudo_reps` partitions. Each partition
is considered a pseudo-replicate. (Default value: 3)
remove_empty_features: Remove features that are not expressed in any cell. (Default value: True)
Expand All @@ -958,8 +958,8 @@ def make_bulk(
random_seed: A random values to set seed while creating `pseudo_reps` partitions cells randomly.
Returns:
A pandas dataframe containing the bulk profile. If `return_fraction` is True, then a tuple of two dataframes is returned.
The second dataframe contains the fraction of cells expressing each feature in each group.
A pandas dataframe containing the bulk profile. If `return_fraction` is True, then a tuple of two dataframes
is returned. The second dataframe contains the fraction of cells expressing each feature in each group.
"""

def make_reps(v, n_reps: int, seed: int) -> List[np.ndarray]:
Expand Down Expand Up @@ -1169,7 +1169,7 @@ def smart_label(
for n, k in enumerate(j, start=1):
a = chr(ord("@") + n)
new_names[k] = f"{i}{a.lower()}"

missing_vals = list(set(df.index).difference(idxmax.unique()))
if len(missing_vals) > 0:
miss_idxmax = df.loc[missing_vals].idxmax(axis=1).to_dict()
Expand Down
4 changes: 2 additions & 2 deletions scarf/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,11 +1141,11 @@ class ZarrMerge:

def __init__(
self,
zarr_path: str,
zarr_path: ZARRLOC,
assays: list,
names: List[str],
merge_assay_name: str,
in_workspaces: Union[str, None] = None,
in_workspaces: Union[list[str], None] = None,
out_workspace: Union[str, None] = None,
chunk_size=(1000, 1000),
dtype: Optional[str] = None,
Expand Down

0 comments on commit 5215769

Please sign in to comment.