range1 <- IRanges(c(1,2,3), c(5,2,8))
## with some data ##
filter <- c(1L, 0L, 1L)
score <- c(10L, 2L, NA)
strand <- factor(c("+", NA, "-"), levels = levels(strand()))
## GRanges instance
gr <- GenomicData(range1, score, chrom = "chr1", genome = "hg18")
mcols(gr)[["score"]]
strand(gr) ## all '*'
gr <- GenomicData(range1, score, filt = filter, strand = strand,
chrom = "chr1")
mcols(gr)[["filt"]]
strand(gr) ## equal to 'strand'
## coercion from data.frame ##
df <- as.data.frame(gr)
Run the code above in your browser using DataLab