dittobarplot Var error
1
0
Entering edit mode
Fayrouz • 0
@512b2f4a
Last seen 10 months ago
United States

I am trying to visualize the frequency of the different cells clusters on Seurat object clustered using SingleR. It is a naive question but am not sure what should I have in the Var. supposedly, it is the clusters in metadata but It keeps giving me the error "Error in .var_OR_get_meta_or_gene(var, object) : pred21@meta.data is not a metadata or gene nor equal in length to ncol('object')"

```dittoBarPlot( object = JHMV21, var = "pred21@meta.data")

and this is the singleR part

```JHMV21_counts <- GetAssayData(JHMV21, slot = 'counts') pred21 <- SingleR(test = JHMV21_counts, ref= ref, labels = ref$label.main)

```JHMV21$SingleR.labels <- pred21$labels[match(rownames(JHMV21@meta.data),rownames(pred21))] cluster4<- DimPlot(JHMV21, reduction = 'umap', group.by = 'SingleR.labels', label = TRUE, label.size =3)

RNASeq ditto dittoSeq SingleR • 1.0k views
ADD COMMENT
0
Entering edit mode
dbunis ▴ 10
@danielbunis-22319
Last seen 10 months ago
United States

It's a little hard to parse your code as it's not formatted properly, but I think I follow well enough.

dittoBarPlot expects you to give the name of a metadata column to var.

It looks like you have put your SingleR calls in a column called "SingleR.labels" with this code:

JHMV21$SingleR.labels <- pred21$labels[match(rownames(JHMV21@meta.data),rownames(pred21))]

You'll also need a secondary metadata to group.by, for which you could probably use 'orig.ident', but this will entirely depend on how you want to organize the data.

So try:

dittoBarPlot(
    JHMV21,
    var = 'SingleR.labels',
    group.by = 'orig.ident'
)

You may also wish to add scale = "count" to see numbers rather than percent.

ADD COMMENT

Login before adding your answer.

Traffic: 580 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