Skip to content

Commit

Permalink
Merge remote-tracking branch 'compbiomed/devel' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Campbell committed Oct 22, 2024
2 parents bbdef01 + 6bd11f6 commit b825433
Show file tree
Hide file tree
Showing 29 changed files with 368 additions and 269 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ exec/png
^\.github$
^vignettes/articles/*
^images
.dockerignore
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.RData
.Rhistory
.git
.gitignore
manifest.json
rsconnect/
.Rproj.user
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ Imports:
scuttle,
utils,
stats,
zellkonverter
RoxygenNote: 7.3.1
zellkonverter,
tidyr
RoxygenNote: 7.3.2
Suggests:
testthat,
Rsubread,
Expand Down
7 changes: 7 additions & 0 deletions R/computeHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ computeHeatmap <- function(inSCE,
features[[i]] <- .convertToHyphen(features[[i]])
}

## temp fix
# make sure the cell names are consistent
# UPDATE THIS IN .convertSCEToSeurat function eventually
rownames(object@reductions$pca@cell.embeddings) <-
unlist(.convertToHyphen(rownames(object@reductions$pca@cell.embeddings)))
##

object <- Seurat::ScaleData(object, features = features.all)

# get assay data with only selected features (all dims) and
Expand Down
1 change: 1 addition & 0 deletions R/doubletFinder_doubletDetection.R
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
#' @seealso \code{\link{runCellQC}}, \code{\link{plotDoubletFinderResults}}
#' @examples
#' data(scExample, package = "singleCellTK")
#' options(future.globals.maxSize = 786432000)
#' sce <- subsetSCECols(sce, colData = "type != 'EmptyDroplet'")
#' sce <- runDoubletFinder(sce)
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/dropletUtils_emptyDrops.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#' @title Identify empty droplets using \link[DropletUtils]{emptyDrops}.
#' @description Run \link[DropletUtils]{emptyDrops} on the count matrix in the
#' provided \\linkS4class{SingleCellExperiment} object.
#' provided \linkS4class{SingleCellExperiment} object.
#' Distinguish between droplets containing cells and ambient RNA in a
#' droplet-based single-cell RNA sequencing experiment.
#' @param inSCE A \linkS4class{SingleCellExperiment} object. Must contain a raw
Expand Down
28 changes: 22 additions & 6 deletions R/ggPlotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -852,11 +852,19 @@ plotSCEScatter <- function(inSCE,
vcolor = "red",
vsize = 1,
vlinetype = 1) {

mult_modules <- FALSE

if (is.null(groupBy)) {
groupBy <- rep("Sample", length(y))
if (length(colnames(y)) > 1){
mult_modules <- TRUE
groupBy <- rep(colnames(y), each = dim(y)[1])
y <- tidyr::pivot_longer(as.data.frame(y), cols = 1:dim(y)[2], cols_vary = "slowest")$value#
}else{
groupBy <- rep("Sample", length(y))
}
}


if(!is.factor(groupBy)){
if(is.null(plotOrder)){
plotOrder = unique(groupBy)
Expand Down Expand Up @@ -920,6 +928,10 @@ plotSCEScatter <- function(inSCE,
axis.title.x = ggplot2::element_blank())
}

if (mult_modules){
p <- p + xlab("Modules")
}

if (gridLine == TRUE){
p <- p + ggplot2::theme(panel.grid.major.y = ggplot2::element_line("grey"))
}
Expand Down Expand Up @@ -1417,9 +1429,9 @@ plotSCEViolinAssayData <- function(inSCE,
#' @param feature Desired name of feature stored in assay of SingleCellExperiment
#' object. Only used when "assays" slotName is selected. Default NULL.
#' @param sample Character vector. Indicates which sample each cell belongs to.
#' @param dimension Desired dimension stored in the specified reducedDims.
#' Either an integer which indicates the column or a character vector specifies
#' column name. By default, the 1st dimension/column will be used.
#' @param dimension Desired dimension(s) stored in the specified reducedDims.
#' Either an integer which indicates the column(s) or a character vector specifies
#' column name(s). By default, the 1st dimension/column will be used.
#' Only used when "reducedDims" slotName is selected. Default NULL.
#' @param groupBy Groupings for each numeric value. A user may input a vector
#' equal length to the number of the samples in the SingleCellExperiment
Expand Down Expand Up @@ -1568,7 +1580,11 @@ plotSCEViolin <- function(inSCE,
samples <- unique(sample)
plotlist <- lapply(samples, function(x) {
sampleInd <- which(sample == x)
countSub <- counts[sampleInd]
if (length(colnames(counts)) > 1){
countSub <- counts[sampleInd,]
}else{
countSub <- counts[sampleInd]
}
if(!is.null(groupBy)){
groupbySub <- groupBy[sampleInd]
}else{
Expand Down
8 changes: 4 additions & 4 deletions R/miscFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,18 @@ discreteColorPalette <- function(n, palette = c("random", "ggplot", "celda"),
#' Adds '-1', '-2', ... '-i' to multiple duplicated rownames, and in place
#' replace the unique rownames, store unique rownames in \code{rowData}, or
#' return the unique rownames as character vecetor.
#' @param x A matrix like or /linkS4class{SingleCellExperiment} object, on which
#' @param x A matrix like or \linkS4class{SingleCellExperiment} object, on which
#' we can apply \code{rownames()} to and has duplicated rownames.
#' @param as.rowData Only applicable when \code{x} is a
#' /linkS4class{SingleCellExperiment} object. When set to \code{TRUE}, will
#' \linkS4class{SingleCellExperiment} object. When set to \code{TRUE}, will
#' insert a new column called \code{"rownames.uniq"} to \code{rowData(x)}, with
#' the deduplicated rownames.
#' @param return.list When set to \code{TRUE}, will return a character vector
#' of the deduplicated rownames.
#' @export
#' @return By default, a matrix or /linkS4class{SingleCellExperiment} object
#' @return By default, a matrix or \linkS4class{SingleCellExperiment} object
#' with rownames deduplicated.
#' When \code{x} is a /linkS4class{SingleCellExperiment} and \code{as.rowData}
#' When \code{x} is a \linkS4class{SingleCellExperiment} and \code{as.rowData}
#' is set to \code{TRUE}, will return \code{x} with \code{rowData} updated.
#' When \code{return.list} is set to \code{TRUE}, will return a character vector
#' with the deduplicated rownames.
Expand Down
2 changes: 1 addition & 1 deletion R/plotBubble.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @param ylab The y-axis label
#' @param colorLow The color to be used for lowest value of mean expression
#' @param colorHigh The color to be used for highest value of mean expression
#' @param scale Option to scale the data. Default: /code{FALSE}. Selected assay will not be scaled.
#' @param scale Option to scale the data. Default: \code{FALSE}. Selected assay will not be scaled.
#' @return A ggplot of the bubble plot.
#' @importFrom rlang .data
#' @importFrom reshape2 melt
Expand Down
2 changes: 1 addition & 1 deletion R/runBatchCorrection.R
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ integrated = integrated[:, orderIdx]
#' variable genes identification. Default \code{"counts"}.
#' @param kmeansK An integer vector. Indicating the kmeans' K-value for each
#' batch (i.e. how many subclusters in each batch should exist), in order to
#' construct pseudo-replicates. The length of code{kmeansK} needs to be the same
#' construct pseudo-replicates. The length of \code{kmeansK} needs to be the same
#' as the number of batches. Default \code{NULL}, and this value will be
#' auto-detected by default, depending on \code{cellType}.
#' @param cellType A single character. A string indicating a field in
Expand Down
2 changes: 1 addition & 1 deletion R/runClusterSummaryMetrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @param featureNames A string or vector of strings with each gene to aggregate.
#' @param displayName A string that is the name of the column used for genes.
#' @param groupNames The name of a colData entry that can be used as groupNames.
#' @param scale Option to scale the data. Default: /code{FALSE}. Selected assay will not be scaled.
#' @param scale Option to scale the data. Default: \code{FALSE}. Selected assay will not be scaled.
#' @return A dataframe with mean expression and percent of cells in cluster that
#' express for each cluster.
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/runDimReduce.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ runDimReduce <- function(inSCE,
seed = seed, ...)
} else if (method == "scaterUMAP") {
inSCE <- runUMAP(inSCE = inSCE, useAssay = useAssay, useAltExp = useAltExp,
useReducedDim = useReducedDim, initialDims = 25,
useReducedDim = useReducedDim,
useFeatureSubset = useFeatureSubset, scale = scale,
reducedDimName = reducedDimName, seed = seed, ...)
} else if (method == "scanpyPCA"){
Expand Down
Loading

0 comments on commit b825433

Please sign in to comment.