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
2bf3dc44
Commit
2bf3dc44
authored
8 years ago
by
Luke Zappia
Browse files
Options
Downloads
Patches
Plain Diff
Use fitdist for means
Need to do some more comparisons to check if these is the best approach...
parent
f9d4f54e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/estimate.R
+5
-9
5 additions, 9 deletions
R/estimate.R
man/estMeanParams.Rd
+2
-1
2 additions, 1 deletion
man/estMeanParams.Rd
with
7 additions
and
10 deletions
R/estimate.R
+
5
−
9
View file @
2bf3dc44
...
...
@@ -57,7 +57,8 @@ estimateParams.matrix <- function(counts, params = NULL) {
#' Estimate mean parameters
#'
#' Estimate rate and shape parameters for the gamma distribution used to
#' simulate gene expression means. Uses a method of moments approach.
#' simulate gene expression means using the 'moment matching estimation' method
#' of \code{\link{fitdist}}.
#'
#' @param norm.counts library size normalised counts matrix.
#' @param params splatParams object to store estimated values in.
...
...
@@ -75,15 +76,10 @@ estMeanParams <- function(norm.counts, params) {
means
<-
rowMeans
(
norm.counts
)
means
<-
means
[
means
!=
0
]
z
<-
log
(
means
)
fit
<-
fitdistrplus
::
fitdist
(
means
,
"gamma"
,
method
=
"mme"
)
mean.z
<-
mean
(
z
)
var.z
<-
var
(
z
)
alpha
<-
limma
::
trigammaInverse
(
var.z
)
beta
<-
exp
(
digamma
(
alpha
)
-
mean.z
)
params
<-
setParams
(
params
,
mean.shape
=
alpha
,
mean.rate
=
beta
)
params
<-
setParams
(
params
,
mean.shape
=
unname
(
fit
$
estimate
[
"shape"
]),
mean.rate
=
unname
(
fit
$
estimate
[
"rate"
]))
return
(
params
)
}
...
...
This diff is collapsed.
Click to expand it.
man/estMeanParams.Rd
+
2
−
1
View file @
2bf3dc44
...
...
@@ -16,7 +16,8 @@ splatParams object with estimated values.
}
\description{
Estimate rate and shape parameters for the gamma distribution used to
simulate gene expression means. Uses a method of moments approach.
simulate gene expression means using the 'moment matching estimation' method
of \code{\link{fitdist}}.
}
\examples{
data("sc_example_counts")
...
...
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