This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Remove Singletons From Trimmed Fastq Files

How are you removing singletons from whole exome data fastq files from which the adapter sequences have already been removed? We have some data where the paired-end files do not match up, and we believe this is due to singletons that need to be removed. What tools are currently out there?

Have checked Trimming Algorithm but do not see this specifically addressed.

Much thanks.

fastq

Are the two paired files sorted in the same order excluding singletons?

2 answers

We solved the problem in a very simple way, ditch fastq, use BAM even for unaligned reads and let the flags do their magic.

Can you elaborate? I don't understand what this means. How are you mapping BAMs?

You are not mapping the BAMs. You merely convert from fastq to BAM and working on those as your raw unmapped data. This will save you a lot of trouble of knowing who is paired/not paired/read group info etc.

And then you convert back to fastq for mapping? I am still not sure what exactly you are doing. Which "flags" are you talking about? Can you please elaborate? Is there a workflow you can reference or point to as an illustration?

And then you convert back to fastq for mapping?

yes and no, we use file descriptors. So bowtie apparently still cannot read bam, so we call it like that:

bowtie2 -1 <(samtools view -f "0x40" -Y input.bam) -2 <(samtools view -f "0x80" -Y input.bam)

Use this custom version of samtools: https://github.com/udo-stenzel/samtools-patched

I am still not sure what exactly you are doing. Which "flags" are you talking about? Can you please elaborate?

Every read in a BAM file has binary flags combined into a single number. These flags tell us about whether the read is paired, mapped, properly paired, QC failed etc... see http://samtools.sourceforge.net/SAM1.pdf

Is there a workflow you can reference or point to as an illustration?

Unfortunately not really. I suggest being more familiar with the BAM format and regular unix concepts like pipe/file descriptors etc. Good luck and have fun!

Try Sickle Paired End (sickle pe) for paired end trimming. OR

If already trimmed you use cmpfastq to get common and singletons in separate files.

Log in to answer this question.