Grep VCF position awk
1
0
Entering edit mode
4.5 years ago
the_cowa ▴ 40

Hi all, I need to grep positions from vcf files to make another vcf file so I used this command

less output.VCF|awk '{OFS="\t"; if ($2 >= 1166 && $2 <= 80082 ){ print }}' |grep -w "^scaffold329" > scaffold329_116-80082.vcf

But it is taking a long time to grep. Is there any way to speed up this task ?

awk vcf grep • 1.0k views
ADD COMMENT
3
Entering edit mode

Please use dedicated tools such as tabix to handle defined formats.

ADD REPLY
3
Entering edit mode
4.5 years ago
ATpoint 85k

Following-up on the advise of cpad0112

bgzip output.VCF
tabix -p vcf output.VCF.gz
tabix -h output.VCF.gz scaffold329:1166-80082 > scaffold329_116-80082.vcf
ADD COMMENT

Login before adding your answer.

Traffic: 1643 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6