Given exome sequencing of a patient, along with a gene name, we'd like to create a fasta file of that gene's sequence, with the sequence modified to include their unique SNPs.
I could probably hack something together from variant calls and the reference fasta, but I feel like someone must have had to do this before. Haplotyping is obviously an issue here too, but I'd settle for something that used IUPAC bases (Y = C/T) and condensed it down to a haploid representation.
Anyone know of a tool that will let us do this easily?
1 answer
As always, it turns out that there is more than one way to do this.
This question, pointed to by Pierre above, has a solution using the GATK FastaAlternateReferenceMaker that seems like it would work: Introducing known mutations (from a VCF) into a FASTA file
We ended up doing something more like this, where we create a bed file with the exons we're interested in, and pipe it through a few tools to create the needed output:
samtools mpileup -u -l exome.bed -f reference.fa aligment.bam | bcftools view -cg - | vcfutils vcf2fq > vhl_cds_consensus.fq
Thanks, all!
Log in to answer this question.
I'd also like to have this ability, with both haplotypes reported (although i guess that's impossible without the VCF being phased) Some kind of tool that takes VCF + annotation and makes fasta?
duplicate of Introducing known mutations (from a VCF) into a FASTA file ?