This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Extract Consensus Sequence Of Mapped Regions From A Bam File?

I would like to extract consensus sequence of only the mapped regions from a BAM file. I have a bam file which contains only a few regions that are mapped, most of my regions are completely unmapped. How could I go about this?

Thanks,

bam samtools

1 answer

FastaAlternativeReferenceMaker function from picardtools compares variant files to reference to create a consensus fasta sequence ; -L flag takes the input intervals file, -o flag gives the output consensus fasta file, -variant flag takes the variant file (SNPS and Indels together) -R flag takes the reference genome

java -Xmx2g -jar /GATK_pre/GenomeAnalysisTK-1.0.4905/GenomeAnalysisTK.jar -R reference.fasta -T FastaAlternateReferenceMaker -L sorted.bam.intervals -o consensus.fasta –variant snps_indel_file

Log in to answer this question.