Can you post the full output of your flagstat command? Flag stat reports the total number of records in the file. If your file contains any secondary alignment records or supplementary alignment records these will be included in flagstat’s count, but excluded by SamToFastq so as not to emit the same read more than once. That’s my best guess given the information below.
-t On Sep 17, 2014, at 10:49 AM, Justin P Whalley <jpwhal...@pcb.ub.es> wrote: > Hello, > > I wish to convert a bam file to a fastq file. However using Picard's > Sam2Fastq, I lost around 19% of the reads: > > Using the command: > samtools flagstat 5842_7#1.bam > I found that my bam file had 57917111 paired reads. > > Running the command: > java -Xmx4g -jar SamToFastq.jar I=5842_7#1.bam F=5842_7#1.end1.fq > F2=5842_7#1.end2.fq FU=5842_7#1.unpaired.fq > left me with a the end1.fq and end2.fq with 46859131 reads each (and the > unpaired.fq file empty). > > Initially I thought that pass filtering may have thrown out the low > quality reads, but using the option to include them: > java -Xmx4g -jar SamToFastq.jar I=5842_7#1.bam F=5842_7#1.end1.fq > F2=5842_7#1.end2.fq FU=5842_7#1.unpaired.fq INCLUDE_NON_PF_READS=true > still results in the same number of reads. > > Does anyone know why this happens and if there is a way around this? I > have resorted to using BEDTools, which is roughly three times slower > than Picard, but does keep all the reads. > > Thank you in advance for any help, > Justin > > ------------------------------------------------------------------------------ > Want excitement? > Manually upgrade your production database. > When you want reliability, choose Perforce > Perforce version control. Predictably reliable. > http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk > _______________________________________________ > Samtools-help mailing list > Samtools-help@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/samtools-help ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ Samtools-help mailing list Samtools-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/samtools-help