Title: | Exposome exploration and outcome data analysis |
---|---|
Description: | Package that allows to explore the exposome and to perform association analyses between exposures and health outcomes. |
Authors: | Carles Hernandez-Ferrer [aut, cre], Juan R. Gonzalez [aut], Xavier EscribĂ -Montagut [aut] |
Maintainer: | Xavier EscribĂ Montagut <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.29.0 |
Built: | 2024-12-19 03:54:20 UTC |
Source: | https://github.com/bioc/rexposome |
Method to get the classification of the samples from an ExposomeClust.
classification(object)
classification(object)
object |
An ExposomeClust to get the samples' classification. |
A labelled vector with the classification of each exposure.
clustering as a constructor for ExposomeClust, plotClassification to plot the groups
data("eclust") tt <- classification(expo_c) table(tt)
data("eclust") tt <- classification(expo_c) table(tt)
This method allows to create an ExposomeClust object from an
ExposomeSet object by clustering samples through the exposure
levels. The method is flexible to accept any clustering method
(method
) that allows to obtain a classification (cmethod
)
of the samples. The function assigned to argument method
must have
an argument called data
, waiting for the matrix of exposures
(samples as rows, exposures as columns). If the result object of the
method
has no accessor $classification
, then a cmethod
is required and will be applied on the result of method
to obtain
a labelled vector with the samples' classification.
clustering(object, method, cmethod, ..., warnings = TRUE)
clustering(object, method, cmethod, ..., warnings = TRUE)
object |
|
method |
Function applied to the exposures of |
cmethod |
(optional) Function to obtain the classification from the object
generated with |
... |
Passed to content of |
warnings |
(default |
ExposomeClust
with the original exposures and the
classification of each exposure.
The function assigned to cmethod
will be directy applied to
the result of the method
as: cmethod(model)
; being
model
the result of method
.
classification to see how to obtain the classification of the samples from an ExposomeClust, plotClassification to plot the groups
data("exposome") # EXAMPLE 1: Clustering with mclust library(mclust) c <- clustering(expo[12:32, ], method = Mclust, G = 2) table(classification(c)) # This works since the result of Mclust has an accessor # $classification # EXAMPLE 2: Cluseting with flexmix library(flexmix) # First we carete a function to apply flexmix to the ExposomeSet flexmix_clust <- function(data, ...) { data <- as.matrix(data) flexmix(formula = data~1, ...) } # Then if we apply the method to the ExposomeSet it will crash: # c <- clustering(expo[12:32, ], method = flexmix_clust, k = 2, model = FLXMCmvnorm()) # Because the method does not know how to obtain the classification for the result # since flexmix has not an accessor called $classiciation # We create a function to get the classification flexmix_clas <- function(model, ...) { return(clusters(model)) } # We put it to the ExposomeClust c <- clustering(expo[12:32, ], method = flexmix_clust, cmethod = flexmix_clas, k = 2, model = FLXMCmvnorm()) classification(c) # This works because the ExposomeClust has a way to get # the classification
data("exposome") # EXAMPLE 1: Clustering with mclust library(mclust) c <- clustering(expo[12:32, ], method = Mclust, G = 2) table(classification(c)) # This works since the result of Mclust has an accessor # $classification # EXAMPLE 2: Cluseting with flexmix library(flexmix) # First we carete a function to apply flexmix to the ExposomeSet flexmix_clust <- function(data, ...) { data <- as.matrix(data) flexmix(formula = data~1, ...) } # Then if we apply the method to the ExposomeSet it will crash: # c <- clustering(expo[12:32, ], method = flexmix_clust, k = 2, model = FLXMCmvnorm()) # Because the method does not know how to obtain the classification for the result # since flexmix has not an accessor called $classiciation # We create a function to get the classification flexmix_clas <- function(model, ...) { return(clusters(model)) } # We put it to the ExposomeClust c <- clustering(expo[12:32, ], method = flexmix_clust, cmethod = flexmix_clas, k = 2, model = FLXMCmvnorm()) classification(c) # This works because the ExposomeClust has a way to get # the classification
Method to calculate the correlation between the exposures of an ExposomeSet. The correlation method takes into account the nature of each pair of exposures: continuous vs. continuous uses cor function from R base, categorical vs. categorical uses cramerV function from lsr R package and categorical vs. continuous exposures correlation is calculated as the square root of the adjusted r-square obtained from fitting a lineal model with the categorical exposures as dependent variable and the continuous exposure as independent variable. The function creates and returns an ExposomeCorr object.
correlation(object, ..., warnings = TRUE)
correlation(object, ..., warnings = TRUE)
object |
|
... |
|
warnings |
(default |
ExposomeCorr
with the correlation between the selected
exposures and their description
plotCorrelation to plot the correlations of an ExposomeCorr, clustering to see how the exposures can cluster samples, pca to compute PCA on exposures
data("exposome") expo.c <- correlation(expo) expo.c expo.c.table <- extract(expo.c)
data("exposome") expo.c <- correlation(expo) expo.c expo.c.table <- extract(expo.c)
imExposomeSet
for testing purpousesimExposomeSet
created from the raw data included in the
package. The creation process is ilustrated in the vignette.
data("ex_imp")
data("ex_imp")
An object of class imExposomeSet
of dimension 47 x 109 x 10.
An imExposomeSet
object.
data("ex_imp") ex_imp
data("ex_imp") ex_imp
ExposomeSet
for testing purpousesExposomeSet
with full set of 104 exposures,
1200 simulated samples and 4 phenotypes (asthma status,
BMI measure, sex, and age).
data("exposome")
data("exposome")
An object of class ExposomeSet
of dimension 104 x 1200 x 4.
An ExposomeSet
object.
data("exposome") dim(expo) exposureNames(expo) familyNames(expo) sampleNames(expo) phenotypeNames(expo)
data("exposome") dim(expo) exposureNames(expo) familyNames(expo) sampleNames(expo) phenotypeNames(expo)
ExposomeClust
for testing purpousesExposomeClust
created from an ExposomeSet
with full set of 104 exposures, 1200 simulated samples
and 4 phenotypes (asthma status, BMI measure, sex, and age).
The clustering was done using hclust
and
cutree
with k = 3
.
data("eclust")
data("eclust")
An object of class ExposomeClust
of dimension 99 x 1200 x 5.
An ExposomeSet
object.
data("eclust") dim(expo_c) table(classification(expo_c))
data("eclust") dim(expo_c) table(classification(expo_c))
Given an ExposomeSet it returns the inner matrix of exposures, having the exposures as columns and the samples as rows.
expos(object)
expos(object)
object |
An ExposomeSet. |
A matrix of exposures
data("exposome") expos(expo)[1:3, 1:3]
data("exposome") expos(expo)[1:3, 1:3]
Class ExposomeClust
obtained from clustering on an
ExposomeSet object, represents the groups of samples created
applying a clustering method on the ExposomeSet
' exposures.
## S4 method for signature 'ExposomeClust,ANY' plot(x, y, ...) ## S4 method for signature 'ExposomeClust' classification(object) ## S4 method for signature 'ExposomeClust' plotClassification(object, type = "heatmap", ...) ## S4 method for signature 'ExposomeClust' sampleNames(object)
## S4 method for signature 'ExposomeClust,ANY' plot(x, y, ...) ## S4 method for signature 'ExposomeClust' classification(object) ## S4 method for signature 'ExposomeClust' plotClassification(object, type = "heatmap", ...) ## S4 method for signature 'ExposomeClust' sampleNames(object)
x |
Object of class |
y |
NOT USED |
... |
Argument given to |
object |
An object of class ExposomeClust |
type |
(default |
An object of class ExposomeClust
plot(x = ExposomeClust, y = ANY)
: Wrapper for plotClassification
method.
classification(ExposomeClust)
: Return classe asigned to each sample
plotClassification(ExposomeClust)
: Draws a heatmap for the samples' classification.
sampleNames(ExposomeClust)
: Method to obtain samples' names
model
Result obtained on applying method
on the exposures.
method
Function used to perform the clustering of the exposures.
call
Call used to create this object.
samples
Name of the exposures after the clustering process.
clustering
to apply a clustering on an
ExposomeSet
and create an ExposomeClust
.
Class ExposomeCorr
contains a matrix of correlations between
continuos exposures calculated using cor. It also contains the
description of each exposures (fData
of the original
ExposomeSet) in order to maintain a coherence
with the original source. It extends eSet-class.
## S4 method for signature 'ExposomeCorr,ANY' plot(x, y, ...) ## S4 method for signature 'ExposomeCorr' dim(x) ## S4 method for signature 'ExposomeCorr' extract(object, sort, ...) ## S4 method for signature 'ExposomeCorr' plotCorrelation(object, type = c("circos", "matrix"), ...)
## S4 method for signature 'ExposomeCorr,ANY' plot(x, y, ...) ## S4 method for signature 'ExposomeCorr' dim(x) ## S4 method for signature 'ExposomeCorr' extract(object, sort, ...) ## S4 method for signature 'ExposomeCorr' plotCorrelation(object, type = c("circos", "matrix"), ...)
x |
Object of class ExposomeCorr |
y |
NOT USED |
... |
Arguments passed to |
object |
An |
sort |
NOT USED |
type |
To choose between |
An object of class ExposomeCorr
plot(x = ExposomeCorr, y = ANY)
: Wrapper for plotClassification
method.
dim(ExposomeCorr)
: Return the dimension of the internat matrix of
correlation.
extract(ExposomeCorr)
: Return the raw correlation matrix
plotCorrelation(ExposomeCorr)
: Draws both a matrix of circos plot of correlations
assayData
featureData
Contains the description of the exposures including the family where they belong (see eSet, AnnotatedDataFrame).
pca
to study the behavioud between samples
and exposures in an ExposomeSet
Class ExposomePCA
contains a matrix of exposures used to
compute the PCA, also a table of phenotypes and a set congtaing the
multiple results of computing the PCA.
## S4 method for signature 'ExposomePCA,ANY' plot(x, y, ...) ## S4 method for signature 'ExposomePCA' exposureNames(object) ## S4 method for signature 'ExposomePCA' extract(object, table = "exposures", ...) ## S4 method for signature 'ExposomePCA' ndim(object) ## S4 method for signature 'ExposomePCA' phenotypeNames(object) ## S4 method for signature 'ExposomePCA' plot3PCA( object, cmpX, cmpY, cmpZ, phenotype, main, angle = 35, pch = 16, legend = TRUE, plines = TRUE ) ## S4 method for signature 'ExposomePCA' plotEXP(object, exposure) ## S4 method for signature 'ExposomePCA' plotPCA( object, set, cmpX = 1, cmpY = 2, show.exposures = FALSE, show.samples = FALSE, phenotype ) ## S4 method for signature 'ExposomePCA' plotPHE(object, phenotype, exp2fac = 5)
## S4 method for signature 'ExposomePCA,ANY' plot(x, y, ...) ## S4 method for signature 'ExposomePCA' exposureNames(object) ## S4 method for signature 'ExposomePCA' extract(object, table = "exposures", ...) ## S4 method for signature 'ExposomePCA' ndim(object) ## S4 method for signature 'ExposomePCA' phenotypeNames(object) ## S4 method for signature 'ExposomePCA' plot3PCA( object, cmpX, cmpY, cmpZ, phenotype, main, angle = 35, pch = 16, legend = TRUE, plines = TRUE ) ## S4 method for signature 'ExposomePCA' plotEXP(object, exposure) ## S4 method for signature 'ExposomePCA' plotPCA( object, set, cmpX = 1, cmpY = 2, show.exposures = FALSE, show.samples = FALSE, phenotype ) ## S4 method for signature 'ExposomePCA' plotPHE(object, phenotype, exp2fac = 5)
x |
Object of class |
y |
NOT USED |
... |
NOT USED |
object |
An |
table |
Can takes values |
cmpX |
PC to place in X-axis |
cmpY |
PC to place in Y-axis |
cmpZ |
PC to place in Z-axis |
phenotype |
(when |
main |
Title |
angle |
Point of view |
pch |
Size of the dots |
legend |
Boolean to show or hide the legend |
plines |
Boolean to show of hide the dotted lines that helps to place the dots in the X/Y axes |
exposure |
Vector of exposures to be shown in the plot |
set |
Can take values |
show.exposures |
When set to |
show.samples |
When set to |
exp2fac |
Number of different values to considere an exposures continuous |
An object of class ExposomePCA
plot(x = ExposomePCA, y = ANY)
: Wrapper for plotPCA
method.
exposureNames(ExposomePCA)
: Getter to obtain the exposures's names.
extract(ExposomePCA)
: Method to extract the raw results of the PCA.
ndim(ExposomePCA)
: Number of principal components in an ExposomePCA.
phenotypeNames(ExposomePCA)
: Getter to obtain the phenotype's names.
plot3PCA(ExposomePCA)
: Methdo to draw a 3D plot for PCA
plotEXP(ExposomePCA)
: Plot correlation between exposures and PCA
plotPCA(ExposomePCA)
: Methdo to draw a 2D plot for PCA
plotPHE(ExposomePCA)
: Plot association score between phentoypes and PCA
pca
list containing all elements of the PCA
phenoData
Contains the phenotypes or variables experimenter-supplied (see eSet, AnnotatedDataFrame).
featureData
Contains the description of the exposures including the family where they belong (see eSet, AnnotatedDataFrame).
correlation
to study the correlation between
exposures in a ExposomeSet
Class ExposomeSet
contains the exposure levels, the exposure's
description and the samples phenotype. It is the starting object for
rexposome
package and extends eSet.
## S4 method for signature 'ExposomeSet,ANY' plot(x, y, ...) ## S4 method for signature 'ExposomeSet' clustering(object, method, cmethod, ..., warnings = TRUE) ## S4 method for signature 'ExposomeSet' correlation(object, ..., warnings = TRUE) ## S4 method for signature 'ExposomeSet' dim(x) ## S4 method for signature 'ExposomeSet' expos(object) ## S4 method for signature 'ExposomeSet' exposureNames(object) ## S4 method for signature 'ExposomeSet' exwas( object, formula, filter, family, ..., baselevels, tef = TRUE, verbose = FALSE, warnings = TRUE, robust = FALSE ) ## S4 method for signature 'ExposomeSet' familyNames(object, by.exposure = FALSE) ## S4 method for signature 'ExposomeSet' highAndLow( object, ngroups = 3, intervals = c("standard", "extreme"), select, drop = FALSE, warnings = TRUE ) ## S4 method for signature 'ExposomeSet' ilod( object, seed = 1234, lod.col = "LOD", pNA = 0.2, tLog = FALSE, method = "QRILC", warnings = TRUE, ... ) ## S4 method for signature 'ExposomeSet' imputation(object, select, ..., messages = FALSE) ## S4 method for signature 'ExposomeSet' invExWAS(object, formula, filter, tef = TRUE, verbose = FALSE, warnings = TRUE) ## S4 method for signature 'ExposomeSet' mexwas(object, phenotype, family, warnings = TRUE) ## S4 method for signature 'ExposomeSet' normalityTest( object, exposure, th = 0.05, min.val = 5, na.rm = TRUE, warnings = TRUE ) ## S4 method for signature 'ExposomeSet' pca(object, npc = 10, pca = FALSE, ...) ## S4 method for signature 'ExposomeSet' phenotypeNames(object) ## S4 method for signature 'ExposomeSet' plotFamily(x, family, group, group2, scatter = TRUE, na.omit = TRUE) ## S4 method for signature 'ExposomeSet' plotHistogram(x, select, density = TRUE, show.trans = FALSE) ## S4 method for signature 'ExposomeSet' plotLOD(object, lod.col = "LOD", x.max = 100, sort = TRUE) ## S4 method for signature 'ExposomeSet' plotMissings( object, set = c("exposures", "phenotypes"), x.max = 100, sort = TRUE ) ## S4 method for signature 'ExposomeSet' standardize(object, select, method = "normal", na.rm = TRUE, warnings = TRUE) ## S4 method for signature 'ExposomeSet' Summary(x, set = c("exposures", "phenotypes"), select, ..., na.rm = FALSE) ## S4 method for signature 'ExposomeSet' tableLOD(object, output = "n", lod.col = "LOD", sort = TRUE) ## S4 method for signature 'ExposomeSet' tableMissings( object, set = c("exposures", "phenotypes"), output = "n", sort = TRUE ) ## S4 method for signature 'ExposomeSet' trans(object, fun, select, by.exposure = FALSE, ...)
## S4 method for signature 'ExposomeSet,ANY' plot(x, y, ...) ## S4 method for signature 'ExposomeSet' clustering(object, method, cmethod, ..., warnings = TRUE) ## S4 method for signature 'ExposomeSet' correlation(object, ..., warnings = TRUE) ## S4 method for signature 'ExposomeSet' dim(x) ## S4 method for signature 'ExposomeSet' expos(object) ## S4 method for signature 'ExposomeSet' exposureNames(object) ## S4 method for signature 'ExposomeSet' exwas( object, formula, filter, family, ..., baselevels, tef = TRUE, verbose = FALSE, warnings = TRUE, robust = FALSE ) ## S4 method for signature 'ExposomeSet' familyNames(object, by.exposure = FALSE) ## S4 method for signature 'ExposomeSet' highAndLow( object, ngroups = 3, intervals = c("standard", "extreme"), select, drop = FALSE, warnings = TRUE ) ## S4 method for signature 'ExposomeSet' ilod( object, seed = 1234, lod.col = "LOD", pNA = 0.2, tLog = FALSE, method = "QRILC", warnings = TRUE, ... ) ## S4 method for signature 'ExposomeSet' imputation(object, select, ..., messages = FALSE) ## S4 method for signature 'ExposomeSet' invExWAS(object, formula, filter, tef = TRUE, verbose = FALSE, warnings = TRUE) ## S4 method for signature 'ExposomeSet' mexwas(object, phenotype, family, warnings = TRUE) ## S4 method for signature 'ExposomeSet' normalityTest( object, exposure, th = 0.05, min.val = 5, na.rm = TRUE, warnings = TRUE ) ## S4 method for signature 'ExposomeSet' pca(object, npc = 10, pca = FALSE, ...) ## S4 method for signature 'ExposomeSet' phenotypeNames(object) ## S4 method for signature 'ExposomeSet' plotFamily(x, family, group, group2, scatter = TRUE, na.omit = TRUE) ## S4 method for signature 'ExposomeSet' plotHistogram(x, select, density = TRUE, show.trans = FALSE) ## S4 method for signature 'ExposomeSet' plotLOD(object, lod.col = "LOD", x.max = 100, sort = TRUE) ## S4 method for signature 'ExposomeSet' plotMissings( object, set = c("exposures", "phenotypes"), x.max = 100, sort = TRUE ) ## S4 method for signature 'ExposomeSet' standardize(object, select, method = "normal", na.rm = TRUE, warnings = TRUE) ## S4 method for signature 'ExposomeSet' Summary(x, set = c("exposures", "phenotypes"), select, ..., na.rm = FALSE) ## S4 method for signature 'ExposomeSet' tableLOD(object, output = "n", lod.col = "LOD", sort = TRUE) ## S4 method for signature 'ExposomeSet' tableMissings( object, set = c("exposures", "phenotypes"), output = "n", sort = TRUE ) ## S4 method for signature 'ExposomeSet' trans(object, fun, select, by.exposure = FALSE, ...)
x |
An |
y |
NOT USED |
... |
Arguments to be passed to imputeFAMD |
object |
An |
method |
Method to be used. |
cmethod |
Function implementing a systsme to retrieve classification from clustering output |
warnings |
If set to |
formula |
Formula, not including exposures, to be tested. No need to provide response (left term) |
filter |
Expression to be used to filter |
family |
Family descriving the nature of the health outcome |
baselevels |
Labeled vector with the default base level for categorical exposures. |
tef |
If |
verbose |
If set to |
by.exposure |
If set to |
ngroups |
Number of intervals to be used |
intervals |
If |
select |
Vector selecting thee xposures to be used. |
drop |
If set to |
seed |
Numeric seed |
lod.col |
Indicator of the column where the LOD is located |
pNA |
Maximum percentage allowed of values under LOD |
tLog |
If set to |
messages |
If set to |
phenotype |
Health outcome to be used as dependent variable. |
exposure |
Vecror of exposures to be used. |
th |
Threshold of P-Value used to considere normalit |
min.val |
Minimum number of observations to perform test |
na.rm |
If set to |
npc |
Number of PC to be kept |
pca |
Perform PCA (only numerical variables) or FAMD (numerical and categorical) |
group |
Phenotype to group exposures |
group2 |
Phenotype to group exposures |
scatter |
If set to true it shows the samples value in the plot |
na.omit |
If set to |
density |
If set to |
show.trans |
If set to |
x.max |
Threshold for x axis (in %) |
sort |
If set to |
set |
Cantake values |
output |
Can take values |
fun |
Function to bt used in the transformation process |
An object of class ExposomeSet
plot(x = ExposomeSet, y = ANY)
: Wrapper for plotFamily
method.
clustering(ExposomeSet)
: Performs clustering on samples based on exposure levels.
correlation(ExposomeSet)
: Computes correlation on exposures.
dim(ExposomeSet)
: Returns the number of exsures, samples and phenotypes.
expos(ExposomeSet)
: Returns a data.frame
with exposures.
exposureNames(ExposomeSet)
: Getter to obtain the exposures's names.
exwas(ExposomeSet)
: Performs an EXposome-Wide Association Study
familyNames(ExposomeSet)
: Getter to obtain the families's names of the
family of each exposure.
highAndLow(ExposomeSet)
: Performs a discretization of continuous exposures.
ilod(ExposomeSet)
: Imputation of under-LOD values of exposures.
imputation(ExposomeSet)
: Imputation of missing values of exposures.
invExWAS(ExposomeSet)
: Performs an EXposome-Wide Association Study (modelling the exposures as response)
mexwas(ExposomeSet)
: Performs a Multiple-EXposure-Wide Association Study.
normalityTest(ExposomeSet)
: Test the normality of each exposure.
pca(ExposomeSet)
: Performs a PCA
phenotypeNames(ExposomeSet)
: Getter to obtain the phenotypes's names.
plotFamily(ExposomeSet)
: Draws a boxplot or accumulated-bar plot for each
exposure in a given family.
plotHistogram(ExposomeSet)
: Draws an histogram of a given continuous exposure
or a pie chart if a given categorycal exposure.
plotLOD(ExposomeSet)
: Draws a barchart with the amount of under-LOD values.
plotMissings(ExposomeSet)
: Draws a bar-plot with the amount of missing values.
standardize(ExposomeSet)
: Standardization of exposures.
Summary(ExposomeSet)
: Summary of both continuous and categorical exposures
tableLOD(ExposomeSet)
: Returns a vector with the number of under-LOD values
per exposure.
tableMissings(ExposomeSet)
: Returns a vector with the number of missing values
per exposure.
trans(ExposomeSet)
: Transformation of exposures.
assayData
Contains the exposures matrix with column number equal to
nrow(phenoData)
(see eSet, AssayData).
featureData
Contains the description of the exposures including the family where they belong (see eSet, AnnotatedDataFrame).
phenoData
Contains the phenotypes or variables experimenter-supplied (see eSet, AnnotatedDataFrame).
readExposome
to create an ExposomeSet
from files, loadExposome
to create an ExposomeSet
from data.frames
Getter to obtain the exposures's names of an ExposomeSet or ExposomePCA
exposureNames(object)
exposureNames(object)
object |
ExposomeSet that will be queried for the exposures's names. |
The name of the exposures as a character vector.
exposureNames collides with featureNames of eSet.
Although in rexposome 1.0.0
both function can be used as
synonyms, this usage is discouraged and it is not assured.
phenotypeNames to get the phenotypes, familyNames to get the families of exposures
data("exposome") exposureNames(expo)
data("exposome") exposureNames(expo)
ExWAS
, ExposomeClust
and ExposomeCorr
.Returns internal table of results of objects of class ExWAS
,
ExposomeClust
and ExposomeCorr
.
extract(object, ...)
extract(object, ...)
object |
Object of class |
... |
NO USED |
A data.frame
containing the raw result from PsyGeNET or
a data.frame
with the result Jaccard Index for each disease.
The exwas
method performs an "Exposome-Wide Association Study" (ExWAS)
using the exposures in ExposomeSet and one of its phenotype.
exwas( object, formula, filter, family, ..., baselevels, tef = TRUE, verbose = FALSE, warnings = TRUE, robust = FALSE )
exwas( object, formula, filter, family, ..., baselevels, tef = TRUE, verbose = FALSE, warnings = TRUE, robust = FALSE )
object |
|
formula |
|
filter |
|
family |
Family of the distribution followed by the health outcome to be tested (gaussian, bionomal, ... check glm). |
... |
NOT USED |
baselevels |
(optional) If set, must be a labeled vector with the default base level for categorical exposures. |
tef |
(default |
verbose |
(default |
warnings |
(default |
An codeExWAS object with the result of the association study
An Environment-Wide Association Study (ExWAS) on Type 2 Diabetes Mellitus. Chirag J. Patel, Jayanta Bhattacharya, Atul J. Butte. May 20, 2010 Plos One
Evaluating the effective numbers of independent tests and significant p-value thresholds in commercial genotyping arrays and public imputation reference datasets. Miao-Xin Li, Juilian M. Y. Yeung, Stacey S. Cherny and Pak C. Sham. May 2012 Hum Genet.
extract to obtain a table with the result of the ExWAS, plotExwas to plot the results of the ExWAS
data(exposome) w1 <- exwas(expo[1:5, ], asthma~1, family = "binomial") w2 <- exwas(expo[1:5, ], asthma~sex+age, family = "binomial") w3 <- exwas(expo[1:5, ], asthma~age, family = "binomial", filter = sex=="boy")
data(exposome) w1 <- exwas(expo[1:5, ], asthma~1, family = "binomial") w2 <- exwas(expo[1:5, ], asthma~sex+age, family = "binomial") w3 <- exwas(expo[1:5, ], asthma~age, family = "binomial", filter = sex=="boy")
Class ExWAS
obtained from exwas method of an
ExposomeSet object, contains the result of testing the association
of exposures of an ExposomeSet
to its phenotypes. "ExWAS" is the
acronym of "Exposome-Wide Association Study". The function can be applied
to one of to many phenotypes in the ExposomeSet
object.
## S4 method for signature 'ExWAS,ANY' plot(x, y, ...) ## S4 method for signature 'ExWAS' extract(object, sort = TRUE, ...) ## S4 method for signature 'ExWAS' get_robust_sd(object, sort = TRUE, ...) ## S4 method for signature 'ExWAS' names(x) ## S4 method for signature 'ExWAS' plotEffect(x, y, select, labels, xlab, ylab) ## S4 method for signature 'ExWAS' plotExwas( object, ..., subtitles, color, exp.order, labels, show.effective = TRUE ) ## S4 method for signature 'ExWAS' plotVolcano(x, p.value = -log10(0.001), labels, show.effect = FALSE) ## S4 method for signature 'ExWAS' tef(object)
## S4 method for signature 'ExWAS,ANY' plot(x, y, ...) ## S4 method for signature 'ExWAS' extract(object, sort = TRUE, ...) ## S4 method for signature 'ExWAS' get_robust_sd(object, sort = TRUE, ...) ## S4 method for signature 'ExWAS' names(x) ## S4 method for signature 'ExWAS' plotEffect(x, y, select, labels, xlab, ylab) ## S4 method for signature 'ExWAS' plotExwas( object, ..., subtitles, color, exp.order, labels, show.effective = TRUE ) ## S4 method for signature 'ExWAS' plotVolcano(x, p.value = -log10(0.001), labels, show.effect = FALSE) ## S4 method for signature 'ExWAS' tef(object)
x |
An |
y |
An |
... |
NOT USED |
object |
An object of class |
sort |
If |
select |
(optional) Vector with the selected exposures |
labels |
(optional) Character vector with the labels for each exposure. It must be labeled vector. |
xlab |
(optional) Label for x-axis |
ylab |
(optional) Label for y-axis |
subtitles |
Character vector with the "subtitle" for each plot when
given more than one |
color |
(optional) A vector of colors. The vector must have length equal to the number of families. The vector must be names with the name of the families. |
exp.order |
(optional) Order of the exposures. |
show.effective |
(default TRUE) draws a brown line on the threshold given by the effective number of tests. |
p.value |
(default |
show.effect |
(default |
An object of class ExWAS
plot(x = ExWAS, y = ANY)
: Wrapper for plotExwas
method.
extract(ExWAS)
: Method to obtain the matrix of association scores
get_robust_sd(ExWAS)
: Method to obtain the matrix of association scores
names(ExWAS)
: Method to obtain the Threshold for effective tests (TEF)
plotEffect(ExWAS)
: Draws a plot with the confidence interval of each
exposure. Alows to compare two ExWAS instances.
plotExwas(ExWAS)
: Method to plot a manhatan plot for association between
exposures and phenitypes
plotVolcano(ExWAS)
: Method to plot a volcano plot for association between
exposures and phenotypes
tef(ExWAS)
: Method to obtain the Threshold for effective tests (TEF)
effective
Number containing the effective number of tests.
formula
Tested formula.
comparison
Result of performing the test to find association between levels of exposures and phenotype.
description
Description of the exposures used in the ExWAS. (in description file).
exwas
to perform an Exposome-Wide Association Study
and to create an ExWAS
, mexwas
to perform a
Multivariate Exposome-Wide Association Study and to create a
mExWAS
This method returns the name of the families in an ExposomeSet, but it can return a vector, labeled with the exposures in the ExposomeSet, containing the family belonging to each exposure.
familyNames(object, by.exposure = FALSE)
familyNames(object, by.exposure = FALSE)
object |
|
by.exposure |
(default |
The families of the exposures into the ExposomeSet, or the family of each exposure into the ExposomeSet.
exposureNames to get the name of the exposures, phenotypeNames to get the phenotypes
data("exposome") # Get families familyNames(expo) # Get the family of each exposure familyNames(expo, by.exposure = TRUE)
data("exposome") # Get families familyNames(expo) # Get the family of each exposure familyNames(expo, by.exposure = TRUE)
ExWAS
Returns internal table of robust SD of objects of class ExWAS
get_robust_sd(object, ...)
get_robust_sd(object, ...)
object |
Object of class |
... |
NO USED |
A data.frame
containing the raw result from robust SD
This method allows to convert continuous exposures of an ExposomeSet
to categorical exposures using the n-percentile groups, defined by
ngroups
argument. By default, all levels are kept but if
intervals
is set to "extrem"
, the levels between the extrems
(aka. lowes and highest) are discarted and their values set to NA
.
highAndLow( object, ngroups = 3, intervals = "standard", select, drop = FALSE, warnings = TRUE )
highAndLow( object, ngroups = 3, intervals = "standard", select, drop = FALSE, warnings = TRUE )
object |
An object of class |
ngroups |
(default |
intervals |
(default |
select |
(optional) Subset of exposures where the discretization is applied. If missing, all exposures are used. |
drop |
(default |
warnings |
(defaulr |
A new ExposomeSet
with categorical exposures.
trans
to transform exposures,
standardize
to standardize exposures.
# No drop data("exposome") exp.hl <- highAndLow(expo, intervals = "standard", select = "ldde_lip") dim(exp.hl) # exposures samples phenotyes # 105 1200 4 dim(expo) # exposures samples phenotyes # 104 1200 4 # exps.hl has 107 exposures: the original 104 plus the new # 3 factored exposures # Drop exp.hl <- highAndLow(expo, intervals = "standard", select = "ldde_lip", drop = TRUE) dim(exp.hl) # exposures samples phenotyes # 104 1200 4 dim(expo) # exposures samples phenotyes # 104 1200 4
# No drop data("exposome") exp.hl <- highAndLow(expo, intervals = "standard", select = "ldde_lip") dim(exp.hl) # exposures samples phenotyes # 105 1200 4 dim(expo) # exposures samples phenotyes # 104 1200 4 # exps.hl has 107 exposures: the original 104 plus the new # 3 factored exposures # Drop exp.hl <- highAndLow(expo, intervals = "standard", select = "ldde_lip", drop = TRUE) dim(exp.hl) # exposures samples phenotyes # 104 1200 4 dim(expo) # exposures samples phenotyes # 104 1200 4
This function is a wrapper of the functions impute.MinProb
from the package imputeLCMD
.
ilod( object, seed = 1234, lod.col = "LOD", pNA = 0.2, tLog = FALSE, method = "QRILC", warnings = TRUE, ... )
ilod( object, seed = 1234, lod.col = "LOD", pNA = 0.2, tLog = FALSE, method = "QRILC", warnings = TRUE, ... )
object |
|
seed |
(default |
lod.col |
(default |
pNA |
(default |
tLog |
(default |
method |
(default |
warnings |
(default |
... |
Arguments passed to |
A new ExposomeSet
with the imputed exposures.
plotMissings to plot the missing data of an ExposomeSet, tableMissings to get a table with the missing data of an ExposomeSet
## Not run: #Being x an ExposomeSet x <- ilod(x) ## End(Not run)
## Not run: #Being x an ExposomeSet x <- ilod(x) ## End(Not run)
Class imExposomeSet
was designed to store the exposures obtained
after a multiple imputation process done using mice
. The
data.frame
obtained from mice
has the particulatiry
to contain the columns .imp
and .id
joint
to phenotypes and exposures. The slots assayData
, featureData
,
and phenoData
are coordinated.
## S4 method for signature 'imExposomeSet,ANY' plot(x, y, ...) ## S4 method for signature 'imExposomeSet' dim(x) ## S4 method for signature 'imExposomeSet' expos(object) ## S4 method for signature 'imExposomeSet' exposureNames(object) ## S4 method for signature 'imExposomeSet' extract(object, rid = -1, ...) ## S4 method for signature 'imExposomeSet' exwas( object, formula, filter, family, ..., baselevels, tef = TRUE, verbose = FALSE, warnings = TRUE, robust = FALSE ) ## S4 method for signature 'imExposomeSet' familyNames(object, by.exposure = FALSE) ## S4 method for signature 'imExposomeSet' phenotypeNames(object) ## S4 method for signature 'imExposomeSet' plotFamily(x, family, group, group2, scatter = FALSE, na.omit = TRUE) ## S4 method for signature 'imExposomeSet' sampleNames(object) ## S4 method for signature 'imExposomeSet' x[[i]] ## S4 method for signature 'imExposomeSet,ANY,ANY,ANY' x[i, j, k, ..., drop = FALSE] ## S4 method for signature 'imExposomeSet' toES(object, rid = 1)
## S4 method for signature 'imExposomeSet,ANY' plot(x, y, ...) ## S4 method for signature 'imExposomeSet' dim(x) ## S4 method for signature 'imExposomeSet' expos(object) ## S4 method for signature 'imExposomeSet' exposureNames(object) ## S4 method for signature 'imExposomeSet' extract(object, rid = -1, ...) ## S4 method for signature 'imExposomeSet' exwas( object, formula, filter, family, ..., baselevels, tef = TRUE, verbose = FALSE, warnings = TRUE, robust = FALSE ) ## S4 method for signature 'imExposomeSet' familyNames(object, by.exposure = FALSE) ## S4 method for signature 'imExposomeSet' phenotypeNames(object) ## S4 method for signature 'imExposomeSet' plotFamily(x, family, group, group2, scatter = FALSE, na.omit = TRUE) ## S4 method for signature 'imExposomeSet' sampleNames(object) ## S4 method for signature 'imExposomeSet' x[[i]] ## S4 method for signature 'imExposomeSet,ANY,ANY,ANY' x[i, j, k, ..., drop = FALSE] ## S4 method for signature 'imExposomeSet' toES(object, rid = 1)
x |
An |
y |
NOT USED |
... |
Other used arguments |
object |
An object of class |
rid |
Number of the imputation to be extracted |
formula |
Formula, not including exposures, to be tested. |
filter |
Expression to be used to filter |
family |
Family descriving the nature of the health outcome |
baselevels |
Labeled vector with the base-level of the categorical exposures |
tef |
If set to |
verbose |
If set to |
warnings |
If set to |
by.exposure |
If set to |
group |
Phenotype to group exposures |
group2 |
NOT USED |
scatter |
If set to true it shows the samples value in the plot |
na.omit |
NOT USED |
i |
Character coresponding to selected exposures. |
j |
Character corresponding to selected sample names. |
k |
Character corresponding to selected phenotypes. |
drop |
NOT USED |
An object of class imExposomeSet
plot(x = imExposomeSet, y = ANY)
: Wrapper for plotFamily
method.
dim(imExposomeSet)
: Returns the number of exsures, samples and phenotypes.
expos(imExposomeSet)
: Returns a data.frame
with exposures.
exposureNames(imExposomeSet)
: Method to obtain samples' names
extract(imExposomeSet)
: Method to extract exposures for a single imputation
exwas(imExposomeSet)
: Performs an EXposome-Wide Association Study
familyNames(imExposomeSet)
: Getter to obtain the families's names of the
family of each exposure.
phenotypeNames(imExposomeSet)
: Getter to obtain the families's names of the
family of each exposure.
plotFamily(imExposomeSet)
: Draws a boxplot or accumulated-bar plot for each
exposure in the all imputed sets.
sampleNames(imExposomeSet)
: Method to obtain samples' names
[[
: Get an ExposomeSet
with the selected
imputation
x[i
: Subset an imExposomeSet
toES(imExposomeSet)
: Returns an ExposomeSet
with ethe given imputation.
nimputation
Number of imputations done with mice
.
assayData
data.frame
containing .imp
, .id
and
the exposures.
featureData
data.frame
containing the description of
the exposures.
phenoData
data.frame
containing .imp
, .id
and
the phenotypes.
Sample order is not guarantee
loadImputed
to create an imExposomeSet
from data.frames
This function is a wrapper of the functions mice
and complete
from the package mice
. Also to the impute
from the
package Hmisc
. The function is designed to use those functions
to impute missing values on exposures (not in phenotypes).
imputation(object, select, ..., messages = FALSE)
imputation(object, select, ..., messages = FALSE)
object |
|
select |
Exposures to be imputed. If missing, all exposes will be imputed. |
... |
Argument given to function |
messages |
(default |
A new ExposomeSet
with the imputed exposures.
plotMissings to plot the missing data of an ExposomeSet, tableMissings to get a table with the missing data of an ExposomeSet
## Not run: #Being x an ExposomeSet x <- imputation(x) ## End(Not run)
## Not run: #Being x an ExposomeSet x <- imputation(x) ## End(Not run)
Homologous function to the ilod method of ExposomeSet for a
given data.frame
of exposures and a vector
of threshold.
The use of this function is related to HELIX Project.
imputeLOD( x, lod, description = NULL, pNA = 0.2, pLOD = 0, log = TRUE, seed = NULL )
imputeLOD( x, lod, description = NULL, pNA = 0.2, pLOD = 0, log = TRUE, seed = NULL )
x |
|
lod |
|
description |
|
pNA |
(default: |
pLOD |
(default: |
log |
(default: |
seed |
(default: |
A new data.frame
with the imputed exposures.
## Not run: inma.imp <- imputeLOD(x = raw, lod = lod, description = desc, pNA = pNA, pLOD = pLOD, log = log, seed = seed) ## End(Not run)
## Not run: inma.imp <- imputeLOD(x = raw, lod = lod, description = desc, pNA = pNA, pLOD = pLOD, log = log, seed = seed) ## End(Not run)
The invExWAS
method performs an "Exposome-Wide Association Study" (ExWAS)
using the exposures in ExposomeSet and one of its phenotype. (modelling the exposures as response)
invExWAS(object, formula, filter, tef = TRUE, verbose = FALSE, warnings = TRUE)
invExWAS(object, formula, filter, tef = TRUE, verbose = FALSE, warnings = TRUE)
object |
|
formula |
|
filter |
|
tef |
(default |
verbose |
(default |
warnings |
(default |
An codeExWAS object with the result of the association study
extract to obtain a table with the result of the ExWAS, plotExwas to plot the results of the association
data(exposome) w1 <- invExWAS(expo, ~BMI) w2 <- invExWAS(expo, ~BMI + sex) plotExwas(w1, w2)
data(exposome) w1 <- invExWAS(expo, ~BMI) w2 <- invExWAS(expo, ~BMI + sex) plotExwas(w1, w2)
data.frames
Given three data.frames
that defines the exposome (measures
of exposome, exposome description and individuals phentype) it loads
them and creates an object of type ExposomeSet.
loadExposome( exposures, description, phenotype, description.famCol = "family", exposures.asFactor = 5, warnings = TRUE )
loadExposome( exposures, description, phenotype, description.famCol = "family", exposures.asFactor = 5, warnings = TRUE )
exposures |
|
description |
|
phenotype |
|
description.famCol |
(default |
exposures.asFactor |
(default |
warnings |
(default |
The rows of the exposure's data.frames
, that corresponds to samples'
names, must be the same than the phenotype's data.frames
. In the
same way, the columns in exposure's data.frames
must be the same
in description data.frame
.
An object of class ExposomeSet.
ExposomeSet's fData
will contain some inner columns
called .std
, .trn
, .fct
and .type
in order to
trace the transformations an exposure suffers and to know, at eny moment, if
an exposure is categorical or continuous. The "description" file can
contains a column called type
with values "factor"
and
"numeric"
to speficy how an exposure needs to be understood. If
given, this column will be renamed to .type
. If not given, it will
be created using exposures.asFactor
value.
ExposomeSet for class description, readExposome for constructor from txt/csv files.
path <- file.path(path.package("rexposome"), "extdata") description <- file.path(path, "description.csv") phenotype <- file.path(path, "phenotypes.csv") exposures <- file.path(path, "exposures.csv") dd <- read.csv(description, header=TRUE) ee <- read.csv(exposures, header=TRUE) pp <- read.csv(phenotype, header=TRUE) rownames(dd) <- dd[, 2] dd <- dd[ , -2] rownames(ee) <- ee[ , 1] ee <- ee[ , -1] rownames(pp) <- pp[ , 1] pp <- pp[ , -1] exp <- loadExposome( exposures = ee, description = dd, phenotype = pp, description.famCol = "Family" )
path <- file.path(path.package("rexposome"), "extdata") description <- file.path(path, "description.csv") phenotype <- file.path(path, "phenotypes.csv") exposures <- file.path(path, "exposures.csv") dd <- read.csv(description, header=TRUE) ee <- read.csv(exposures, header=TRUE) pp <- read.csv(phenotype, header=TRUE) rownames(dd) <- dd[, 2] dd <- dd[ , -2] rownames(ee) <- ee[ , 1] ee <- ee[ , -1] rownames(pp) <- pp[ , 1] pp <- pp[ , -1] exp <- loadExposome( exposures = ee, description = dd, phenotype = pp, description.famCol = "Family" )
data.frame
Creation of an ExposomeSet from single data.frame
loadExposome_plain( data, data_id, sep = ",", pheno_cols, na.strings = c("NA", "-", "?", " ", ""), families = NULL, exposures.asFactor = 5, warnings = TRUE )
loadExposome_plain( data, data_id, sep = ",", pheno_cols, na.strings = c("NA", "-", "?", " ", ""), families = NULL, exposures.asFactor = 5, warnings = TRUE )
data |
|
data_id |
|
sep |
|
pheno_cols |
|
na.strings |
|
families |
|
exposures.asFactor |
|
warnings |
(default |
An object of class ExposomeSet.
path <- file.path(path.package("rexposome"), "extdata") phenotype <- file.path(path, "phenotypes.csv") exposures <- file.path(path, "exposures.csv") ee <- read.csv(exposures, header=TRUE) pp <- read.csv(phenotype, header=TRUE) # Create fake dataset with exposures and phenotypes combined data <- cbind(ee, pp) loadExposome_plain <- function(data, data_id = "idnum", pheno_cols = c("rhinitis", "wheezing", "sex", "age", "cbmi", "blood_pre", "whistling_chest","flu"))
path <- file.path(path.package("rexposome"), "extdata") phenotype <- file.path(path, "phenotypes.csv") exposures <- file.path(path, "exposures.csv") ee <- read.csv(exposures, header=TRUE) pp <- read.csv(phenotype, header=TRUE) # Create fake dataset with exposures and phenotypes combined data <- cbind(ee, pp) loadExposome_plain <- function(data, data_id = "idnum", pheno_cols = c("rhinitis", "wheezing", "sex", "age", "cbmi", "blood_pre", "whistling_chest","flu"))
data.frames
Given a data.frame
from code
with the multiple
imputations of both exposures and phenotypes, join with a data.frame
with exposures' description, and object of class imExposomeSet
is created.
loadImputed( data, description, description.famCol = "family", description.expCol = "exposure", exposures.asFactor = 5, warnings = TRUE )
loadImputed( data, description, description.famCol = "family", description.expCol = "exposure", exposures.asFactor = 5, warnings = TRUE )
data |
The |
description |
|
description.famCol |
(default |
description.expCol |
(default |
exposures.asFactor |
(default |
warnings |
(default |
The coordination of the information is based in the columns .imp
and
.id
from the data.frame
obtained from mice
. The
division of exposures and phenotypes is based in description
data.frame
, that are the exposures. Hence, the elements in the
main data.frame
that are not in the description, are the
phentoypes.
An object of class imExposomeSet.
imExposomeSet for class description
data("me") # me is an imputed matrix of exposure and phenotyes path <- file.path(path.package("rexposome"), "extdata") description <- file.path(path, "description.csv") dd <- read.csv(description, header=TRUE, stringsAsFactors=FALSE) dd <- dd[dd$Exposure %in% colnames(me), ] ex_imp <- loadImputed(data = me, description = dd, description.famCol = "Family", description.expCol = "Exposure")
data("me") # me is an imputed matrix of exposure and phenotyes path <- file.path(path.package("rexposome"), "extdata") description <- file.path(path, "description.csv") dd <- read.csv(description, header=TRUE, stringsAsFactors=FALSE) dd <- dd[dd$Exposure %in% colnames(me), ] ex_imp <- loadImputed(data = me, description = dd, description.famCol = "Family", description.expCol = "Exposure")
data.frame
for testing purpousesdata.frame
created with mice
used to test and
ilustrate the creation of imExposomeSet
.
data("me")
data("me")
An object of class data.frame
with 654 rows and 57 columns.
A data.frame
.
data("me") dim(me) colnames(me)
data("me") dim(me) colnames(me)
The mexwas
method performs an "Multi Exposome-Wide
Association Study" (m-ExWAS) using the exposures in ExposomeSet
and one of its phenotype. It uses the packages glmnet
and
partDSA
.
mexwas(object, phenotype, family, warnings = TRUE)
mexwas(object, phenotype, family, warnings = TRUE)
object |
|
phenotype |
Target phenotype used for the study. If missing all the phenotypes in the ExposomeSet will be used. |
family |
It must decrive the nature of the outcome. Can take values
|
warnings |
(default |
Returns an object of class mExWAS
extract to obtain a table with the result of the ExWAS, plotExwas to plot the results of the ExWAS
data("exposome") wt <- mexwas(expo[3:7, 1:100], phenotype = "asthma", family = "binomial")
data("exposome") wt <- mexwas(expo[3:7, 1:100], phenotype = "asthma", family = "binomial")
Class mExWAS
obtained from mexwas method of an
ExposomeSet object, contains the result of testing the multiple
models of exposures of an ExposomeSet
to a set of given phenotypes.
"mExWAS" is the #' acronym of "Multivariate Exposome-Wide Association
Study".
## S4 method for signature 'mExWAS,ANY' plot(x, y, ...) ## S4 method for signature 'mExWAS' extract(object, type = "test", sort = TRUE) ## S4 method for signature 'mExWAS' plotExwas( object, ..., subtitles, color, exp.order, labels, show.effective = TRUE )
## S4 method for signature 'mExWAS,ANY' plot(x, y, ...) ## S4 method for signature 'mExWAS' extract(object, type = "test", sort = TRUE) ## S4 method for signature 'mExWAS' plotExwas( object, ..., subtitles, color, exp.order, labels, show.effective = TRUE )
x |
Object of class |
y |
NOT USED |
... |
Other used arguments. |
object |
object of class |
type |
(default |
sort |
NOT USED |
subtitles |
NOT USED |
color |
NOT USED |
exp.order |
NOT USED |
labels |
NOT USED |
show.effective |
NOT USED |
An object of class mExWAS
plot(x = mExWAS, y = ANY)
: Wrapper for plotExwas
method.
extract(mExWAS)
: Method to obtain the generated model
plotExwas(mExWAS)
: Method to plot a heap-map with the coeficient of each
exposure
result
klist with the fitted model and result.
phenotype
Name of the phenotype used in the analysys.
description
feature data from original ExposomeSet.
mexwas
to perform a Multivariate Exposome-Wide
Association Study and to create a mExWAS
,
exwas
to perform an Exposome-Wide Association Study
and to create an ExWAS
Number of principal components in an ExposomePCA.
ndim(object)
ndim(object)
object |
|
The number of components in the ExposomePCA
.
plotPCA to plot the PCA values of an ExposomePCA, clustering to see how the exposures can cluster samples, correlation to compute the correlation between exposures
data("exposome") epca <- pca(expo[3:7, 1:100]) ndim(epca)
data("exposome") epca <- pca(expo[3:7, 1:100]) ndim(epca)
data.frame
of boolean indicating if the exposures follows
a normal distribution or not.This functions uses shapiro.test
to test the normality of the
exposures and returns a data.frame
with a boolean value and a
p-value for each exposure.
normalityTest( object, exposure, th = 0.05, min.val = 5, na.rm = TRUE, warnings = TRUE )
normalityTest( object, exposure, th = 0.05, min.val = 5, na.rm = TRUE, warnings = TRUE )
object |
ExposomeSet with the exposome to be tested. |
exposure |
Name of the exposure to be tested, if missing all the exposures will be tested. |
th |
(by default |
min.val |
(by default |
na.rm |
(by default |
warnings |
(by default: |
A data.frame
with three columns: exposure, normality and
p.value. "exposure" column contains the name of each exposure. "normalty"
column contains a logical
value indicating if the obtained p-value
is under the given threshold. "p.value" column contains the obtained p-value
from shapiro.test
.
plotHistogram to draw the shape of an exposure, plotMissings to draw a plot with the missing data an ExposomeSet, imputation to impute missing data on the exposures of an ExposomeSet
data("exposome") normalityTest(expo)
data("exposome") normalityTest(expo)
Method to calculate a PCA based on the exposures of an ExposomeSet. Only numerical-exposures (non categorical) will be computed. The function resurns an ExposomePCA object. This PCA is performed by using FactoMineR package.
pca(object, npc = 10, pca = FALSE, ...)
pca(object, npc = 10, pca = FALSE, ...)
object |
|
npc |
(by default 10) number of dimensions kept in the results |
pca |
(default |
... |
Arguments to be passed to imputeFAMD |
An ExposomePCA
with the values of the PCA.
plotPCA to plot the PCA values of an ExposomePCA, clustering to see how the exposures can cluster samples, correlation to compute the correlation between exposures
data("exposome") epca <- pca(expo[12:20, ])
data("exposome") epca <- pca(expo[12:20, ])
Getter to obtain the phenotype's names of an ExposomeSet or ExposomePCA.
phenotypeNames(object)
phenotypeNames(object)
object |
|
The name of the phenotypes as a a character vector.
exposureNames to get the name of the exposures, familyNames to get the families of exposures
data("exposome") phenotypeNames(expo)
data("exposome") phenotypeNames(expo)
Methdo to draw a plot for samples using three PC contained in an ExposomePCA
plot3PCA( object, cmpX, cmpY, cmpZ, phenotype, main, angle = 35, pch = 16, legend = TRUE, plines = TRUE )
plot3PCA( object, cmpX, cmpY, cmpZ, phenotype, main, angle = 35, pch = 16, legend = TRUE, plines = TRUE )
object |
An onbject of class ExposomePCA |
cmpX |
Component to be placed at X axis |
cmpY |
Component to be placed at Y axis |
cmpZ |
Component to be placed at Z axis |
phenotype |
Used to color samples by phentoype |
main |
Title for the plot |
angle |
(default |
pch |
(default |
legend |
(default |
plines |
(default |
A list
with different graphics option from scatterplot3d
.
pca to compite PCA on an ExposomeSet, plotPCA to plot the PCA, ExposomePCA as main class data("exposome") epca <- pca(expo[3:7, 1:100]) plot3PCA(epca, cmpX = 1, cmpY = 2, cmpZ = 3, phenotype = "sex")
Draw the profile of the levels exposures after a classification with a clustering method
plotClassification(object, type = "heatmap", ...)
plotClassification(object, type = "heatmap", ...)
object |
Object of class |
type |
Two types are available: |
... |
NOT USED |
A list
with different graphics parameters.
clustering as a constructor for ExposomeClust, classification to see how to obtain the classification of the samples from an ExposomeClust
## Not run: data("eclust") plotClassification(expo_c) ## End(Not run)
## Not run: data("eclust") plotClassification(expo_c) ## End(Not run)
While the circos plot can be used to see the general behaviours intra and
extra families of exposures, the matrix plot allows for a detailed view of
the correlations within an ExposomeCorr
object.
plotCorrelation(object, type = "circos", ...)
plotCorrelation(object, type = "circos", ...)
object |
|
type |
(default |
... |
Arguments given to |
A list
with different graphics parameters.
correlation as a constructor for ExposomeCorr objects, pca to compute PCA on exposures
data("exposome") expo.c <- correlation(expo) plotCorrelation(expo.c, type="circos") plotCorrelation(expo.c, type="matrix")
data("exposome") expo.c <- correlation(expo) plotCorrelation(expo.c, type="circos") plotCorrelation(expo.c, type="matrix")
ExWAS
objectThis function draws a sort of manhattan plots using the p-value of the
association of the exposures with phenotypes of an ExWAS
object.
plotEffect(x, y, select, labels, xlab, ylab)
plotEffect(x, y, select, labels, xlab, ylab)
x |
An |
y |
(optional) Another |
select |
(optional) Character with exposures to be shown. |
labels |
(optional) Character vector with the labels for each exposure. It must be labeled vector. |
xlab |
(optional) Label for X-axis. |
ylab |
(optional) Label for Y-axis. |
An object of class ggplot
.
exwas as a constructor for ExWAS objects, extract to obtain a table with the result of the ExWAS
data(exposome) w1 <- exwas(expo[1:5, ], asthma~1, family = "binomial") w2 <- exwas(expo[1:5, ], asthma~sex+age, family = "binomial") plotEffect(w1, w2)
data(exposome) w1 <- exwas(expo[1:5, ], asthma~1, family = "binomial") w2 <- exwas(expo[1:5, ], asthma~sex+age, family = "binomial") plotEffect(w1, w2)
Function used to plot the correlation between the exposures in an ExposomePCA and the values for each component of the PCA in the same ExposomePCA
plotEXP(object, exposure)
plotEXP(object, exposure)
object |
An object of class ExposomePCA |
exposure |
(optional) to select a set of exposures to be ploted. If not given all are used. |
An object of class ggplot
.
pca to compute PCA on an ExposomeSet, plotPHE to plot the P-Value of association between phenotypes ans PCA, ExposomePCA as main class
data("exposome") epca <- pca(expo[3:7, 1:100]) plotEXP(epca)
data("exposome") epca <- pca(expo[3:7, 1:100]) plotEXP(epca)
ExWAS
objectThis function draws a sort of manhattan plots using the p-value of the
association of the exposures with phenotypes of an ExWAS
object.
plotExwas( object, ..., subtitles, color, exp.order, labels, show.effective = TRUE )
plotExwas( object, ..., subtitles, color, exp.order, labels, show.effective = TRUE )
object |
An |
... |
Other objects of class |
subtitles |
(optional) Characters used as "substitle" when more than one
|
color |
(optional) Character vector of HTML colors, labeled with family's names. Used to colore the exposures. |
exp.order |
(optional) Character vector of exposures used to order and subset the plot. |
labels |
(optional) Character vector with the labels for each exposure. It must be labeled vector. |
show.effective |
(default |
An object of class ggplot
.
exwas as a constructor for ExWAS objects, extract to obtain a table with the result of the ExWAS
data(exposome) w1 <- exwas(expo[1:5, ], asthma~1, family = "binomial") plotExwas(w1)
data(exposome) w1 <- exwas(expo[1:5, ], asthma~1, family = "binomial") plotExwas(w1)
This function draw a profile of the full exposome into an ExposomeSet or the profile of the exposures in a specific family. For continuous families, box-plots are drawn; while for categorical families accumulative bar-charts.
plotFamily(x, family, group, group2, scatter = TRUE, na.omit = TRUE)
plotFamily(x, family, group, group2, scatter = TRUE, na.omit = TRUE)
x |
ExposomeSet which exposome will be plotted. |
family |
Name of the familty that will be drawn. |
group |
If set it displays the family grouped by the given phenotype. |
group2 |
If set it displays the family grouped by the given phenotype. |
scatter |
(default |
na.omit |
(default |
A ggplot
object if a family was selected. invisible()
if argument family
was set to "all"
.
plotHistogram to draw the shape of an exposure, plotMissings to plot the missing data from an ExposomeSet
data("exposome") plt <- plotFamily(expo, family = "Metals") plt <- plt + ggplot2::ggtitle("Metals") plt plt <- plotFamily(expo, family = "Indoor air") plt <- plt + ggplot2::ggtitle("Indoor air") plt
data("exposome") plt <- plotFamily(expo, family = "Metals") plt <- plt + ggplot2::ggtitle("Metals") plt plt <- plotFamily(expo, family = "Indoor air") plt <- plt + ggplot2::ggtitle("Indoor air") plt
It draws a grid with an histogram per exposure in an ExposomeSet.
plotHistogram(x, select, density = TRUE, show.trans = FALSE)
plotHistogram(x, select, density = TRUE, show.trans = FALSE)
x |
ExposomeSet which exposome will be plotted. |
select |
Name fo the exposure to be plotted. If missing, all exposures will be used. |
density |
(default |
show.trans |
(default |
A ggplot
object.
plotFamily to draw the profile of a family of exposures, plotMissings to plot the missing data from an ExposomeSet
data("exposome") plotHistogram(expo[1:3, ], select = "ldde_lip")
data("exposome") plotHistogram(expo[1:3, ], select = "ldde_lip")
This function can be used to draw the amount of under-LOD values in the exposures of an ExposomeSet.
plotLOD(object, lod.col = "LOD", x.max = 100, sort = TRUE)
plotLOD(object, lod.col = "LOD", x.max = 100, sort = TRUE)
object |
ExposomeSet which exposome will be plotted. |
lod.col |
(default |
x.max |
(default |
sort |
(default |
A ggplot
object.
plotFamily to draw the profile of a family of exposures, plotHistogram to draw the shape of an exposure, tableMissings to get a table with the missing data of an ExposomeSet, imputation to impute missing data on the exposures of an ExposomeSet
data("exposome") # The included has no missing data plotLOD(expo)
data("exposome") # The included has no missing data plotLOD(expo)
This function can be used to draw the number of missing data in exposures and in phenotypes of an ExposomeSet.
plotMissings(object, set, x.max = 100, sort = TRUE)
plotMissings(object, set, x.max = 100, sort = TRUE)
object |
ExposomeSet which exposome will be plotted. |
set |
Can be set to |
x.max |
(default |
sort |
(default |
A ggplot
object.
plotFamily to draw the profile of a family of exposures, plotHistogram to draw the shape of an exposure, tableMissings to get a table with the missing data of an ExposomeSet, imputation to impute missing data on the exposures of an ExposomeSet
data("exposome") # The included has no missing data plotMissings(expo, set = "exposures") plotMissings(expo, set = "phenotypes")
data("exposome") # The included has no missing data plotMissings(expo, set = "exposures") plotMissings(expo, set = "phenotypes")
Methdo to draw a plot for PCA contained in an ExposomePCA
plotPCA( object, set, cmpX = 1, cmpY = 2, show.exposures = FALSE, show.samples = FALSE, phenotype )
plotPCA( object, set, cmpX = 1, cmpY = 2, show.exposures = FALSE, show.samples = FALSE, phenotype )
object |
An onbject of class ExposomePCA |
set |
Group ( |
cmpX |
(default: |
cmpY |
(default: |
show.exposures |
(default: |
show.samples |
(default: |
phenotype |
If |
An object of class ggplot
or an object of class
gtable
if argument set
was set to "all"
.
pca to compite PCA on an ExposomeSet, plotPCA to plot the PCA, ExposomePCA as main class
data("exposome") epca <- pca(expo[3:7, 1:100]) # A grid with exposures space, samples space and explained variance plotPCA(epca, set = "all") # Only exposures space plotPCA(epca, set = "exposures") + ggplot2::theme(legend.position = "bottom") # Only samples space plotPCA(epca, set = "samples") # Only samples space but coloured by phenotype plotPCA(epca, set = "samples", phenotype = "sex") + ggplot2::theme(legend.position = "bottom")
data("exposome") epca <- pca(expo[3:7, 1:100]) # A grid with exposures space, samples space and explained variance plotPCA(epca, set = "all") # Only exposures space plotPCA(epca, set = "exposures") + ggplot2::theme(legend.position = "bottom") # Only samples space plotPCA(epca, set = "samples") # Only samples space but coloured by phenotype plotPCA(epca, set = "samples", phenotype = "sex") + ggplot2::theme(legend.position = "bottom")
Function used to plot the association between the phentoypes in an ExposomePCA and the values for each component of the PCA in the same ExposomePCA
plotPHE(object, phenotype, exp2fac = 5)
plotPHE(object, phenotype, exp2fac = 5)
object |
An object oc class ExposomePCA |
phenotype |
(optional) to select a set of phenotypes to be ploted. If not given all are used. |
exp2fac |
(default, |
An object of class ggplot
.
pca to compute PCA on an ExposomeSet, plotEXP to plot the correlation between exposures ans PCA, ExposomePCA as main class
data("exposome") epca <- pca(expo[3:7, 1:100]) plotPHE(epca)
data("exposome") epca <- pca(expo[3:7, 1:100]) plotPHE(epca)
ExWAS
objectThis function draws a sort of manhattan plots using the p-value of the
association of the exposures with phenotypes of an ExWAS
object.
plotVolcano(x, p.value = -log10(0.001), labels, show.effect = FALSE)
plotVolcano(x, p.value = -log10(0.001), labels, show.effect = FALSE)
x |
An |
p.value |
(default |
labels |
(optional) Character vector with the labels for each exposure. It must be labeled vector. |
show.effect |
(default |
An object of class ggplot
.
exwas
as a constructor for ExWAS
objects, extract
to obtain a table with the result of
the ExWAS, plotEffect
to see or compare effects of
one or two models.
Given the files that defines the exposome (measures of exposome, exposome description and individuals phentype) it loads them and creates an object of type ExposomeSet.
readExposome( exposures, description, phenotype, sep = ",", na.strings = c("NA", "-", "?", " ", ""), exposures.samCol = "sample", description.expCol = "exposure", description.famCol = "family", phenotype.samCol = "sample", exposures.asFactor = 5, warnings = TRUE )
readExposome( exposures, description, phenotype, sep = ",", na.strings = c("NA", "-", "?", " ", ""), exposures.samCol = "sample", description.expCol = "exposure", description.famCol = "family", phenotype.samCol = "sample", exposures.asFactor = 5, warnings = TRUE )
exposures |
String with the path to the file with the matrix of exposures. |
description |
String with the path to the file with the description of the exposures (relation between exposures and exposure-family). |
phenotype |
String with the path to the file with the phenotypes of interest. |
sep |
(default |
na.strings |
(default |
exposures.samCol |
(default |
description.expCol |
(default |
description.famCol |
(default |
phenotype.samCol |
(default |
exposures.asFactor |
(default |
warnings |
(default |
The rows of the exposure's file, that corresponds to samples' names, must be the same than the phenotype's file. In the same way, the columns in exposure's file must be the same found as rows in description file.
An object of class ExposomeSet.
ExposomeSet's fData
will contain some inner columns
called .std
, .trn
, .fct
and .type
in order to
trace the transformations an exposure suffers and to know, at eny moment, if
an exposure is categorical or continuous. The "description" file can
contains a column called type
with values "factor"
and
"numeric"
to speficy how an exposure needs to be understood. If
given, this column will be renamed to .type
. If not given, it will
be created using exposures.asFactor
value.
ExposomeSet for class description,
loadExposome for constructor from loaded
data.frame
s
## Locate the data-files path <- file.path(path.package("rexposome"), "extdata") description <- file.path(path, "description.csv") phenotype <- file.path(path, "phenotypes.csv") exposures <- file.path(path, "exposures.csv") ## Create ExposomeSet from files exp <- readExposome( exposures = exposures, description = description, phenotype = phenotype, exposures.samCol = 1, description.expCol = 2, description.famCol = 1, phenotype.samCol = 1 )
## Locate the data-files path <- file.path(path.package("rexposome"), "extdata") description <- file.path(path, "description.csv") phenotype <- file.path(path, "phenotypes.csv") exposures <- file.path(path, "exposures.csv") ## Create ExposomeSet from files exp <- readExposome( exposures = exposures, description = description, phenotype = phenotype, exposures.samCol = 1, description.expCol = 2, description.famCol = 1, phenotype.samCol = 1 )
#' @section exposures loading and exposures managment:
rexposome
offers two methods to bring exposome data to R and
Bioconductor. readExposome
allows to read three txt-like
files (.csv
, .tsv
, ...) while loadExposome
is sued with matrix
and data.frame
s. The class obtained is
an ExposomeSet
, a class based in eSet
for exposome
data managment.
The packages offers a wide set of functions to preprocess exposome data.
Method trans
allow to transforms the exposures, method
normalityTest
allows to check for normality in exposome,
standardize
allows to standardize the exposures, among others.
Finally, impute
and ilod
allow tu use mice
,
Hmisc
and imputeLCMD
for exposure missing data and exposure
under-lod data imputation.
the two methods exwas
and mexwas
allows to test
the association between exposures and health outcomes (phenotpe data).
The methods plotFamily
allows to see how the exposures
behaves within families. plotCorrelation
helps to understand
how exposures are related between themselves. plotClassification
allos to visually detect cuslters of samples that share the same pattern
of levels of exposures.
"exposures"
or "phenotypes"
).
#' @param select Subseting of exposures of phenotypes.
#' @return A basic description of the exposures in the ExposomeSet
#' @examples
#' data("exposome")
#' Summary(expo, set = "exposures")
#' @export Summary
setGeneric("Summary", function(object, set=c("exposures", "phenotypes"),
select)
standardGeneric("Summary")
)
Standardize of an ExposomeSet.Given an ExposomeSet it standardizes the exposures by using mean/sd
if method is "normal"
or by using median/mad if method is
"robust"
.
standardize(object, select, method = "normal", na.rm = TRUE, warnings = TRUE)
standardize(object, select, method = "normal", na.rm = TRUE, warnings = TRUE)
object |
|
select |
Subseting of exposures of phenotypes. |
method |
(default |
na.rm |
(by default |
warnings |
(defaulr |
An ExposomeSet
with the selected exposures standardized and
keeping the others exposures as the original input object.
highAndLow to transform the continuous exposures to levelled factors, trans to transform the exposures
data("exposome") exp.sn <- standardize(expo, method = "normal", select = "lbde100_lip") exp.rs <- standardize(expo, method = "iqr", select = "lbde100_lip") exp.rs <- standardize(expo, method = "robust", select = "lbde100_lip")
data("exposome") exp.sn <- standardize(expo, method = "normal", select = "lbde100_lip") exp.rs <- standardize(expo, method = "iqr", select = "lbde100_lip") exp.rs <- standardize(expo, method = "robust", select = "lbde100_lip")
This function can be used to obtain a table with the under-LOD data in exposures of an ExposomeSet.
tableLOD(object, output = "n", lod.col = "LOD", sort = TRUE)
tableLOD(object, output = "n", lod.col = "LOD", sort = TRUE)
object |
ExposomeSet which exposome will be plotted. |
output |
(default |
lod.col |
(default |
sort |
(default |
A numeric vector with number of udner-LOD values per exposure. The vector is labeled with the exposure's names.
plotFamily to draw the profile of a family of exposures, plotHistogram to draw the shape of an exposure, plotMissings to draw a plot with the missing data an ExposomeSet, imputation to impute missing data on the exposures of an ExposomeSet
data("exposome") # The included has no missing data tableLOD(expo, output = "n")
data("exposome") # The included has no missing data tableLOD(expo, output = "n")
This function can be used to obtain a table with the missing data in exposures and in phenotypes of an ExposomeSet.
tableMissings(object, set, output = "n", sort = TRUE)
tableMissings(object, set, output = "n", sort = TRUE)
object |
ExposomeSet which exposome will be plotted. |
set |
Can be set to |
output |
(default |
sort |
(default |
A numeric vector with number of missing values per exposure. The vector is labeled with the exposure's names.
plotFamily to draw the profile of a family of exposures, plotHistogram to draw the shape of an exposure, plotMissings to draw a plot with the missing data an ExposomeSet, imputation to impute missing data on the exposures of an ExposomeSet
data("exposome") # The included has no missing data tableMissings(expo, set = "exposures") tableMissings(expo, set = "phenotypes")
data("exposome") # The included has no missing data tableMissings(expo, set = "exposures") tableMissings(expo, set = "phenotypes")
Function to get the Threshold for effective tests (TEF)
tef(object)
tef(object)
object |
An |
A number indicating the efective threshold.
Evaluating the effective numbers of independent tests and significant p-value thresholds in commercial genotyping arrays and public imputation reference datasets. Miao-Xin Li, Juilian M. Y. Yeung, Stacey S. Cherny and Pak C. Sham. May 2012 Hum Genet.
exwas as a constructor for ExWAS objects
data(exposome) w1 <- exwas(expo[1:5, ], asthma~1, family = "binomial") w2 <- exwas(expo[1:5, ], asthma~sex+age, family = "binomial") tef(w1) tef(w2)
data(exposome) w1 <- exwas(expo[1:5, ], asthma~1, family = "binomial") w2 <- exwas(expo[1:5, ], asthma~sex+age, family = "binomial") tef(w1) tef(w2)
This methods allows to select an imputed-set and use it to create an
ExposomeSet
from an imExposomeSet
.
toES(object, rid = 1)
toES(object, rid = 1)
object |
An object of class |
rid |
(default |
An object of class ExposomeSet
-
data("ex_imp") toES(ex_imp, rid = 1)
data("ex_imp") toES(ex_imp, rid = 1)
The exposures in an ExposomeSet can be transformed using this
function. transform
apples a function fun
to the selected
exposures.
trans(object, fun, select, by.exposure = FALSE, ...)
trans(object, fun, select, by.exposure = FALSE, ...)
object |
|
fun |
Function to be applied on the exposures. |
select |
If not set, receive the name of all exposures. It can takes a character vector to select specific exposures. |
by.exposure |
(default |
... |
Argument given to |
A new ExposomeSet
with selected exposures transformed with
fun
.
highAndLow to transform the continuous exposures to levelled factors, standardize to standardize by normal or robust methods the exposures
data("exposome") exp.t <- trans(expo, fun = log, select = "ldde_lip")
data("exposome") exp.t <- trans(expo, fun = log, select = "ldde_lip")
Function that takes two numeric vectors (P-Value and fold change) and draws a volcano plot using ggplot2
volcano_plot( pval, fc, names, size = 2, tFC = 2, tPV = -log10(0.001), show.effect = FALSE )
volcano_plot( pval, fc, names, size = 2, tFC = 2, tPV = -log10(0.001), show.effect = FALSE )
pval |
numeric vector of P.Values |
fc |
numeric vector of fold change |
names |
character vector with the feature's names. |
size |
(default |
tFC |
(default |
tPV |
(default |
show.effect |
(default |
A ggplot
object
data(exposome) w1 <- extract(exwas(expo[1:20, ], asthma~1, family = "binomial")) volcano_plot(w1$pvalue, w1$effect, rownames(w1))
data(exposome) w1 <- extract(exwas(expo[1:20, ], asthma~1, family = "binomial")) volcano_plot(w1$pvalue, w1$effect, rownames(w1))