Hi,
I have VCF file and list of position file. I want to grep those records from VCF which have position corresponding to position present in position file. For this purpose I used this command.
grep -wfF Position.txt myVCF > insec.vcf
here is the list of position.
`POS
10248
10321
10327
10492
10583
12783
13116
13118
13273
13302
14354
14542
14907
14930
15029
15118
15190
15208
15211
15274
`
Here is the result
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT LP6005441-DNA_G11
chr1 10492 rs55998931 C T 182.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=2.356;ClippingRankSum=0;DB;DP=4
chr1 10583 rs58108140 G A 170.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=-3.006;ClippingRankSum=0;DB;DP=
chr1 12783 rs62635284 G A 522.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=4.292;ClippingRankSum=0;DB;DP=2
chr1 13116 rs62635286 T G 125.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=-0.301;ClippingRankSum=0;DB;DP=
chr1 13118 rs62028691 A G 125.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=-1.009;ClippingRankSum=0;DB;DP=
chr1 13273 rs531730856 G C 675.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=-2.577;ClippingRankSum=0;DB;DP=
chr1 13302 rs180734498 C T 135.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=1.88;ClippingRankSum=0;DB;DP=41
chr1 13417 rs777038595 C CGAGA 606.73 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=-2.053;ClippingRankSum=0;DB;DP=
chr1 13896 rs201696125 C A 195.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=-1.19;ClippingRankSum=0;DB;DP=5
chr1 14699 rs62635298 C G 160.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=1.278;ClippingRankSum=0;DB;DP=3
chr1 14907 rs6682375 A G 922.77 PASS AC=1;AF=0.5;AN=2;BaseQRankSum=-0.114;ClippingRankSum=0;DB;DP=
But it is giving some extra records as well like record containing 13415,13896. These positions are not present in list of positions. What shall I do to overcome this problem?
Hi,
Use same command (without -w) by including <tab>YOUR_POSITION<tab> in 'Position.txt' file. This might work.
Example to add tabs:
It worked :) Thank you