Error: SPOTlight command in R
1
0
Entering edit mode
15 months ago
Hien • 0

Hi everyone,

Do anyone help me to figure out my error in SPOTlight command? Tutorials and outsourcing data for SPOTlight are not enough for me to fix my errors.

I have two Seurat objects: one is a Seurat object from https://www.gutcellatlas.org/ for reference with annotating cell lines, and the other is a Seurat object from my sample (Visium spatial gene expression).

spotlight_ls <- SPOTlight(
  x = seurat_cap3,
  y = data_sc,
  groups = "category", # Variable in sc_seu containing the cell-type annotation
  mgs = test, # Dataframe with the marker genes
  n_top = NULL,
  gene_id = "gene",
  weight_id = "weight",
  group_id = "type",
  gene_id = "gene"
)

It always shows the error:

Error in SPOTlight(x = seurat_sc, y = data_sc, groups = "category", mgs = test,  : formal argument "gene_id" matched by multiple actual arguments

sessionInfo(package = NULL)
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Thank you so much!

transcriptome R spatial visium SPOTlight • 1.1k views
ADD COMMENT
1
Entering edit mode
15 months ago

That is an easy fix, but of course easy to overlook - you accidentally provided the argument gene_id twice.

ADD COMMENT
0
Entering edit mode

Hi, Thank you for your indication! I have fixed the command as removing gene_id = gene and the title of mgs(cluster_markers_all) following "gene", "type", and "weight".

nmf_mod_ls = SPOTlight( x = seurat_sc, 
                       y = data_sc@assays$Spatial@counts, 
                       group = "category", 
                       mgs = cluster_test,
                       weight_id = "weight",
                       group_id = "type",
                       gene_id = "gene")

However, again, it shows the different error

Error in trainNMF(x = x, y = y, groups = groups, mgs = mgs, n_top = n_top,  : 
  is.null(groups) | length(groups) == ncol(x) is not TRUE

Right now, I have not indicated how to fix it :(

ADD REPLY
0
Entering edit mode

Unfortunately, I have no experience with SPOTlight. The previous error was a generic R issue, so I could help nonetheless, but this one is clearly package specific.

However, is.null(groups) | length(groups) == ncol(x) is not TRUE tests that either no groups are provided or the length of the group vector corresponds to the number of columns in x. So try to run ncol(seurat_sc) and provide a vector of exactly this length to group. Assuming your seurat_sc would only comprise 4 columns/cells, something like group = c("A","B","A","C") could work?

ADD REPLY

Login before adding your answer.

Traffic: 2671 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6