bcftools multiple commands
1
0
Entering edit mode
2.9 years ago
Filago ▴ 90

Hello,

I want to process a VCF-file with bcftools. Amongst other things I want to:

  1. use multiple commands in one line of code e.g. bcftools annotate + bcftools view --> (How) is this possible?

  2. filter for multiple bed-file regions. Can I do this in one line of code? --> e.g. bcftools view -R file1.bed -R file2.bed -o output?

Best,

Andreas

bcftools • 3.5k views
ADD COMMENT
1
Entering edit mode
2.9 years ago
4galaxy77 2.8k

You can't run multiple commands at once, but you can pipe multiple commands e.g. bcftools annotate --some-args in.bcf | bcftools view -s sample > out.bcf. I would probably suggest merging the bed files in bedtools first and then running bcftools on a single file.

ADD COMMENT
0
Entering edit mode

Hey, I tried now the piping, but the following error occurs: "Failed to read from standard input: not compressed with bgzip", which does not arise if I split the commands into several lines. Any suggestions?

ADD REPLY
0
Entering edit mode

There may be a - missing from original answer. Can you try: bcftools annotate --some-args in.bcf | bcftools view -s sample - > out.bcf. If that is not the command you are having problem with then post the command you are using.

ADD REPLY
0
Entering edit mode

Here you can find a simplified version of my command:

bcftools annotate -x INFO/vep file.vcf.gz | bcftools view --types snps --regions-file bedfile -o output_file - O z

or

bcftools annotate -x INFO/vep file.vcf.gz | bcftools view --types snps --regions-file bedfile - > output_file

Both commands lead to the same named error.

Thanks for your help!

Andreas

ADD REPLY

Login before adding your answer.

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