This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Running bcftools on vcf files

Hello

I am trying to run bcftools view -p to filter only the SNPs that have phased genotypes, but I keep getting either empty files or the following error message:

[bcf_sync] incorrect number of fields (0 != 5) at 0:0

Immediately following the VCF file header. Do I need to convert the vcf back to bcf?

Please help, the command I'm running is:

bcftools view input.vcf -p

Thanks,

  • Stefano
sequencing snp

Could you give us the output of:

egrep -C 10 "^#CHROM" input.vcf

I'm showing the first two variants for brevity. This is a non-human organism so disregard unusual chrom names. The first is a phased SNP the second is unphased

LmjF.07    1021    .    T    TC    1261.05    .    AC=1;AF=0.333333;LEN=1;TYPE=ins    GT    0|0|1
LmjF.07    1048    .    T    G    1218.11    .    AB=0.228426;ABP=129.209;AC=1;AF=0.333333;AN=3;AO=45;CIGAR=1X;DP=197;DPB=197;DPRA=0;EPP=4.21667;EPPR=4.4389;GTI=0;LEN=1;MEANALT=1;MQM=28.7556;MQMR=46.9276;NS=1;NUMALT=1;ODDS=148.333;PAIRED=0.111111;PAIREDR=0.605263;PAO=0;PQA=0;PQR=0;PRO=0;QA=1493;QR=5425;RO=152;RPL=27;RPP=6.91895;RPPR=5.06748;RPR=18;RUN=1;SAF=14;SAP=16.956;SAR=31;SRF=83;SRP=5.81036;SRR=69;TYPE=snp;technology.ILLUMINA=1    GT:DP:RO:QR:AO:QA    0/0/1:197:152:5425:45:1493

Which version of bcftools are you using?

Edit: BTW, that error normally only happens when it attempts to read BCF in from a pipe and that's in an older format.

You are correct, after updating to the latest version it works!

0 answers

No answers yet.

Log in to answer this question.