Title: | Statistical Analysis of Metabolomic Data |
---|---|
Description: | The MAIT package contains functions to perform end-to-end statistical analysis of LC/MS Metabolomic Data. Special emphasis is put on peak annotation and in modular function design of the functions. |
Authors: | Francesc Fernandez-Albert, Rafael Llorach, Cristina Andres-LaCueva, Alexandre Perera |
Maintainer: | Pol Sola-Santos <[email protected]> |
License: | GPL-2 |
Version: | 1.41.0 |
Built: | 2024-10-31 03:39:59 UTC |
Source: | https://github.com/bioc/MAIT |
This function takes a MAIT-class object having significant features already detected and looks up for biotransformations between them. MAIT has a default biotransformation table that will be used if no other table is specified via the bioTable input parameter.
Biotransformations(MAIT.object = NULL, peakPrecision = 0.005, bioTable = NULL, adductTable = NULL, adductAnnotation = FALSE)
Biotransformations(MAIT.object = NULL, peakPrecision = 0.005, bioTable = NULL, adductTable = NULL, adductAnnotation = FALSE)
MAIT.object |
A MAIT-class object where significant features have already been found. |
peakPrecision |
Maximum difference between the peak masses differences and the values shown in bioTable to be considered as a biotransformation. As default the value is 0.005 Da. |
bioTable |
Table containing the biotransformations to be looked for in the signData input. By default it is taken the MAIT-class biotransformations table. |
adductTable |
Table containing the adducts to be looked for in the signData input. By default it is taken the MAIT-class positive adducts table. If this argument is set to "negAdducts", then the default table for negative adducts is taken instead. It is possible to use a user-defined adduct table |
adductAnnotation |
If it is set to TRUE, both adduct and Biotransformations annotation stages are performed. |
A MAIT-class object with the updated biotransformations slot
Francesc Fernandez, [email protected]
spectralAnova
spectralTStudent
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-Biotransformations(MAIT.object = MAIT, peakPrecision = 0.005) MAIT@FeatureInfo@biotransformations; #Detected Biotransformations
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-Biotransformations(MAIT.object = MAIT, peakPrecision = 0.005) MAIT@FeatureInfo@biotransformations; #Detected Biotransformations
This table contains the biotransformations to be looked up for.
A table having the fields:
NAME: The name of the biotransformation
MASSDIFF: The mass difference of the fragment caused by the biotransformation
Francesc Fernandez, [email protected]
Function classes
extracts the class names of a linkMAIT-class object as a vector.
classes(MAIT.object)
classes(MAIT.object)
MAIT.object |
A MAIT-class object |
A character vector containing the class names of the MAIT-class object
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT classes(MAIT)
data(MAIT_sample) MAIT classes(MAIT)
Function classifRatioClasses
extracts the class classification ratio of a MAIT object as a matrix.
classifRatioClasses(MAIT.object)
classifRatioClasses(MAIT.object)
MAIT.object |
A MAIT-class object where function Validation has already been launched successfully. |
A matrix containing the classification ratio for each class, classifier and iteration.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT) classifRatioClasses(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT) classifRatioClasses(MAIT)
Function classNum
extracts the number of samples belonging to each class of a MAIT object as a vector.
classNum(MAIT.object)
classNum(MAIT.object)
MAIT.object |
A MAIT-class object |
A numeric vector containing the number of samples for each class of the MAIT object. The order of the classes correspond to that of the output of function classes.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT classNum(MAIT)
data(MAIT_sample) MAIT classNum(MAIT)
The Human Metabolome Database is saved in this dataframe.
A table having the fields:
ENTRY: HMDB entry
NAME: The compound name
FORMULA: The chemical formula of the compound
MASS: Mass of the fragment
Biofluid: Where the compound can be found
Francesc Fernandez, [email protected]
identifyMetabolites
metaboliteTable
Function featureID
extracts the feature IDs of a MAIT object as a vector.
featureID(MAIT.object)
featureID(MAIT.object)
MAIT.object |
A MAIT-class object |
A numeric vector containing the feature IDs of the MAIT object.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) featureID(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) featureID(MAIT)
Function featureInfo
extracts the slot MAIT.FeatureInfo of a MAIT object.
featureInfo(MAIT.object)
featureInfo(MAIT.object)
MAIT.object |
A MAIT-class object |
An object of the class MAIT.FeatureInfo. More Info at MAIT-class.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) featureInfo(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) featureInfo(MAIT)
Function featureSigID
extracts the vector index of the feature IDs of a MAIT object that have been found significant through function spectralSigFeatures.
featureSigID(MAIT.object)
featureSigID(MAIT.object)
MAIT.object |
A MAIT-class object |
A numeric vector containing the statistically significant feature IDs of the MAIT object.
Francesc Fernandez, [email protected]
MAIT-class
spectralSigFeatures
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) featureSigID(MAIT) featureID(MAIT)[featureSigID(MAIT)] #Significant spectra IDs
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) featureSigID(MAIT) featureID(MAIT)[featureSigID(MAIT)] #Significant spectra IDs
Function getScoresTable takes an MAIT-class
object and returns a list with the scores of the features in the samples. Additionally, it returns the spectral ID of the peak and (optionally) a table containing the peak information (mass, retention time and annotation).
getScoresTable(MAIT.object = NULL, getSpectra = TRUE, getExtendedTable = FALSE)
getScoresTable(MAIT.object = NULL, getSpectra = TRUE, getExtendedTable = FALSE)
MAIT.object |
A MAIT-class object where significant features have already been found. |
getSpectra |
If it is set to TRUE, an element of the returned list will contain the spectra ID of each feature. |
getExtendedTable |
If it is set to TRUE, an element of the returned list will contain a table with peak information (mass, retention time, annotation, intensity per sample) |
A list containing:
scores: The intensity of each feature per sample
spectraID: A numeric with the correspondence between peaks and spectral ID
extendedTable: a data frame containg detailed peak information (mass, retention time, annotation, intensity per sample).
Francesc Fernandez, [email protected]
spectralTStudent
spectralAnova
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) getScoresTable(MAIT,getExtendedTable=TRUE)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) getScoresTable(MAIT,getExtendedTable=TRUE)
Takes a MAIT object and performs the metabolite search for the significant features
identifyMetabolites(MAIT.object=NULL, peakTolerance=0.005, database=NULL, polarity="positive", printCSVfile=TRUE)
identifyMetabolites(MAIT.object=NULL, peakTolerance=0.005, database=NULL, polarity="positive", printCSVfile=TRUE)
MAIT.object |
A MAIT-class object where significant features have already been found. |
peakTolerance |
Maximum difference between the peak masses differences and the values shown in the database to be considered as a match. As default the value is 0.005 Da. |
database |
User-defined input table. If it is set to NULL, the default MAIT database is selected to perform the metabolite identification. |
polarity |
Character parameter that can be set to "positive" or "negative" depending on the polarity in which the samples were taken. |
printCSVfile |
Set to TRUE if an output table has to be produced. The table should be found in (working directory)/Tables/SearchTable.csv. |
An output table is stored in the folder (working directory)/Tables/SearchTable.csv if printCSVfile
is set to TRUE. More info at metaboliteTable
Francesc Fernandez, [email protected]
Biotransformations
spectralSigFeatures
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-Biotransformations(MAIT.object = MAIT, peakPrecision = 0.005) MAIT <- identifyMetabolites(MAIT.object = MAIT, peakTolerance = 0.005,polarity="positive")
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-Biotransformations(MAIT.object = MAIT, peakPrecision = 0.005) MAIT <- identifyMetabolites(MAIT.object = MAIT, peakTolerance = 0.005,polarity="positive")
Function loadings
returns the loading vectors for either the PCA, PLS models when functions plotPCA
or plotPLS
have been already respectively launched. It also can be used to retrieve the peak aggregation models.
loadings(object, type = "none", ...)
loadings(object, type = "none", ...)
object |
A MAIT-class object |
type |
A character whose value should be "PCA" or "PLS" depending on which loading vectors are wanted. If it is set to "none", the peak aggregation models are retrieved. |
... |
Other input |
A matrix with the loading vectors.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) loadings(MAIT) MAIT<-plotPCA(MAIT,plot3d=FALSE) loadings(MAIT,type="PCA") MAIT<-plotPLS(MAIT,plot3d=FALSE) loadings(MAIT,type="PLS")
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) loadings(MAIT) MAIT<-plotPCA(MAIT,plot3d=FALSE) loadings(MAIT,type="PCA") MAIT<-plotPLS(MAIT,plot3d=FALSE) loadings(MAIT,type="PLS")
Function LSDResults
extracts the results of the LSD tests of a MAIT object as a matrix.
LSDResults(MAIT.object)
LSDResults(MAIT.object)
MAIT.object |
A MAIT-class object |
A matrix containing the results of the Fisher's LSD tests. For each row, equal letters mean that the groups are found to be equal in the test.
Francesc Fernandez, [email protected]
MAIT-class
FisherLSD
spectralSigFeatures
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) LSDResults(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) LSDResults(MAIT)
A MAIT-class object containing simulated LC/MS data
MAIT.object |
A MAIT-class object |
Francesc Fernandez, [email protected]
"MAIT"
MAIT class objects are used in the MAIT package to perform the analysis and statistical calculus of LC/MS data. It has 5 main slots: FeatureInfo, RawData, Validation, PhenoData and FeatureData
FeatureInfo
:Object of class MAIT.FeatureInfo-class
RawData
:Object of class MAIT.RawData-class
Validation
:Object of class MAIT.Validation-class
PhenoData
:Object of class MAIT.PhenoData-class
FeatureData
:Object of class MAIT.FeatureData-class
signature(object = "MAIT")
: This function show a summary of the workflow results performed so far including the classification results and the parameters used.
signature(object = "MAIT")
: returns the model for either the PCA, PLS models when functions plotPCA
or plotPLS
have been already respectively launched.
signature(object = "MAIT")
: Retrieves the scores from a MAIT object
signature(object = "MAIT")
: Retrieves the loadings from a MAIT object
Francesc Fernandez, [email protected]
"MAIT.FeatureData"
MAIT.FeatureData objects are used in the MAIT package to save the feature data.
scores
:Here it is saved the dataset obtained after applying the peakAggregation function.
featureID
:The ID numbers of all features are saved here.
featureSigID
:The ID numbers of the significant features are saved here.
LSDResults
:The results of performing a Fisher LSD test on each significant variable are saved in this slot.
models
:The model for each feature used to obtain the scores are saved in this slot.
pvalues
:In this slot are saved the pvalues of the features.
pvaluesCorrection
:The pvalues corrected by multiple test correction are saved here.
pcaModel
:PCA model generated using the function plotPCA
.
plsModel
:PCA model generated using the function plotPLS
.
masses
:Masses used as an input for the function MAITbuilder
.
rt
:Retention time values used as an input for the function MAITbuilder
.
extendedTable
:Dataframe containing the information regarding masses, retention time values, intensity and spectra IDs
passes as an input for the function MAITbuilder
Francesc Fernandez, [email protected]
"MAIT.FeatureInfo"
MAIT.FeatureInfo objects are used in the MAIT package to save the data related to the information of the features.
It stores information related to the features. It contains three extra slots:
biotransformations
:Biotransformations found when function Biotransformations is launched.
peakAgMethod
:In this slot is stored the table created by the function identifyMetabolites. It can be retrieved quickly in R by using the function metaboliteTable
metaboliteTable
:Peak Aggregation Method used when function peakAggregation is launched.
No methods defined with class "MAIT.FeatureInfo" in the signature.
Francesc Fernandez, [email protected]
"MAIT.Parameters"
This class contains all the parameters used in the MAIT run.
sampleProcessing
:List containing the parameters of the function sampleProcessing
peakAnnotation
:List containing the parameters of the function peakAnnotation
peakAggregation
:List containing the parameters of the function peakAggregation
sigFeatures
:List containing the parameters of the function spectralSigFeatures
biotransformations
:List containing the parameters of the function Biotransformations
identifyMetabolites
:List containing the parameters of the function identifyMetabolites
classification
:List containing the parameters of the function Validation
plotPCA
:List containing the parameters of the function plotPCA
plotPLS
:List containing the parameters of the function plotPLS
plotHeatmap
:List containing the parameters of the function plotHeatmap
Francesc Fernandez, [email protected]
"MAIT.PhenoData"
MAIT.PhenoData objects are used in the MAIT package to save the phenotype data.
Objects can be created by calls of the form new("MAIT.PhenoData", ...)
.
The information related to the classes present in the data is stored in this slot. It has three different extra slots:
classes
:It contains the name of the classes in the data. It can be quickly accessed by using the function classes
classNum
:Vector showing the number of samples belonging to each class. It can be quickly accessed by using the function classNum
resultsPath
:In this slot is saved the direction where the project is saved. This means that all the output tables and files of the MAIT object are going to be stored in that directory. It can be quickly accessed by using the function resultsPath
Francesc Fernandez, [email protected]
"MAIT.RawData"
MAIT.RawData objects are used in the MAIT package to save the data related to the information of the features.
This class contains information of the raw data and the parameters of the whole analysis. It has two slots:
parameters
:All the parameters of the analysis are saved in this slot. It can be obtained as a matrix in R by typing summary(parameters(MAIT.object))
data
:This slot contains either the xcmsSet-class or the xsAnnotate object, depending if the function peakAnnotation has already been launched
No methods defined with class "MAIT.RawData" in the signature.
Francesc Fernandez, [email protected]
"MAIT.Validation"
MAIT.Validation objects are used in the MAIT package to save the validation results obtained from the classification run.
The information related to the run of the function Validation is saved here. It contains three lots:
ovClassifRatioTable
:Summary table showing the overall classification ratios for each of the three classifiers. It can be quickly gathered by using the function ovClassifRatioTable
ovClassifRatioData
:All the data corresponding to the overall classification ratios. It can be quickly gathered by using the function ovClassifRatioData
classifRatioClasses
:All the data corresponding to the classification ratios per class. It can be quickly gathered by using the function classifRatioClasses
Francesc Fernandez, [email protected]
Function MAITbuilder creates a MAIT-class object for a given external data. This process allows the user to analyse external peak data through all the MAIT processing steps.
MAITbuilder(data = NULL, spectraID = NULL, masses = NULL, rt = NULL, classes = NULL, significantFeatures = FALSE, spectraEstimation = FALSE, rtRange = 0.2, corThresh = 0.7)
MAITbuilder(data = NULL, spectraID = NULL, masses = NULL, rt = NULL, classes = NULL, significantFeatures = FALSE, spectraEstimation = FALSE, rtRange = 0.2, corThresh = 0.7)
data |
Matrix containing the peak intensity values for each sample. Each row should correspond to a peak and each column to a sample. |
spectraID |
Numeric corresponding to the peak spectral grouping IDs.Two peaks having the same spectraID means that they correspond to the same spectrum. |
masses |
Numeric that contains the masses of the peaks. It should be as long as the number of rows in the argument data. |
rt |
Numeric that contains the retention time of the peaks. It should be as long as the number of rows in the argument data. |
classes |
Character with the class labels for each sample. It should be as long as the number of columns in the argument data. |
significantFeatures |
If it is set to TRUE, all the features set as an input are considered to be significant. Funcions Biotransformations, identifyMetabolites, Validation, plotPCA, plotPLS, plotHeatmap, plotBoxplot are computed on the significant features only. If it is only wanted to perform an annotation process on the external peak data, this flag should be set to TRUE. |
spectraEstimation |
If it is set to TRUE, an estimation of the peak grouping into spectra is performed. This computation is based on a retention time window (set by the argument rtRange) and a correlation threshold (defined by the parameter corThresh). |
rtRange |
Retention time parameter used to build a window to perform an estimation of the peak grouping into spectra. |
corThresh |
Peak correlation value used to define a threshhol to perform an estimation of the peak grouping into spectra. |
All the imput values are stored in a new MAIT object.
Francesc Fernandez, [email protected]
data(MAIT_sample) peaks<-scores(MAIT) aux<-getScoresTable(MAIT) masses<-aux$extendedTable$mz rt <- aux$extendedTable$rt classFactor <- rep(classes(MAIT),classNum(MAIT)) importMAIT <- MAITbuilder (data=peaks,masses=masses,rt=rt, significantFeatures=TRUE, spectraEstimation=TRUE, rtRange=0.2, corThresh=0.7,classes=classFactor) importMAIT
data(MAIT_sample) peaks<-scores(MAIT) aux<-getScoresTable(MAIT) masses<-aux$extendedTable$mz rt <- aux$extendedTable$rt classFactor <- rep(classes(MAIT),classNum(MAIT)) importMAIT <- MAITbuilder (data=peaks,masses=masses,rt=rt, significantFeatures=TRUE, spectraEstimation=TRUE, rtRange=0.2, corThresh=0.7,classes=classFactor) importMAIT
Takes a MAIT-class
object and builds a table with the information related to the significant features and their possible identifications.
metaboliteTable(MAIT.object, printCSVfile = FALSE)
metaboliteTable(MAIT.object, printCSVfile = FALSE)
MAIT.object |
A MAIT-class object where significant features have already been found. |
printCSVfile |
A boolean parameter. Set to TRUE if a csv file should be written with the metabolite table. |
An output table is stored in the folder (working directory)/Tables/SearchTable.csv having the fields:
First column: search ID number.
Second column (mz): Peak mass.
Third column(rt): Peak retention time (in minutes).
The columns from the third to the column labeled "p.adj" contain number of class samples where the peak has been detected and the intensities of the peak among samples.
The P.adjust column contains the corrected peak p-value using bonferroni.
The p column shows the peak p-value with no multiple test correction.
The Fisher column shows the FIsher test results for the peak. Each of the letters separated by the character "_" corresponds to a class value. Classes having the same letters are indistinguible whereas those having different letters are statistically different clases.
The isotopes column shows if the peak has been identified as a possible isotope.
The adduct column shows which kind of adduct or biotransformation could the peak be.
Column Name contains the name of the possible metabolite identification for the peak.
The column labeled spectra contains the spectral ID of the peak.
Column Biofluid shows if the identified search is stored as a biofluid in the input database or not.
The column ENTRY shows the database name of the entry for the metabolite.
Francesc Fernandez, [email protected]
identifyMetabolites
spectralAnova
spectralTStudent
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-Biotransformations(MAIT.object = MAIT, peakPrecision = 0.005) MAIT <- identifyMetabolites(MAIT.object = MAIT, peakTolerance = 0.005,polarity="positive") head(metaboliteTable(MAIT))
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-Biotransformations(MAIT.object = MAIT, peakPrecision = 0.005) MAIT <- identifyMetabolites(MAIT.object = MAIT, peakTolerance = 0.005,polarity="positive") head(metaboliteTable(MAIT))
Function model
returns the model for either the PCA, PLS models when functions plotPCA
or plotPLS
have been already respectively launched.
model(x,type)
model(x,type)
x |
A MAIT-class object |
type |
A character whose value should be "PCA" or "PLS" depending on which loading vectors are wanted. |
The PCA or PLS model
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotPCA(MAIT,plot3d=FALSE) model(MAIT,type="PCA") MAIT<-plotPLS(MAIT,plot3d=FALSE) model(MAIT,type="PLS")
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotPCA(MAIT,plot3d=FALSE) model(MAIT,type="PCA") MAIT<-plotPLS(MAIT,plot3d=FALSE) model(MAIT,type="PLS")
Function models
extracts the models of a MAIT object as a list.
models(MAIT.object)
models(MAIT.object)
MAIT.object |
A MAIT-class object |
A list containing the models of the MAIT object.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) models(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) models(MAIT)
This table contains the adducts to be looked up for when the LC/MS polarisation mode was set to Negative. The layout of the table is that of the CAMERA
adduct table.
A table having the fields:
ID: An ID number
name: The adduct name
nmol: Number of fragments in the adduct
charge: Electric charge of the adduct
massdiff: Mass difference in the fragment caused by the adduct
oidscore: Numeric relating the related clusters of ions
quasi: Binary value showing the validness of the annotation group
ips: Four values are possible (0.25,0.5,0.75,1) depending on the likelihood of the rule
Francesc Fernandez, [email protected]
Function ovClassifRatioData
extracts the overall classification ratio for a MAIT-class object
ovClassifRatioData(MAIT.object)
ovClassifRatioData(MAIT.object)
MAIT.object |
A MAIT-class object |
A list containing the overall classification ratio of the MAIT-class object for each classifier.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT) ovClassifRatioData(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT) ovClassifRatioData(MAIT)
Function ovClassifRatioData
extracts the overall classification table for a MAIT-class
object
ovClassifRatioTable(MAIT.object)
ovClassifRatioTable(MAIT.object)
MAIT.object |
A MAIT-class object |
A list containing the overall classification table of the MAIT object for each classifier showing the mean value and their standard error.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT) ovClassifRatioTable(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT) ovClassifRatioTable(MAIT)
Function parameters
extracts the slot linkMAIT.Parameters-class of a MAIT-class
object. This class contains all the parameters that have been used in the previous functions. Typing a summary of this object, a matrix version of the parameters is obtained.
parameters(MAIT.object)
parameters(MAIT.object)
MAIT.object |
A MAIT-class object |
An object of the class MAIT.Parameters.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT) parameters(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT) parameters(MAIT)
peakAnnotation function performs spectra building and peak annotation using the CAMERA package on a MAIT-class object, after applying the sampleProcessing function. The resultant xsAnnotate object is stored in a MAIT-class object.
peakAnnotation(MAIT.object = NULL, corrWithSamp = 0.7, perfwhm = 0.6, sigma = 6, adductTable = NULL, printSpectraTable = TRUE, corrBetSamp = 0.75, pval = 0.05, calcIso = TRUE, calcCiS = TRUE, calcCaS = TRUE, graphMethod = "hcs", annotateAdducts = TRUE)
peakAnnotation(MAIT.object = NULL, corrWithSamp = 0.7, perfwhm = 0.6, sigma = 6, adductTable = NULL, printSpectraTable = TRUE, corrBetSamp = 0.75, pval = 0.05, calcIso = TRUE, calcCiS = TRUE, calcCaS = TRUE, graphMethod = "hcs", annotateAdducts = TRUE)
MAIT.object |
A MAIT-class object where function sampleProcessing has already been applied. The output of the function is going to be an update of the same MAIT-class object. |
corrWithSamp |
Correlation threshold value within samples |
perfwhm |
This parameter is used to group two peaks depending on their retention time. Two peaks are considered to be coeluted if their retention time falls in a range defined as Rt_med +/- FWHM * perfwhm. Where Rt_med is the retention time median and FWHM is the Full Width at Half Maximum. Defined this way, perfwhm is the percentage of the width of the FWHM (Full Width at Half Maximum) |
sigma |
Defining the coelution range as defined in the perfwhm variable, the FWHM is obtained by the expression FWHM=SD*sigma, where SD is calculated considering the peak as normally distributed. |
adductTable |
User-defined input table to annotate the peaks. If it is set to NULL, the default MAIT table for adducts in positive polarization is selected. If its value is "negAdducts", the default MAIT table for fragments in negative polarization is chosen. By default it is set to NULL. |
printSpectraTable |
If it is set to TRUE, a three-column table is build as a csv file, where the first column shows the peak mass, the second column its retention time and the third one shows its spectral ID number. This file is saved under the project directory, in the subfolder named Tables. |
corrBetSamp |
Correlation threshold value between samples |
pval |
See groupCorr function in the CAMERA package |
calcIso |
See groupCorr function in the CAMERA package |
calcCiS |
See groupCorr function in the CAMERA package |
calcCaS |
See groupCorr function in the CAMERA package |
graphMethod |
See groupCorr function in the CAMERA package |
annotateAdducts |
If it is set to TRUE, the function will perform an adduct annotation stage. |
A MAIT-class object containing the xsAnnotate-class in the rawData slot.
Francesc Fernandez, [email protected]
#Provided that the data files are saved accordingly #in subfolders under a folder named "data" (see vignette): #MAIT<-sampleProcessing(dataDir = "data", project = "Results", snThres=2,rtStep=0.02) #MAIT<-peakAnnotation(MAIT.object = MAIT,corrWithSamp = 0.7, corrBetSamp = 0.7,perfwhm = 0.6)
#Provided that the data files are saved accordingly #in subfolders under a folder named "data" (see vignette): #MAIT<-sampleProcessing(dataDir = "data", project = "Results", snThres=2,rtStep=0.02) #MAIT<-peakAnnotation(MAIT.object = MAIT,corrWithSamp = 0.7, corrBetSamp = 0.7,perfwhm = 0.6)
This function takes a MAIT-class object containing information related to the significant features and plots a boxplot for each significant feature (peak or spectra).
plotBoxplot(MAIT.object=NULL)
plotBoxplot(MAIT.object=NULL)
MAIT.object |
A MAIT-class object where significant features have already been found. |
A boxplot is stored as a png file for each of the significant features (peak or spectra). The files will be stored in the directory (working directory)/Boxplots
Francesc Fernandez, [email protected]
spectralAnova
spectralTStudent
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotBoxplot(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotBoxplot(MAIT)
This function takes a MAIT object containing information of the significant features in the data and plots 10 heatmaps. 5 diferent p-values (0.05, 0.01, 0.001, 1e-4 and 1e-5) and two clustering distances (euclidean and pearson) are used.
plotHeatmap(MAIT.object=NULL)
plotHeatmap(MAIT.object=NULL)
MAIT.object |
A MAIT-class object where significant features have already been found. |
10 different heatmaps using 5 p-values (0.05, 0.01, 0.001, 1e-4 and 1e-5) and two clustering distances (euclidean and pearson) are created. The plots will be stored as png files in a folder called (working directory)/Heatmaps
Francesc Fernandez, [email protected]
spectralAnova
spectralTStudent
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotHeatmap(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotHeatmap(MAIT)
This function takes a MAIT-class object containing information of the significant features in the data and performs 2D scoreplots (PC1 vs PC2, PC2 vs PC3 and PC1 vs PC3) saved as png files. Additionally it also performs an interactive 3D PCA scoreplot.
plotPCA (MAIT.object=NULL, Log=FALSE, center=TRUE, scale=TRUE, plot3d=TRUE)
plotPCA (MAIT.object=NULL, Log=FALSE, center=TRUE, scale=TRUE, plot3d=TRUE)
MAIT.object |
A MAIT-class object where significant features have already been found. |
Log |
Set to TRUE if the data should be plotted using the logarithm of the intensity. |
center |
Set to TRUE if the data should be centered around its mean. See |
scale |
Set to TRUE if the data should be scaled. See |
plot3d |
Boolean set to TRUE if a 3D PCA scoreplot should be plot. |
Three different PCA scoreplots are printed in three png files. One using PC1 vs PC2, another with PC1 vs PC3 and the last one with PC2 vs PC3. The files will be stored in the directory (working directory)/PCA_Scoreplots. Moreover, an interactive 3D PCA scoreplot is also generated through function PCAplot3d.
Francesc Fernandez, [email protected]
spectralAnova
spectralTStudent
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotPCA(MAIT,plot3d=FALSE)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotPCA(MAIT,plot3d=FALSE)
This function takes a MAIT-class object containing information of the significant features in the data and performs 2D scoreplots (PC1 vs PC2, PC2 vs PC3 and PC1 vs PC3) saved as png files. Additionally it also performs an interactive 3D PLS scoreplot.
plotPLS (MAIT.object=NULL, Log=FALSE, center=TRUE, scale=TRUE, plot3d=TRUE)
plotPLS (MAIT.object=NULL, Log=FALSE, center=TRUE, scale=TRUE, plot3d=TRUE)
MAIT.object |
A MAIT-class object where significant features have already been found. |
Log |
Set to TRUE if the data should be plotted using the logarithm of the intensity. |
center |
Set to TRUE if the data should be centered around its mean. See |
scale |
Set to TRUE if the data should be scaled. See |
plot3d |
Boolean set to TRUE if a 3D PCA scoreplot should be plot. |
If the number of components in the PLS is found to be three or more, three different PLS scoreplots are printed in three png files. One using PC1 vs PC2, another with PC1 vs PC3 and the last one with PC2 vs PC3. If the number of components is less than three, all the possible plots of these three are created. The files will be stored in the directory (working directory)/PLS_Scoreplots. Moreover, an interactive 3D PLS scoreplot is also generated through function PCAplot3d.
Francesc Fernandez, [email protected]
spectralAnova
spectralTStudent
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotPLS(MAIT,plot3d=FALSE)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT<-plotPLS(MAIT,plot3d=FALSE)
This table contains the adducts to be looked up for when the LC/MS polarisation mode was set to positive. The layout of the table is that of the CAMERA
adduct table.
A table having the fields:
ID: An ID number
name: The adduct name
nmol: Number of fragments in the adduct
charge: Electric charge of the adduct
massdiff: Mass difference in the fragment caused by the adduct
oidscore: Numeric relating the related clusters of ions
quasi: Binary value showing the validness of the annotation group
ips: Four values are possible (0.25,0.5,0.75,1) depending on the likelihood of the rule
Francesc Fernandez, [email protected]
Function pvalues
extracts the pvalues contained in a MAIT-class
object.
pvalues(MAIT.object)
pvalues(MAIT.object)
MAIT.object |
A MAIT-class object |
A numeric vector containing the pvalues of a MAIT-class object.
Francesc Fernandez, [email protected]
MAIT-class
spectralSigFeatures
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) pvalues(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) pvalues(MAIT)
Function pvaluesCorrection
returns a character showing wheter some multiple testing correction has been perfomed on the p-values.
pvaluesCorrection(MAIT.object)
pvaluesCorrection(MAIT.object)
MAIT.object |
A MAIT-class object |
The output is a character whose values could be "None" if no p-value correction has been performed or "Bonferroni" if Bonferroni multiple test correction was selected when function spectralSigFeatures was applied.
Francesc Fernandez, [email protected]
MAIT-class
spectralSigFeatures
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) pvaluesCorrection(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) pvaluesCorrection(MAIT)
Function rawData
extracts the raw data used to build the MAIT-class
object
rawData(MAIT.object)
rawData(MAIT.object)
MAIT.object |
A MAIT-class object |
A list containing either a xcmsSet or a xsAnnotate object.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT rawData(MAIT)
data(MAIT_sample) MAIT rawData(MAIT)
Function resultsPath
returns the folder where the plots and tables are saved for a MAIT-class
object
resultsPath(MAIT.object)
resultsPath(MAIT.object)
MAIT.object |
A MAIT-class object |
A character showing where the plots and tables have been stored.
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) resultsPath(MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) resultsPath(MAIT)
sampleProcessing takes a set of netCDF files containing LC/MS sample data and performs a peak detection, retention time correction and peak grouping steps using the package xcms. A MAIT-class object is created and all the informated is saved in it.
sampleProcessing(dataDir = NULL, snThres = 5, Sigma = 5/2.3548, mzSlices = 0.3, retcorrMethod = "loess", groupMethod = "density", bwGroup = 3, mzWidGroup = 0.25, filterMethod = "centWave", prefilter = c(3,3000), rtStep = 0.03, nSlaves = 0, minfrac = 0.5, minsamp = 1, peakwidth = c(5, 20), project = NULL, ppm = 10, family = c("gaussian", "symmetric"), span = 0.2, fwhm = 30)
sampleProcessing(dataDir = NULL, snThres = 5, Sigma = 5/2.3548, mzSlices = 0.3, retcorrMethod = "loess", groupMethod = "density", bwGroup = 3, mzWidGroup = 0.25, filterMethod = "centWave", prefilter = c(3,3000), rtStep = 0.03, nSlaves = 0, minfrac = 0.5, minsamp = 1, peakwidth = c(5, 20), project = NULL, ppm = 10, family = c("gaussian", "symmetric"), span = 0.2, fwhm = 30)
dataDir |
Folder where the netCDF files are stored. The samples files must be classified in subdirectories according to their classes. |
snThres |
Signal to noise ratio. Setting a high value of this parameter will lead to a higher number of features although they will be more noisy. |
Sigma |
Standard deviation (width) of matched filtration model peak. |
mzSlices |
Minimum difference in m/z for peaks with overlapping retention times. |
retcorrMethod |
Method used to correct the retention times values of the variables. |
groupMethod |
Method used to build the group peaks of variables. |
bwGroup |
Bandwidth (standard deviation or half width at half maximum) of gaussian smoothing kernel to apply to the peak density chromatogram. |
mzWidGroup |
Width of overlapping m/z slices to use for creating peak density chromatograms and grouping peaks across samples. |
filterMethod |
Filtering method applied in the peak detection step. |
prefilter |
c(k, I)specifying the prefilter step for the first analysis step(ROI detection). Mass traces are only retained if they contain at least k peakswith intensity>= I. |
rtStep |
Step size to use for profile generation. |
nSlaves |
Number of slaves for parallel calculus. |
project |
Project folder name under which the results will be saved. This folder will be created in the working directory. |
minfrac |
minimum fraction of samples necessary in at least one of the sample groups for it to be a valid group. See group.density in package xcms for details. |
minsamp |
minimum number of samples necessary in at least one of the sample groups for it to be a valid group. See group.density in package xcms for details. |
ppm |
maxmial tolerated m/z deviation in consecutive scans, in ppm (parts per million). See findPeaks.centWave in package xcms for details. |
peakwidth |
Chromatographic peak width, given as range (min,max) in seconds. |
fwhm |
See fwhm argument in xcmsSet function. |
span |
See span argument in xcmsSet function. |
family |
See family argument in xcmsSet function. |
A MAIT-class object containing the data of the netCDF files. The xcmsSet-class object can be retrieved using the function rawData.
Francesc Fernandez, [email protected]
#Provided that the data files are saved accordingly #in subfolders under a folder named "data" (see vignette): #MAIT<-sampleProcessing(dataDir = "data", project = "Results", snThres=2,rtStep=0.02)
#Provided that the data files are saved accordingly #in subfolders under a folder named "data" (see vignette): #MAIT<-sampleProcessing(dataDir = "data", project = "Results", snThres=2,rtStep=0.02)
Function scores
extracts the scores MAIT object
scores(object, type,...)
scores(object, type,...)
object |
A MAIT-class object |
type |
If it is set to "none", the peak aggregation models are returned. If it is set to "PCA", the PCA model is returned. If it is set to "PLS", the PCA model is returned. |
... |
Other input |
A numeric matrix containing the scores saved in the MAIT object
Francesc Fernandez, [email protected]
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) scores(MAIT) MAIT<-plotPCA(MAIT,plot3d=FALSE) scores(MAIT,type="PCA") MAIT<-plotPLS(MAIT,plot3d=FALSE) scores(MAIT,type="PLS")
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) scores(MAIT) MAIT<-plotPCA(MAIT,plot3d=FALSE) scores(MAIT,type="PCA") MAIT<-plotPLS(MAIT,plot3d=FALSE) scores(MAIT,type="PLS")
Function sigPeaksTable takes an MAIT-class
object containing significant feature information and builds a table with the information related to these features.
sigPeaksTable(MAIT.object=NULL, printCSVfile=FALSE, extendedTable = TRUE, printAnnotation=TRUE)
sigPeaksTable(MAIT.object=NULL, printCSVfile=FALSE, extendedTable = TRUE, printAnnotation=TRUE)
MAIT.object |
A MAIT-class object where significant features have already been found. |
printCSVfile |
Set to TRUE if an output table has to be produced. The table should be found in (working directory)/(project directory)Tables/significativeFeatures.csv. |
extendedTable |
Set to TRUE the table created by the peak external data is used. |
printAnnotation |
Set to TRUE The peak annotation is provided in the output table |
A table containing:
First column (mz): Peak mass
Second column(mzmin): Minimum peak mass of the peak group.
Third column(mzmax): Maximum peak mass of the peak group.
Fourth column(rt): Peak retention time (in minutes).
Fifth column(rtmin): Minimum peak retention time of the peak group.
Sixth column(rtmax): Maximum peak retention time of the peak group.
Seventh column(npeaks): Number of samples where the peak has been detected.
The columns from the nineth to the column labeled "isotopes" contain number of class samples where the peak has been detected and the intensities of the peak among samples.
The isotopes column shows if the peak has been identified as a possible isotope.
The adduct column shows which kind of adduct could the peak be.
The column labeled pcgroup contains the spectral ID of the peak.
The P.adjust column contains the corrected peak p-value using post-hoc methods.
The p column shows the peak p-value with no multiple test correction.
The Fisher column shows the Fisher test results for the peak. Each of the letters separated by the character "_" corresponds to a class value. Classes having the same letters are indistinguible whereas those having different letters are statistically different clases.
The last columns contain the mean and median values for each feature
Francesc Fernandez, [email protected]
spectralTStudent
spectralAnova
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) head(sigPeaksTable(MAIT))
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) head(sigPeaksTable(MAIT))
Function spectralSigFeatures takes a MAIT-class
object and obtains which of the variables are significant given a p-value threshold. The parameters of the significant features can ve printed to an output table (TRUE by default). Depending on the number of classes in the data, the function chooses between using ANOVA tests through function spectralAnova, or T-Student tests by using function spectralTStudent.
spectralSigFeatures(MAIT.object = NULL, pvalue = 0.05, p.adj = "none", printCSVfile = FALSE, scale = FALSE, parametric = TRUE, var.equal = FALSE, test.fun = NULL, jitter = FALSE, jitter.factor = 1, jitter.amount = 0, namefun = NULL)
spectralSigFeatures(MAIT.object = NULL, pvalue = 0.05, p.adj = "none", printCSVfile = FALSE, scale = FALSE, parametric = TRUE, var.equal = FALSE, test.fun = NULL, jitter = FALSE, jitter.factor = 1, jitter.amount = 0, namefun = NULL)
MAIT.object |
A MAIT-class object where function peakAggregation has already been applied. The output of the function is going to be an update of the same MAIT-class object. |
pvalue |
P-value threshold. Variables having a p-value lower than this value is considered as a significant variable. |
p.adj |
Character with the name of the posthoc method to be applied to correct the pvalues. The supported methods are that of the p.adjust function |
printCSVfile |
Set to TRUE if an output table has to be produced. See function sigPeaksTable for more information. |
scale |
Set to FALSE by default. When set to TRUE, a unit variance scaling of the data when no peak aggregation is performed. If a peak aggregation method is applied, this parameter is ignored. |
parametric |
If it is set to TRUE, the statistical tests to be applied will be parametrical tests (e.g. ANOVA, TStudent or Welch's tests). Non-parametrical tests (e.g. Kruskal-Wallis, Mann-Whitney tests) are applied otherwise. |
var.equal |
Set to FALSE by default. When set to TRUE, a Student's T-Test is applyied when having 2 classes in the data. If it is set to FALSE, a Welch's test is applyied instead. |
test.fun |
Function of the user-defined posthoc method to be applyied. |
jitter |
If it is set to TRUE, a jitter noise is added to the data. This is useful when applying Mann-Whitney tests with ties. |
jitter.factor |
See argument factor of the function jitter. |
jitter.amount |
See argument amount of the function jitter. |
namefun |
Name of the user-defined posthoc test in the argument test.fun. |
A MAIT-class object containing the significant features of the scores slot of MAIT-class object used as an input.
Francesc Fernandez, [email protected]
MAIT-class
spectralTStudent
spectralAnova
sigPeaksTable
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE)
signPeaksAnova
or function TStudent2Clases
Function Validation performs a cross-validated classification using three different classifiers: KNN, PLSDA and SVM. The output comes in a table with the classification ratio and its standard error. The classification ratio is weighted to take into account the different sample number of each class.
Validation(Iterations=NULL, MAIT.object=NULL, trainSamples=NULL, PCAscale=FALSE, PCAcenter=TRUE, RemoveOnePeakSpectra=FALSE, tuneSVM=FALSE, scale=TRUE)
Validation(Iterations=NULL, MAIT.object=NULL, trainSamples=NULL, PCAscale=FALSE, PCAcenter=TRUE, RemoveOnePeakSpectra=FALSE, tuneSVM=FALSE, scale=TRUE)
Iterations |
Number of iterations to be performed in the classifications. For each iteration a new training group is randomly chosen. |
MAIT.object |
A MAIT-class object where significant features have already been found. |
trainSamples |
Number of samples per class to construct the train dataset. |
PCAscale |
If method="PCA" and PCAscale is set to TRUE, then the data is scaled following the |
PCAcenter |
If method="PCA" and PCAscale is set to TRUE, then the data is centered following the |
RemoveOnePeakSpectra |
If it is set to TRUE, all the one-peak spectra are deleted from the dataSet and the resulting |
tuneSVM |
If it is set to TRUE, a tune of parameters is performed before the SVM calculus. |
scale |
If it is set to TRUE, the data is scaled through the spectral mean value. Set to TRUE by default. |
The numerical results of the classification per class and per classifier are saved in a MAIT-class object. Additionally, a table is also included in the output both in the list (field table) and printed as a csv file in the folder (working directory)/Validation. A boxplot is also printed as a png in the same folder showing the differences between classifiers. The confusion matrices of each iteration and classifier are also stored as csv files.
Francesc Fernandez, [email protected]
peakAggregation
spectralAnova
spectralTStudent
spectralSigFeatures
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT)
data(MAIT_sample) MAIT<-spectralSigFeatures(MAIT,p.adj="fdr",parametric=TRUE) MAIT <- Validation(Iterations = 20, trainSamples= 15, MAIT.object = MAIT)