I have some old bam files that I don't have the original fastq files for. I tried using picard Samtofastq but I am having an issues when I realign the reads. I have been using picard to revert the old bam files back to fastq files, bwa to align the reads, and picard to sort and deduplicate. I used samtools
flagstat to check out what was going on with my new bam files and this is what I got
473763117 + 0 in total (QC-passed reads + QC-failed reads) 1618429 + 0 secondary 0 + 0 supplementary 24690025 + 0 duplicates 473247331 + 0 mapped (99.89% : N/A) 472144688 + 0 paired in sequencing 236072344 + 0 read1 236072344 + 0 read2 466910892 + 0 properly paired (98.89% : N/A) 471430496 + 0 with itself and mate mapped 198406 + 0 singletons (0.04% : N/A) 3805718 + 0 with mate mapped to a different chr 2458472 + 0 with mate mapped to a different chr (mapQ>=5)
I have checked out my files and it doesn't look like it is an issue with bwa or picard sort/deduplicate. The only thing I can think of is that there is some issue with picard samtofastq
This is the command I use
java -jar picard.jar SamToFastq I=C01767.bam FASTQ=C01767.R1.fastq SECOND_END_FASTQ=C01767.R2.fastq
Am I doing something wrong here?
I know GATK has a way to do this, but their method only give you one files here. I kind of want both of the fastq files