Skip to content

Commit

Permalink
Merge pull request #245 from zhewa/SCE
Browse files Browse the repository at this point in the history
Sce
  • Loading branch information
zhewa committed Jan 15, 2020
2 parents 3573495 + 7d31b5b commit 49988e7
Show file tree
Hide file tree
Showing 92 changed files with 3,297 additions and 1,356 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -24,4 +24,4 @@ r_github_packages:
after_success:
- R CMD INSTALL $PKG_TARBALL
- Rscript -e 'covr::coveralls()'
- Rscript -e 'library(lintr); lint_package(linters = with_defaults(object_length_linter(length = 40L), object_name_linter = NULL, commented_code_linter = NULL, object_usage_linter = NULL), exclusions = list("R/RcppExports.R"))'
- Rscript -e 'library(lintr); lint_package(linters = with_defaults(object_length_linter(length = 40L), object_name_linter = NULL, commented_code_linter = NULL, object_usage_linter = NULL, cyclocomp_linter(complexity_limit = 40)), exclusions = list("R/RcppExports.R"))'
30 changes: 19 additions & 11 deletions DESCRIPTION
@@ -1,12 +1,14 @@
Package: celda
Title: CEllular Latent Dirichlet Allocation
Version: 1.1.2
Authors@R: c(person("Joshua", "Campbell", email = "camp@bu.edu", role = c("aut", "cre")),
person("Sean", "Corbett", email = "scorbett@bu.edu", role = c("aut")),
person("Yusuke", "Koga", email="ykoga07@bu.edu", role = c("aut")),
person("Zhe", "Wang", email="zhe@bu.edu", role = c("aut")))
Description: celda leverages Bayesian hierarchical modeling to cluster genes,
cells, or both simultaneously from single cell sequencing data.
Version: 1.3.1
Authors@R: c(person("Joshua", "Campbell", email = "camp@bu.edu",
role = c("aut", "cre")),
person("Sean", "Corbett", email = "scorbett@bu.edu", role = c("aut")),
person("Yusuke", "Koga", email="ykoga07@bu.edu", role = c("aut")),
person("Shiyi", "Yang", email="syyang@bu.edu", role = c("aut")),
person("Eric", "Reed", email="reeder@bu.edu", role = c("aut")),
person("Zhe", "Wang", email="zhe@bu.edu", role = c("aut")))
Description: celda is a Bayesian hierarchical model that can co-cluster features and cells in single cell sequencing data.
Depends:
R (>= 3.6)
VignetteBuilder: knitr
Expand All @@ -31,8 +33,9 @@ Imports:
S4Vectors,
data.table,
Rcpp,
RcppArmadillo,
RcppEigen,
umap,
uwot,
enrichR,
stringi,
SummarizedExperiment,
Expand All @@ -42,7 +45,12 @@ Imports:
withr,
dendextend,
ggdendro,
pROC
pROC,
magrittr,
scater (>= 1.14.4),
scran,
SingleCellExperiment,
dbscan
Suggests:
testthat,
knitr,
Expand All @@ -55,10 +63,10 @@ Suggests:
M3DExampleData,
BiocManager,
BiocStyle
LinkingTo: Rcpp, RcppEigen
LinkingTo: Rcpp, RcppArmadillo, RcppEigen
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: false
RoxygenNote: 6.1.1
RoxygenNote: 7.0.2
BugReports: https://github.com/campbio/celda/issues
biocViews: SingleCell, GeneExpression, Clustering, Sequencing, Bayesian
12 changes: 9 additions & 3 deletions NAMESPACE
@@ -1,9 +1,9 @@
# Generated by roxygen2: do not edit by hand

export("decontXcounts<-")
export(appendCeldaList)
export(availableModels)
export(bestLogLikelihood)
export(buildTreeHybrid)
export(celda)
export(celdaGridSearch)
export(celdaHeatmap)
Expand All @@ -19,11 +19,13 @@ export(clusters)
export(compareCountMatrix)
export(countChecksum)
export(decontX)
export(decontXcounts)
export(differentialExpression)
export(distinctColors)
export(factorizeMatrix)
export(featureModuleLookup)
export(featureModuleTable)
export(findMarkers)
export(geneSetEnrich)
export(getDecisions)
export(logLikelihood)
Expand Down Expand Up @@ -63,6 +65,7 @@ export(simulateContaminatedMatrix)
export(subsetCeldaList)
export(topRank)
export(violinPlot)
exportMethods("decontXcounts<-")
exportMethods(bestLogLikelihood)
exportMethods(celdaHeatmap)
exportMethods(celdaPerplexity)
Expand All @@ -72,6 +75,8 @@ exportMethods(celdaUmap)
exportMethods(clusterProbability)
exportMethods(clusters)
exportMethods(countChecksum)
exportMethods(decontX)
exportMethods(decontXcounts)
exportMethods(factorizeMatrix)
exportMethods(featureModuleLookup)
exportMethods(logLikelihoodHistory)
Expand All @@ -91,7 +96,9 @@ import(grDevices)
import(graphics)
import(grid)
import(gridExtra, except = c(combine))
import(magrittr)
import(stats, except = c(start, end))
import(uwot)
importFrom(MAST,FromMatrix)
importFrom(MAST,summary)
importFrom(MAST,zlm)
Expand Down Expand Up @@ -126,6 +133,7 @@ importFrom(gtable,gtable_height)
importFrom(gtable,gtable_width)
importFrom(matrixStats,logSumExp)
importFrom(methods,.hasSlot)
importFrom(methods,hasArg)
importFrom(methods,is)
importFrom(methods,new)
importFrom(pROC,auc)
Expand All @@ -138,8 +146,6 @@ importFrom(scales,brewer_pal)
importFrom(scales,dscale)
importFrom(scales,hue_pal)
importFrom(stringi,stri_list2matrix)
importFrom(umap,umap)
importFrom(umap,umap.defaults)
importFrom(withr,with_seed)
useDynLib(celda,"_colSumByGroup")
useDynLib(celda,"_colSumByGroupChange")
Expand Down
24 changes: 24 additions & 0 deletions R/RcppExports.R
@@ -1,10 +1,34 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

decontXEM <- function(counts, counts_colsums, theta, eta, phi, z, pseudocount) {
.Call('_celda_decontXEM', PACKAGE = 'celda', counts, counts_colsums, theta, eta, phi, z, pseudocount)
}

decontXLogLik <- function(counts, theta, eta, phi, z, pseudocount) {
.Call('_celda_decontXLogLik', PACKAGE = 'celda', counts, theta, eta, phi, z, pseudocount)
}

decontXInitialize <- function(counts, theta, z, pseudocount) {
.Call('_celda_decontXInitialize', PACKAGE = 'celda', counts, theta, z, pseudocount)
}

calculateNativeMatrix <- function(counts, native_counts, theta, eta, phi, z, row_index, col_index, pseudocount) {
.Call('_celda_calculateNativeMatrix', PACKAGE = 'celda', counts, native_counts, theta, eta, phi, z, row_index, col_index, pseudocount)
}

cG_calcGibbsProbY_Simple <- function(counts, nGbyTS, nTSbyC, nbyTS, nbyG, y, L, index, gamma, beta, delta) {
.Call('_celda_cG_calcGibbsProbY_Simple', PACKAGE = 'celda', counts, nGbyTS, nTSbyC, nbyTS, nbyG, y, L, index, gamma, beta, delta)
}

cG_CalcGibbsProbY_ori <- function(index, counts, nTSbyC, nbyTS, nGbyTS, nbyG, y, L, nG, lg_beta, lg_gamma, lg_delta, delta) {
.Call('_celda_cG_CalcGibbsProbY_ori', PACKAGE = 'celda', index, counts, nTSbyC, nbyTS, nGbyTS, nbyG, y, L, nG, lg_beta, lg_gamma, lg_delta, delta)
}

cG_CalcGibbsProbY_fastRow <- function(index, counts, nTSbyC, nbyTS, nGbyTS, nbyG, y, L, nG, lg_beta, lg_gamma, lg_delta, delta) {
.Call('_celda_cG_CalcGibbsProbY_fastRow', PACKAGE = 'celda', index, counts, nTSbyC, nbyTS, nGbyTS, nbyG, y, L, nG, lg_beta, lg_gamma, lg_delta, delta)
}

cG_CalcGibbsProbY <- function(index, counts, nTSbyC, nbyTS, nGbyTS, nbyG, y, L, nG, lg_beta, lg_gamma, lg_delta, delta) {
.Call('_celda_cG_CalcGibbsProbY', PACKAGE = 'celda', index, counts, nTSbyC, nbyTS, nGbyTS, nbyG, y, L, nG, lg_beta, lg_gamma, lg_delta, delta)
}
Expand Down
17 changes: 5 additions & 12 deletions R/all_generics.R
Expand Up @@ -596,33 +596,26 @@ setGeneric("celdaTsne",
#' requires more memory. Default 25000.
#' @param minClusterSize Integer. Do not subsample cell clusters below this
#' threshold. Default 100.
#' @param initialDims Integer. PCA will be used to reduce the dimentionality
#' of the dataset. The top 'initialDims' principal components will be used
#' for umap. Default 20.
#' @param modules Integer vector. Determines which features modules to use for
#' tSNE. If NULL, all modules will be used. Default NULL.
#' @param seed Integer. Passed to \link[withr]{with_seed}. For reproducibility,
#' a default value of 12345 is used. If NULL, no calls to
#' \link[withr]{with_seed} are made.
#' @param umapConfig An object of class "umapConfig" specifying parameters to
#' the UMAP algorithm.
#' @return Numeric Matrix of dimension `ncol(counts)` x 2, colums representing
#' the "X" and "Y" coordinates in the data's t-SNE represetation.
#' @examples
#' @param ... Additional parameters to `uwot::umap`
#' @return A two column matrix of UMAP coordinates#' @examples
#' data(celdaCGSim, celdaCGMod)
#' tsneRes <- celdaUmap(celdaCGSim$counts, celdaCGMod)
#' @importFrom umap umap.defaults
#' umapRes <- celdaUmap(celdaCGSim$counts, celdaCGMod)
#' @export
setGeneric("celdaUmap",
signature = "celdaMod",
function(counts,
celdaMod,
maxCells = 25000,
maxCells = NULL,
minClusterSize = 100,
initialDims = 20,
modules = NULL,
seed = 12345,
umapConfig = umap::umap.defaults) {
...) {
standardGeneric("celdaUmap")
})

Expand Down
10 changes: 5 additions & 5 deletions R/buildTreeHelper.R
Expand Up @@ -319,10 +319,10 @@
splitStats <- vapply(
colnames(features),
function(feat, features, class, splitMetric) {
splitMetric(feat, class, features, rPerf = T)
splitMetric(feat, class, features, rPerf = TRUE)
}, features, class, splitMetric, FUN.VALUE = double(1))
names(splitStats) <- colnames(features)
splitStats <- sort(splitStats, decreasing = T)
splitStats <- sort(splitStats, decreasing = TRUE)

return(splitStats)
}
Expand Down Expand Up @@ -412,7 +412,7 @@
featValues <- features[, feat]

# Get order of values
ord <- order(featValues, decreasing = T)
ord <- order(featValues, decreasing = TRUE)

# Get sorted class and values
featValuesSort <- featValues[ord]
Expand Down Expand Up @@ -516,7 +516,7 @@
featValues <- features[, feat]

# Get order of values
ord <- order(featValues, decreasing = T)
ord <- order(featValues, decreasing = TRUE)

# Get sorted class and values
featValuesSort <- featValues[ord]
Expand Down Expand Up @@ -835,7 +835,7 @@
stat = HM,
stringsAsFactors = F))
}, .splitMetricModF1, fSub, cSub, group2only))
altStats <- altStats[order(altStats$stat, decreasing = T), ]
altStats <- altStats[order(altStats$stat, decreasing = TRUE), ]

# Get alternative splits
splitStats <- altStats$stat[1]
Expand Down
128 changes: 0 additions & 128 deletions R/buildTreeHybrid.R

This file was deleted.

0 comments on commit 49988e7

Please sign in to comment.