rtracklayer and BED-export
1
0
Entering edit mode
@johannes-waage-3852
Last seen 9.6 years ago
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]]
• 1.4k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States
Thanks for finding this. That's been broken for a year, but no one ran into it, I guess. Must have been distracted while writing the code. I've made the change for 1.10.5. Michael On Wed, Nov 3, 2010 at 4:34 AM, Johannes Waage <johannes.waage@bric.dk>wrote: > 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]] > > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

Traffic: 1038 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6