ucl-ihi / CodeClub

Repository for all things IHI CodeClub
https://ucl-ihi.github.io/CodeClub/
3 stars 5 forks source link

Creating instrumental variable for mendelian randomisation - in Ubuntu #13

Open rmgpanw opened 4 years ago

rmgpanw commented 4 years ago

Problem summary

Marker  Chrom   Pos Allele1 Allele2 Ncases  Ncontrols   GC.Pvalue   Overall
rs12083781  1   796375  C   T   16144   17832   0.0829  +
rs75932129  1   796767  A   G   16144   17832   0.101   -
rs58013264  1   797440  C   T   16144   17832   0.0836  +
rs10900604  1   798400  G   A   16144   17832   0.0967  +
rs11240777  1   798959  A   G   16144   17832   0.102   +
rs61768212  1   801467  C   G   16144   17832   0.0846  +
rs7553096   1   802026  A   G   16144   17832   0.0787  +
rs10157494  1   802496  T   C   16144   17832   0.103   +
rs7526310   1   804759  T   C   16144   17832   0.0799  +

or download here: sample.txt

I have tried the following, which does not work

awk -F '{if ( $8 = 0.0000.) print $0 }' sample.txt

I get 'syntax error' when I run this with the sample.txt file

Could someone please advise me on how to improve on this? Thanks!

alhenry commented 4 years ago

I think there are a couple of things that caused syntax errors in the initial code:

The following should work: awk '$8 < 0.00001' sample.txt

(it wont show any output as there is no variant with P < 0.00001, so to check you can change it to e.g. awk '$8 < 0.1' sample.txt

If you want to preserve the header: awk 'NR==1 || $8 < 0.1' sample.txt