Closed NK-HD closed 2 years ago
i have a similar question also-
ref = readRDS('references/Symphony_ref_data/fibroblast_atlas.rds')
query = symphony::mapQuery(seuratobj@assays$RNA, seuratobj@meta.data, ref,
vars = seuratobj@meta.data,
do_normalize = TRUE)
this does not work... I get the following output. Do yall have an example with working with Seurat Obj?
Normalizing
Error in as(A, "dgCMatrix") :
no method or default for coercing “Assay” to “dgCMatrix”
Many thanks!!!
You need to get the counts dgCMatrix
from the object. Also, vars
is the column names of meta_data
that you want to harmonize over (a batch variable). Something like this:
query = symphony::mapQuery(
seuratobj[['RNA']]@counts,
seuratobj@meta.data,
ref,
vars = 'samples', # use column names from your meta_data
do_normalize = TRUE)
Thank you! I attempted the above code and it worked! Will update if anything else needs attention. Wei
Hey, thank you very much for your solution!
As far as I see, this works with a symphony reference, but is there a way (and ideally a code snip) to use a preexisting Seurat object (Harmony integrated) (and it´s UMAP and its clusters) as a reference?
Thank you very much!!!
Best, Niklas
@NK-HD I've had success following this vignette when creating references for docs.dseqr.com. Happy to add another reference there if it's something public and of general use
@alexvpickering and everybody else :) Thank you very much for the vignette and help!
I have a specific problem now since I would like to use an existing seurat object and the according clusters (RunHarmony() already done) as a reference to analyse new data by using the same clustering.
So I can´t re-run RunHarmony.Seurat without redoing the whole clustering and downstream analysis (right?).
As I understand it the issue is here in the buildReferenceFromSeurat() function:
res$R <- t(obj@reductions$harmony@misc$R) message('Saved soft cluster assignments')
Error: Error in t.default(obj@reductions$harmony@misc$R) : argument is not a matrix
This data is apparently not in the object when this is processed with the default RunHarmony() function, as I understand it, correct?
Would it be possible to extract that info by any other way from a seurat object processed by the default RunHarmony() function?
Thank you very much for your help!!!! Best, Niklas
Hi @NK-HD ,
Thanks so much for your message! Unfortunately, it is not currently possible to make an existing Harmony object into a mappable Symphony object without rerunning the integration step with the RunHarmony.Seurat
function. This is because the RunHarmony.Seurat function calculates and saves additional components of the reference needed for mapping. Hopefully, if you run RunHarmony.Seurat it should give you the same or nearly the same embedding as the first time you ran RunHarmony() (it'd be good to check this anyway for the sake of reproducibility). Apologies for the inconvenience - we will try to think of a way to "Symphonize" a legacy Harmony object in the future.
Hi @joycekang,
Is there any update on the comment above re: making an existing Harmony object into a Symphony object without rerunning RunHarmony.Seurat?
This would be very useful for my pipeline!
Many thanks for such a great tool :)
Best, C
Dear Symphony Team,
thank you for developing this very interesting package!
could you maybe assist me on how to use an existing (harmony based integrated) Seurat object as a reference to map new datasets (ideally Seurat datasets) on?
Thank you very much in advance fr your help! Best, Niklas