automatically create index files from output in bcftools
1
0
Entering edit mode
5.2 years ago
4galaxy77 2.8k

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 • 1.8k views
ADD COMMENT
1
Entering edit mode

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 REPLY
0
Entering edit mode
5.2 years ago

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 COMMENT

Login before adding your answer.

Traffic: 2060 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