theislab / scvelo

RNA Velocity generalized through dynamical modeling
https://scvelo.org
BSD 3-Clause "New" or "Revised" License
408 stars 103 forks source link

Question about logarithmization in scvelo.pp.filter_and_normalize #1187

Closed elifdogandar closed 6 months ago

elifdogandar commented 6 months ago

Hi, I have a question/request:

I have data coming from another analysis merged with loom data with spliced/ unspliced counts. After merging adata with loom file, and apply scvelo.pp.filter_and_normalize, it notices that adata X was preprocessed and doesn't normalize it but logarithmizes anyways. It causes X to be logarithmized twice, once in the earlier analysis and once with scvelo. Is it possible to apply layers_log={'X', 'spliced', 'unspliced'} similar to what was discussed here: question about normalization. In a way that I will be allowed to decide which layers to be logarithmized?

Or, alternatively, would it be okay to do that: Applying filter_and_normalizeonly to loom file and merge afterwards such as:

adata = sc.read_h5ad("seurat_to_anndata.h5ad")
ldata = scv.read('merged_loom.loom', cache=True)
scv.pp.filter_and_normalize(ldata, min_shared_counts=20, n_top_genes=2000)
adata = scv.utils.merge(adata, ldata)
scv.pp.moments(adata)

Thank you very much for the scVelo :)

Edit: After some search, I fell like logarithm is already only applied to X to begin with. Is it true? Then when I set log to False, problem will be solved.