Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.12.1 #739

Merged
merged 41 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1ad2417
Merge pull request #42 from compbiomed/devel
salzcamino Sep 21, 2023
5ff6fd1
Pulled from origin devel to allow for successful merge
Sep 24, 2023
61da00f
Added scaling implementation in bubbleplot and implemented GUI change…
Oct 2, 2023
7990962
Fixed normalization function to return back into tempSCE, and updated…
Oct 7, 2023
29ba8ff
Add start to runTSCAN, fix feature reducedDim error in plotSeuratGenes
salzcamino Oct 19, 2023
e2dd010
Merge pull request #43 from compbiomed/devel
salzcamino Oct 19, 2023
ba6531e
Updated Harmony documentation
irzamsarfraz Oct 29, 2023
93d7804
Merge pull request #728 from salzcamino/master
joshua-d-campbell Nov 1, 2023
1c33c66
Merge pull request #729 from irzamsarfraz/devel
joshua-d-campbell Nov 1, 2023
1bd4201
added support for importing SCE by loose file
liuming1997 Nov 30, 2023
3da9da5
Merge branch 'devel' of github.com:mingl1997/singleCellTK into devel
liuming1997 Nov 30, 2023
c68e365
Merge pull request #18 from compbiomed/devel
mingl1997 Nov 30, 2023
2785300
fix for importCellRangerV3 to handle subdirectory
liuming1997 Dec 12, 2023
65baa07
Merge branch 'devel' of github.com:mingl1997/singleCellTK into devel
liuming1997 Dec 12, 2023
6a8453f
Merge remote-tracking branch 'origin/devel'
akshayarav Dec 22, 2023
8d923b0
Modified .ggBubble to set gene/feature names vertically
akshayarav Dec 23, 2023
71c60d5
Change Cluster to Select Annotation for bubbleplot GUI
akshayarav Dec 23, 2023
91a9191
Finish Bubbleplot GUI
akshayarav Jan 3, 2024
808bc67
Merge branch 'master' into devel
joshua-d-campbell Jan 5, 2024
b0884e6
Merge pull request #730 from mingl1997/devel
joshua-d-campbell Jan 5, 2024
d448443
Merge pull request #717 from akshayarav/devel
joshua-d-campbell Jan 5, 2024
b5db71f
Merge pull request #19 from compbiomed/devel
mingl1997 Jan 5, 2024
c858471
fixed documentation error and updated the looseFile flag to flatFile
liuming1997 Jan 5, 2024
b8823f8
fixed bubble plot and added optparse check
liuming1997 Jan 8, 2024
09d8c61
fixed documentation error associated with setting seed
liuming1997 Jan 8, 2024
c61dcd2
pointed SCTK to latest stable release
mingl1997 Jan 8, 2024
4164d5d
Update Dockerfile
mingl1997 Jan 8, 2024
2b7bfad
Merge pull request #44 from compbiomed/master
salzcamino Jan 9, 2024
8163de9
Merge pull request #45 from compbiomed/devel
salzcamino Jan 9, 2024
3a89ac1
update plotSeuratGenes args
salzcamino Jan 9, 2024
b2eceb6
documentation
salzcamino Jan 9, 2024
bc1c790
add namespace for element_text
salzcamino Jan 9, 2024
c3dd29a
Merge pull request #735 from mingl1997/devel
joshua-d-campbell Jan 9, 2024
bed5da0
edited Dockerfile to point to master repo
liuming1997 Jan 9, 2024
6943873
Merge pull request #20 from compbiomed/devel
mingl1997 Jan 9, 2024
6ad2414
resolve conflicts
salzcamino Jan 9, 2024
34fd845
git push origin masterMerge branch 'compbiomed-devel'
salzcamino Jan 9, 2024
67149a6
Merge pull request #737 from mingl1997/devel
joshua-d-campbell Jan 10, 2024
232ba3a
Merge pull request #738 from salzcamino/master
joshua-d-campbell Jan 10, 2024
c300c15
updated NEWS and version bump
joshua-d-campbell Jan 10, 2024
ae66d83
Updated docs for v2.12.1
joshua-d-campbell Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: singleCellTK
Type: Package
Title: Comprehensive and Interactive Analysis of Single Cell RNA-Seq Data
Version: 2.12.0
Authors@R: c(person(given="Yichen", family="Wang", email="wangych@bu.edu", role=c("aut", "cre"),
Version: 2.12.1
Authors@R: c(person(given="Yichen", family="Wang", email="wangych@bu.edu", role=c("aut"),
comment = c(ORCID = "0000-0003-4347-5199")),
person(given="Irzam", family="Sarfraz", email="isarfraz@bu.edu", role=c("aut"),
comment = c(ORCID = "0000-0001-8121-792X")),
Expand All @@ -22,7 +22,8 @@ Authors@R: c(person(given="Yichen", family="Wang", email="wangych@bu.edu", role=
person(given=c("W.", "Evan"), family="Johnson", email="wej@bu.edu", role=c("aut"),
comment = c(ORCID = "0000-0002-6247-6595")),
person(given="Ming", family="Liu", email="mingl@bu.edu", role=c("aut")),
person(given=c("Joshua", "David"), family="Campbell", email="camp@bu.edu", role=c("aut"))
person(given=c("Joshua", "David"), family="Campbell", email="camp@bu.edu", role=c("aut", "cre"),
comment = c(ORCID = "0000-0003-0780-8662"))
)
Depends:
R (>= 4.0),
Expand Down Expand Up @@ -137,7 +138,8 @@ Suggests:
BiocGenerics,
RColorBrewer,
fastmap (>= 1.1.0),
harmony
harmony,
optparse
VignetteBuilder: knitr
URL: https://www.camplab.net/sctk/
BugReports: https://github.com/compbiomed/singleCellTK/issues
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN R -e "BiocManager::install('scRNAseq')"
RUN R -e "BiocManager::install('celda')"
#RUN R -e "devtools::install_github('wleepang/shiny-directory-input')"
RUN R -e "options(timeout=360000)" \
&& R -e "devtools::install_github('compbiomed/singleCellTK', ref = 'devel', force = TRUE, dependencies = TRUE)"
&& R -e "devtools::install_github('compbiomed/singleCellTK', force = TRUE, dependencies = TRUE)"

RUN R -e "install.packages('reticulate')"
RUN R -e "Sys.setenv(RETICULATE_PYTHON = '/usr/bin/python3')"
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Changes in Version 2.12.1 (2024-01-10)
================================================================================
* Updates to documentation
* Fixes to runTSCAN and plotSeurat Genes
* Added support for flat file import into SCTK-QC
* Fixed directory issue in importCellRanger
* Added Bubble plot to Shiny GUI
* Updated Dockerfile

Changes in Version 2.12.0 (2023-10-24)
================================================================================
* Updated version to match Bioconductor 3.18
Expand Down
14 changes: 12 additions & 2 deletions R/importCellRanger.R
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,18 @@
}
}

sampleLength <- length(unlist(lapply(cellRangerDirs,
list.dirs, recursive = FALSE)))
# check cellRangerDirs sample length
sampleLength = 0
for (i in cellRangerDirs) {
temp = paste0(i, "/outs")
if (dir.exists(temp) == TRUE) {
sampleLength = sampleLength + 1

Check warning on line 200 in R/importCellRanger.R

View check run for this annotation

Codecov / codecov/patch

R/importCellRanger.R#L196-L200

Added lines #L196 - L200 were not covered by tests
}
rm(temp)

Check warning on line 202 in R/importCellRanger.R

View check run for this annotation

Codecov / codecov/patch

R/importCellRanger.R#L202

Added line #L202 was not covered by tests
}

#sampleLength <- length(unlist(lapply(cellRangerDirs,
# list.dirs, recursive = FALSE)))

if (!is.null(sampleNames)) {
if (sampleLength != length(sampleNames)) {
Expand Down
16 changes: 11 additions & 5 deletions R/plotBubble.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +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.
#' @return A ggplot of the bubble plot.
#' @importFrom rlang .data
#' @importFrom reshape2 melt
Expand All @@ -21,14 +22,14 @@
#' displayName="feature_name", groupNames="type", title="cell type test",
#' xlab="gene", ylab="cluster", colorLow="white", colorHigh="blue")
#' @export
plotBubble <- function(inSCE, useAssay="logcounts", featureNames, displayName=NULL, groupNames="cluster", title="", xlab=NULL, ylab=NULL, colorLow="white", colorHigh="blue"){
plotBubble <- function(inSCE, useAssay="logcounts", featureNames, displayName=NULL, groupNames="cluster", title="", xlab=NULL, ylab=NULL, colorLow="white", colorHigh="blue", scale = FALSE){
metrics <- runClusterSummaryMetrics(inSCE, useAssay=useAssay, featureNames=featureNames,
displayName=displayName, groupNames=groupNames)
displayName=displayName, groupNames=groupNames, scale = scale)
.ggBubble(avgExpr = metrics$avgExpr, percExpr = metrics$percExpr, colorLow = colorLow,
colorHigh = colorHigh, title = title)
colorHigh = colorHigh, title = title, xlab=xlab, ylab=ylab)
}

.ggBubble <- function(avgExpr, percExpr, groupNames=NULL, featureNames=NULL, colorLow="white", colorHigh="blue", title=""){
.ggBubble <- function(avgExpr, percExpr, groupNames=NULL, featureNames=NULL, colorLow="white", colorHigh="blue", title="", xlab="Features", ylab="Clusters"){
if(is.null(featureNames)) {
if(is.null(rownames(avgExpr))) {
stop("'featureNames' must be supplied or the 'rownames' of the average expression matrix must be set.")
Expand Down Expand Up @@ -65,7 +66,12 @@ plotBubble <- function(inSCE, useAssay="logcounts", featureNames, displayName=NU
gg <- ggplot2::ggplot(df, ggplot2::aes(x = .data[['featureNames']], y = .data[['groupNames']])) +
ggplot2::geom_point(ggplot2::aes(color=.data[['avgExpr']], size=.data[['percExpr']])) +
ggplot2::ggtitle(title) +
ggplot2::xlab(xlab) +
ggplot2::ylab(ylab) +
ggplot2::scale_color_gradient2(low=colorLow, high=colorHigh)
.ggSCTKTheme(gg)
g <- .ggSCTKTheme(gg)

g <- g + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90, vjust = 0.5, hjust=1))
g
}

20 changes: 17 additions & 3 deletions R/runBatchCorrection.R
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,12 @@
#' conditions.
#' @param inSCE Input \linkS4class{SingleCellExperiment} object
#' @param useAssay A single character indicating the name of the assay requiring
#' batch correction. Default \code{"logcounts"}.
#' batch correction. Default \code{NULL}. It is recommended to use a reducedDim
#' such as PCA through the `useReducedDim` parameter of this function.
#' @param useReducedDim A single character indicating the name of the reducedDim
#' used to be corrected. Specifying this will ignore \code{useAssay}. Default
#' to be used. It is recommended to use a reducedDim instead of a full assay as
#' using an assay might cause the algorithm to not converge and throw error.
#' Specifying this will ignore \code{useAssay}. Default
#' \code{NULL}.
#' @param batch A single character indicating a field in \code{colData} that
#' annotates the batches of each cell; or a vector/factor with the same length
Expand Down Expand Up @@ -317,7 +320,7 @@
#' if (require("harmony"))
#' sceCorr <- runHarmony(sceBatches)
#' }
runHarmony <- function(inSCE, useAssay = "logcounts", useReducedDim = NULL,
runHarmony <- function(inSCE, useAssay = NULL, useReducedDim = NULL,
batch = "batch", reducedDimName = "HARMONY",
nComponents = 50, lambda = 0.1, theta = 5,
sigma = 0.1, nIter = 10, seed = 12345, verbose = TRUE, ...) {
Expand All @@ -327,6 +330,17 @@
"install.packages('harmony')",
call. = FALSE)
}

# Check if both useAssay and useReducedDim are not NULL
if(is.null(useAssay) && is.null(useReducedDim)){
stop("Both 'useAssay' & 'useReducedDim' cannot be NULL. It is recommended to use a reducedDim (PCA) for this algorithm but a full-sized assay can also be used. However, using an assay may cause the algorithm to not converge.")

Check warning on line 336 in R/runBatchCorrection.R

View check run for this annotation

Codecov / codecov/patch

R/runBatchCorrection.R#L335-L336

Added lines #L335 - L336 were not covered by tests
}

# If using useAssay, send a warning to recommend using PCA
if((!is.null(useAssay)) && is.null(useReducedDim)){
warning("You are using a full-sized assay with Harmony. It is recommended to use a reducedDim (PCA) for better results, as using a full sized assay may cause the algorithm to not converge. Computation will proceed with selected assay ...")

Check warning on line 341 in R/runBatchCorrection.R

View check run for this annotation

Codecov / codecov/patch

R/runBatchCorrection.R#L340-L341

Added lines #L340 - L341 were not covered by tests
}

## Input check
useMat <- .selectSCEMatrix(inSCE, useAssay, useReducedDim,
useAltExp = NULL, returnMatrix = TRUE)
Expand Down
24 changes: 18 additions & 6 deletions R/runClusterSummaryMetrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +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.
#' @return A dataframe with mean expression and percent of cells in cluster that
#' express for each cluster.
#' @examples
Expand All @@ -15,8 +16,11 @@
#' displayName="feature_name", groupNames="type")
#' @export

runClusterSummaryMetrics <- function(inSCE, useAssay="logcounts", featureNames, displayName=NULL, groupNames="cluster"){

runClusterSummaryMetrics <- function(inSCE, useAssay="logcounts", featureNames, displayName=NULL, groupNames="cluster", scale = FALSE){
if(isTRUE(scale)){
runNormalization(inSCE=inSCE, useAssay=useAssay, scale = TRUE, normalizationMethod = NULL, transformation = NULL,
pseudocountsBeforeNorm = NULL, pseudocountsBeforeTransform = NULL)

Check warning on line 22 in R/runClusterSummaryMetrics.R

View check run for this annotation

Codecov / codecov/patch

R/runClusterSummaryMetrics.R#L21-L22

Added lines #L21 - L22 were not covered by tests
}
if (!groupNames %in% names(SingleCellExperiment::colData(inSCE))) {
stop("Specified variable '", groupNames, "' not found in colData(inSCE)")
}
Expand All @@ -40,16 +44,24 @@
warning("Specified genes '", toString(falseGenes), "' not found in ", warning)
}

tempSCE <- inSCE[featureNames, ]


if(isTRUE(scale)){
tempSCE <- runNormalization(inSCE=tempSCE, outAssayName = "scaled", useAssay=useAssay,scale = TRUE, normalizationMethod = NULL, transformation = NULL,
pseudocountsBeforeNorm = NULL, pseudocountsBeforeTransform = NULL)
useAssay <- "scaled"

Check warning on line 53 in R/runClusterSummaryMetrics.R

View check run for this annotation

Codecov / codecov/patch

R/runClusterSummaryMetrics.R#L51-L53

Added lines #L51 - L53 were not covered by tests
}

avgExpr <- assay(scuttle::aggregateAcrossCells(inSCE, ids=SingleCellExperiment::colData(inSCE)[,groupNames],
avgExpr <- assay(scuttle::aggregateAcrossCells(tempSCE, ids=SingleCellExperiment::colData(inSCE)[,groupNames],
statistics="mean", use.assay.type=useAssay,
subset.row=featureNames))
subset.row=NULL))



percExpr <- assay(scuttle::aggregateAcrossCells(inSCE, ids=SingleCellExperiment::colData(inSCE)[,groupNames],
percExpr <- assay(scuttle::aggregateAcrossCells(tempSCE, ids=SingleCellExperiment::colData(inSCE)[,groupNames],
statistics="prop.detected", use.assay.type=useAssay,
subset.row=featureNames))
subset.row=NULL))


df <- data.frame(featureNames = featureNames)
Expand Down
2 changes: 1 addition & 1 deletion R/runDimReduce.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ runDimReduce <- function(inSCE,
useAssay = NULL, useReducedDim = NULL,
useAltExp = NULL, reducedDimName = method,
nComponents = 20, useFeatureSubset = NULL,
scale = FALSE, seed = NULL, ...)
scale = FALSE, seed = 12345, ...)
{

method <- match.arg(method)
Expand Down
4 changes: 2 additions & 2 deletions R/runNormalization.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
#' outAssayName = "logcounts")
runNormalization <- function(inSCE,
useAssay = "counts",
outAssayName = "customNormalizedAssay",
normalizationMethod = NULL,
outAssayName = "logcounts",
normalizationMethod = "logNormCounts",
scale = FALSE,
seuratScaleFactor = 10000,
transformation = NULL,
Expand Down
Loading
Loading