negative value with IRanges
I'm using the Gviz library from Bioconductor, I'm trying to plot ideograms which are technically graphed from left to right, but our data have some negative width indicating that the plot should be from right to left. How can I input negative values for the width with IRanges?
Here is the piece of code we're working with:
library(Gviz) library(IRanges) gen <- "mm9" chr <- "chr1" itrack <- IdeogramTrack(genome = gen, chromosome = chr) gtrack <- GenomeAxisTrack() dat <- read.delim("C:/R/mydata.TXT", header = FALSE, sep ="\t") s <- dat[] e <- dat[] l <- dat[] annot1 = IRanges(start = s, width = l) Error.Call2("solve_user_SEW0", start, end, width, PACKAGE = "IRanges") : solving row 1: negative widths are not allowed # Those logical following commands work well if no negative integer is passed to IRanges atrack <- AnnotationTrack (annot1, chromosome = chr, genome = gen, name = "foo") plotTracks (list(itrack, gtrack, atrack))
Like the error message says, IRanges can't have negative width -- the 'start' is always left-most. Perhaps using a GRanges object with strand="-"?