Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproducing a UMAP embedding with Symphony #31

Open
yannk-lm opened this issue Mar 29, 2022 · 1 comment
Open

Reproducing a UMAP embedding with Symphony #31

yannk-lm opened this issue Mar 29, 2022 · 1 comment

Comments

@yannk-lm
Copy link

Hello,

I wanted to use the mapQuery function on a UMAP generated from Harmony spaces by my regular pipeline. Then I saw in #15 that it wasn't implemented, so I thought about a different approach.

If I could generate a Symphony reference (using harmony::HarmonyMatrix() into symphony::buildReferenceFromHarmonyObj()) where the input (embeddings, parameters, seeds) are strictly identical to the one I use in my regular pipeline, it should produce (I think) the same result.

However, I am using a wrapper function that use SingleCellExperiment object as input to generate and to store my PCA.
Since I have some trouble understanding your processing of the irlba::irlba() output in your vignette, I was wondering if there was a way to extract from my SCE object :

  1. the input needed for the data_mat argument in harmony::HarmonyMatrix()
  2. the loadings for symphony::buildReferenceFromHarmonyObj()

FYI this is my regular pipeline :
dec<-scran::modelGeneVar(sce)
top.hvgs <- scran::getTopHVGs(dec, n=hvgs)
set.seed(0)
sce<-scran::fixedPCA(sce, subset.row=top.hvgs, assay.type = "logcounts", BSPARAM = BiocSingular::IrlbaParam())
set.seed(0)
sce <- harmony::RunHarmony(sce, "sample)
set.seed(0)
sce <- scater::runUMAP(sce, dimred="HARMONY", n_dimred = 30)

Thank you very much for your help and please let me know if some point are not clear enough.

Regards,
Yannick

@joycekang
Copy link
Collaborator

Hi Yannick,

Apologies for the delay in getting back to you.

If you are still interested in tackling this, (1) the input to harmony::HarmonyMatrix() should be the uncorrected PCA matrix (PCs x cells). (2) the loadings should be the PCA loadings used to project the cells into the lower-dimensional space (dimensions cells x PCs), which should be retrievable from irlba (but I am not sure about the scran function).

You'll also need the Harmony object that is returned by the call to harmony::RunHarmony

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants