This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Unaligning BAM files

Can anyone help me unalign BAM files that have been aligned using TMAP? I want to run my raw reads through GATK best practices but the BAM files we received from our core facility are already aligned using TMAP. Thanks!

tmap bam iontorrent

I am trying to find mutations that are present in diseased tissue versus the patients blood.

so you want to run quality score recall and indel realignment and stuff ? You need mapped reads for this.

I do, but I'm trying to use the Galaxy Project and that won't work with TMAP aligned reads

GATK accepts sorted bam files. So, why you want to unalign to raw reads?

I want to be able to use the same methodology in a previous study on a different type of cancer.

Can you please elaborate in brief?

Basically I want to

  1. Mark and remove PCR duplicates with the Picard package.
  2. Realign Indels with known sites and base quality score recalibration were performed with GATK (Genome Analysis Toolkit), in line with current best practices in the next-generation sequencing field for variant detection, to produce variant-caller ready reads in BAM format.
  3. Call variants with MuTect
  4. Use Invex to find passenger vs driver mutations

For these analysis, you don't need raw read files. you can use bam files that you have got. Sort them, if it is not. used this sorted files for MarkDuplicates and further analysis.

So you don't need to obtain reads from your bam files. If you still want to obtain raw reads use bedtools bamtofastq conversion tool.

You may not get unaligned reads in fastq files that you obtain from bam files.

The best thing to do is to ask the sequencing core to provide you with the original fastq files. Also, beware of the the homopolymer repeat error in the Ion torrent data.

2 answers

samtools sort -n my_alignment.bam my_alignment_qsorted
bedtools bamtofastq -i my_alignment_qsorted.bam -fq /dev/stdout -fq2 /dev/stdout | bwa mem -p /mnt/data/reference/hs37d5.fa - | samtools view -Sb > realigned.bam

If you want to run the GATK, I recommend:

bedtools bamtofastq -i my_alignment_qsorted.bam -fq /dev/stdout -fq2 /dev/stdout | bwa mem -p -R "@RG\tID:foo\tSM:my_sample" /mnt/data/reference/hs37d5.fa - | samblaster | samtools view -Sb - > realigned.bam

Is bamtofastq from bedtools what you need?

Log in to answer this question.