mckellardw / scMuscle

The Cornell Single-Cell Muscle Project (scMuscle) aims to collect, analyze and provide to the research community skeletal muscle transcriptomic data
18 stars 4 forks source link

add theta values as an assay error #3

Closed skim245 closed 2 years ago

skim245 commented 2 years ago

Thank you in advance for sharing the R scripts as well as all the processed data. I'm playing with visium_github_v1.R script and faced a trouble that I cannot solve.

Below is the code I used:

for(i in 1:length(seu.list)){ # add theta (composition) values as an Assay colnames(celltype.bp[[i]]$res$final.gibbs.theta) <- stringr::str_replaceall(rownames(celltype.bp[[i]]$para$input.phi),pattern = " ", replacement="") seu.list[[i]][["celltype.bp"]] <- CreateAssayObject(data=t(celltype.bp[[i]]$res$final.gibbs.theta)) }

Here is the error message I get: Feature names cannot have underscores (''), replacing with dashes ('-')Keys should be one or more alphanumeric characters followed by an underscore, setting key from celltype.bp to celltypebpFeature names cannot have underscores (''), replacing with dashes ('-')Keys should be one or more alphanumeric characters followed by an underscore, setting key from celltype.bp_ to celltypebpFeature names cannot have underscores (''), replacing with dashes ('-')Keys should be one or more alphanumeric characters followed by an underscore, setting key from celltype.bp_ to celltypebpFeature names cannot have underscores (''), replacing with dashes ('-')Keys should be one or more alphanumeric characters followed by an underscore, setting key from celltype.bp to celltypebp

Thank you again for the codes!

mckellardw commented 2 years ago

That is actually just a warning, not an error. Check what assays are stored in your Seurat object(s) by running this:

Assays(seu.list[[1]])

The print out should include celltype.bp (or something very similar, I don't remember exactly how keys are handled for assays in Seurat). Replace the 1 with other indices to check other entries in your list of Seurat objects.

You can also check to make sure that the BayesPrism outputs are stored as the default assay in your Seurat object by printing:

DefaultAssay(seu.list[[1]])

This print out should have the celltype.bp assay name as well. The default assay is where Seurat looks when you try to generate FeaturePlot()'s, which is where I suspect you may berunning into issues.

Last thing you can check is the names under which the cell type theta values are stored in the Seurat object. Just print

rownames(seu.list[[1]])

and you should see all the cell types from your reference. If you are still running into bugs, please share the outputs from these 3 lines so I can help.

skim245 commented 2 years ago

@mckellardw thank you for the comments! Indeed, running Assays(seu.list[[1]]) showed: [1] "Spatial" "celltype.bp"

and changing the default assay & checking rownames showed cell types from the reference. DefaultAssay(seu.list[[1]]) <- "celltype.bp" rownames(seu.list[[1]])

now I'm working on the Ridge plot step where it requires prediction.scores and this is only called in the step where we calculate co-occurrence. I wasn't sure if the order of codes has been shifted and needs more help on downstream steps!