Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PHOENICS
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
PANORAMICS
PHOENICS
Commits
bc3d9801
Commit
bc3d9801
authored
3 months ago
by
GUILMINEAU Camille
Browse files
Options
Downloads
Patches
Plain Diff
corrections
parent
e041e04c
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
NAMESPACE
+5
-0
5 additions, 0 deletions
NAMESPACE
R/pathwayRes-class.R
+74
-38
74 additions, 38 deletions
R/pathwayRes-class.R
R/test_pathway.R
+10
-6
10 additions, 6 deletions
R/test_pathway.R
man/pathwayRes.Rd
+1
-0
1 addition, 0 deletions
man/pathwayRes.Rd
man/test_pathway.Rd
+3
-4
3 additions, 4 deletions
man/test_pathway.Rd
with
93 additions
and
48 deletions
NAMESPACE
+
5
−
0
View file @
bc3d9801
...
...
@@ -3,9 +3,14 @@
S3method(adjust_pval,pathwayRes)
S3method(extract,pathwayRes)
S3method(head,pathwayRes)
S3method(plot,MFApath)
S3method(plot,PCApath)
S3method(plot,pathwayRes)
S3method(print,MFApath)
S3method(print,PCApath)
S3method(print,pathwayRes)
S3method(summary,MFApath)
S3method(summary,PCApath)
S3method(summary,pathwayRes)
export(adjust_pval)
export(extract)
...
...
This diff is collapsed.
Click to expand it.
R/pathwayRes-class.R
+
74
−
38
View file @
bc3d9801
...
...
@@ -28,10 +28,23 @@ summary.pathwayRes <- function(object, ...) {
cat
(
"Tested effects:"
,
object
[[
1
]]
$
test_pathway
$
Fixed_effect
)
}
#' @exportS3Method
summary.PCApath
<-
function
(
object
,
...
)
{
cat
(
"phoenics method based on PCA\n"
)
NextMethod
()
}
#' @exportS3Method
summary.MFApath
<-
function
(
object
,
...
)
{
cat
(
"phoenics method based on MFA\n"
)
NextMethod
()
}
#' @rdname pathwayRes
#' @aliases print.pathwayRes
#' @examples
#' print(out_test)
#' print(out_test2)
#' @exportS3Method
print.pathwayRes
<-
function
(
x
,
...
)
{
cat
(
"A list of pathways which contains for each pathway: \n"
)
...
...
@@ -39,10 +52,21 @@ print.pathwayRes <- function(x, ...) {
cat
(
"$"
,
names
(
path_res
)[
1
],
": "
,
"Pathway name \n"
,
sep
=
""
)
cat
(
"$"
,
names
(
path_res
)[
2
],
": "
,
"Pathway code \n"
,
sep
=
""
)
cat
(
"$"
,
names
(
path_res
)[
3
],
": "
,
"Metabolites in the pathway \n"
,
sep
=
""
)
cat
(
"$"
,
names
(
path_res
)[
4
],
": "
,
"
PCA
results \n"
,
sep
=
""
)
cat
(
"$"
,
names
(
path_res
)[
4
],
": "
,
"
Factor analysis
results \n"
,
sep
=
""
)
cat
(
"$"
,
names
(
path_res
)[
5
],
": "
,
"Model results \n"
,
sep
=
""
)
cat
(
"$"
,
names
(
path_res
)[
6
],
": "
,
"Pathway test results \n"
,
sep
=
""
)
cat
(
"$"
,
names
(
path_res
)[
7
],
": "
,
"Type of factor analysis \n"
,
sep
=
""
)
}
#' @exportS3Method
print.PCApath
<-
function
(
x
,
...
)
{
cat
(
"phoenics method based on PCA\n"
)
NextMethod
()
}
#' @exportS3Method
print.MFApath
<-
function
(
x
,
...
)
{
cat
(
"phoenics method based on MFA\n"
)
NextMethod
()
}
#' @rdname pathwayRes
...
...
@@ -97,43 +121,54 @@ plot.PCApath <- function(x, ..., pathway_id = NULL,
object_sub
<-
extract.pathwayRes
(
x
,
pathway_id
)
analysis
<-
object_sub
[[
1
]]
$
analysis
if
(
plot
==
"var"
)
{
p
<-
factoextra
::
fviz_pca_var
(
object_sub
[[
1
]]
$
PCA
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
repel
=
TRUE
)
return
(
p
)
}
if
(
plot
==
"ind"
)
{
p
<-
factoextra
::
fviz_pca_ind
(
object_sub
[[
1
]]
$
PCA
,
habillage
=
habillage
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
geom
=
"point"
,
pointsize
=
2
,
mean.point
=
FALSE
)
return
(
p
)
}
NextMethod
()
}
#' @exportS3Method
plot.MFApath
<-
function
(
x
,
...
,
pathway_id
=
NULL
,
plot
=
c
(
"eig"
,
"var"
,
"ind"
,
"group"
),
habillage
=
"none"
)
{
plot
<-
match.arg
(
plot
)
if
(
analysis
==
"PCA"
)
{
if
(
plot
==
"var"
)
{
p
<-
factoextra
::
fviz_pca_var
(
object_sub
[[
1
]]
$
PCA
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
repel
=
TRUE
)
return
(
p
)
}
if
(
plot
==
"ind"
)
{
p
<-
factoextra
::
fviz_pca_ind
(
object_sub
[[
1
]]
$
PCA
,
habillage
=
habillage
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
geom
=
"point"
,
pointsize
=
2
,
mean.point
=
FALSE
)
return
(
p
)
}
if
(
is.null
(
pathway_id
))
{
message
(
"`pathway_id` not specified... defaulting to the first pathway"
)
pathway_id
<-
names
(
x
)[
1
]
}
if
(
analysis
==
"MFA"
)
{
if
(
plot
==
"group"
)
{
p
<-
factoextra
::
fviz_mfa_var
(
object_sub
[[
1
]]
$
PCA
,
choice
=
"group"
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
repel
=
TRUE
)
return
(
p
)
}
if
(
plot
==
"var"
)
{
p
<-
factoextra
::
fviz_mfa_var
(
object_sub
[[
1
]]
$
PCA
,
choice
=
"quanti.var"
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
repel
=
TRUE
)
return
(
p
)
}
if
(
plot
==
"ind"
)
{
p
<-
factoextra
::
fviz_mfa_ind
(
object_sub
[[
1
]]
$
PCA
,
partial
=
"all"
,
habillage
=
habillage
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
pointsize
=
2
)
return
(
p
)
}
object_sub
<-
extract.pathwayRes
(
x
,
pathway_id
)
if
(
plot
==
"group"
)
{
p
<-
factoextra
::
fviz_mfa_var
(
object_sub
[[
1
]]
$
PCA
,
choice
=
"group"
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
repel
=
TRUE
)
return
(
p
)
}
if
(
plot
==
"var"
)
{
p
<-
factoextra
::
fviz_mfa_var
(
object_sub
[[
1
]]
$
PCA
,
choice
=
"quanti.var"
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
repel
=
TRUE
)
return
(
p
)
}
if
(
plot
==
"ind"
)
{
p
<-
factoextra
::
fviz_mfa_ind
(
object_sub
[[
1
]]
$
PCA
,
partial
=
"all"
,
habillage
=
habillage
,
title
=
object_sub
[[
1
]]
$
pathway_name
,
pointsize
=
2
)
return
(
p
)
}
NextMethod
()
}
...
...
@@ -170,10 +205,11 @@ extract <- function(object, pathway_id) {
#' @exportS3Method
extract.pathwayRes
<-
function
(
object
,
pathway_id
)
{
class_sub
<-
class
(
object
)
cond
<-
lapply
(
object
,
function
(
path
)
path
$
pathway_code
%in%
pathway_id
|
path
$
pathway_name
%in%
pathway_id
)
object_sub
<-
object
[
unlist
(
cond
)]
class
(
object_sub
)
<-
c
(
"PCApath"
,
"pathwayRes"
)
class
(
object_sub
)
<-
c
lass_sub
return
(
object_sub
)
}
...
...
This diff is collapsed.
Click to expand it.
R/test_pathway.R
+
10
−
6
View file @
bc3d9801
...
...
@@ -35,9 +35,9 @@
#' @param analysis character string indicating if the pathway scores are
#' obtained using \link[FactoMineR]{PCA} or \link[FactoMineR]{MFA}
#'
#' @return an object of class \code{PCApath}
and
\code{path
wayRes} which is a
#' list of pathway results. Each element of the
list contain the following
#' entries:
#' @return an object of class \code{PCApath}
or
\code{
MFA
path
} and
#'
\code{pathwayRes} which is a
list of pathway results. Each element of the
#'
list contain the following
entries:
#' \item{pathway_name}{a character corresponding to the pathway name}
#' \item{pathway_code}{a character corresponding to the pathway code}
#' \item{metabolites}{a data.frame with the names and codes of the quantified
...
...
@@ -48,7 +48,6 @@
#' \item{model}{the output of the mixed model fit}
#' \item{test_pathway}{a data.frame with the p-values for each tested fixed
#' effect}
#' \item{analysis}{a character corresponding to the parameter \code{analysis}}
#'
#' @importFrom FactoMineR PCA MFA
#' @importFrom lme4 lmer
...
...
@@ -308,13 +307,18 @@ test_pathway <- function(quantif, design, pathways = "auto", fixed, random,
res
<-
list
(
"pathway_name"
=
path_name
,
"pathway_code"
=
path_code
,
"metabolites"
=
out_met
,
"PCA"
=
res_pca
,
"model"
=
res_lmm
,
"test_pathway"
=
res_test
,
"analysis"
=
analysis
)
"test_pathway"
=
res_test
)
return
(
res
)
})
names
(
res_pathway
)
<-
unique
(
pathways
$
pathway_name
)
class
(
res_pathway
)
<-
c
(
"PCApath"
,
"pathwayRes"
)
if
(
analysis
==
"PCA"
)
{
class
(
res_pathway
)
<-
c
(
"PCApath"
,
"pathwayRes"
)
}
if
(
analysis
==
"MFA"
)
{
class
(
res_pathway
)
<-
c
(
"MFApath"
,
"pathwayRes"
)
}
return
(
res_pathway
)
}
This diff is collapsed.
Click to expand it.
man/pathwayRes.Rd
+
1
−
0
View file @
bc3d9801
...
...
@@ -82,6 +82,7 @@ out_test2 <- test_pathway(quantif, design, pathways,
npc = 2, model = "blmer", analysis = "MFA")
summary(out_test2)
print(out_test)
print(out_test2)
plot(out_test)
plot(out_test, pathway_id = "mmu00052", plot = "var")
plot(out_test, pathway_id = "mmu00052", plot = "ind", habillage = "Age")
...
...
This diff is collapsed.
Click to expand it.
man/test_pathway.Rd
+
3
−
4
View file @
bc3d9801
...
...
@@ -59,9 +59,9 @@ using \link[lme4]{lmer} or \link[blme]{blmer}. Default to \code{"lmer"}}
obtained using \link[FactoMineR]{PCA} or \link[FactoMineR]{MFA}}
}
\value{
an object of class \code{PCApath}
and
\code{path
wayRes} which is a
list of pathway results. Each element of the
list contain the following
entries:
an object of class \code{PCApath}
or
\code{
MFA
path
} and
\code{pathwayRes} which is a
list of pathway results. Each element of the
list contain the following
entries:
\item{pathway_name}{a character corresponding to the pathway name}
\item{pathway_code}{a character corresponding to the pathway code}
\item{metabolites}{a data.frame with the names and codes of the quantified
...
...
@@ -72,7 +72,6 @@ from \link[FactoMineR]{MFA})}
\item{model}{the output of the mixed model fit}
\item{test_pathway}{a data.frame with the p-values for each tested fixed
effect}
\item{analysis}{a character corresponding to the parameter \code{analysis}}
}
\description{
Perform a differential analysis at pathway level based on
...
...
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