From dfc44493fc0e754e353e64e9b70734c561373dc1 Mon Sep 17 00:00:00 2001
From: Vincent LAVILLE <vincent.laville@pasteur.fr>
Date: Fri, 17 Nov 2017 18:47:27 +0100
Subject: [PATCH] NEW README

---
 .Rbuildignore |   4 +-
 README.html   |   4 +-
 README.md     | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 107 insertions(+), 3 deletions(-)
 create mode 100644 README.md

diff --git a/.Rbuildignore b/.Rbuildignore
index 9c006ca..71c3f60 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -1,3 +1,5 @@
 VarExp.Rproj
 R/deleted_funcs.R
-readme.md
+code-of-conduct.md
+README.html
+README.md
diff --git a/README.html b/README.html
index e363729..a3af51d 100644
--- a/README.html
+++ b/README.html
@@ -215,11 +215,11 @@ fracJ    &lt;- calculateVarFrac(std_betaG, std_betaI, C, parsY[2], sum(COHORT$PH
 </div>
 <div id="code-of-conduct" class="section level2">
 <h2>Code of conduct</h2>
-<p>Please note that this project is released with a <a href="https://github.com/vincenla/VarExp/code-of-conduct.md">Contributor Code of Conduct</a>. By participating in this project you agree to abide by its terms.</p>
+<p>Please note that this project is released with a <a href="https://gitlab.pasteur.fr/statistical-genetics/VarExp/blob/master/code-of-conduct.md">Contributor Code of Conduct</a>. By participating in this project you agree to abide by its terms.</p>
 </div>
 <div id="license" class="section level2">
 <h2>License</h2>
-<p>This project is licensed under the MIT License - see the <a href="https://github.com/vincentla/VarExp/">LICENSE.md</a> file for details</p>
+<p>This project is licensed under the MIT License - see the <a href="https://gitlab.pasteur.fr/statistical-genetics/VarExp/blob/master/LICENSE">LICENSE.md</a> file for details</p>
 </div>
 </div>
 
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4fe0e75
--- /dev/null
+++ b/README.md
@@ -0,0 +1,102 @@
+
+```{r setup, include=FALSE}
+knitr::opts_chunk$set(echo = TRUE)
+```
+
+# 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)
+
+## Prerequisite
+
+Library [**Rcurl**](https://cran.r-project.org/web/packages/RCurl/index.html) is required to run **VarExp**
+
+## 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:
+
+``` r
+install.packages("VarExp_0.1.0.tar.gz", repos = NULL, type = "source")
+```
+
+## Input format
+
+Two input files are required.
+
+* A file providing the meta-analysis results with the following mandatory columns:
+    + the rs identifier of the variant
+    + the chromosome number on which the variant is
+    + the physical position of the variant (currently in NCBI Build B37)
+    + the tested allele of the variant
+    + the frequency of the allele A0
+    + the regression coefficient of the main genetic effect
+    + the regression coefficient of the interaction effect         
+  
+```{r, echo = FALSE}
+data("GWAS")
+print(GWAS, 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:
+    + the identifier of the cohort
+    + the sample size of the cohort
+    + 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
+
+``` {r, echo = FALSE}
+data("COHORT")
+print(COHORT, row.names = FALSE)
+```
+
+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.
+
+``` r
+# Load the package
+library(VarExp)
+
+# Load the meta-analysis summary statistics file
+data(GWAS)
+
+# Load the cohort description file
+data(COHORT)
+
+# Compute the genotype correlation matrix from the reference panel
+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
+# Necessary if pruning = TRUE, otherwise should have no effect
+GWAS <- checkInput(GWAS, colnames(C))
+
+# Retrieve mean and variance of the exposure and the phenotype
+# from individual cohort summary statistics
+parsY <- calculateParamsFromIndParams(COHORT$PHENO_N, COHORT$PHENO_Mean, COHORT$PHENO_SD)
+parsE <- calculateParamsFromIndParams(COHORT$PHENO_N, COHORT$EXPO_Mean, COHORT$EXPO_SD)
+
+# 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_betaI <- standardizeBeta(GWAS$MAIN_EFFECT, GWAS$INT_EFFECT, GWAS$FREQ_A0, parsE[1], parsE[2], type = "I")
+
+# Estimation of the fraction of variance explained
+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")
+fracJ    <- calculateVarFrac(std_betaG, std_betaI, C, parsY[2], sum(COHORT$PHENO_N), "J")
+```
+
+## Bug report / Help
+
+Please open an issue if you find a bug.
+
+## 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.
+
+## 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
\ No newline at end of file
-- 
GitLab