Question: How to write a preprocess.reads function for summarizeOverlaps that requires different logic for paired and single end reads?
gravatar for Ryan C. Thompson
8 months ago by
The Scripps Research Institute, La Jolla, CA
Ryan C. Thompson7.1k wrote:

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?

ADD COMMENTlink modified 8 months ago by Valerie Obenchain ♦♦ 6.7k • written 8 months ago by Ryan C. Thompson7.1k
gravatar for Valerie Obenchain
8 months ago by
Valerie Obenchain ♦♦ 6.7k
United States
Valerie Obenchain ♦♦ 6.7k wrote:

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.


ADD COMMENTlink written 8 months ago by Valerie Obenchain ♦♦ 6.7k

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 REPLYlink modified 8 months ago • written 8 months ago by Ryan C. Thompson7.1k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 158 users visited in the last hour