bcftools: invalid option -- b was showed error
4
0
Entering edit mode
10.1 years ago
bigbang ▴ 20

There is a simple example of Lambda phage, which is on bowtie 2 website. I tried this following command for generating vcf format. After I entered the command [fai_load] build FASTA index.

bcftools: invalid option -- b was showed. And created eg2.raw.bcf file was empty, zero byte.
samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -bvcg - > eg2.raw.bcf

Is there anyone who could tell me what this simple error means? Thank you.

samtools bcftools • 9.4k views
ADD COMMENT
1
Entering edit mode
10.1 years ago

The current bcftools view documentation does not list a -b flag.

ADD COMMENT
0
Entering edit mode

You are right. The version of bcftools I am using now is 1.1. There is a little bit difference between older and newer version. For example: in version 1.1, commands create .bcf -> .bam and .vcf -> .bcf are differ from commands used in version 1.0. I found following command and it worked ok in bcftools 1.1. Thank you.

samtools mpileup -g -f genomes/NC_008253.fna alignments/sim_reads_aligned.sorted.bam > variants/sim_variants.bcf
ADD REPLY
0
Entering edit mode
8.8 years ago
kulvait ▴ 270

Hi,

the problem is that the page http://samtools.sourceforge.net/mpileup.shtml is outdated. Unfortunately there is not available some recent documentation of samtools mpileup command.

Thus if you run

samtools mpileup -uf ref.fa aln1.bam aln2.bam | bcftools view -bvcg - > var.raw.bcf  

you get into problems. The page refer to bcftools 0.1.19 while the current version of the package is bcftools 1.3.0. In former documentation http://www.htslib.org/doc/samtools-0.1.19.html and current documentation http://www.htslib.org/doc/bcftools.html there are differences. In particular for calling variants we have to use another tool bcftools call. I will summarize these differences

-b Output in the BCF format. The default is VCF. while in the new version this switch is replaced by --output-type b

-v Output variant sites only (force -c) I guess that option in the new version should read bcftools call -v

-c Call variants using Bayesian inference. This option automatically invokes option -e. I don't think in the new documentation there is option for that.

-g Call per-sample genotypes at variant sites (force -c) I don't know even what does it mean nor what is its counterpart in the new version of bcftools.

Thus I think in the updated version of variant calling documentation might be command such as this

samtools mpileup -uf ref.fa aln1.bam aln2.bam | bcftools call -c -v --output-type b  | bcftools view -m 2 --output-type b

In my case where I need minor variants at low frequencies I doubt that this aproach would not work anyway since bcftools does expect some ploidy of the genome which does roughly speaking mean that they expect that variants are either in 100% reads or 50% reads or they do not exist. In my case when I can have some clone with somatic variants in 1% of the reads, that would be stripped off. Another problem is that from the row for example

chr20   31022959        .       T       C       221.999 .       DP=4024;VDB=0;SGB=-0.693147;RPB=0.999999;MQB=1;BQB=0.939023;MQ0F=0;AF1=1;AC1=2;DP4=7,0,4010,0;MQ=60;FQ=-281.989;PV4=1,1,1,1
     GT:PL   1/1:255,255,0

I am not able to tell what is a frequency and the read depth for alternate allele. Or am I wrong?

Vojtech.

ADD COMMENT
0
Entering edit mode
7.5 years ago
tsai.141 • 0

Hi I tried it but I got another type of error, any suggestion would help

samtools mpileup -uf S288C_reference_sequence_R64-2-1_20150113.fsa f0_sorted.bam f1.sorted.bam | bcftools call -c -v --output-type b |bcftools view -m 2 --output-type b Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are diploid [mpileup] 2 samples in 2 input files <mpileup> Set max per-file depth to 4000 [vcf.c:899 bcf_hdr_read] invalid BCF2 magic string: only BCFv2.2 is supported. Failed to open -: could not parse header Failed to open -: unknown file type

and as expected, if I ran old command , I got invalid -b

samtools mpileup -uf S288C_reference_sequence_R64-2-1_20150113.fsa f0_sorted.bam f1.sorted.bam | bcftools view -bvcg -> f0f1.raw.bcf [mpileup] 2 samples in 2 input files view: invalid option -- 'b'

ADD COMMENT
0
Entering edit mode
7.5 years ago
tsai.141 • 0

problem solved by re-install bcftools........

ADD COMMENT

Login before adding your answer.

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