rtracklayer colorByStrand - is it possible to add quotes?
2
0
Entering edit mode
Janet Young ▴ 740
@janet-young-2360
Last seen 4.5 years ago
Fred Hutchinson Cancer Research Center,…

Hi there,

I'm using rtracklayer's export function to get a bed file, and then I upload that file manually to the UCSC genome browser via my web browser. 

I am using the trackLine/colorByStrand function - it seems to be almost working fine, but not quite. It would be great if the colorByStrand option could put quotes around the color specifications.  Hopefully the code below shows the issue.

Thanks,

Janet

 

library(rtracklayer)
gr <- GRanges(seqnames="chr1", ranges=IRanges(start=c(1000,2000), width=100), strand=c("+","-") )
myColors <- cbind(col2rgb("red"),col2rgb("blue"))
myTrack <- new("BasicTrackLine", name="gr", description="gr", colorByStrand=myColors )
myTrack 
# track name=gr description=gr colorByStrand=255,0,0 0,0,255 
export(gr, "gr.bed", "BED", trackLine=myTrack )

### I get an error when I upload that to UCSC browser. Error looks like this:
# Error File 'gr.bed' - line 1 of custom input: variable needs to start with letter '0,0,255'

### the UCSC error goes away if I add quotes around the colors in the track line, like this
# track name=gr description=gr colorByStrand="255,0,0 0,0,255" 

sessionInfo()

R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rtracklayer_1.38.3   GenomicRanges_1.30.3 GenomeInfoDb_1.14.0  IRanges_2.12.0       S4Vectors_0.16.0     BiocGenerics_0.24.0 

loaded via a namespace (and not attached):
 [1] lattice_0.20-35            matrixStats_0.53.1         XML_3.98-1.10              Rsamtools_1.30.0          
 [5] Biostrings_2.46.0          GenomicAlignments_1.14.2   bitops_1.0-6               grid_3.4.3                
 [9] zlibbioc_1.24.0            XVector_0.18.0             Matrix_1.2-12              BiocParallel_1.12.0       
[13] tools_3.4.3                Biobase_2.38.0             RCurl_1.95-4.10            DelayedArray_0.4.1        
[17] compiler_3.4.3             SummarizedExperiment_1.8.1 GenomeInfoDbData_0.99.0   
rtracklayer • 882 views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States

Thanks, should be fixed in devel, 1.39.10. Btw, potential bugs are often better reported as a GitHub issue.

ADD COMMENT
0
Entering edit mode
Janet Young ▴ 740
@janet-young-2360
Last seen 4.5 years ago
Fred Hutchinson Cancer Research Center,…

Thanks, Michael - appreciate it. Yes, I'll start using github instead for stuff like this.   

Maybe the github pages are worth a mention on http://www.bioconductor.org/help/support/posting-guide/  ?         

ADD COMMENT

Login before adding your answer.

Traffic: 786 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