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
7e9d67ae
Commit
7e9d67ae
authored
8 years ago
by
Luke Zappia
Browse files
Options
Downloads
Patches
Plain Diff
Add simulateDE function
parent
e0b2901c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DESCRIPTION
+1
-1
1 addition, 1 deletion
DESCRIPTION
R/simulate.R
+22
-0
22 additions, 0 deletions
R/simulate.R
with
23 additions
and
1 deletion
DESCRIPTION
+
1
−
1
View file @
7e9d67ae
Package: splatter
Type: Package
Title: Simple Simulation of Single-cell RNA Sequencing Data
Version: 0.3.
3
Version: 0.3.
4
Date: 2016-10-09
Author: Luke Zappia
Authors@R: as.person(c(
...
...
This diff is collapsed.
Click to expand it.
R/simulate.R
+
22
−
0
View file @
7e9d67ae
...
...
@@ -70,6 +70,7 @@ splat <- function(params = defaultParams(), method = c("groups", "paths"),
pData
(
sim
)
$
Group
<-
group.names
[
groups
]
sim
<-
simulateGeneMeans
(
sim
,
params
)
sim
<-
simulateDE
(
sim
,
params
)
# Create new SCESet to make sure values are calculated correctly
sce
<-
newSCESet
(
countData
=
counts
(
sim
),
...
...
@@ -104,6 +105,27 @@ simulateGeneMeans <- function(sim, params) {
return
(
sim
)
}
simulateDE
<-
function
(
sim
,
params
)
{
n.genes
<-
getParams
(
params
,
"nGenes"
)
de.prob
<-
getParams
(
params
,
"de.prob"
)
de.downProb
<-
getParams
(
params
,
"de.downProb"
)
de.facLoc
<-
getParams
(
params
,
"de.facLoc"
)
de.facScale
<-
getParams
(
params
,
"de.facScale"
)
means.gene
<-
fData
(
sim
)
$
GeneMean
group.names
<-
unique
(
pData
(
sim
)
$
Group
)
for
(
group.name
in
group.names
)
{
de.facs
<-
getLNormFactors
(
n.genes
,
de.prob
,
de.downProb
,
de.facLoc
,
de.facScale
)
group.means.gene
<-
means.gene
*
de.facs
fData
(
sim
)[[
paste0
(
"DEFac"
,
group.name
)]]
<-
de.facs
fData
(
sim
)[[
paste0
(
"GeneMean"
,
group.name
)]]
<-
group.means.gene
}
return
(
sim
)
}
#' Get log-normal factors
#'
#' Randomly generate multiplication factors from a log-normal distribution.
...
...
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