scanpy problem for empty cells
Entering edit mode
10 weeks ago
Andy ▴ 100

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/ 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/ 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/", line 1649, in <module>
    sc.external.pp.scrublet(adata) #estimates doublets

My code is:

adata.obs['study'] = adata.obs['study'].astype('category')
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, :]


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 • 275 views

Login before adding your answer.

Traffic: 1843 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6