Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sirplus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioCellGen-public
sirplus
Commits
cfbad4d5
Commit
cfbad4d5
authored
7 years ago
by
Luke Zappia
Browse files
Options
Downloads
Patches
Plain Diff
Update scDDEstimate
parent
31fb64a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NAMESPACE
+1
-0
1 addition, 0 deletions
NAMESPACE
R/scDD-estimate.R
+42
-34
42 additions, 34 deletions
R/scDD-estimate.R
man/scDDEstimate.Rd
+16
-10
16 additions, 10 deletions
man/scDDEstimate.Rd
with
59 additions
and
44 deletions
NAMESPACE
+
1
−
0
View file @
cfbad4d5
...
...
@@ -5,6 +5,7 @@ S3method(lun2Estimate,matrix)
S3method(lunEstimate,SingleCellExperiment)
S3method(lunEstimate,matrix)
S3method(scDDEstimate,SingleCellExperiment)
S3method(scDDEstimate,default)
S3method(scDDEstimate,matrix)
S3method(simpleEstimate,SingleCellExperiment)
S3method(simpleEstimate,matrix)
...
...
This diff is collapsed.
Click to expand it.
R/scDD-estimate.R
+
42
−
34
View file @
cfbad4d5
...
...
@@ -6,6 +6,8 @@
#' containing count data to estimate parameters from.
#' @param conditions Vector giving the condition that each cell belongs to.
#' Conditions can be 1 or 2.
#' @param condition String giving the column that represents biological group of
#' interest.
#' @param params SCDDParams object to store estimated values in.
#' @param verbose logical. Whether to show progress messages.
#' @param BPPARAM A \code{\link[BiocParallel]{BiocParallelParam}} instance
...
...
@@ -29,64 +31,70 @@
#' }
#' @importFrom BiocParallel SerialParam
#' @export
scDDEstimate
<-
function
(
counts
,
conditions
,
params
=
newSCDDParams
(),
verbose
=
TRUE
,
BPPARAM
=
SerialParam
())
{
scDDEstimate
<-
function
(
counts
,
params
=
newSCDDParams
(),
verbose
=
TRUE
,
BPPARAM
=
SerialParam
(),
...
)
{
if
(
!
requireNamespace
(
"scDD"
,
quietly
=
TRUE
))
{
stop
(
"The scDD simulation requires the 'scDD' package."
)
}
UseMethod
(
"scDDEstimate"
)
}
#' @rdname scDDEstimate
#' @importFrom SingleCellExperiment SingleCellExperiment
#' @export
scDDEstimate.matrix
<-
function
(
counts
,
conditions
,
params
=
newSCDDParams
(),
verbose
=
TRUE
,
BPPARAM
=
SerialParam
(),
...
)
{
checkmate
::
assertMatrix
(
counts
,
mode
=
"numeric"
,
any.missing
=
FALSE
,
min.rows
=
1
,
min.cols
=
1
,
row.names
=
"unique"
,
col.names
=
"unique"
)
checkmate
::
assertIntegerish
(
conditions
,
len
=
ncol
(
counts
),
lower
=
1
,
upper
=
2
)
counts
<-
SingleCellExperiment
(
assays
=
list
(
counts
=
counts
),
colData
=
data.frame
(
condition
=
conditions
))
scDDEstimate.default
(
counts
,
"condition"
,
params
,
verbose
,
BPPARAM
)
}
#' @rdname scDDEstimate
#' @export
scDDEstimate.SingleCellExperiment
<-
function
(
counts
,
condition
s
,
scDDEstimate.SingleCellExperiment
<-
function
(
counts
,
condition
=
"condition"
,
params
=
newSCDDParams
(),
verbose
=
TRUE
,
BPPARAM
=
SerialParam
())
{
counts
<-
BiocGenerics
::
counts
(
counts
)
scDDEstimate
(
counts
,
conditions
,
params
,
verbose
,
BPPARAM
)
BPPARAM
=
SerialParam
(),
...
)
{
scDDEstimate.default
(
counts
,
condition
,
params
,
verbose
,
BPPARAM
)
}
#' @rdname scDDEstimate
#' @importFrom methods as
#' @export
scDDEstimate.matrix
<-
function
(
counts
,
conditions
,
params
=
newSCDDParams
(),
verbose
=
TRUE
,
BPPARAM
=
SerialParam
())
{
if
(
!
requireNamespace
(
"scDD"
,
quietly
=
TRUE
))
{
stop
(
"The scDD simulation requires the 'scDD' package."
)
}
scDDEstimate.default
<-
function
(
counts
,
condition
,
params
,
verbose
,
BPPARAM
)
{
checkmate
::
assertClass
(
params
,
"SCDDParams"
)
checkmate
::
assertMatrix
(
counts
,
mode
=
"numeric"
,
any.missing
=
FALSE
,
min.rows
=
1
,
min.cols
=
1
,
row.names
=
"unique"
,
col.names
=
"unique"
)
checkmate
::
assertIntegerish
(
conditions
,
len
=
ncol
(
counts
),
lower
=
1
,
upper
=
2
)
counts.list
<-
list
(
Cond1
=
counts
[,
conditions
==
1
],
Cond2
=
counts
[,
conditions
==
2
])
checkmate
::
assertClass
(
counts
,
"SingleCellExperiment"
)
checkmate
::
assertCharacter
(
condition
,
min.chars
=
1
,
any.missing
=
FALSE
,
len
=
1
)
if
(
!
(
condition
%in%
colnames
(
SummarizedExperiment
::
colData
(
counts
))))
{
stop
(
"'condition' must be the name of a column in `colData(counts)`"
)
}
if
(
verbose
)
{
processed
<-
scDD
::
preprocess
(
counts.list
,
c
(
"Cond1"
,
"Cond2"
),
median_norm
=
TRUE
)
processed
<-
scDD
::
preprocess
(
counts
,
condition
,
median_norm
=
TRUE
)
}
else
{
suppressMessages
(
processed
<-
scDD
::
preprocess
(
counts.list
,
c
(
"Cond1"
,
"Cond2"
),
median_norm
=
TRUE
)
processed
<-
scDD
::
preprocess
(
counts
,
condition
,
median_norm
=
TRUE
)
)
}
assays
<-
S4Vectors
::
SimpleList
(
NormCounts
=
processed
)
colData
<-
S4Vectors
::
DataFrame
(
condition
=
conditions
,
row.names
=
colnames
(
processed
))
SCdat
<-
SummarizedExperiment
::
SummarizedExperiment
(
assays
=
assays
,
colData
=
colData
)
if
(
verbose
)
{
SCdat
<-
scDD
::
scDD
(
SCdat
,
testZeroes
=
FALSE
,
param
=
BPPARAM
)
SCdat
<-
scDD
::
scDD
(
processed
,
testZeroes
=
FALSE
,
param
=
BPPARAM
,
condition
=
condition
)
}
else
{
dummy
<-
utils
::
capture.output
(
suppressMessages
(
SCdat
<-
scDD
::
scDD
(
SCdat
,
testZeroes
=
FALSE
,
param
=
BPPARAM
)
SCdat
<-
scDD
::
scDD
(
processed
,
testZeroes
=
FALSE
,
param
=
BPPARAM
,
condition
=
condition
)
))
}
...
...
This diff is collapsed.
Click to expand it.
man/scDDEstimate.Rd
+
16
−
10
View file @
cfbad4d5
...
...
@@ -2,26 +2,26 @@
% Please edit documentation in R/scDD-estimate.R
\name{scDDEstimate}
\alias{scDDEstimate}
\alias{scDDEstimate.SingleCellExperiment}
\alias{scDDEstimate.matrix}
\alias{scDDEstimate.SingleCellExperiment}
\alias{scDDEstimate.default}
\title{Estimate scDD simulation parameters}
\usage{
scDDEstimate(counts, conditions, params = newSCDDParams(), verbose = TRUE,
BPPARAM = SerialParam())
\method{scDDEstimate}{SingleCellExperiment}(counts, conditions,
params = newSCDDParams(), verbose = TRUE, BPPARAM = SerialParam())
scDDEstimate(counts, params = newSCDDParams(), verbose = TRUE,
BPPARAM = SerialParam(), ...)
\method{scDDEstimate}{matrix}(counts, conditions, params = newSCDDParams(),
verbose = TRUE, BPPARAM = SerialParam())
verbose = TRUE, BPPARAM = SerialParam(), ...)
\method{scDDEstimate}{SingleCellExperiment}(counts, condition = "condition",
params = newSCDDParams(), verbose = TRUE, BPPARAM = SerialParam(), ...)
\method{scDDEstimate}{default}(counts, condition, params, verbose, BPPARAM)
}
\arguments{
\item{counts}{either a counts matrix or a SingleCellExperiment object
containing count data to estimate parameters from.}
\item{conditions}{Vector giving the condition that each cell belongs to.
Conditions can be 1 or 2.}
\item{params}{SCDDParams object to store estimated values in.}
\item{verbose}{logical. Whether to show progress messages.}
...
...
@@ -29,6 +29,12 @@ Conditions can be 1 or 2.}
\item{BPPARAM}{A \code{\link[BiocParallel]{BiocParallelParam}} instance
giving the parallel back-end to be used. Default is
\code{\link[BiocParallel]{SerialParam}} which uses a single core.}
\item{conditions}{Vector giving the condition that each cell belongs to.
Conditions can be 1 or 2.}
\item{condition}{String giving the column that represents biological group of
interest.}
}
\value{
SCDDParams object containing the estimated parameters.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment