I want to write a function that I can use as the preprocess.reads
argument to summarizeOverlaps
that will reduce each read to just the midpoint of the fragment represented by the read. For paired-end reads, this involves taking the midpoint of the outer ends of the two reads, while for single-end reads, this involves specifying the fragment length and then taking the point half that distance downstream of the 5-prime end of the read. What is the best way for me to write a function that can handle both? Should the function simply check if its argument is an instance of GAlignmentPairs
in order to decide between the paired-end and single-end logic, or is there a better way?
Ok, good to know. So basically, my preprocessing function should be prepared to handle any one of GAlignments, GAlignmentPairs, and GAlignmentsList. And furthermore it should be prepared to distinguish between mated and un-mated reads within a GAlignmentsList.