atarashansky / SAMap

SAMap: Mapping single-cell RNA sequencing datasets from evolutionarily distant organisms.
MIT License
64 stars 19 forks source link

SAMap consistently generating a bifurcated UMAP #142

Closed dariotommasini closed 7 months ago

dariotommasini commented 8 months ago

Hi @atarashansky ,

Do you know why SAMap would consistently generate UMAPs that look like this? Essentially, every cluster is being split in two. The different species are well integrated within those clusters. Any ideas what might be causing this and what hyperparameter i could tune to prevent this?

Screenshot 2024-02-06 at 2 48 49 PM Screenshot 2024-02-06 at 2 52 13 PM
atarashansky commented 8 months ago

Usually you see this as an artifact of some batch effect or confounding biological process like cell cycle. Can you try differential expression between the bifurcated clusters to see what pops up? Also, if you look at each species' embedding separately (e.g. sm.sams['species1_id'].run_umap() followed by sm.sams['species1_id'].scatter() do you also see the bifurcation?

dariotommasini commented 8 months ago

Thanks, I'll try that!

dariotommasini commented 7 months ago

Hi @atarashansky ,

I have a question about how SAMap reads the data. It seems like if there exists a file called 'XXX_pr.h5ad', then SAMap will use that file. Is there a way to turn off this behavior? I want it to always process the original XXX.h5ad file rather than use the preprocessed one.

dariotommasini commented 7 months ago

Actually, I was mistaken. The issue is that the filenames dictionary is a mutable so after a SAMap run, it will be a dictionary holding SAM objects rather than file paths. I had to deep copy it to stop this behavior.

dariotommasini commented 7 months ago

Hi @atarashansky ,

Is there a way to make a SAM object directly from an h5ad file, or would I have to save the h5ad file and then load it as a sam object?

atarashansky commented 7 months ago

You can do sam=SAM(counts=adata) where adata is an AnnData object loaded in memory.

dariotommasini commented 7 months ago

Awesome, thanks!