Question: automatically create index files from output in bcftools
0
gravatar for 4galaxy77
2.0 years ago by
4galaxy77290
United Kingdom
4galaxy77290 wrote:

say i am running a command in bcftools like

/share/apps/genomics/bcftools-1.9/bin/bcftools view -O b -o $x.multiallelicIndelsRemoved.1240positions.vcf.bgz -R $variants --exclude-types indels $sample

Rather than then having to run a separate command on the output file to produce an index file:

/share/apps/genomics/bcftools-1.9/bin/bcftools index $x.multiallelicIndelsRemoved.1240positions.vcf.bgz

Is there a option that I can use in the first command which will automatically produce an index for the output file? I'm sure there must be, but I couldn't find it in the documentation.

Thanks.

software error • 537 views
ADD COMMENTlink modified 2.0 years ago by Kevin Blighe71k • written 2.0 years ago by 4galaxy77290
1

If there is an other command called bcftools index why would you want to use an option to index your file in bcftools view ?

If you want a single command line to do both you can :

/share/apps/genomics/bcftools-1.9/bin/bcftools view -O b -o $x.multiallelicIndelsRemoved.1240positions.vcf.bgz -R $variants --exclude-types indels $sample && /share/apps/genomics/bcftools-1.9/bin/bcftools index $x.multiallelicIndelsRemoved.1240positions.vcf.bgz

Do you want to keep the $x.multiallelicIndelsRemoved.1240positions.vcf.bgz file ?

ADD REPLYlink modified 2.0 years ago • written 2.0 years ago by Bastien Hervé4.9k
0
gravatar for Kevin Blighe
2.0 years ago by
Kevin Blighe71k
Republic of Ireland
Kevin Blighe71k wrote:

I think that you need to clear up what your file extensions mean.

With your first command, you have specified:

-O b -o $x.multiallelicIndelsRemoved.1240positions.vcf.bgz

-O b does not output a bgzipped VCF file, as your output filename ($x.multiallelicIndelsRemoved.1240positions.vcf.bgz) is implying. -O b outputs a compressed BCF, so, your output file should have the BCF extension.

After you output BCF, you simply index it with bcftools index

Take a closer look at the command line options for the commands that you aim to use.

Kevin

ADD COMMENTlink modified 2.0 years ago by WouterDeCoster45k • written 2.0 years ago by Kevin Blighe71k
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: 2352 users visited in the last hour
_