stuart-lab / signac

R toolkit for the analysis of single-cell chromatin data
https://stuartlab.org/signac/
Other
302 stars 84 forks source link

Options for ncol and keeping order of idents in RegionHeatmap #1729

Open mossconfuse opened 2 weeks ago

mossconfuse commented 2 weeks ago

Thanks for the useful tools, as always.

I was toying with the RegionHeatmap function, but ultimately had to copy and modify it to produce my own version. Based on that, I recommend adding arguments for ncol, so the user can specify the number of columns the individual facets are arranged in. Also, rearranging the facets by idents, as they keep getting reshuffled (1,2,3,10 ->1,10,2,3):

data.use <- all.assay[all.assay$assay == assay[[i]], 
      ]
data.use$group <- factor(x = data.use$group, levels = idents)

    pp <- ggplot(data = data.use, mapping = aes_string(x = "bin", 
      y = "name", fill = "value")) + facet_wrap(facets = ~group, 
      scales = "free_y", nrow = nrow, ncol = ncol) + geom_raster() + 

I also kept getting "Error in colors_all[[assay[[i]]]] : subscript out of bounds" when I tried to supply a single custom cols and a singular assay ("peaks"), so I had to overwrite with

names(x = colors_all) <- assay