Skip to content
Snippets Groups Projects
Commit b9712191 authored by Vincent  LAVILLE's avatar Vincent LAVILLE
Browse files

NEW README

parent 07a18fa6
No related branches found
No related tags found
No related merge requests found
...@@ -3,3 +3,4 @@ ...@@ -3,3 +3,4 @@
.RData .RData
.Ruserdata .Ruserdata
VarExp.Rproj VarExp.Rproj
README.Rmd
This diff is collapsed.
# VarExp VarExp
======
The R package **VarExp** provides functions for the estimating of the percentage of phenotypic variance explained by genetic effects, interaction effects or jointly by both effects. This suite of functions are useful for meta-analysis designs where pooling individual genotype data is challenging. A pre-print article related to this work is available [here](bioRkiv link) The R package **VarExp** provides functions for the estimating of the
percentage of phenotypic variance explained by genetic effects,
interaction effects or jointly by both effects. This suite of functions
are useful for meta-analysis designs where pooling individual genotype
data is challenging. A pre-print article related to this work is
available [here](bioRkiv%20link)
## Prerequisite Prerequisite
------------
Library [**Rcurl**](https://cran.r-project.org/web/packages/RCurl/index.html) is required to run **VarExp** Library
[**Rcurl**](https://cran.r-project.org/web/packages/RCurl/index.html) is
required to run **VarExp**
## Installation Installation
------------
For now, **VarExp** can be installed only using package source. In R, after setting your working directory to *VarExp_0.1.0.tar.gz* location, type: For now, **VarExp** can be installed only using package source. In R,
after setting your working directory to *VarExp\_0.1.0.tar.gz* location,
type:
``` r install.packages("VarExp_0.1.0.tar.gz", repos = NULL, type = "source")
install.packages("VarExp_0.1.0.tar.gz", repos = NULL, type = "source")
```
## Input format Input format
------------
Two input files are required. Two input files are required.
* A file providing the meta-analysis results with the following mandatory columns: - A file providing the meta-analysis results with the following
+ the rs identifier of the variant mandatory columns:
+ the chromosome number on which the variant is - the rs identifier of the variant
+ the physical position of the variant (currently in NCBI Build B37) - the chromosome number on which the variant is
+ the tested allele of the variant - the physical position of the variant (currently in NCBI Build
+ the frequency of the allele A0 B37)
+ the regression coefficient of the main genetic effect - the tested allele of the variant
+ the regression coefficient of the interaction effect - the frequency of the allele A0
- the regression coefficient of the main genetic effect
```{r, echo = FALSE} - the regression coefficient of the interaction effect
data("GWAS")
print(GWAS, row.names = FALSE) <!-- -->
```
## RSID CHR POS A0 FREQ_A0 MAIN_EFFECT INT_EFFECT
* A file providing the summary statistics for the outcome and the exposure in each individual cohort included in the meta-analysis. ## rs72900467 1 989500 A 0.05558 -0.282895628 0.11487230
Mandatory columns of this file are: ## rs34372380 1 1305201 T 0.11205 -0.003162676 0.01704444
+ the identifier of the cohort ## rs4422949 1 834928 G 0.21753 -0.133573045 -0.11129018
+ the sample size of the cohort ## rs9442366 1 1009234 T 0.42201 0.121852094 -0.09421119
+ the phenotype mean in the cohort ## rs61768199 1 781845 G 0.09736 -0.017142010 0.02977832
+ the standard deviation of the phenotype in the cohort ## rs9439462 1 1462766 T 0.04784 0.206595425 0.06823945
+ the exposure mean in the cohort ## rs307370 1 1273278 A 0.16546 0.052140346 -0.01852352
+ the standard deviation of the exposure in the cohort ## rs11807848 1 1061166 C 0.39556 0.169484484 0.03845663
## rs7538305 1 824398 C 0.15379 0.054950590 -0.04494799
``` {r, echo = FALSE} ## rs28613513 1 1112810 T 0.05358 -0.001334013 0.10294423
data("COHORT")
print(COHORT, row.names = FALSE) - A file providing the summary statistics for the outcome and the
``` exposure in each individual cohort included in the meta-analysis.
Mandatory columns of this file are:
Note that in the case of a binary exposure, the two latter columns can be replaced by a single column providing the count of exposed individuals in each cohort. - the identifier of the cohort
- the sample size of the cohort
## Short tutorial - the phenotype mean in the cohort
- the standard deviation of the phenotype in the cohort
- the exposure mean in the cohort
- the standard deviation of the exposure in the cohort
<!-- -->
## Cohort PHENO_N PHENO_Mean PHENO_SD EXPO_Mean EXPO_SD
## 1 10000 1.297265 3.097524 2.002715 1.250979
## 2 10000 1.288332 3.152367 2.009427 1.242574
## 3 10000 1.390218 3.109720 1.995473 1.258670
## 4 10000 1.342020 3.151429 1.999943 1.256718
## 5 10000 1.385564 3.153274 2.002401 1.235129
Note that in the case of a binary exposure, the two latter columns can
be replaced by a single column providing the count of exposed
individuals in each cohort.
Short tutorial
--------------
Data used in this tutorial are included in the ***VarExp*** package. Data used in this tutorial are included in the ***VarExp*** package.
``` r # Load the package
# Load the package library(VarExp)
library(VarExp)
# Load the meta-analysis summary statistics file # Load the meta-analysis summary statistics file
data(GWAS) data(GWAS)
# Load the cohort description file # Load the cohort description file
data(COHORT) data(COHORT)
# Compute the genotype correlation matrix from the reference panel # Compute the genotype correlation matrix from the reference panel
C <- getGenoCorMatrix(GWAS$RSID, GWAS$CHR, GWAS$POS, GWAS$A0, "EUR", pruning = FALSE) C <- getGenoCorMatrix(GWAS$RSID, GWAS$CHR, GWAS$POS, GWAS$A0, "EUR", pruning = FALSE)
# Make sure SNPs in the GWAS data and in the correlation matrix match # Make sure SNPs in the GWAS data and in the correlation matrix match
# Necessary if pruning = TRUE, otherwise should have no effect # Necessary if pruning = TRUE, otherwise should have no effect
GWAS <- checkInput(GWAS, colnames(C)) GWAS <- checkInput(GWAS, colnames(C))
# Retrieve mean and variance of the exposure and the phenotype # Retrieve mean and variance of the exposure and the phenotype
# from individual cohort summary statistics # from individual cohort summary statistics
parsY <- calculateParamsFromIndParams(COHORT$PHENO_N, COHORT$PHENO_Mean, COHORT$PHENO_SD) parsY <- calculateParamsFromIndParams(COHORT$PHENO_N, COHORT$PHENO_Mean, COHORT$PHENO_SD)
parsE <- calculateParamsFromIndParams(COHORT$PHENO_N, COHORT$EXPO_Mean, COHORT$EXPO_SD) parsE <- calculateParamsFromIndParams(COHORT$PHENO_N, COHORT$EXPO_Mean, COHORT$EXPO_SD)
# Re-scale effect sizes as if estimated in a standardized model # Re-scale effect sizes as if estimated in a standardized model
std_betaG <- standardizeBeta(GWAS$MAIN_EFFECT, GWAS$INT_EFFECT, GWAS$FREQ_A0, parsE[1], parsE[2], type = "G") std_betaG <- standardizeBeta(GWAS$MAIN_EFFECT, GWAS$INT_EFFECT, GWAS$FREQ_A0, parsE[1], parsE[2], type = "G")
std_betaI <- standardizeBeta(GWAS$MAIN_EFFECT, GWAS$INT_EFFECT, GWAS$FREQ_A0, parsE[1], parsE[2], type = "I") std_betaI <- standardizeBeta(GWAS$MAIN_EFFECT, GWAS$INT_EFFECT, GWAS$FREQ_A0, parsE[1], parsE[2], type = "I")
# Estimation of the fraction of variance explained # Estimation of the fraction of variance explained
fracG <- calculateVarFrac(std_betaG, std_betaI, C, parsY[2], sum(COHORT$PHENO_N), "G") fracG <- calculateVarFrac(std_betaG, std_betaI, C, parsY[2], sum(COHORT$PHENO_N), "G")
fracI <- calculateVarFrac(std_betaG, std_betaI, C, parsY[2], sum(COHORT$PHENO_N), "I") fracI <- calculateVarFrac(std_betaG, std_betaI, C, parsY[2], sum(COHORT$PHENO_N), "I")
fracJ <- calculateVarFrac(std_betaG, std_betaI, C, parsY[2], sum(COHORT$PHENO_N), "J") fracJ <- calculateVarFrac(std_betaG, std_betaI, C, parsY[2], sum(COHORT$PHENO_N), "J")
```
## Bug report / Help Bug report / Help
-----------------
Please open an issue if you find a bug. Please open an issue if you find a bug.
## Code of conduct Code of conduct
---------------
Please note that this project is released with a [Contributor Code of Conduct](https://gitlab.pasteur.fr/statistical-genetics/VarExp/blob/master/code-of-conduct.md). By participating in this project you agree to abide by its terms. Please note that this project is released with a [Contributor Code of
Conduct](https://gitlab.pasteur.fr/statistical-genetics/VarExp/blob/master/code-of-conduct.md).
By participating in this project you agree to abide by its terms.
## License License
-------
This project is licensed under the MIT License - see the [LICENSE.md](https://gitlab.pasteur.fr/statistical-genetics/VarExp/blob/master/LICENSE) file for details This project is licensed under the MIT License - see the
\ No newline at end of file [LICENSE.md](https://gitlab.pasteur.fr/statistical-genetics/VarExp/blob/master/LICENSE)
file for details
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment