Debian Codegraph @

doc/pages/cis_nominal.html

raw
1 <html>
2 <head>
3 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
4 <meta http-equiv="Cache-Control" content="max-age=3600"/>
5 <meta name="description" content="description"/>
6 <meta name="keywords" content="keywords"/>
7 <meta name="author" content="author"/>
8 <link rel="stylesheet" type="text/css" href="../style/default.css" media="screen"/>
9 <title>FastQTL</title>
10 <script language="Javascript" src="../script/print_last_modif_date.js" ></script>
11 </head>
12
13 <body>
14 <div class="content">
15
16 <div class="item" id="cis_map1">
17 <h1>Default nominal pass</h1>
18 <p>
19 To perform a simple nominal pass on the example data set, use:
20 </p>
21
22 <code>
23 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --region 22:17000000-18000000 --out nominals.default.txt.gz
24 </code>
25
26 <p>
27 This produces this output on the screen when everything works correctly:
28 </p>
29
30 <img WIDTH=40% src="../img/fastqtl_screenshot_nominal.jpg"></img>
31
32 </div>
33
34 <div class="item" id="cis_map3">
35 <h1>Association testing parameters</h1>
36 <p>
37 Associations between genotype dosages and phenotype quantifications are measured with linear regressions (<a href="http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient">here</a>), similar to the R/lm function. This model assumes that phenotypes are normally distributed.
38 If your phenotype quantifications are not normally distributed, you can force them to match normal distributions N(0, 1) by using:
39 </p>
40
41 <code>
42 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --region 22:17000000-18000000 --out nominals.quantile.txt.gz <b>--normal</b>
43 </code>
44
45 <p>
46 To change the cis-window size (i.e. the maximal distance spanned by phenotype-variant pairs to be considered for testing) from default value 1e6 bp to 2e6 bp, use:
47 </p>
48
49 <code>
50 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --region 22:17000000-18000000 --out nominals.window2Mb.txt.gz <b>--window 2e6</b>
51 </code>
52
53 <p>
54 To change the seed of the random number generator, which is particularly useful to replicate an analysis, use:
55 </p>
56
57 <code>
58 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --region 22:17000000-18000000 --out nominals.seed.txt.gz <b>--seed 123456789</b>
59 </code>
60
61 <p>
62 To add covariates in the linear regressions used for association testing, use:
63 </p>
64
65 <code>
66 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --region 22:17000000-18000000 --out nominals.cov.txt.gz <b>--cov covariates.txt.gz</b>
67 </code>
68
69 <p>
70 The file <b>covariates.txt.gz</b> needs to be formatted as described <b>here</b>.
71 </p>
72 </div>
73
74 <div class="item" id="cis_map4">
75 <h1>Excluding/Including data</h1>
76 <p>
77 To exclude samples, variants, phenotypes or covariates from the analysis, you can use one of these options:
78 <ol>
79 <li>To exclude samples: <i>--exclude-samples file.exc</i></li>
80 <li>To exclude variants: <i>--exclude-sites file.exc</i></li>
81 <li>To exclude phenotypes: <i>--exclude-phenotypes file.exc</i></li>
82 <li>To exclude caovariates: <i>--exclude-covariates file.exc</i></li>
83 </ol>
84 </p>
85
86 <p>
87 For instance, if you want to ignore 3 samples when analyzing the example data set, first create a text file containing the IDs of the samples to be excluded, called here <i>file.exc</i>:
88 </p>
89
90 <code>
91 UNR1<br>
92 UNR2<br>
93 UNR3<br>
94 </code>
95
96 <p>
97 Then, add the following option to the command line:
98 </p>
99
100 <code>
101 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --region 22:17000000-18000000 --out nominals.sub.txt.gz <b>--exclude-samples file.exc</b>
102 </code>
103
104 <p>
105 Similarly to these 4 options for data exclusion, you can also specify the set of samples, variants, phenotypes and covariates you wich to include in the analysis using the options: <i>--include-samples, --include-sites, --include-phenotypes and --include-covariates</i>, respectively.
106 </p>
107 </div>
108
109
110 <div class="item" id="cis_map5">
111 <h1>Parallelization</h1>
112 <p>
113 As a first way to facilitate parallelization on compute cluster, we developed an option to run the analysis for just a chunk of molecular phenotypes.
114 The region of interest is specified with the standard <b>chr:start-end</b> format.
115 FastQTL extracts all phenotypes in this region, then all genotypes given the specified cis-window size and finally performs the analysis for this data subset.
116 For instance, to a nominal pass only for molecular phenotypes located on chr22 between coordinates 18Mb and 20Mb, use:
117 </p>
118
119 <code>
120 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz <b>--region chr22:18000000-20000000</b> --out nominals.18M20M.txt.gz
121 </code>
122
123 <note>
124 This option requires both the genotype and phenotype files to be indexed with TABIX!
125 </note>
126
127 <p>
128 This strategy is quite similar to what is commonly used for genotype imputation, where only small chunks of data are imputed one at a time in seperate jobs.
129 However in practice, it is usually quite complicated to properly split the genome into a given number of chunks with correct coordinates.
130 To facilitate this, we embedded all coordinates into a chunk-based system such that you only need to specify the chunk index you want to run.
131 Then, splitting the genome into chunks, extraction of data, and analysis are automatically performed.
132 For instance, to run analysis on chunk number 25 when splitting the example data set (i.e. genome) into 30 chunks, just run:
133 </p>
134
135 <code>
136 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.chunk25.txt.gz <b>--chunk 25 30</b>
137 </code>
138
139 <p>
140 If you want to submit the whole analysis into 30 jobs on your compute cluster, just run:
141 </p>
142
143 <code>
144 for j in <b>$(seq 1 30)</b>; do<br>
145 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.txt.gz <b>--chunk $j 30</b>" | qsub<br>
146 done
147 </code>
148
149 <p>
150 Here <b>qsub</b> needs to be changed according to the job submission system used (bsub, psub, etc...).
151 </p>
152
153 <note>
154 In this simple example, we only split the data into 30 chunks.
155 However, a realistic whole genome analysis would require to split the data in 200, 500 or even 1,000 chunks to fully use the capabilities of a modern compute cluster.
156 </note>
157
158 <p>
159 Finally, we also developed a slightly different parallelization option that, this time, allows to generate all required command lines and write them into a file.
160 Let take the same example as before, that is splitting the analysis into 10 jobs:
161 </p>
162
163 <code>
164 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out results <b>--commands 10 commands.10.txt</b>
165 </code>
166
167 <p>
168 Now if you look at the file <b>commands.10.txt</b>, you'll see this:
169 </p>
170
171 <code>
172 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:17517460-20748406 --region 22:17517460-20748406<br>
173 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:36424473-39052635 --region 22:36424473-39052635<br>
174 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:24407642-30163001 --region 22:24407642-30163001<br>
175 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:42017123-45704850 --region 22:42017123-45704850<br>
176 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:20792146-22307210 --region 22:20792146-22307210<br>
177 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:39052641-39915701 --region 22:39052641-39915701<br>
178 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:30163352-36044443 --region 22:30163352-36044443<br>
179 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:45809500-51222092 --region 22:45809500-51222092<br>
180 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:22337213-24322661 --region 22:22337213-24322661<br>
181 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --out nominals.22:39928860-42017101 --region 22:39928860-42017101<br>
182 </code>
183
184 <p>
185 Where region coordinates are automatically determined given the total number of chunks specified.
186 You can then submit all these commands on a cluster using:
187 </p>
188
189 <code>
190 while read c; do<br>
191 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $c | qsub<br>
192 done <b>< commands.10.txt</b>
193 </code>
194 </div>
195
196 <div class="item" id="cis_map7">
197 <h1>Output file format of a <b>nominal</b> pass</h1>
198
199 <p>
200 Once the analysis completed and all output file collected, you can easily concat and compress all of them into a single output file in order to ease downstream analysis with:
201 </p>
202
203 <code>
204 zcat nominals.chunk*.txt.gz | gzip -c > nominals.all.chunks.txt.gz
205 </code>
206
207 <p>
208 After having performed a nominal pass on the data and concatenating the output files, you end up with a file with 5 columns and N lines corresponding to all N phenotype-variant pairs tested.
209 For instance, if you tested 1,000 molecular phenotypes and for each there are 1,000 variants in cis, it means that you'll get 1,000,000 lines in the output files.
210 Hereafter a short example:
211 </p>
212
213 <code>
214 ENSG00000237438.1 snp_22_18516782 999322 0.602225<br>
215 ENSG00000237438.1 snp_22_18516997 999537 0.796906<br>
216 ENSG00000237438.1 snp_22_18517084 999624 0.20782<br>
217 ENSG00000237438.1 snp_22_18517312 999852 0.196428<br>
218 ENSG00000177663.8 snp_22_16566314 -999530 0.77477<br>
219 ENSG00000177663.8 snp_22_16566347 -999497 0.57854<br>
220 ENSG00000177663.8 snp_22_16566779 -999065 0.379964<br>
221 ENSG00000177663.8 snp_22_16580254 -985590 0.525688<br>
222 ENSG00000177663.8 snp_22_16581158 -984686 0.329372<br>
223 ENSG00000177663.8 snp_22_16581386 -984458 0.461748<br>
224 </code>
225
226 <p>
227 In this file, the 4 columns correspond to:
228 <ol>
229 <li>ID of the tested molecular phenotype (in this particular case, the gene ID)</li>
230 <li>ID of the tested variant (in this case a SNP)</li>
231 <li>Distance between the variant and the phenotype in bp</li>
232 <li>The nominal p-value of association</li>
233 </ol>
234 </p>
235
236 <p>
237 To make this file much smaller, you can output only significant phenotype-variant pairs with a pvalue below 0.001 for instance.
238 To do so, use:
239 </p>
240
241 <code>
242 fastQTL --vcf genotypes.vcf.gz --bed phenotypes.bed.gz --region 22:17000000-18000000 <b>--threshold 0.001</b> --out nominals.threshold.txt.gz
243 </code>
244
245 </div>
246
247 <div class="log"><script type="text/javascript"> print_last_modif_date("$Date: 2014-10-25 12:59:59 +0200 (Sat, 25 Oct 2014) $"); </script></div>
248 </div>
249 </body>
250 </html>