Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Armin Rauschenberger
joinet
Commits
ea777429
Commit
ea777429
authored
Jun 14, 2018
by
Rauschenberger
Browse files
automation
parent
7bb9a7cf
Changes
8
Hide whitespace changes
Inline
Side-by-side
R/function.R
View file @
ea777429
...
...
@@ -63,20 +63,26 @@ prepare.data.matrices <- function(Y,X){
#' @description
#' This function adjusts exon expression data for different library sizes.
#'
#' @param
y
#' @param
Y
#' matrix with \eqn{n} rows (samples) and \eqn{p} columns (exons)
#'
#' @examples
#' NA
#'
adjust.library.sizes
<-
function
(
y
){
n
<-
nrow
(
y
);
p
<-
ncol
(
y
)
lib.size
<-
rowSums
(
y
)
norm.factors
<-
edgeR
::
calcNormFactors
(
object
=
t
(
y
),
lib.size
=
lib.size
)
adjust.library.sizes
<-
function
(
Y
){
if
(
!
is.matrix
(
Y
)){
stop
(
"Argument Y is no matrix."
,
call.
=
FALSE
)
}
if
(
!
is.numeric
(
Y
)){
stop
(
"Argument Y is not numeric."
,
call.
=
FALSE
)
}
n
<-
nrow
(
Y
);
p
<-
ncol
(
Y
)
lib.size
<-
rowSums
(
Y
)
norm.factors
<-
edgeR
::
calcNormFactors
(
object
=
t
(
Y
),
lib.size
=
lib.size
)
gamma
<-
norm.factors
*
lib.size
/
mean
(
lib.size
)
gamma
<-
matrix
(
gamma
,
nrow
=
n
,
ncol
=
p
,
byrow
=
FALSE
)
y
<-
y
/
gamma
return
(
y
)
Y
<-
Y
/
gamma
return
(
Y
)
}
#' @export
...
...
@@ -86,7 +92,7 @@ adjust.library.sizes <- function(y){
#' @description
#' This function adjusts exon expression data for different exon lengths.
#'
#' @param
y
#' @param
Y
#' matrix with \eqn{n} rows (samples) and \eqn{p} columns (exons)
#'
#' @param gene
...
...
@@ -104,14 +110,23 @@ adjust.library.sizes <- function(y){
#' @examples
#' NA
#'
adjust.exon.length
<-
function
(
y
,
gene
,
start
,
end
){
n
<-
nrow
(
y
);
p
<-
ncol
(
y
);
names
<-
dimnames
(
y
)
y
<-
as.numeric
(
y
)
x
<-
rep
(
end
-
start
,
times
=
n
)
gene
<-
rep
(
gene
,
times
=
n
)
lmer
<-
lme4
::
lmer
(
y
~
x
+
(
1
|
gene
))
y
<-
matrix
(
stats
::
residuals
(
lmer
),
nrow
=
p
,
ncol
=
n
,
dimnames
=
names
)
return
(
y
-
min
(
y
))
adjust.exon.length
<-
function
(
Y
,
gene
,
start
,
end
){
if
(
!
is.matrix
(
Y
)){
stop
(
"Argument Y is no matrix."
,
call.
=
FALSE
)
}
if
(
any
(
ncol
(
Y
)
!=
c
(
length
(
gene
),
length
(
start
),
length
(
end
)))){
stop
(
"Contradictory dimensions."
,
call.
=
FALSE
)
}
n
<-
nrow
(
Y
);
p
<-
ncol
(
Y
);
names
<-
dimnames
(
Y
)
Y
<-
as.numeric
(
Y
)
# wrong?
x
<-
rep
(
end
-
start
,
each
=
n
)
gene
<-
strsplit
(
gene
,
split
=
","
)
gene
<-
sapply
(
gene
,
function
(
x
)
x
[[
1
]][
1
])
gene
<-
rep
(
gene
,
each
=
n
)
lmer
<-
lme4
::
lmer
(
Y
~
x
+
(
1
|
gene
))
Y
<-
matrix
(
stats
::
residuals
(
lmer
),
nrow
=
n
,
ncol
=
p
,
dimnames
=
names
)
Y
<-
Y
-
min
(
Y
)
return
(
Y
)
}
#' @export
...
...
README.Rmd
View file @
ea777429
...
...
@@ -13,17 +13,11 @@ knitr::opts_chunk$set(
)
```
## Scope
spliceQTL
## Installation
```{r,eval=FALSE}
#install.packages("devtools")
devtools::install_github("rauschenberger/spliceQTL")
```
## Reference
README.md
View file @
ea777429
<!-- Modify xxx.Rmd, not xxx.md! -->
## Scope
spliceQTL
## Installation
```
r
#install.packages("devtools")
devtools
::
install_github
(
"rauschenberger/spliceQTL"
)
```
## Reference
docs/index.html
View file @
ea777429
...
...
@@ -83,21 +83,8 @@
<!-- Modify xxx.Rmd, not xxx.md! -->
<div
id=
"scope"
class=
"section level2"
>
<h2
class=
"hasAnchor"
>
<a
href=
"#scope"
class=
"anchor"
></a>
Scope
</h2>
<p>
spliceQTL
</p>
</div>
<div
id=
"installation"
class=
"section level2"
>
<h2
class=
"hasAnchor"
>
<a
href=
"#installation"
class=
"anchor"
></a>
Installation
</h2>
<div
class=
"sourceCode"
id=
"cb1"
><pre
class=
"sourceCode r"
><code
class=
"sourceCode r"
><a
class=
"sourceLine"
id=
"cb1-1"
data-line-number=
"1"
><span
class=
"co"
>
#install.packages("devtools")
</span></a>
<a
class=
"sourceLine"
id=
"cb1-2"
data-line-number=
"2"
>
devtools
<span
class=
"op"
>
::
</span><span
class=
"kw"
><a
href=
"http://www.rdocumentation.org/packages/devtools/topics/install_github"
>
install_github
</a></span>
(
<span
class=
"st"
>
"rauschenberger/spliceQTL"
</span>
)
</a></code></pre></div>
</div>
<div
id=
"reference"
class=
"section level2"
>
<h2
class=
"hasAnchor"
>
<a
href=
"#reference"
class=
"anchor"
></a>
Reference
</h2>
</div>
</div>
<div
class=
"col-md-3 hidden-xs hidden-sm"
id=
"sidebar"
>
...
...
docs/reference/adjust.exon.length.html
View file @
ea777429
...
...
@@ -120,13 +120,13 @@
</div>
<pre
class=
"usage"
><span
class=
'fu'
>
adjust.exon.length
</span>
(
<span
class=
'no'
>
y
</span>
,
<span
class=
'no'
>
gene
</span>
,
<span
class=
'no'
>
start
</span>
,
<span
class=
'no'
>
end
</span>
)
</pre>
<pre
class=
"usage"
><span
class=
'fu'
>
adjust.exon.length
</span>
(
<span
class=
'no'
>
Y
</span>
,
<span
class=
'no'
>
gene
</span>
,
<span
class=
'no'
>
start
</span>
,
<span
class=
'no'
>
end
</span>
)
</pre>
<h2
class=
"hasAnchor"
id=
"arguments"
><a
class=
"anchor"
href=
"#arguments"
></a>
Arguments
</h2>
<table
class=
"ref-arguments"
>
<colgroup><col
class=
"name"
/><col
class=
"desc"
/></colgroup>
<tr>
<th>
y
</th>
<th>
Y
</th>
<td><p>
matrix with \(n\) rows (samples) and \(p\) columns (exons)
</p></td>
</tr>
<tr>
...
...
docs/reference/adjust.library.sizes.html
View file @
ea777429
...
...
@@ -120,13 +120,13 @@
</div>
<pre
class=
"usage"
><span
class=
'fu'
>
adjust.library.sizes
</span>
(
<span
class=
'no'
>
y
</span>
)
</pre>
<pre
class=
"usage"
><span
class=
'fu'
>
adjust.library.sizes
</span>
(
<span
class=
'no'
>
Y
</span>
)
</pre>
<h2
class=
"hasAnchor"
id=
"arguments"
><a
class=
"anchor"
href=
"#arguments"
></a>
Arguments
</h2>
<table
class=
"ref-arguments"
>
<colgroup><col
class=
"name"
/><col
class=
"desc"
/></colgroup>
<tr>
<th>
y
</th>
<th>
Y
</th>
<td><p>
matrix with \(n\) rows (samples) and \(p\) columns (exons)
</p></td>
</tr>
</table>
...
...
man/adjust.exon.length.Rd
View file @
ea777429
...
...
@@ -4,10 +4,10 @@
\alias{adjust.exon.length}
\title{Adjust exon length}
\usage{
adjust.exon.length(
y
, gene, start, end)
adjust.exon.length(
Y
, gene, start, end)
}
\arguments{
\item{
y
}{matrix with \eqn{n} rows (samples) and \eqn{p} columns (exons)}
\item{
Y
}{matrix with \eqn{n} rows (samples) and \eqn{p} columns (exons)}
\item{gene}{gene (not exon) names\strong{:} vector of length \eqn{p}}
...
...
man/adjust.library.sizes.Rd
View file @
ea777429
...
...
@@ -4,10 +4,10 @@
\alias{adjust.library.sizes}
\title{Adjust library sizes}
\usage{
adjust.library.sizes(
y
)
adjust.library.sizes(
Y
)
}
\arguments{
\item{
y
}{matrix with \eqn{n} rows (samples) and \eqn{p} columns (exons)}
\item{
Y
}{matrix with \eqn{n} rows (samples) and \eqn{p} columns (exons)}
}
\description{
This function adjusts exon expression data for different library sizes.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment