# The "Genome_intervals_stranded" class
j <- new(
"Genome_intervals_stranded",
matrix(
c(1,2,
3,5,
4,6,
8,9
),
byrow = TRUE,
ncol = 2
),
closed = matrix(
c(
FALSE, FALSE,
TRUE, FALSE,
TRUE, TRUE,
TRUE, FALSE
),
byrow = TRUE,
ncol = 2
),
annotation = data.frame(
seq_name = factor( c("chr01","chr01", "chr02","chr02") ),
strand = factor( c("+", "+", "+", "-") ),
inter_base = c(FALSE,FALSE,FALSE,TRUE)
)
)
## print
print(j)
## size of each interval as count of included bases
size(j)
## close intervals left and right (canonical representation)
close_intervals(j)
## simpler way to construct a Genome_intervals_stranded object
GS <- GenomeIntervals(start=c(1,3,4,5,8,10), end=c(5,5,6,8,9,11),
chromosome=rep(c("chr2","chrX","chr1"), each=2),
strand=c("-","-","+","+","+","+") )
show(GS)
Run the code above in your browser using DataLab