Title: | Meta-Analysis for Detecting Genotype x Environment Associations |
---|---|
Description: | Provides functions to perform all steps of genome-wide association meta-analysis for studying Genotype x Environment interactions, from collecting the data to the manhattan plot. The procedure accounts for the potential correlation between studies. In addition to the Fixed and Random models, one can investigate the relationship between QTL effects and some qualitative or quantitative covariate via the test of contrast and the meta-regression, respectively. The methodology is available from: (De Walsche, A., et al. (2023) \doi{10.1101/2023.03.01.530237}). |
Authors: | Annaïg De Walsche [aut, cre] , Tristan Mary-Huard [aut] |
Maintainer: | Annaïg De Walsche <[email protected]> |
License: | GPL-3 |
Version: | 1.1.0 |
Built: | 2024-10-30 06:48:47 UTC |
Source: | CRAN |
The function autocor computes the autocorrelation.(function from localscore)
autocor(x)
autocor(x)
x |
A numeric vector. |
the autocorrelation.
The function CheckContrast check and reformat the matrix of contrast.
CheckContrast(Contrast, ContrastName)
CheckContrast(Contrast, ContrastName)
Contrast |
A matrix of contrast. |
ContrastName |
The name of the contrast. |
The matrix of contrast in the right format.
The function CheckIncidence check and reformat the matrix of incidence.
CheckIncidence(Incidence, IncidenceName)
CheckIncidence(Incidence, IncidenceName)
Incidence |
A matrix of incidence, as obtained from |
IncidenceName |
The name of the incidence. |
The matrix of incidence in the right format.
The function ContrastStatTest compute the statistic of the contrast test.
ContrastStatTest(Incidence, Contrast = NULL, Zmat, MatCorr, IncidenceName)
ContrastStatTest(Incidence, Contrast = NULL, Zmat, MatCorr, IncidenceName)
Incidence |
A matrix of incidence, as obtained from |
Contrast |
A matrix of contrast, if |
Zmat |
A matrix containing the Zscores of all markers (in rows) in each environment (in columns). |
MatCorr |
The inter-environments correlation matrix. Can be computed using |
IncidenceName |
The name of the incidence. |
A dataset of two columns containing the pvalue of the test of contrast and the minimum number of environment per group of all markers.
The function ContrastStatTest compute the statistic of the contrast test.
ContrastStatTest.NA( Incidence, Contrast = NULL, Zmat, MatCorr, Data, Configs.list, IncidenceName )
ContrastStatTest.NA( Incidence, Contrast = NULL, Zmat, MatCorr, Data, Configs.list, IncidenceName )
Incidence |
A matrix of incidence, as obtained from metaGE.incidence. |
Contrast |
A matrix of contrast, if NULL the identity matrix is used. ( |
Zmat |
A matrix containing the Zscores of all markers (in rows) in each environment (in columns). |
MatCorr |
The inter-environments correlation matrix. Can be computed using |
Data |
A dataset containing the effect, the pvalues and the na configuration for all marker |
Configs.list |
A vector containing the |
IncidenceName |
The name of the incidence. |
A dataset of two columns containing the pvalue of the test of contrast and the minimum number of environment per group of all markers.
A dataset containing variables describing the 22 environments.
envDesc
envDesc
A data frame with 22 rows and 3 variables:
FileName: environment name
Temp: temperature
Water: water condition
Computes H1 posteriors of the Z-scores.
FastKerFdr(Z, p0, plotting = FALSE, NbKnot = 1e+05, tol = 1e-05)
FastKerFdr(Z, p0, plotting = FALSE, NbKnot = 1e+05, tol = 1e-05)
Z |
A vector containing Zscores |
p0 |
A double between 0 and 1. A priori proportion of H0 hypotheses |
plotting |
A boolean saying to plot or not (FALSE by default) |
NbKnot |
The (maximum) number of knot for the kde procedure.(1e5 by default) |
tol |
a tolerance value for convergence (1e-5 by default) |
tau is the vector of H1 posteriors
This function give the index of the markers which seems not significant (under H0)
GetH0Items(Zmat, Threshold = 0.8, plotting = FALSE, Cores = NULL)
GetH0Items(Zmat, Threshold = 0.8, plotting = FALSE, Cores = NULL)
Zmat |
A matrix containing the Zscore (in rows) for each environment (in columns) |
Threshold |
Threshold on posteriors (to be H1) to filter markers for correlation computation (0.6 by default) |
plotting |
A boolean saying to plot or not (FALSE by default) |
Cores |
The number of cores to used, optional. By default, availableCores()-1 cores is used. |
A vector of index of markers which seems not significant (under H0)
The function lindley computes the lindley process from scores.(function from localscore)
lindley(scores)
lindley(scores)
scores |
A numeric vector. |
the lindley.
This function compute the values of loglikelihood for all markers.
LLikelihoodT_vect(Zmat, Delta, P, Mu, Tau)
LLikelihoodT_vect(Zmat, Delta, P, Mu, Tau)
Zmat |
A matrix containing the Zscores of all markers (in rows) in each environment (in columns) |
Delta |
A vector containing the diagonal coefficients of the diagonal matrix obtained by the diagonalization of the correlation matrix |
P |
Matrix such that MatCorr = P Delta t(P), with Delta diagonal |
Mu |
A vector containing the average effect of the markers |
Tau |
A vector containing the heterogeneity between environments of the markers |
A vector containing the value of the Log-Likelihood of all markers
The function MakeQQplot displays the QQplot of the -log10(pvalues).
MakeQQplot(Pvalues, Name = NULL, Xrange = NULL, Yrange = NULL)
MakeQQplot(Pvalues, Name = NULL, Xrange = NULL, Yrange = NULL)
Pvalues |
A vector containing pvalues. |
Name |
A name of the corresponding test. (optional) |
Xrange |
A range for the x axis. (optional) |
Yrange |
A range for the y axis. (optional) |
A dataset containing the results of 10 different genetic association studies testing the association between a set of 25,436 markers and the grain yield. The data are extrated from: Drops Amaizing available on the https://doi.org/10.15454/6TL2N4 website. This dataset were obtained thanks to the metaGE.collect function.
metaData
metaData
A data frame with 25,436 rows and 35 variables:
CHR: chromosome of the marker
POS: position of the marker
MARKER: name of the marker
FREQ.env: maf of the marker in the environment env
EFFECT.env: regression coefficient of the marker in the environment env
EFFECT_SE.env: standard error of the regression coefficient of the marker in the environment env
PVAL.env: pvalue of the marker in the environment env
WEIGHT.env: weight of the marker in the environment env
ALLELE0: allele0
ALLELE1: allele1
This function merges files containing the summary statistics of GWAS in different environments (one file per environment).
metaGE.collect( FileNames, VariableNames, MinFreq = 0, DropDuplicates = TRUE, Verbose = FALSE, NA.rmv = TRUE )
metaGE.collect( FileNames, VariableNames, MinFreq = 0, DropDuplicates = TRUE, Verbose = FALSE, NA.rmv = TRUE )
FileNames |
A list containing the file paths to merge (one trait only) or a list of such lists |
VariableNames |
A named list containing the column names in the original files corresponding to the variables : MARKER, CHR, POS, EFFECT, PVAL (optional: FREQ, ALLELE0, ALLELE1) ; or a list of such lists. |
MinFreq |
A numeric value allowing to filter markers based on the maf. (optional) |
DropDuplicates |
A boolean indicating whether duplicate markers should be removed or not. ( |
Verbose |
A boolean indicating whether progression messages should be printed or not. ( |
NA.rmv |
A boolean indicating if the |
Each file MUST contain the variables below:
MARKER: the marker name
CHR: the chromosome
POS: the position of the marker
EFFECT: the mean effect of the marker
PVAL: the pvalue
Each file might contain the variables:
FREQ: MAF
ALLELE0: Allele coding for allele 0
ALLELE1: Allele coding for allele 1
A list with the following elements:
Data |
A tibble containing all the columns of interest of all the files from FileNames. |
RemovedMarkers |
Same kind of tibble, but containing the markers that have been removed due to unclear allele coding, maf filtering or duplicates dropping. |
require(dplyr) require(tibble) require(stringr) RepData <- system.file("extdata", package = "metaGE") # Get the complete list of association files File.list <- list.files(RepData ,full.names = TRUE) %>% tibble(Names = .) %>% mutate(ShortNames = Names %>% str_remove(pattern = paste0(RepData,"/")) %>% str_remove(pattern = "_DF.txt")) %>% select(ShortNames,Names) %>% deframe ###Build the dataset ## First provide the list of variable names Names.list <- list(MARKER="Marker_Name", CHR="Chromosome", POS="Marker_Position", FREQ="Maf", EFFECT="SNP_Weight", PVAL="Pvalue", ALLELE0="Allele1", ALLELE1="Allele2") MinFreq <- 0.07 ## Now collect metaData <- metaGE.collect(File.list, Names.list,MinFreq = MinFreq)
require(dplyr) require(tibble) require(stringr) RepData <- system.file("extdata", package = "metaGE") # Get the complete list of association files File.list <- list.files(RepData ,full.names = TRUE) %>% tibble(Names = .) %>% mutate(ShortNames = Names %>% str_remove(pattern = paste0(RepData,"/")) %>% str_remove(pattern = "_DF.txt")) %>% select(ShortNames,Names) %>% deframe ###Build the dataset ## First provide the list of variable names Names.list <- list(MARKER="Marker_Name", CHR="Chromosome", POS="Marker_Position", FREQ="Maf", EFFECT="SNP_Weight", PVAL="Pvalue", ALLELE0="Allele1", ALLELE1="Allele2") MinFreq <- 0.07 ## Now collect metaData <- metaGE.collect(File.list, Names.list,MinFreq = MinFreq)
This function infer the inter-environment correlation matrix from the z-scores after filtering markers with high probability of being under H1.
metaGE.cor(Data, Threshold = 0.6, NA.omit = TRUE, Cores = NULL)
metaGE.cor(Data, Threshold = 0.6, NA.omit = TRUE, Cores = NULL)
Data |
A dataset containing the effects and pvalues of each marker (in rows) in each environment (in columns) as obtained by |
Threshold |
Threshold on posteriors (to be H1) to filter markers before computing correlation ( |
NA.omit |
A boolean: should the NA be removed for the inter-environment correlation matrix computation ( |
Cores |
The number of cores to used, optional. By default, |
The inter-environment correlation matrix
require(corrplot) data("metaData") Threshold <- 0.8 matCorr <- metaGE.cor(metaData, Threshold = Threshold) #corrplot(matCorr,order = "hclust")
require(corrplot) data("metaData") Threshold <- 0.8 matCorr <- metaGE.cor(metaData, Threshold = Threshold) #corrplot(matCorr,order = "hclust")
Quantitative trait loci detection via Fixed or Random effect meta-analysis GWAS procedure.
metaGE.fit(Data, MatCorr, Method, NA.omit = TRUE, DropZScores = FALSE)
metaGE.fit(Data, MatCorr, Method, NA.omit = TRUE, DropZScores = FALSE)
Data |
A dataset containing the estimated marker effect and its associated pvalue of each marker (in rows) in each environment (in columns), as obtained from |
MatCorr |
The inter-environments correlation matrix. Can be computed using |
Method |
A string specifying the method to be performed: either " |
NA.omit |
A boolean specifying whether the markers with some |
DropZScores |
A boolean specifying whether the Zscores should be dropped from the dataset or not.( |
Different tests may be performed:
Fixed Effect (Fe), to identify markers with a stable effect across environments.
Random Effect (Re), to identify markers whose effects may be unstable across environments.
The dataset Data with supplementary columns:
PVALUE: The pvalue of the MA test,
Mu: Estimate of the mean marker effect,
Tau: Estimate of the variance of the marker effect, for the Random model only,
the Zscores for each environment if DropZScores = FALSE
.
require(dplyr) # Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fixed Effect FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") head(FeDF %>% select(CHR, POS, MARKER, Mu, Tau, PVALUE)) # Random Effect ReDF <- metaGE.fit(metaData, matCorr, Method = "Re") head(ReDF %>% select(CHR, POS, MARKER, Mu, Tau, PVALUE))
require(dplyr) # Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fixed Effect FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") head(FeDF %>% select(CHR, POS, MARKER, Mu, Tau, PVALUE)) # Random Effect ReDF <- metaGE.fit(metaData, matCorr, Method = "Re") head(ReDF %>% select(CHR, POS, MARKER, Mu, Tau, PVALUE))
The function metaGE.heatmap displays the heatmap of the zscores, the estimated marker effects or the pvalues of each markers (in rows) in each environments (in columns).
metaGE.heatmap( Data, Prefix = "Z.", EnvGroups = NULL, QTLsVarName = NULL, RowOrder = TRUE, ColOrder = TRUE, ShowDendrogram = FALSE, Colors = c("red", "black", "green"), Main = "" )
metaGE.heatmap( Data, Prefix = "Z.", EnvGroups = NULL, QTLsVarName = NULL, RowOrder = TRUE, ColOrder = TRUE, ShowDendrogram = FALSE, Colors = c("red", "black", "green"), Main = "" )
Data |
A dataset containing the zscores, the effects or the pvalues of each marker (in rows) in each environment (in columns), as obtained from |
Prefix |
The prefix of the score to display in the heatmap: " |
EnvGroups |
A dataset containing the names of the environments (in the first column) and the groups to which the environments belong (in the second column). (optional) |
QTLsVarName |
The name of the column indicating to which QTL the marker belongs. (optional) |
RowOrder |
A boolean specifying whether to reorder the markers or not. ( |
ColOrder |
A boolean specifying whether to reorder the environments or not. ( |
ShowDendrogram |
A boolean specifying whether to show the clustering of the rows and/or the columns. ( |
Colors |
A vector of three colors corresponding to the color scale of the Heatmap.(optional) |
Main |
The main to display.(optional) |
The heatmap
require(dplyr) # Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fit the Fixed Effect model FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") # Control the FDR (here Benjamini-Hochberg) Alpha <- 0.05 Signif <- FeDF$PVALUE %>% p.adjust(method = "BH") %>% `<`(Alpha) %>% which # Draw the z-scores heatmap of the significant markers heatmap <- metaGE.heatmap(Data = FeDF[Signif,], Prefix = "Z.")
require(dplyr) # Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fit the Fixed Effect model FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") # Control the FDR (here Benjamini-Hochberg) Alpha <- 0.05 Signif <- FeDF$PVALUE %>% p.adjust(method = "BH") %>% `<`(Alpha) %>% which # Draw the z-scores heatmap of the significant markers heatmap <- metaGE.heatmap(Data = FeDF[Signif,], Prefix = "Z.")
The function metaGE.incidence convert categorical variable describing the environments into a matrix of dummy variables with in rows the levels of the variables and in columns the environment.
metaGE.incidence(VarName, Covariate, EnvName, Data, AtLeast = 1)
metaGE.incidence(VarName, Covariate, EnvName, Data, AtLeast = 1)
VarName |
The name of the column containing the categorical variable in the Covariate dataset. |
Covariate |
A dataset containing categorical variables (in columns) describing the environments (in rows). |
EnvName |
The name of the column containing the names of the environment in the Covariate dataset. |
Data |
A dataset containing the effects and pvalues of each marker (in rows) in each environment (in columns), as obtained from |
AtLeast |
A numeric value indicating the minimum number of environments must belong to each level (equals |
The names of the environment must be the same as used in the Data dataset.
A binary matrix containing indicator variables with in rows the levels of the variables and in columns the environment.
# Import the data data("metaData") data("envDesc") # Build the matrix of incidence (Incidence.Temp <- metaGE.incidence(VarName = "Temp",Covariate = envDesc, EnvName = "ShortName", Data = metaData))
# Import the data data("metaData") data("envDesc") # Build the matrix of incidence (Incidence.Temp <- metaGE.incidence(VarName = "Temp",Covariate = envDesc, EnvName = "ShortName", Data = metaData))
The function metaGE.lscore computes the local score and the significant regions from a set of pvalues.
metaGE.lscore(Data, PvalName, xi)
metaGE.lscore(Data, PvalName, xi)
Data |
A dataset containing the following columns: CHR, POS, MARKER and |
PvalName |
The name of the column containing the p-value. |
xi |
The threshold of the score, |
This function is directly inherited from the scorelocalfunctions.R R code file of Fariello MI, Boitard S, Mercier S, et al.,
as available on the https://forge-dga.jouy.inra.fr/projects/local-score website.
The technical details of the computation can be found in Fariello MI, Boitard S, Mercier S, et al.
Accounting for linkage disequilibrium in genome scans for selection without individual genotypes: The local score approach.
doi:10.1111/mec.14141.
The function computes a local score for the detection of significant regions based on the hypothesis that the H0 distribution of the pvalues is
uniform. Under this hypothesis the local score follows a Gumbel distribution (under H0) whose parameters depend
on the threshold xi
and on the autocorrelation between pvalues within each chromosome. The threshold has
to be selected in 1,2,3,4 and the autocorrelation is computed internally.
A list with the following elements:
Data |
The dataset Data with the local score as supplementary column. |
SigZones |
A dataset containing information about the significant regions. |
SigMarker |
A dataset containing the significant markers. |
ChrThreshold |
A dataset containing the chromosome-wide significance thresholds. |
require(dplyr) ## Not run: # Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fit the Fixed Effect model FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") # Compute the score local xi <- 2 FeScore <- metaGE.lscore(FeDF,"PVALUE", xi) #FeScore$SigZones ## End(Not run)
require(dplyr) ## Not run: # Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fit the Fixed Effect model FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") # Compute the score local xi <- 2 FeScore <- metaGE.lscore(FeDF,"PVALUE", xi) #FeScore$SigZones ## End(Not run)
The function metaGE.manhattan displays the Manhattan plot of the -log10(p-value) or the local score of each marker along the genome.
metaGE.manhattan( Data, VarName, Threshold = NULL, SigZones = NULL, Score = FALSE, AnnotateMarkers = NULL, Main = "", col = c("grey", "black"), colSigZones = "blue", Ylim = NULL )
metaGE.manhattan( Data, VarName, Threshold = NULL, SigZones = NULL, Score = FALSE, AnnotateMarkers = NULL, Main = "", col = c("grey", "black"), colSigZones = "blue", Ylim = NULL )
Data |
A dataset containing the columns: CHR, POS, MARKER and the variable to plot for each marker, as obtained from |
VarName |
The name of the column containing the variable to plot, generally the p-value or a score. |
Threshold |
A threshold in order to draw a "genome-wide significant" line. (optional) |
SigZones |
A dataset containing the significant zones to plot, as obtained from |
Score |
A boolean. If |
AnnotateMarkers |
A list of markers name to annotate in the plot. (optional) |
Main |
The main to display. (optional) |
col |
A character vector indicating which colors to alternate for different chromosomes. (optional) |
colSigZones |
A character indicating which color to plot the significant zones.(" |
Ylim |
Two numeric values, specifying the lower limit and the upper limit of the y-axe scale. (optional) |
The Manhattan plot.
require(dplyr) # Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fit the Fixed Effect model FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") # Control the FDR (here Benjamini-Hochberg) Alpha <- 0.05 Signif <- FeDF$PVALUE %>% p.adjust(method = "BH") %>% `<`(Alpha) %>% which # Draw the corresponding manhattan plot #PvalThresholdFe <- FeDF[Signif,]$PVALUE%>% max %>% max(.,0) #manhattan_pval <- metaGE.manhattan(Data = FeDF,VarName = 'PVALUE', # Threshold = PvalThresholdFe, # Main = '-log10(Pval) alongside the chromosome Fe method') # Compute the score local ## Not run: xi <- 2 FeScore <- metaGE.lscore(FeDF,"PVALUE", xi) # Draw the corresponding manhattan plot manhattan_lscore <- metaGE.manhattan(Data = FeScore$Data,VarName = 'SCORE', SigZones = FeScore$SigZones, Score = TRUE, Main = 'Local score alongside the chromosome Fe method') ## End(Not run)
require(dplyr) # Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fit the Fixed Effect model FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") # Control the FDR (here Benjamini-Hochberg) Alpha <- 0.05 Signif <- FeDF$PVALUE %>% p.adjust(method = "BH") %>% `<`(Alpha) %>% which # Draw the corresponding manhattan plot #PvalThresholdFe <- FeDF[Signif,]$PVALUE%>% max %>% max(.,0) #manhattan_pval <- metaGE.manhattan(Data = FeDF,VarName = 'PVALUE', # Threshold = PvalThresholdFe, # Main = '-log10(Pval) alongside the chromosome Fe method') # Compute the score local ## Not run: xi <- 2 FeScore <- metaGE.lscore(FeDF,"PVALUE", xi) # Draw the corresponding manhattan plot manhattan_lscore <- metaGE.manhattan(Data = FeScore$Data,VarName = 'SCORE', SigZones = FeScore$SigZones, Score = TRUE, Main = 'Local score alongside the chromosome Fe method') ## End(Not run)
The function metaGE.pvalplot displays the pvalue distribution and the QQplot of the -log10(pvalues).
metaGE.pvalplot(Pvalues, Main = "")
metaGE.pvalplot(Pvalues, Main = "")
Pvalues |
A vector containing pvalues. |
Main |
The main to display.(optional) |
No return value, the plot is displayed in the active graphics window.
# Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fit the Fixed Effect model FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") # Check the pvalues metaGE.pvalplot(Pvalues = FeDF$PVALUE, Main= "Pvalue Fe")
# Import the data data("metaData") # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) # Fit the Fixed Effect model FeDF <- metaGE.fit(metaData, matCorr, Method = "Fe") # Check the pvalues metaGE.pvalplot(Pvalues = FeDF$PVALUE, Main= "Pvalue Fe")
The function metaGE.regplot displays the graph of the z-scores of a marker according to a covariate.
metaGE.regplot( Data, Covariate, EnvName, MarkerName, VarName, Zscore = FALSE, aesCol = NULL, Main = "" )
metaGE.regplot( Data, Covariate, EnvName, MarkerName, VarName, Zscore = FALSE, aesCol = NULL, Main = "" )
Data |
A dataset containing the columns: MARKER and the z-scores or the effects of each marker (in rows) in each environment (in columns), as obtained from |
Covariate |
A dataset containing the values of one or more covariates (in columns) in each environment (in rows). |
EnvName |
The name of the column containing the names of the environment in the |
MarkerName |
The name of the marker. |
VarName |
The name of the column containing the covariable to plot. |
Zscore |
A boolean. If |
aesCol |
The name of the column in the |
Main |
The main to display.(optional) |
The plot
data("metaData") data("envDesc") metaGE.regplot(Data = metaData, Covariate = envDesc, EnvName = "ShortName", MarkerName = "AX-91369217", VarName = "Tnight.mean", aesCol = "Classification")
data("metaData") data("envDesc") metaGE.regplot(Data = metaData, Covariate = envDesc, EnvName = "ShortName", MarkerName = "AX-91369217", VarName = "Tnight.mean", aesCol = "Classification")
The function metaGE.test compute meta-analysis contrast or regression test.
metaGE.test( Data, MatCorr, Incidence = NULL, Contrast = NULL, Covariate = NULL, EnvName = NULL, NA.omit = TRUE, DropZScores = FALSE )
metaGE.test( Data, MatCorr, Incidence = NULL, Contrast = NULL, Covariate = NULL, EnvName = NULL, NA.omit = TRUE, DropZScores = FALSE )
Data |
A dataset containing the estimated marker effect and its associated pvalue of each marker (in rows) in each environment (in columns), as obtained from |
MatCorr |
The inter-environment correlation matrix. It can be compute by the |
Incidence |
A matrix of incidence, as obtained from |
Contrast |
A matrix of contrast, or a list of such matrix. |
Covariate |
A dataset containing the values of one or more covariates (in columns) in each environment (in rows). |
EnvName |
The name of the column containing the names of the environment in the |
NA.omit |
A boolean specifying whether the markers with some |
DropZScores |
A boolean specifying whether the Zscores should be dropped from the dataset or not. ( |
If Incidence
is provided, the function will perform all the corresponding tests of contrast. If Covariate
is provided, the function will perform all the corresponding meta-regression tests.
The Contrast
can be NULL
, in this case the identity matrix is used.
The dataset Data
with supplementary columns containing the PVALUE of each test performed.
require(dplyr) # Import the data data("metaData") data("envDesc") #' # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) #### Contrast test # Build the matrix of incidence Incidence.Water <- metaGE.incidence(VarName = "Water",Covariate = envDesc, EnvName = "ShortName", Data = metaData) # Perform the contrast test ContrastDF <- metaGE.test(metaData, matCorr,Incidence = Incidence.Water, Contrast = NULL) head(ContrastDF %>% select(CHR, POS, MARKER, PVALUE.Contrast1)) #### Regression test RegressionDF <- metaGE.test(metaData,matCorr, Covariate = envDesc[,c(1,5)],EnvName = "ShortName" ) head(RegressionDF %>% select(CHR, POS, MARKER, PVALUE.Tnight.mean))
require(dplyr) # Import the data data("metaData") data("envDesc") #' # Compute the inter-environment correlation matrix matCorr <- metaGE.cor(metaData, Threshold = 0.8) #### Contrast test # Build the matrix of incidence Incidence.Water <- metaGE.incidence(VarName = "Water",Covariate = envDesc, EnvName = "ShortName", Data = metaData) # Perform the contrast test ContrastDF <- metaGE.test(metaData, matCorr,Incidence = Incidence.Water, Contrast = NULL) head(ContrastDF %>% select(CHR, POS, MARKER, PVALUE.Contrast1)) #### Regression test RegressionDF <- metaGE.test(metaData,matCorr, Covariate = envDesc[,c(1,5)],EnvName = "ShortName" ) head(RegressionDF %>% select(CHR, POS, MARKER, PVALUE.Tnight.mean))
This function read the one file, select interesting columns and rename them.
ReadData(ListN, FileN, VarN, MinFreq = 0)
ReadData(ListN, FileN, VarN, MinFreq = 0)
ListN |
The name of the list of files where the file to read belongs or NULL if there is only one list of files |
FileN |
The name of the file to read |
VarN |
A named list containing the column names in the file corresponding to the variables below: MARKER, CHR, POS, EFFECT, PVAL. (optional: FREQ, ALLELE0, ALLELE1) |
MinFreq |
A numeric value allowing to filter to keep markers with MAF > MinFreq |
A tibble with the interesting columns selected and renamed.
The function RegressionStatTest compute the statistic and the pvalue of the regression test.
RegressionStatTest(Covariate, CovName, Zmat, MatCorr)
RegressionStatTest(Covariate, CovName, Zmat, MatCorr)
Covariate |
A dataset containing the values of one Covariate (in columns) in each environment (in rows). |
CovName |
The name the Covariate. |
Zmat |
A matrix containing the Zscores of all markers (in rows) in each environment (in columns). |
MatCorr |
The inter-environments correlation matrix. Can be computed using |
A dataset of two columns containing the pvalue of the meta-regression test and the number of environment used to perform the test of all markers.
The function RegressionStatTest compute the statistic and the pvalue of the regression test.
RegressionStatTestNA(Covariate, CovName, Zmat, MatCorr, Data, Configs.list)
RegressionStatTestNA(Covariate, CovName, Zmat, MatCorr, Data, Configs.list)
Covariate |
A dataset containing the values of one covariate (in columns) in each environment (in rows). |
CovName |
The name the covariate. |
Zmat |
A matrix containing the Zscores of all markers (in rows) in each environment (in columns). |
MatCorr |
The inter-environments correlation matrix. Can be computed using |
Data |
A dataset containing the effect, the pvalues and the |
Configs.list |
A vector containing the NA configurations present in the dataset |
A dataset of two columns containing the pvalue of the meta-regression test and the number of environment used to perform the test of all markers.
The function sig_sl computes the significative regions from a lindley process given a significance threshold.(function from localscore)
sig_sl(lind, pos, th)
sig_sl(lind, pos, th)
lind |
The lindley |
pos |
The position |
th |
The threshold |
the significance threshold.
The function thresUnif computes the significance threshold.(function from localscore)
thresUnif(L, cor, xi, alpha = 0.05)
thresUnif(L, cor, xi, alpha = 0.05)
L |
The length of the chromosome |
cor |
The autocorrelation of the chromosome |
xi |
The threshold of the score, xi = 1,2,3 or 4. |
alpha |
The nominal threshold. |
The distribution of the p-values is uniform, the local score follows a Gumbel distribution under the null.
the significance threshold.