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

Getting a permanent error #84

Closed
beginner984 opened this issue Jun 20, 2021 · 8 comments
Closed

Getting a permanent error #84

beginner984 opened this issue Jun 20, 2021 · 8 comments

Comments

@beginner984
Copy link

Hello

I have a Seurat object make directly from log2 normalised data (I don't have access to the raw counts)

I get this error

> dittoDimPlot(pbmc2)
Error in .leave_default_or_null(main, var, length(var) != 1) : 
  argument "var" is missing, with no default
> pbmc2
An object of class Seurat 
11548 features across 6651 samples within 1 assay 
Active assay: RNA (11548 features, 2000 variable features)
 3 dimensional reductions calculated: tsne, pca, umap
> 

What is the solution please

@dtm2451
Copy link
Owner

dtm2451 commented Jun 21, 2021

The error message tells you that 'argument "var" is missing'. You need to give this function something to color the points by.

You can run getMetas(pbmc2) or getGenes(pbmc2) to see what metadata or gene (probably thousands) options there are in the object.

But mainly, what you need to do is give something to the var input:

dittoDimPlot(pbmc2, var = "<a_gene_or_metadata>")

@beginner984
Copy link
Author

beginner984 commented Jun 21, 2021

Thank you so much

I passed that now I get this

> getMetas(pbmc1)
[1] "orig.ident"      "nCount_RNA"      "nFeature_RNA"    "percent.mt"     
[5] "RNA_snn_res.1"   "seurat_clusters" "RNA_snn_res.0.2" "RNA_snn_res.0.5"

> dittoHeatmap(pbmc1, features2,
+              annot.by = "RNA_snn_res.0.2")
Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE) : 
  invalid character indexing
> dittoHeatmap(pbmc1, features2,
+              annot.by = c("RNA_snn_res.0.2"))
Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE) : 
  invalid character indexing
> features2
 [1] "CD38"    "B220"    "IL2RA"   "TCRB"    "IFNG"    "MHC-II"  "TNF"     "CD274"  
 [9] "CD4"     "TBX21"   "CD19"    "CD80"    "PDCD1"   "CD8A"    "ITGAE"   "CD86"   
[17] "EMR1"    "PTPRC"   "FOXP3"   "Ly6c1"   "ITGAM"   "FCGR1A"  "CD44"    "RORC"   
[25] "ARG1"    "KLRB1"   "ITGAX"   "Ly6g"    "SIGLEC8" "FOXP3"   "NOS2"    "SELL"   
[33] "MRC1"   
> dittoHeatmap(pbmc1, features2,
+              order.by = "RNA_snn_res.0.2")
Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE) : 
  invalid character indexing
> 

> dittoDotPlot(pbmc1, vars = features2, group.by = "RNA_snn_res.0.2")
Error in .multi_var_gather_raw(object, vars, assay, slot, adjustment,  : 
  All 'vars' must be a metadata or gene

Any help please?

@dtm2451
Copy link
Owner

dtm2451 commented Jun 21, 2021

Potentially you have a weird Seurat object that has odd cell column names or metadata rownames? I'm curious where this Seurat object that doesn't have a counts slot would be from... that wouldn't happen for any normal Seurat workflow. This leads me to believe the object was likely constructed in an ill-advised way.

dittoSeq commonly indexes data via the cells' names. What do you see if you look at colnames(pbmc2), rownames(pbmc2@meta.data), and names(pbmc2$RNA_snn_res.0.2)? Those should all be identical.

@dtm2451
Copy link
Owner

dtm2451 commented Jul 19, 2021

Coming back to this, it also looks like you have a mix of fully uppercase + some partially lowercase genes in your features2 that you are trying to plot. That could also be your issue... human genes are fully uppercase whereas other species may have lowercase letters. If any of your features don't actually exist in the object, such errors would be expected.

I don't think this is a bug to do with dittoSeq itself, so I'm going to close the issue, but feel free to respond / reopen if needed.

@dtm2451 dtm2451 closed this as completed Jul 19, 2021
@sagarutturkar
Copy link

Thank you for providing this nice package. I am facing the similar issue but only with the function dittoHeatmap. I am able to generate other plots without any issue and I am using the same gene for dittoHeatmap

dittoDimPlot(sample, "orig.ident")

dittoPlot(sample, "Irf7", group.by = "orig.ident")

dittoBarPlot(sample, "orig.ident", group.by = "seurat_clusters")

dittoBoxPlot(sample, "Irf7", group.by = "orig.ident")

dittoHeatmap(sample, TLR7, annot.by = c("orig.ident"))

Error:

Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE) : 
  invalid character indexing

My Seurat object is created after subsetting a group of cells from the original Seurat object. It's a relatively small file. I can share the link for this file if you provide a good email address. Your help will be much appreciated.

Thanks

@dtm2451
Copy link
Owner

dtm2451 commented May 3, 2022

Couple issues perhaps with the syntax here:

  • You don't have TLR7 in quotes, so unless you actually have a vector of gene names stored in an object named TCF7, that could be to root of this issue?
  • Secondly, (again assuming TLR7 doesn't hold a character vector?) the dittoHeatmap function assumes that you are providing more than one total of genes (to the genes input) and/or metadatas (to the 'metas' input). There's scaling of the extracted data matrix that's performed by default before the plot is generated, and that scaling requires more than one row of data. Heatmaps are normally made with many genes. I recommend selecting some more genes to put in your heatmap so giving something like dittoHeatmap(sample, c("TLR7", "CD3E"), annot.by = c("orig.ident")).

@sagarutturkar
Copy link

Thank you, for the quick response and suggestions. This is resolved now.

The issue here was again the gene names.TLR7 was indeed a character vector but a few genes were missing from the Seurat object itself. I used the DoHeatmap function from Seurat which automatically removed the missing genes and generated a heatmap. Then, I used those exact set of genes to dittoHeatmap function and it worked well.

Thank you again for this awesome package.

@dtm2451
Copy link
Owner

dtm2451 commented May 3, 2022

Ahhh, great!

Also FYI:

isGene() is a helper function in dittoSeq that could have helped with that as well! (There's a bunch of helpers in dittoSeq that unify and simplify certain interactions with Seurat/SingleCellExperiment/SummarizedExperiment objects, which are used in dittoSeq's internals, but I also felt were worth exposing for users.)

You could use this in the future to automate trimming to just the genes inside your object: TCF7_in <- isGene(TCF7, sample, return.values = TRUE)

Cheers,
Dan

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

3 participants