Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Gitlab will go into maintenance Friday 3rd February from 9:00 to 10:00
Open sidebar
BDS
GeneDER
ArrayUtils
Commits
bdb15ba2
Commit
bdb15ba2
authored
Jun 20, 2019
by
Leon-Charles Tranchevent
Browse files
Limma anlaysis: integration of co-factor and block key usage (for datasets with paired samples).
parent
231e050f
Changes
2
Hide whitespace changes
Inline
Side-by-side
R/preprocess_data_agilent_limma.R
View file @
bdb15ba2
...
...
@@ -42,7 +42,7 @@ preprocess_data_agilent_limma <- function(input_data_dir, output_data_file,
batch_data
<-
log2
(
batch
$
E
)
# We change the probe ids (1 to 45015) to be the probe names instead (A_XX_PXXXX).
rownames
(
batch_data
)
<-
(
batch
$
genes
)
$
ProbeName
rownames
(
batch_data
)
<-
(
batch
$
genes
)
$
ProbeName
# nolint
remove
(
raw_data_input_dir
,
batch
)
# We run the LIMMA pre-processing method on the data.
...
...
R/run_limma.R
View file @
bdb15ba2
...
...
@@ -25,25 +25,25 @@ run_limma <- function(pheno_data, eset, limma_parameters,
clinical_factor
<-
limma_parameters
[[
1
]]
coefficients
<-
limma_parameters
[[
2
]]
has_block
<-
!
is.null
(
cofactor_name
)
is_factorial_limma
<-
length
(
coefficients
)
==
3
# We create the design matrix (regular case - no block).
clinical
<-
factor
(
pheno_data
[[
clinical_factor
]])
design
<-
stats
::
model.matrix
(
~
0
+
clinical
)
colnames
(
design
)
<-
levels
(
clinical
)
# If necessary we add a block based on a co-factor.
# For instance, if we have paired samples.
if
(
has_block
)
{
clinical_cofactor
<-
factor
(
pheno_data
[[
cofactor_name
]])
design
<-
stats
::
model.matrix
(
~
0
+
clinical
+
clinical_cofactor
)
colnames
(
design
)
<-
c
(
levels
(
clinical
),
clinical_
cofactor
)
colnames
(
design
)
<-
c
(
levels
(
clinical
),
cofactor
_name
)
}
# We build the contrast (default only one).
contrast
<-
eval
(
substitute
(
limma
::
makeContrasts
(
coeff1
=
c1
,
levels
=
design
),
list
(
c1
=
coefficients
[
1
])))
# For larger lists of coefficients, we add them all.
if
(
is_
factorial
_limma
)
{
if
(
limma_parameters
$
factorial
)
{
contrast
<-
eval
(
substitute
(
limma
::
makeContrasts
(
coeff1
=
c1
,
coeff2
=
c2
,
coeff3
=
c3
,
...
...
@@ -59,8 +59,8 @@ run_limma <- function(pheno_data, eset, limma_parameters,
lmfit
<-
limma
::
lmFit
(
eset
,
design
)
# We create a block if necessary.
if
(
has_block
)
{
corfit
<-
limma
::
duplicateCorrelation
(
eset
,
design
,
block
=
pheno_data
[[
block_key
]])
lmfit
_gender
<-
limma
::
lmFit
(
eset
,
design
,
block
=
pheno_data
[[
block_key
]],
corfit
<-
limma
::
duplicateCorrelation
(
eset
,
design
,
block
=
pheno_data
[[
block_key
]])
lmfit
<-
limma
::
lmFit
(
eset
,
design
,
block
=
pheno_data
[[
block_key
]],
correlation
=
corfit
$
consensus
)
}
fit
<-
limma
::
contrasts.fit
(
lmfit
,
contrast
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment