[BioC] Getting first or last hit from a Hits object
Charles Berry
ccberry at ucsd.edu
Mon Oct 21 05:46:17 CEST 2013
Peter Hickey <hickey at ...> writes:
>
> Hi all,
>
> Suppose I've created a Hits object by
> all_hits <- findOverlaps(query, subject, select = 'all', type = 'any')
> and now I want to get the first (or last) hit for each query. Of course,
> [...]
gr1 <- GRanges(rep(letters,each=10),
IRanges(start=sample(1e6,260),width=20))
hit1 <- findOverlaps( gr1, gr1, maxgap=1e5)
hit1 # show what hit1 is
hit1[!duplicated(queryHits(hit1))] # only the first hit for each query value
hit1[!duplicated(queryHits(hit1),fromLast=TRUE)] # only last hits
HTH,
Chuck
More information about the Bioconductor
mailing list