I'm using the GenomicRanges package in R to find overlaps between two lists of chromosome ranges. When I use this code, I get an error saying that 'start' must be a numeric vector:
x0 = as.data.frame(read.table("file0.bed")) x1 = read.csv ("file1.csv")
library(GenomicRanges) gr0 = with(x0, GRanges(chr, IRanges(start=start, end=stop)))
Error in .normargSEW0(start, "start") : 'start' must be a numeric vector (or NULL)
gr1 = with(x1, GRanges(chr, IRanges(start=start, end=stop)))
hits = findOverlaps(gr0, gr1) Error in findOverlaps(gr0, gr1) : object 'gr0' not found
I tried to add the command as.numeric to 'start', but i also didn't work:
gr0 = with(x0, GRanges(chr, IRanges(start=as.numeric(start), end=as.numeric(stop))))
Error in as.numeric(start) : cannot coerce type 'closure' to vector of type 'double'
Any suggestions on how to solve this?