Entering edit mode
I am trying to understand the output argument of ChIPpeakAnno annotatePeakInBatch(). According to the reference manual:
nearestLocation (default): will output the nearest features calculated as Peak- LocForDistance - FeatureLocForDistance;
shortestDistance: will output nearest features;
Those two options sound identical to me, but I realize they behave differently. I am also not sure why shortestDistance would generate multiple annotations per peak.
nearestLocation will output the nearest one from peak to feature start postion (or middle or end postion as you defined by FeatureLocForDistance)
and shortestDistance will output the nearest feature from the peak with shortest distance. Sometimes there are multiple outputs for one peak because of the select is set to 'all' for GenomicRanges::nearest.
1) I still don't understand "output the nearest feature from the peak with shortest distance". How can nearest not be shortest? Those two words have the same meaning when it comes to distance.
2) Shouldn't "nearest" mean one? Only one is nearest. The rest are further away. How can multiple outputs be nearest?
1) nearest should be shortest but not always.
For example,
For peak a, the nearest annotation will be A, because the start position of A to peak a is 0. The shortest distance is 0 from peak a to feature A, B and C because they are overlapping.
2) Nearest not mean only one but in most case it is. If there are two features shared the same start position or two features in the both end of peaks but with same distance, the outputs will be multiple.
#################################################