Open mgp2022 opened 4 months ago
I am also confused with the input file for running MuSiC. I have an annotated Seurat object and I went through sc.sce <- as.SingleCellExperiment(seurat.object) and somehow the dataformat converted has not been compatible with the MuSiC algorithm. I wonder if you have a detailed step-by-step tutorial of how to construct the write SingleCellExperiment object preferably if from Seurat object so that can help running MuSiC smoothly?
I think I solved it. You have to specify the assay, in this case RNA, as written below:
as.SingleCellExperiment(your_Seurat_object, assay = "RNA")
When I left assay as either: 1) default: as.SingleCellExperiment(your_Seurat_object) OR 2) specify assay as NULL as.SingleCellExperiment(your_Seurat_object, assay = NULL)
That gave me logcounts and no counts. The whole input was wrong and gave errors.
This made Music fail every time as it could not find the slot for "counts".
At first, I forced the name change from logcounts to counts and that worked for Music, but I think the input to Music function should not be logcounts but counts, based on their documentation.
When you specify the assay = "RNA", SingleCellExpriment will add the right assay to the sc file you are creating. Hopefully, that will fix it for you as well. This was very frustrating.
@mgp2022 I'm running into a similar issue you were running into where when I try to run music_prop I get this error:
> results <- music_prop(
+ bulk.mtx = bulk, # Bulk RNA-seq data
+ sc.sce = sce, # SingleCellExperiment object
+ clusters = "cell_type", # Using cluster numbers as cell type labels
+ samples = NULL, # Optional: If you have sample-level information
+ normalize = TRUE # Normalize data if needed
+ )
Error in as.vector(x, mode = "character") :
no method for coercing this S4 class to a vector
I tried doing as you suggested by specifying 'assay = "RNA"', but the logcounts object is still an S4 class. What is the correct data type for the logcounts object? Is it supposed to just be a dataframe?
I have snRNA-seq dataset from literature called sc in S4 Seurat.
I converted it to SingleCellExperiment using this function: sc.sce <- as.SingleCellExperiment(sc)
However, in the sc.sce object something is strange. Instead of counts, I see logcounts when I look under assays->data->listData-> logcounts
logcounts is a S4 [2000x220170] (Matrix::dgCMatrix)
When I run MuSiC is gave me an error that function cannot find the right slot, thus we converted logcount name to count, which I am pretty sure is incorrect.
Could you advise what is the correct approach in this case? I worry that I am using log counts into MuSiC and that may affect the results.
I cannot use MuSiC2 as it is not supported by our work Custer environment.