Skip to content

cell-load filter fails on jiang #39

@abhinadduri

Description

@abhinadduri

In [36]: filtered_x = filter_on_target_knockdown(x, perturbation_column="gene", control_label="NT")

AttributeError Traceback (most recent call last)
in ?()
----> 1 filtered_x = filter_on_target_knockdown(x, perturbation_column="gene", control_label="NT")

~/cell-load/src/cell_load/utils/data_utils.py in ?(adata, perturbation_column, control_label, residual_expression, cell_residual_expression, min_cells, layer, var_gene_name)
337 perts_to_keep = [control_label] # always keep controls
338 for pert in perts.unique():
339 if pert == control_label:
340 continue
--> 341 if is_on_target_knockdown(
342 adata_,
343 target_gene=pert,
344 perturbation_column=perturbation_column,

~/cell-load/src/cell_load/utils/data_utils.py in ?(adata, target_gene, perturbation_column, control_label, residual_expression, layer)
293
294 if not perturbed_cells.any():
295 raise ValueError(f"No cells labelled with perturbation {target_gene!r}.")
296
--> 297 control_mean = _mean(X[control_cells, gene_idx])
298 if control_mean == 0:
299 raise ValueError(
300 f"Mean {target_gene!r} expression in control cells is zero; "

~/miniconda/envs/pertsets/lib/python3.12/site-packages/scipy/sparse/_index.py in ?(self, key)
29 def getitem(self, key):
---> 30 index, new_shape = self._validate_indices(key)
31
32 # 1D array
33 if len(index) == 1:

~/miniconda/envs/pertsets/lib/python3.12/site-packages/scipy/sparse/_index.py in ?(self, key)
279 if ix.shape != mid_shape:
280 raise IndexError(
281 f"bool index {i} has shape {mid_shape} instead of {ix.shape}"
282 )
--> 283 index.extend(ix.nonzero())
284 array_indices.extend(range(index_ndim, tmp_ndim))
285 index_ndim = tmp_ndim
286 else: # dense array

~/miniconda/envs/pertsets/lib/python3.12/site-packages/pandas/core/generic.py in ?(self, name)
6295 and name not in self._accessors
6296 and self._info_axis._can_hold_identifiers_and_holds_name(name)
6297 ):
6298 return self[name]
-> 6299 return object.getattribute(self, name)

AttributeError: 'Series' object has no attribute 'nonzero'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions