Skip to content

Commit

Permalink
version 0.3.0: (2015-07-31)
Browse files Browse the repository at this point in the history
- New slot BacthInfo in 'BASiCS_Data' class
- Batch-speficic technical variability parameters are allowed
- 'BASiCS_VarianceDecomp' modified to accommodate batch membership (including graphical output)
  • Loading branch information
catavallejos committed Jul 31, 2015
1 parent 19eb335 commit a2e1eaa
Show file tree
Hide file tree
Showing 25 changed files with 936 additions and 247 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: BASiCS
Type: Package
Title: Bayesian Analysis of Single-Cell Sequencing data
Version: 0.2.1
Version: 0.3.0
Date: 2015-07-23
Author: Catalina A. Vallejos
Maintainer: Catalina A. Vallejos <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exportClasses("BASiCS_Data", "BASiCS_Chain" , "BASiCS_Summary")
exportMethods(counts,
displayTechIndicator,
displaySpikeInput,
displayBatchInfo,
Summary,
plot,
displayChainBASiCS,
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ version 0.2.0: (2015-06-24)
version 0.2.1: (2015-07-23)
- Argument 'GeneNames' has been added to functions 'BASiCS_VarianceDecomp', 'BASiCS_DetectHVG', 'BASiCS_DetectLVG' so that users can specify gene labels or names that will be used for these functions's output.

version 0.3.0: (2015-07-31)
- New slot BacthInfo in 'BASiCS_Data' class
- Batch-speficic technical variability parameters are allowed
- 'BASiCS_VarianceDecomp' modified to accommodate batch membership (including graphical output)
41 changes: 24 additions & 17 deletions R/Classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' First \code{q.bio} rows correspond to biological genes. Last \code{q-q.bio} rows correspond to technical spike-in genes.
#' @slot Tech Logical vector of length \code{q}. If \code{Tech = F} the gene is biological; otherwise the gene is spike-in.
#' @slot SpikeInput Vector of length \code{q-q.bio} whose elements indicate the input number of molecules for the spike-in genes (amount per cell).
#' @slot BatchInfo Vector of lenght \code{n} containing batch indicators.
#'
#' @examples
#'
Expand All @@ -23,6 +24,7 @@
#' dim(counts(Data, type="technical"))
#' displayTechIndicator(Data)
#' displaySpikeInput(Data)
#' displayBatchInfo(Data)
#'
#' @author Catalina A. Vallejos \email{catalina.vallejos@@mrc-bsu.cam.ac.uk}
#'
Expand All @@ -33,7 +35,8 @@ setClass("BASiCS_Data",
representation = representation(
Counts = "matrix",
Tech = "vector",
SpikeInput = "vector"),
SpikeInput = "vector",
BatchInfo = "vector"),
validity = function(object){
errors <- character()

Expand Down Expand Up @@ -65,10 +68,13 @@ setClass("BASiCS_Data",

if(sum(apply(object@Counts,1,sum) == 0) > 0)
errors <- c(errors, "Some genes have zero counts across all cells. Please remove them before creating the BASiCS_Data object.")

if(sum(apply(object@Counts,1,sum) > 0) == 1)
errors <- c(errors, "Some genes have non-zero counts only in 1 cell. Please remove them before creating the BASiCS_Data object.")

if(length(object@BatchInfo) != n)
errors <- c(errors, "BatchInfo slot is not compatible with the number of cells contained in Counts slot.")

if (length(errors) == 0) TRUE else errors
}
)
Expand All @@ -91,7 +97,8 @@ setClass("BASiCS_Data",
#' (matrix with \code{n} columns, all elements must be positive numbers)
#' @slot nu MCMC chain for cell-specific random effects \eqn{\nu[j]}
#' (matrix with \code{n} columns, all elements must be positive numbers)
#' @slot theta MCMC chain for technical variability hyper-parameter \eqn{\theta} (vector, all elements must be positive)
#' @slot theta MCMC chain for technical variability hyper-parameter(s) \eqn{\theta} (matrix, all elements must be positive, each colum
#' represents 1 batch)
#'
#' @examples
#'
Expand All @@ -109,7 +116,7 @@ setClass("BASiCS_Chain",
phi = "matrix",
s = "matrix",
nu = "matrix",
theta = "vector"),
theta = "matrix"),
validity = function(object){
errors <- character()

Expand All @@ -120,18 +127,18 @@ setClass("BASiCS_Chain",
N = nrow(object@mu)
n = ncol(object@phi)
if(nrow(object@delta) != N |
nrow(object@phi) != N | nrow(object@s) != N |
nrow(object@nu) != N | length(object@theta) != N |
ncol(object@mu) <= ncol(object@delta) |
ncol(object@s) != n | ncol(object@nu) != n) {errors <-c(errors,"Slots' dimensions are not compatible")}
nrow(object@phi) != N | nrow(object@s) != N |
nrow(object@nu) != N | nrow(object@theta) != N |
ncol(object@mu) <= ncol(object@delta) |
ncol(object@s) != n | ncol(object@nu) != n) {errors <-c(errors,"Slots' dimensions are not compatible")}

if(sum(!is.finite(object@mu)) + sum(!is.finite(object@delta)) +
sum(!is.finite(object@phi)) + sum(!is.finite(object@s)) +
sum(!is.finite(object@nu)) + sum(!is.finite(object@theta))) {errors <-c(errors,"One or more of the slots contains NAs or Infinite values")}
sum(!is.finite(object@phi)) + sum(!is.finite(object@s)) +
sum(!is.finite(object@nu)) + sum(!is.finite(object@theta))) {errors <-c(errors,"One or more of the slots contains NAs or Infinite values")}

if (length(errors) == 0) TRUE else errors
}
)
)


#' @name BASiCS_Summary-class
Expand All @@ -144,7 +151,7 @@ setClass("BASiCS_Chain",
#' @slot phi Posterior medians (first column), lower (second column) and upper (third column) limits of cell-specific mRNA content normalising constants \eqn{\phi[j]}
#' @slot s Posterior medians (first column), lower (second column) and upper (third column) limits of cell-specific capture efficiency (or amplification biases if not using UMI based counts) normalising constants \eqn{s[j]}
#' @slot nu Posterior medians (first column), lower (second column) and upper (third column) limits of cell-specific random effects \eqn{\nu[j]}
#' @slot theta Posterior median (first column), lower (second column) and upper (third column) limits of technical variability hyper-parameter \eqn{\theta} (vector, all elements must be positive)
#' @slot theta Posterior median (first column), lower (second column) and upper (third column) limits of technical variability hyper-parameter \eqn{\theta} (each row represents one batch)
#'
#' @examples
#'
Expand All @@ -165,9 +172,9 @@ setClass("BASiCS_Summary",
nu = "matrix",
theta = "matrix"),
validity = function(object){
if(sum(!is.finite(object@mu))>0 | sum(!is.finite(object@delta))>0 |
sum(!is.finite(object@phi))>0 | sum(!is.finite(object@s))>0 |
sum(!is.finite(object@nu))>0 | sum(!is.finite(object@theta))>0) stop("Invalid slots")
else {TRUE}
if(sum(!is.finite(object@mu))>0 | sum(!is.finite(object@delta))>0 |
sum(!is.finite(object@phi))>0 | sum(!is.finite(object@s))>0 |
sum(!is.finite(object@nu))>0 | sum(!is.finite(object@theta))>0) stop("Invalid slots")
else {TRUE}
}
)
Loading

0 comments on commit a2e1eaa

Please sign in to comment.