Dear mailing list,

I have a problem with rtraclayer that you can hopefully help me with.
I'm trying to export tracks to the UCSC browser or to BED files through
rtracklayer, but I have problems with the blockStarts and blockSizes fields
functioning, and get a

>export(targetTrack, format="bed", con="bed.bed")
Error in df[[2]] + lastSize : non-numeric argument to binary operator

error when trying to export a targetTrack with these columns. Removing the
columns works fine.

I then noticed this chunck of code in the source ( 1.10.4), in bed.R

           if (variant == "bedGraph") {
              if (is.null(score)) ## bedGraph requires score
                score <- 0
              df$score <- score
            } else {
              blockSizes <- object$blockSizes
              blockStarts <- object$blockStarts
              if (variant == "bed15" && is.null(blockSizes))
                blockStarts <- blockSizes <- "" # bed15 must have all 15
cols
              if (!is.null(blockSizes) || !is.null(blockStarts)) {
                if (is.null(blockSizes))
                  stop("'blockStarts' specified without 'blockSizes'")
                if (is.null(blockStarts))
                  stop("'blockSizes' specified without 'blockStarts'")
*                lastBlock <- function(x) sub(".*,", "", "20,20")
                lastSize <- lastBlock(blockSizes)
                lastStart <- lastBlock(blockStarts)
                if (any(df[[2]] + lastSize + lastStart != df[[3]]) ||*
                    any(sub(",.*", "", blockStarts) != 0))
                  stop("blocks must span entire feature")
                blockCount <- length(strsplit(blockSizes, ",")[[1]])
              }

Notice the code in bold - it seems like the "20,20" is hardcoded, and
doesn't take x as a parameter. Could this be a bug?
Furthermore, wouldnt *lastSize* always be a character, rendering *if
(any(df[[2]] + lastSize + lastStart != df[[3]]) *problematic?

Best regards, and thx in advance,

Johannes


-- 
Johannes E. Waage, cand.scient. (M.Sc.),
Ph.D student
Porse Group | Sandelin Group

Biotech Research & Innovation Centre (BRIC) | Bioinformatics Centre, Dep. Of
Bioligy
University of Copenhagen
Ole Maalřes Vej 5
DK-2200 Copenhagen N

johannes.waage@bric.ku.dk <rune.damgaard@bric.ku.dk> | jwaage@binf.ku.dk
http://www.bric.ku.dk | http://binf.ku.dk

	[[alternative HTML version deleted]]

