Question: Grep VCF position awk
0
gravatar for the_cowa
7 months ago by
the_cowa40
the_cowa40 wrote:

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 grep vcf • 225 views
ADD COMMENTlink modified 7 months ago by ATpoint44k • written 7 months ago by the_cowa40
3

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

ADD REPLYlink written 7 months ago by cpad011214k
3
gravatar for ATpoint
7 months ago by
ATpoint44k
ATpoint44k wrote:

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 COMMENTlink modified 7 months ago • written 7 months ago by ATpoint44k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1331 users visited in the last hour
_