Tuesday, May 12, 2015

vcf to fasta


gravatar for Francisco Roque
4.1 years ago by
Bergen, Norway
This will not apply directly to the vcf file, but using extra annotation from bcftools (assuming you are using it for snp and indel calling):
samtools mpileup -uf reference.fasta alignment.bam | \
bcftools view -cg - | vcfutils.pl vcf2fq > consensus.fastq
After that just convert the fastq into a consensus fasta using seqtk, converting all bases with quality lower than 20 to lowercase
seqtk fq2fa consensus.fastq 20 > consensus.fasta

No comments: