@@ -852,11 +852,19 @@ plotSCEScatter <- function(inSCE,
852
852
vcolor = " red" ,
853
853
vsize = 1 ,
854
854
vlinetype = 1 ) {
855
+
856
+ mult_modules <- FALSE
857
+
855
858
if (is.null(groupBy )) {
856
- groupBy <- rep(" Sample" , length(y ))
859
+ if (length(colnames(y )) > 1 ){
860
+ mult_modules <- TRUE
861
+ groupBy <- rep(colnames(y ), each = dim(y )[1 ])
862
+ y <- tidyr :: pivot_longer(as.data.frame(y ), cols = 1 : dim(y )[2 ], cols_vary = " slowest" )$ value #
863
+ }else {
864
+ groupBy <- rep(" Sample" , length(y ))
865
+ }
857
866
}
858
867
859
-
860
868
if (! is.factor(groupBy )){
861
869
if (is.null(plotOrder )){
862
870
plotOrder = unique(groupBy )
@@ -920,6 +928,10 @@ plotSCEScatter <- function(inSCE,
920
928
axis.title.x = ggplot2 :: element_blank())
921
929
}
922
930
931
+ if (mult_modules ){
932
+ p <- p + xlab(" Modules" )
933
+ }
934
+
923
935
if (gridLine == TRUE ){
924
936
p <- p + ggplot2 :: theme(panel.grid.major.y = ggplot2 :: element_line(" grey" ))
925
937
}
@@ -1417,9 +1429,9 @@ plotSCEViolinAssayData <- function(inSCE,
1417
1429
# ' @param feature Desired name of feature stored in assay of SingleCellExperiment
1418
1430
# ' object. Only used when "assays" slotName is selected. Default NULL.
1419
1431
# ' @param sample Character vector. Indicates which sample each cell belongs to.
1420
- # ' @param dimension Desired dimension stored in the specified reducedDims.
1421
- # ' Either an integer which indicates the column or a character vector specifies
1422
- # ' column name. By default, the 1st dimension/column will be used.
1432
+ # ' @param dimension Desired dimension(s) stored in the specified reducedDims.
1433
+ # ' Either an integer which indicates the column(s) or a character vector specifies
1434
+ # ' column name(s) . By default, the 1st dimension/column will be used.
1423
1435
# ' Only used when "reducedDims" slotName is selected. Default NULL.
1424
1436
# ' @param groupBy Groupings for each numeric value. A user may input a vector
1425
1437
# ' equal length to the number of the samples in the SingleCellExperiment
@@ -1568,7 +1580,11 @@ plotSCEViolin <- function(inSCE,
1568
1580
samples <- unique(sample )
1569
1581
plotlist <- lapply(samples , function (x ) {
1570
1582
sampleInd <- which(sample == x )
1571
- countSub <- counts [sampleInd ]
1583
+ if (length(colnames(counts )) > 1 ){
1584
+ countSub <- counts [sampleInd ,]
1585
+ }else {
1586
+ countSub <- counts [sampleInd ]
1587
+ }
1572
1588
if (! is.null(groupBy )){
1573
1589
groupbySub <- groupBy [sampleInd ]
1574
1590
}else {
0 commit comments