Genome_intervals-ordering {genomeIntervals} | R Documentation |
An order is defined on genome intervals and stranded genome intervals to allow sort(), order() and rank().
## S4 method for signature 'Genome_intervals' order(..., na.last=TRUE, decreasing=FALSE) ## S4 method for signature 'Genome_intervals_stranded' order(..., na.last=TRUE, decreasing=FALSE) ## S4 method for signature 'Genome_intervals' sort(x, decreasing=FALSE, ...) ## S4 method for signature 'Genome_intervals' rank(x, na.last=TRUE, ties.method=c("average", "first", "last", "random", "max", "min"), ...) ## S4 method for signature 'Genome_intervals' xtfrm(x)
x |
Objects of class |
... |
Objects of class |
na.last |
Ignored for ordering |
decreasing |
|
ties.method |
A character string specifying how ties are treated. Only |
An order on Genome_intervals entries is defined by sorting by 1. seqnames 2. start, where closed start & not inter-base < closed start & inter-base < open start & not inter-base < open start & inter-base 3. stop, where open stop & not inter-base < open stop & inter-base < closed stop & not inter-base < closed stop & inter-base 4. strand (for Genome_intervals_stranded object)
The factors seqnames
and strand
are sorted according to their levels (default R behavior).
The primitive is implemented in xtfrm
which is then called by the other methods.
Hence, the order
, sort
and rank
methods are consistent.
order(..., na.last=TRUE, decreasing=TRUE)
:
return a permutation which rearranges its first argument
into ascending or descending order, breaking ties by further
arguments.
See order
in the base package for more details.
na.last
is ignored for Genome_intervals
objects.
rank(x, na.last=TRUE, ties.method=c("average", "first", "last", "random", "max", "min"), ...)
:
Return the sample ranks of the (stranded) genome intervals in x
.
See rank
in the base package for more details.
sort(x)
:
Sort x
.
See sort
in the base package for more details.
xtfrm(x)
:
Auxiliary function that produces a numeric vector which will sort in the same order as 'x' x
.
See xtfrm
in the base package for more details.
Workhorse for the other methods
Genome_intervals
Genome_intervals_stranded
order
,
sort
,
rank
,
xtfrm
## an example with ties gi = GenomeIntervals(c("chr2", "chr2", "chr1", "chr1"), c(1,1,10,10), c(5,3,12,12) ) sort(gi) rank(gi) order(gi) ## Define order on seqnames at your convenience ## by specifying the order of the levels ## compare: gi = GenomeIntervals( c("chr2", "chr2", "chr10", "chr10"), c(1,1,10,10), c(5,3,12,12) ) sort(gi) ## with: gi2 = GenomeIntervals( factor(c("chr2", "chr2", "chr10", "chr10"), levels=c("chr2", "chr10")), c(1,1,10,10), c(5,3,12,12) ) sort(gi2)