Call an input file doesn't work
I'm using Gviz library from bioconductor. I input a tab delimited file containing CNV position that I need to plot on my chromosome ideogram.
My input file is defined by dat and has 4 columns
-  chromosome
-  start
-  end
-  width (could '+' or '-' depending on the orientation of the Copy Number)
So I did that :
library(IRanges) libraray(Gviz) gen <- "mm9" chr <- "chr1" itrack <- IdeogramTrack(genome = gen, chromosome = chr) gtrack <- GenomeAxisTrack() dat <- read.delim("C:/R/1ips_chr1.txt", header = FALSE, sep ="\t") s <- dat e <- dat l <- dat
It shows an error message when I call the file dat :
atrack1 <- AnnotationTrack( start = s, width = l , chromosome = chr, genome = gen, name = "Sample1") Error : function (classes, fdef, mtable) : unable to find an inherited method for function ".buildRange", for signature "NULL", "data.frame", "NULL", "data.frame"
Obviously the way I call a the inputed file (in dat) doesn't satisfy R .. Someone help me please :)
From the reference manual for the Gviz package (with which I am not familiar), the arguments start and width in the AnnotationTrack function need to be integer vectors. When you subset dat using the single square bracket [, the resulting object is a data.frame (see ?`[.data.frame` for more on this). Try instead
s <- dat[] e <- dat[] l <- dat[]
to obtain integer vectors.