Hi all,
I have paired end files previously aligned via Tophat,These files per sample are aligned and unmapped reads bam files. I wanted to convert the files fastq to rerun the alignment using STAR.
I have tried a couple of things but wanted to know if there were better suggestions.
1) Merge the aligned and unaligned files (samtools merge), sort by name, and then run samtools fastq to give separate fastq files that I could run our alignment with.
This seemed to run ok but STAR gave errors saying that the two fastq files were inconsistent in regard to their file lengths.
That error seemed to stem from some reads having 3 reads of the same name. I think this gives files that are unequal between the fq1 and fq2 files.
2) The other way that I was going to try this was to exclude any improper mates using the flag (-F 2) with samtools before running the conversion. I think this might be appropriate, but I'm not sure if I want to discard reads that may map.
Does that seem to be the best approach for this or if anyone has any better insight that would be very helpful! Darryl
Thanks! I tried both your suggestions BamUtil and bedtools and both seemed remove alignments that were incorrect.