Just from the pair, unfortunately, but thank you for the mpileup suggestion.
I'd like to do a follow-up alignment for only a subset of reads based on their mapping positions. The initial PE alignment is fairly conventional but follows a validated workflow that I won't be changing. My follow-up alignment works best with SE reads, I'm currently aligning the pairs as SE reads, but I think my results will be much better if I join them.
If I'm not able merge pairs within a BAM, I guess I'll extract the subset of reads in the SAM by position, convert them to fasta (or extract by QNAME from fastq), join them by self/reference alignment, and then start the follow-up alignment. My hope was that stitching pairs within SAM and then exporting to fasta would have been simpler.
Most read merging programs expect fastq files as input since people generally merge reads before aligning etc. You can always convert your BAM back to fastq and then do the read merging. You do know for sure that these reads overlap?
All but the shortest reads overlap. I think extracting the reads of interest from the BAM, converting to FASTQ, and merging will be the most straightforward. I was hoping to rely on the SAM's alignment to merge the reads, but in all reality the self-aligned merge is going to be fine for the regions I've targeted.
Why would you like to do that? Maybe there are other ways to reach your goal