User:Jonathan R. I. Coleman/Notebook/Notes and Protocols/2014/06/27: Difference between revisions
No edit summary |
|||
Line 15: | Line 15: | ||
'''GUIDANCE FOR READING THIS FILE:''' | '''GUIDANCE FOR READING THIS FILE:''' | ||
Comments look like this | |||
Commands (on the UNIX command line) look like this | Commands (on the UNIX command line) look like this | ||
Line 42: | Line 39: | ||
'''IMPLEMENTATION IN UNIX:''' | '''IMPLEMENTATION IN UNIX (Imputed to Phase3): (Credit: Tommy Carstensen)''' | ||
zcat impute2.gen.gz | awk '{printf $1"\t"$2; for(i=6; i<NF; i+=3) {printf "\t"$(i+0)*0+$(i+1)*1+$(i+2)*2}; printf "\n"}' | bgzip > dosages.gz | |||
1. Unzips the impute2 file | |||
2. Prints the chromosome number (NB. "---" for unaltered imputed genotypes in impute2 file) and the SNP name (in Phase3 release, this is also the BP positions and alleles) | |||
3. Iterates through the impute2 file and makes single-value dosage score for each line. | |||
4. Gzips the output file. | |||
'' | '''IMPLEMENTATION IN UNIX (Imputed to Phase1 Integrated Haplotypes): (Credit: Tommy Carstensen)''' | ||
zcat impute2.gen.gz | awk '{printf $1"\t"$2"\t"$3"\t"$4"\t"$5; for(i=6; i<NF; i+=3) {printf "\t"$(i+0)*0+$(i+1)*1+$(i+2)*2}; printf "\n"}' | bgzip > dosages.gz | |||
1. Implementation is as above, but the SNP name in earlier releases only contains rs ID, so this adds the BP and alleles to the file. | |||
<!-- ##### DO NOT edit below this line unless you know what you are doing. ##### --> | |||
__NOTOC__ | __NOTOC__ |
Revision as of 03:19, 26 January 2015
Imputation Clean-up | <html><img src="/images/9/94/Report.png" border="0" /></html> Main project page |
Converting from IMPUTE2 .impute2 format to single-value genotype formatJoni Coleman, King's College London (Please send comments to jonathan[dot]coleman[at]kcl[dot]ac[dot]uk)
Comments look like this Commands (on the UNIX command line) look like this
[0 * p(AA)] + [1 * p(AB)] + [2 * p(BB)] which simplifies to: p(AB) + [2 * p(BB)]
zcat impute2.gen.gz | awk '{printf $1"\t"$2; for(i=6; i<NF; i+=3) {printf "\t"$(i+0)*0+$(i+1)*1+$(i+2)*2}; printf "\n"}' | bgzip > dosages.gz 1. Unzips the impute2 file 2. Prints the chromosome number (NB. "---" for unaltered imputed genotypes in impute2 file) and the SNP name (in Phase3 release, this is also the BP positions and alleles) 3. Iterates through the impute2 file and makes single-value dosage score for each line. 4. Gzips the output file.
zcat impute2.gen.gz | awk '{printf $1"\t"$2"\t"$3"\t"$4"\t"$5; for(i=6; i<NF; i+=3) {printf "\t"$(i+0)*0+$(i+1)*1+$(i+2)*2}; printf "\n"}' | bgzip > dosages.gz 1. Implementation is as above, but the SNP name in earlier releases only contains rs ID, so this adds the BP and alleles to the file.
|