STOmics / Stereopy

A toolkit of spatial transcriptomic analysis.
MIT License
179 stars 59 forks source link

Reprocess Mitochondrial % #256

Closed eisascience closed 2 months ago

eisascience commented 3 months ago

The default approach doesnt always work.. it looks for like MT- genes... but what if MT- genes are not enough? or due to the ref genome dont exist in that nomenclature ?

Need a way to recompute with a custom set of genes ...

scanpy (which is the core of stereopy) has something like below.. but its not enough... I need to say have a vector of mt genes .. say myMTgenes = customCharVectorOfGenes

annotate the group of mitochondrial genes as "mt"

adata.var["mt"] = adata.var_names.str.startswith("MT-") sc.pp.calculate_qc_metrics( adata, qc_vars=["mt"], percent_top=None, log1p=False, inplace=True )

tanliwei-coder commented 3 months ago

Sorry, I don't know what you mean.

eisascience commented 3 months ago

In R, I can do something like: st.seq[["percent.mt"]] <- PercentageFeatureSet(st.seq, pattern = "^mt-") or st.seq[["percent.mt"]] <- PercentageFeatureSet(st.seq, geneSet=MyCustomSet)

what would be the equivalent here ? thanks

tanliwei-coder commented 3 months ago

Run data.tl.cal_qc(), then you can get the indicator you mentioned by data.cells['pct_counts_mt'], note that you need to do it before any normalization methods.