This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I run DESingle like Seurat's "FindAllMarkers"?

By default, DESingle appears to be written to compare between conditions, so it only does 1:1 tests, inferred from this error message:

Error in DEsingle(counts = data_transcripts_sce@assays@data@listData$counts, group = data_transcripts_sce@colData@listData$seurat_clusters)
Levels number of 'group' is not two

I would like to construct a loop for it to scan through all clusters in a 1:all fashion, just like Seurat's FindAllMarkers function.

Their instructions only show an example of assigning arbitrary numbers of cells into 2 groups:

group <- factor(c(rep(1,50), rep(2,100)))

which isn't very helpful in practice.

Without expertise in R, nor knowing of more elegant solutions, here is a pseudocode to generate n groups, where n = number of clusters, and each group is cluster k:all, then immediately using that group to run DESingle.

cluster_list <- levels(data_transcripts_seurat@active.ident) # dataset was originally in Seurat format, converted to SCE only for DESingle.

for(cluster in cluster_list) {
      groupname <- paste("group_", cluster, sep="")
      assign(groupname, factor(c(data_transcripts_sce@colData@listData$seurat_clusters<HELP>, 
      data_transcripts_sce@colData@listData$seurat_clusters)))
      clustername <- paste("data_DESingle_cluster_", cluster, sep="")
      assign(clustername, DEsingle(counts = data_transcripts_sce@assays@data@listData$counts, group = groupname))
    }

I'm having trouble implementing that part in <HELP> - how do you use the variable in the for loop (in this case cluster, within the function, and nested within the variable of data_transcripts_sce@colData@listData$seurat_clusters?

Alternatively, I'd also very much like to learn about more elegant ways to do this.

desingle seurat rna-seq r

0 answers

No answers yet.

Log in to answer this question.