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
83837f38
Commit
83837f38
authored
8 years ago
by
Luke Zappia
Browse files
Options
Downloads
Patches
Plain Diff
Add seed paramater and seed simulation
parent
0e4f7aa2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
DESCRIPTION
+1
-1
1 addition, 1 deletion
DESCRIPTION
R/params.R
+7
-4
7 additions, 4 deletions
R/params.R
R/simulate.R
+4
-0
4 additions, 0 deletions
R/simulate.R
man/splatParams.Rd
+1
-0
1 addition, 0 deletions
man/splatParams.Rd
tests/testthat/test-params.R
+6
-0
6 additions, 0 deletions
tests/testthat/test-params.R
with
19 additions
and
5 deletions
DESCRIPTION
+
1
−
1
View file @
83837f38
Package: splatter
Type: Package
Title: Simple Simulation of Single-cell RNA Sequencing Data
Version: 0.3.1
8
Version: 0.3.1
9
Date: 2016-10-11
Author: Luke Zappia
Authors@R: as.person(c(
...
...
This diff is collapsed.
Click to expand it.
R/params.R
+
7
−
4
View file @
83837f38
...
...
@@ -83,6 +83,7 @@
#' value will result in more extreme non-linear variations along a
#' path.
#' }
#' \item seed - Random seed used during the simulation
#' }
#'
#' Those shown in brackets cannot currently be easily estimated from a real
...
...
@@ -105,7 +106,8 @@ splatParams <- function(...) {
bcv
=
list
(
common
=
NA
,
DF
=
NA
),
dropout
=
list
(
present
=
NA
,
mid
=
NA
,
shape
=
NA
),
path
=
list
(
from
=
NA
,
length
=
NA
,
skew
=
NA
,
nonlinearProb
=
NA
,
sigmaFac
=
NA
))
nonlinearProb
=
NA
,
sigmaFac
=
NA
),
seed
=
NA
)
class
(
params
)
<-
"splatParams"
...
...
@@ -155,7 +157,8 @@ print.splatParams <- function(x, ...) {
"[Length]"
=
"path.length"
,
"[Skew]"
=
"path.skew"
,
"[Non-linear]"
=
"path.nonlinearProb"
,
"[Sigma Factor]"
=
"path.sigmaFac"
))
"[Sigma Factor]"
=
"path.sigmaFac"
),
"Seed:"
=
c
(
"Seed"
=
"seed"
))
for
(
category
in
names
(
pp
))
{
parameters
<-
getParams
(
x
,
pp
[[
category
]])
...
...
@@ -332,7 +335,7 @@ checkParams <- function(params) {
dropout.present
=
"LOG"
,
dropout.mid
=
"NUM"
,
dropout.shape
=
"NUM"
,
path.from
=
"INT"
,
path.length
=
"INT"
,
path.skew
=
"PROB"
,
path.nonlinearProb
=
"PROB"
,
path.sigmaFac
=
"POS"
)
path.sigmaFac
=
"POS"
,
seed
=
"INT"
)
# Define which parameters are allowed to be vectors
vectors
<-
c
(
"groupCells"
,
"path.from"
,
"path.length"
,
"path.skew"
)
...
...
@@ -462,7 +465,7 @@ defaultParams <- function() {
dropout.present
=
TRUE
,
dropout.mid
=
0
,
dropout.shape
=
-1
,
path.from
=
0
,
path.length
=
100
,
path.skew
=
0.5
,
path.nonlinearProb
=
0.1
,
path.sigmaFac
=
0.8
)
path.sigmaFac
=
0.8
,
seed
=
sample
(
1
:
1e6
,
1
)
)
return
(
params
)
}
...
...
This diff is collapsed.
Click to expand it.
R/simulate.R
+
4
−
0
View file @
83837f38
...
...
@@ -115,6 +115,10 @@ splat <- function(params = defaultParams(), method = c("groups", "paths"),
params
<-
mergeParams
(
params
,
defaultParams
())
params
<-
expandPathParams
(
params
)
# Set random seed
seed
<-
getParams
(
params
,
"seed"
)
set.seed
(
seed
)
# Get the parameters we are going to use
nCells
<-
getParams
(
params
,
"nCells"
)
nGenes
<-
getParams
(
params
,
"nGenes"
)
...
...
This diff is collapsed.
Click to expand it.
man/splatParams.Rd
+
1
−
0
View file @
83837f38
...
...
@@ -94,6 +94,7 @@ parameters. It has the following sections and values:
value will result in more extreme non-linear variations along a
path.
}
\item seed - Random seed used during the simulation
}
Those shown in brackets cannot currently be easily estimated from a real
...
...
This diff is collapsed.
Click to expand it.
tests/testthat/test-params.R
+
6
−
0
View file @
83837f38
...
...
@@ -185,4 +185,10 @@ test_that("constructor is valid", {
test_that
(
"defaultParams is valid"
,
{
expect_silent
(
checkParams
(
defaultParams
()))
})
test_that
(
"default seed is random"
,
{
params1
<-
defaultParams
()
params2
<-
defaultParams
()
expect_false
(
getParams
(
params1
,
"seed"
)
==
getParams
(
params2
,
"seed"
))
})
\ No newline at end of file
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