Skip to content

Commit

Permalink
Fixed bug when adata.raw is None
Browse files Browse the repository at this point in the history
  • Loading branch information
earmingol committed Feb 1, 2024
1 parent 6a6bf41 commit efb89bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sccellfie/preprocessing/prepare_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def preprocess_inputs(adata, gpr_info, task_by_gene, rxn_by_gene, task_by_rxn, v
task_by_rxn = task_by_rxn.loc[(task_by_rxn != 0).any(axis=1)]

adata2 = adata[:, [True if g in genes else False for g in adata.var_names]]
adata2.raw = adata.raw.to_adata()[:, [True if g in genes else False for g in adata.var_names]]
if hasattr(adata, 'raw'):
if adata.raw is not None:
adata2.raw = adata.raw.to_adata()[:, [True if g in genes else False for g in adata.var_names]]

if verbose:
print(f'Shape of new adata object: {adata2.shape}\n'
Expand Down

0 comments on commit efb89bd

Please sign in to comment.