scanpy problem for empty cells
0
0
Entering edit mode
15 months ago
Andy ▴ 120

Hello everyone,

I encountered a problem when I use scanpy analysis my data.

When I tried to remove scrublet, and then I encountered following error:

filtered out 42144305 cells that have less than 200 genes expressed
Running Scrublet
normalizing counts per cell
/rsrch4/home/canbio/conda/envs/scvi-env/lib/python3.11/site-packages/scanpy/preprocessing/_normalization.py:197: UserWarning: Some cells have zero counts
  warn(UserWarning('Some cells have zero counts'))
    finished (0:00:03)
/rsrch4/home/canbio/.conda/envs/scvi-env/lib/python3.11/site-packages/scanpy/preprocessing/_simple.py:352: RuntimeWarning: invalid value encountered in log1p
  np.log1p(X, out=X)
extracting highly variable genes
Traceback (most recent call last):
  File "/rsrch4/scratch/canbio/fastqfile/integration/analysis0814/scvi/scvi1/run.py", line 1649, in <module>
    sc.external.pp.scrublet(adata) #estimates doublets

My code is:

adata.obs['study'] = adata.obs['study'].astype('category')
print(adata.obs['study'].value_counts())
sc.pp.filter_cells(adata, min_genes=200)
sc.pp.filter_genes(adata, min_cells=3)
import scrublet
sc.external.pp.scrublet(adata) #estimates doublets
adata= adata[adata.obs['predicted_doublet'] == False] #do the actual filtering
adata.var['mt'] = adata.var_names.str.startswith('MT-')  # annotate the group of mitochondrial genes as 'mt'
sc.pp.calculate_qc_metrics(adata, qc_vars=['mt'], percent_top=None, log1p=False, inplace=True)
mito_filter = 10
n_counts_filter = 10000

adata= adata[adata.obs.n_genes_by_counts < n_counts_filter, :]
adata= adata[adata.obs.pct_counts_mt < mito_filter, :]
adata

data.write_h5ad('afterqc.h5ad')

I checked my data, and the integration worked fine in R, but I encountered a problem in Python. Therefore, I think there might be something wrong with my Python code. However, I am not sure where I went wrong.

scanpy • 753 views
ADD COMMENT

Login before adding your answer.

Traffic: 1600 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6