Genome_intervals-ordering: Ordering methods for Genome intervals

Description Usage Arguments Details See Also Examples

Description

An order is defined on genome intervals and stranded genome intervals to allow sort(), order() and rank().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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)

Arguments

x

Objects of class Genome_intervals or Genome_intervals_stranded.

...

Objects of class Genome_intervals, Genome_intervals_stranded or of any other class for order.

na.last

Ignored for ordering Genome_intervals and Genome_intervals_stranded objects

decreasing

TRUE or FALSE.

ties.method

A character string specifying how ties are treated. Only "first" is supported.

Details

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

See Also

Genome_intervals Genome_intervals_stranded order, sort, rank, xtfrm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## 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)

genomeIntervals documentation built on Nov. 8, 2020, 4:56 p.m.