Fill in missing VCF information with bcftools or vcftools or Vcf.pm
Hi Biostars, I was wondering how I might backfill some information into the VCF format. Here are the first three lines of a VCF pooled file I created with bcftools merge.
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Sample1 2:Sample1 3:Sample1 4:Sample1 5:Sample1 6:Sample1 7:Sample
NC001416 1 . G . 0 PASS ADP=3;WT=0;HET=0;HOM=0;NC=1 GT:GQ:SDP:DP:RD:AD:RBQ:ABQ:RDF:RDR:ADF:ADR ./.:.:3:.:.:.:.:.:.:.:.:
NC001416 2 . G . 0 PASS ADP=3;WT=0;HET=0;HOM=0;NC=1 GT:GQ:SDP:DP:RD:AD:RBQ:ABQ:RDF:RDR:ADF:ADR ./.:.:3:.:.:.:.:.:.:.:.:
NC001416 3 . G . 0 PASS ADP=6;WT=0;HET=0;HOM=0;NC=1 GT:GQ:SDP:DP:RD:AD:RBQ:ABQ:RDF:RDR:ADF:ADR ./.:.:6:.:.:.:.:.:.:.:.:
One thing I would want to backfill is the DP attribute for each sample. Would I use bcftools annotate? How? Is there an example or tutorial out there I could follow? I have all the original bam files, so I can supply that information to a given script.
• 4,296 views
•
link
1 answer
This seems like at least a partial answer that I've worked out, using Vcf.pm. I set the depth to 5x on every line in this example.
perl -MVcf -MData::Dumper -e '$vcf=Vcf->new(file=>"sample2.fastq.gz-lambda_virus.vcf.gz"); $vcf->parse_header();while(my $x=$vcf->next_data_hash()){$$x{gtypes}{Sample1}{DP}=5; print $vcf->format_line($x);}'| head
• 1 views
•
link
Log in to answer this question.
Have you tried the Squaring off utility of bcbio.variation.recall?
I think that
bcbio.variation.recalldoes the same thing thatbcftools mergedoes. Right? I am not sure if I can use it to backfill information such as DP (depth).