Skip to content

Commit

Permalink
Merge pull request #2 from spriyansh/multi_lineage
Browse files Browse the repository at this point in the history
v0.04
  • Loading branch information
spriyansh authored Jul 30, 2024
2 parents 24ef55a + 635b497 commit adbf93c
Show file tree
Hide file tree
Showing 51 changed files with 2,003 additions and 497 deletions.
10 changes: 4 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: scMaSigPro
Type: Package
Title: Application of MaSigPro Bioconductor Package for scRNA Trajectory data
Version: 0.0.3
Version: 0.0.4
Authors@R: c(
person("Ana", "Conesa", role = c("aut"), email = "ana.conesa@csic.es"),
person("Maria Jose", "Nueda", role = c("aut"), email = "mj.nueda@ua.es"),
Expand All @@ -14,10 +14,9 @@ Description: scMaSigPro is a polynomial regression-based approach inspired by
significant expression profile differences among branching paths.
License: GPL (>= 2)
Imports:
assertthat, e1071, dplyr, entropy, ggplot2, igraph, magrittr, maSigPro,
MASS, MatrixGenerics, methods, parallel, parallelly, plotly, RColorConesa,
rlang, S4Vectors, scales, shiny, SingleCellExperiment, stats, stringr,
utils, mclust
assertthat, e1071, dplyr, entropy, ggplot2, igraph, magrittr, maSigPro (>= 1.74.0),
MASS, MatrixGenerics (>= 1.14.0), methods, parallel, parallelly, plotly, rlang,
S4Vectors (>= 0.40.2), scales, shiny, SingleCellExperiment (>= 1.24.0), stats, stringr, utils, mclust
Depends: R (>= 4.0)
Encoding: UTF-8
LazyData: true
Expand All @@ -28,7 +27,6 @@ Suggests:
knitr,
rmarkdown,
BiocStyle,
ComplexUpset,
UpSetR,
ggpubr
Config/testthat/edition: 3
Expand Down
10 changes: 2 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export(eDense)
export(eSparse)
export(m3_select_path)
export(pathAssign)
export(pb_counts)
export(plotBinTile)
export(plotDiagnostics)
export(plotIntersect)
Expand All @@ -25,6 +26,7 @@ export(queryCoeff)
export(sc.cluster.trend)
export(sc.filter)
export(sc.p.vector)
export(sc.restruct)
export(sc.set.poly)
export(sc.squeeze)
export(sc.t.fit)
Expand Down Expand Up @@ -54,15 +56,12 @@ importFrom(MASS,glm.nb)
importFrom(MASS,negative.binomial)
importFrom(MatrixGenerics,rowMeans)
importFrom(MatrixGenerics,rowSums)
importFrom(RColorConesa,colorConesa)
importFrom(RColorConesa,getConesaColors)
importFrom(S4Vectors,DataFrame)
importFrom(S4Vectors,coolcat)
importFrom(S4Vectors,isEmpty)
importFrom(SingleCellExperiment,SingleCellExperiment)
importFrom(SingleCellExperiment,colData)
importFrom(SingleCellExperiment,reducedDims)
importFrom(assertthat,assert_that)
importFrom(dplyr,arrange)
importFrom(dplyr,bind_rows)
importFrom(dplyr,filter)
Expand All @@ -84,7 +83,6 @@ importFrom(entropy,discretize)
importFrom(igraph,get.data.frame)
importFrom(maSigPro,get.siggenes)
importFrom(maSigPro,make.design.matrix)
importFrom(maSigPro,position)
importFrom(maSigPro,reg.coeffs)
importFrom(magrittr,"%>%")
importFrom(mclust,Mclust)
Expand Down Expand Up @@ -160,10 +158,6 @@ importFrom(stats,residuals)
importFrom(stats,rstandard)
importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(stringr,str_remove)
importFrom(stringr,str_remove_all)
importFrom(stringr,str_split)
importFrom(stringr,str_split_i)
importFrom(utils,View)
importFrom(utils,combn)
importFrom(utils,data)
Expand Down
50 changes: 50 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## scMaSigPro 0.0.4 (2024-07-30)

* Dependency Changes
* Removed hard dependency on `RColorConesa` and `ComplexUpset`.
* Removed `assertthat`, `stringr` from namespace.
* Removed `maSigPro::position` from namespace.

* Plotting Updates
* Updated plot functions to use a custom palette.
* Updated `plotTrendCluster` function for distinct layers.
* Enhanced `plotIntersect()` with return capabilities.
* Enhanced `plotTrend` with curves, lines, and points.
* Updated ordering by frequency in `UpsetR`.

* Function Updates
* Added `clean_string()` internal function.
* Added `sc.restruct()` function.
* Exported `pb_helpers()`.

* Documentation Updates
* General code styling.
* Updated README with citation information.
* Single comprehensive data documentation.
* Added a new vignette.

* Bug Fixes
* Removed `patchwork` call.

## scMaSigPro 0.0.3 (2024-03-3)

* Bug fixes
* `eSparse()` and `eDense()` indexes
* Removed the ComplexUpset error due to ggplot 3.5.0.

* Remove Package Dependence
* SummarizedExperiment
* ComplexUpset

* Package Suggestions Added
* Patchwork
* ComplexUpset
* UpSetR

* Updated Test cases
* Functionality of `eSparse()` and `eDense()`
* Testing `sc.squeeze()` against manual pseudo-bulking

## scMaSigPro 0.0.1 (2023-12-20)

* Initial Github release.
7 changes: 3 additions & 4 deletions R/annotate_sce.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#' \pkg{SingleCellExperiment} package.
#'
#' @importFrom SingleCellExperiment colData
#' @importFrom assertthat assert_that
#'
#' @param sce A `SingleCellExperiment` object to be annotated.
#' @param ptime_col A character string representing the column name
Expand Down Expand Up @@ -41,7 +40,7 @@ annotate_sce <- function(sce,
verbose = TRUE) {
# Overwite the columns
if (labels_exist) {
assert_that(
assertthat::assert_that(
all(!is.null(exist_ptime_col) & !is.null(exist_path_col)),
msg = paste(
"Requested to set 'path_col' as", path_col,
Expand All @@ -62,12 +61,12 @@ annotate_sce <- function(sce,
cell.meta <- as.data.frame(colData(sce))

# Check columns
assert_that(
assertthat::assert_that(
all(exist_ptime_col %in% colnames(cell.meta)),
msg = paste("'", exist_ptime_col, "', doesn't exist in colData.")
)
# Check columns
assert_that(
assertthat::assert_that(
all(exist_path_col %in% colnames(cell.meta)),
msg = paste("'", exist_path_col, "', doesn't exist in colData")
)
Expand Down
11 changes: 5 additions & 6 deletions R/as_scmp.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#' SingleCellExperiment #' object to an instance of the scmpClass object.
#'
#' @importFrom SingleCellExperiment SingleCellExperiment
#' @importFrom assertthat assert_that
#'
#' @param object An S4 object of class `cds/CellDataSet` or `SingleCellExperiment`.
#' @param from Character string specifying the class of 'object'. Use "cds" for
Expand Down Expand Up @@ -65,32 +64,32 @@ as_scmp <- function(object, from = "cds",
labels_exist = FALSE
)) {
# Check Conversion Type
assert_that(from %in% c("cds", "sce"),
assertthat::assert_that(from %in% c("cds", "sce"),
msg = ("Currently, accepted options in the 'from' parameter are 'cds'
('cds/CellDataSet' object) and 'sce' ('SingleCellExperiment').")
)

# Validate S4
assert_that(
assertthat::assert_that(
all(isS4(object) & all(is(object, "cell_data_set") | is(object, "SingleCellExperiment"))),
msg = "Please provide object from one of the class 'cds/CellDataSet',
or 'SingleCellExperiment/sce'."
)

# Check and validate additional parameters
if (!is.null(additional_params)) {
assert_that(is.list(additional_params),
assertthat::assert_that(is.list(additional_params),
msg = "Please provide 'additional_params' as a named list.
See details for more information"
)
# Check additional parameters
if (from == "cds") {
assert_that(names(additional_params) %in% c("reduction_method", "labels_exist", "align_pseudotime_method"),
assertthat::assert_that(names(additional_params) %in% c("reduction_method", "labels_exist", "align_pseudotime_method"),
msg = "Allowed additional parameters for 'cds' (cds/CellDataSet) are
'reduction_method', and 'labels_exist','align_pseudotime_method'."
)
} else if (from == "sce") {
assert_that(all(names(additional_params) %in% c("exist_ptime_col", "exist_path_col", "labels_exist")),
assertthat::assert_that(all(names(additional_params) %in% c("exist_ptime_col", "exist_path_col", "labels_exist")),
msg = "Allowed additional parameters for sce are 'exist_ptime_col',
'exist_path_col', and 'labels_exist'."
)
Expand Down
22 changes: 16 additions & 6 deletions R/create_scmp.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,33 @@ create_scmp <- function(counts,
path_col,
use_as_bin = FALSE) {
# Validation Checks
assert_that(ncol(counts) == nrow(cell_data),
assertthat::assert_that(ncol(counts) == nrow(cell_data),
msg = paste("Number of cells in raw-counts and cell-level-metadata are different.")
)

assert_that(all(colnames(counts) == rownames(cell_data)),
assertthat::assert_that(all(colnames(counts) == rownames(cell_data)),
msg = paste("Rownames of raw-counts and cell-level-metadata are different.")
)

if (!is.null(bin_counts) || !is.null(bin_cell_data)) {
assert_that(nrow(bin_counts) == nrow(bin_cell_data),
assertthat::assert_that(nrow(bin_counts) == nrow(bin_cell_data),
msg = paste("Number of cells in bin_counts and bin_cell_data are different.")
)
assert_that(all(rownames(bin_counts) == rownames(bin_cell_data)),
assertthat::assert_that(all(rownames(bin_counts) == rownames(bin_cell_data)),
msg = paste("Rownames of bin_counts and bin_cell_data are different.")
)
}

# Validate if path_col is present in cell_data
assertthat::assert_that(path_col %in% colnames(cell_data),
msg = paste("Column name '", path_col, "' not found in cell_data.")
)

# Validate if ptime_col is present in cell_data
assertthat::assert_that(ptime_col %in% colnames(cell_data),
msg = paste("Column name '", ptime_col, "' not found in cell_data.")
)

# Create Single-Cell Experiment Object
sparse_tmp <- SingleCellExperiment(
list(counts = counts),
Expand All @@ -61,7 +71,7 @@ create_scmp <- function(counts,
Sparse = sparse_tmp,
Dense = SingleCellExperiment(assays = list(bulk.counts = matrix(0, nrow = 0, ncol = 0)))
)
sparse_tmp <- NULL
rm(sparse_tmp)

# Use as bin
if (use_as_bin) {
Expand All @@ -76,7 +86,7 @@ create_scmp <- function(counts,

# Transfer Data
scmpObj@Dense <- sparse_tmp
sparse_tmp <- NULL
rm(sparse_tmp)

# Update the slots
scmpObj@Parameters@bin_ptime_col <- ptime_col
Expand Down
Loading

0 comments on commit adbf93c

Please sign in to comment.