How to write a preprocess.reads function for summarizeOverlaps that requires different logic for paired and single end reads?
1
0
Entering edit mode
@ryan-c-thompson-5618
Last seen 6 weeks ago
Icahn School of Medicine at Mount Sinaiā€¦

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?

summarizeoverlaps genomicalignments • 1.3k views
ADD COMMENT
2
Entering edit mode
@valerie-obenchain-4275
Last seen 2.9 years ago
United States

If you're calling summarizedOverlaps with the reads in a GAlignmentsPairs then yes, this would be the way to go. If instead the reads are in a BAM file they will be read into different classes depending on the value of the fragments argument.

When you provide a BAM file of paired-end reads with fragments=TRUE the reads go in a GAlignmentsList before counting. If fragments=FALSE (default) they go into a GAlignmentPairs class.

Valerie

ADD COMMENT
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 583 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6