This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Determining Orientation Of Fastq Files

Hey everyone. I have a bam file which I converted to sam (via samtools) and then used Picard's SamToFastq script and split the bam into two fastq files. I am now trying to run the de novo assembler Trinity on these files. I know they are strand specific, but I do not know their orientation. Are they forward-reverse orientation or reverse-forward? Which strand is the left and which is the right? Does anyone know how to determine this?

fastq bam sam trinity

3 answers

I guess it depends on the method used for generating strand specificity. For dUTP method, I believe its first-strand reverse (hence, reverse-forward). However, since you have mapped your files already, from the flag of every pair or just a couple pairs, you can check if the read is first in pair or second in pair and if the read is reverse oriented or not, isn't it?

Sorry I meant to comment on your answer not create my own. I am not sure what you mean, unless you replace "isn't it?" with "can't you?". Here is an example, read1: @HS5_233:5:1103:12424:50065/1 GTGCAGAGGAGAACGCAGCTCCGCCCTCGCGGTGCTCTCCGGGTCTGTGCTGAGGAGAACGCAACTCCGCCGTCGCAAAGGCGCCGCGCCGGCGCAGACG + ??@DD>;BF?FHFGAFFBHED>A>@;6;1>@?9(8;/383:48>@>>>B#########################

read2: @HS5_233:5:1103:12424:50065/2 GCCGCCCCACCAACCCCCCCCCGTACGCGGGCGTCTCCGCGGCCGGGCCACCCCGCCCGCCCCCTCGACGCGCCCGCCGGAGTATCTGGTCCTGCGCCCG + =11++)0@F###########################################################################################

Are your original FASTQ files strand-specific and paired end? The FASTQ file converted back from SAM will not have any information about read orientation. Given that your reads came from SS protocol, in your sam file, the 2nd column => flag should tell you all the reads that belong in first pair of your fastq and all the reads that are in the 2nd pair of your fastq. You should split your sam files based on the flag to 2 sam files and picard samToFastq on each of them separately.

In short, post from your SAM file, a properly paired read and its pair.

Well they are annotated each read name ending in either /1 or /2. Not sure I understand you completely... how do I check if the read is reverse oriented?

Dan, Its better to comment to my answer rather than creating an answer as a question. It would be nice to explain if you could post 2 pairs of your SS paired end reads.

Sorry not used to the site really, I meant to comment to Arun's reply.

By converting the reads out of .sam format, you have gotten rid of all the mapping information, like orientation.

If you are expecting every read of read 1 to be in one orientation, that's generally not true, unless the sample was prepped in a strand-specific way.

Either way, eyeball a portion of the .sam, and look at the binary flags to learn the orientation of some of your reads. You could split your .bam so that one half has all the forward reads, and one has all the reverse reads, if that's what you want.

Log in to answer this question.