Closed zx8754 closed 9 years ago
FWIW -- in practice, I suspect most bedGraph files don't contain browser and track lines.
@AngieHinrichs I will implement in the code - if there are any definitions in the input graphBed file then ignore.
Once implemented I will close this issue.
data.table::fread
already does this auto-magically by default.
Example:
library(data.table) #version data.table_1.9.6
fread('browser position chr19:49302001-49304701
browser hide all
browser pack refGene encodeRegions
browser full altGraph
# 300 base wide bar graph, autoScale is on by default == graphing
# limits will dynamically change to always show full range of data
# in viewing window, priority = 20 positions this as the second graph
# Note, zero-relative, half-open coordinate system in use for bedGraph format
track type=bedGraph name="BedGraph Format" description="BedGraph format" visibility=full color=200,100,0 altColor=0,100,200 priority=20
chr19 49302000 49302300 -1.0
chr19 49302300 49302600 -0.75
chr19 49302600 49302900 -0.50
chr19 49302900 49303200 -0.25
chr19 49303200 49303500 0.0
chr19 49303500 49303800 0.25
chr19 49303800 49304100 0.50
chr19 49304100 49304400 0.75
chr19 49304400 49304700 1.00', header=FALSE, data.table=FALSE)
# V1 V2 V3 V4
# 1 chr19 49302000 49302300 -1.00
# 2 chr19 49302300 49302600 -0.75
# 3 chr19 49302600 49302900 -0.50
# 4 chr19 49302900 49303200 -0.25
# 5 chr19 49303200 49303500 0.00
# 6 chr19 49303500 49303800 0.25
# 7 chr19 49303800 49304100 0.50
# 8 chr19 49304100 49304400 0.75
# 9 chr19 49304400 49304700 1.0
Read bedGraph file, ignore track definition lines
http://genome.ucsc.edu/goldenpath/help/bedgraph.html
https://github.com/oncogenetics/LocusExplorer/blob/master/server.R#L98
Related issue: https://github.com/oncogenetics/LocusExplorer/issues/40