Entering edit mode
2.3 years ago
storm1907
▴
30
Hello,
I have bedgraph files in following format:
track type=bedGraph description=center_label visibility=full graphType=points color=200,100,0 altColor=0,100,200
chr1 923391 923526 -0.4838883
chr1 924813 925002 -0.45778788
chr1 930090 930401 -0.09189046
chr1 935707 935961 1.25254348
chr1 939207 939525 3.51303879
Is there any tool, with whom I can convert bedgraph to Granges object? Desired format is something like this:
> grl.data
GRangesList object of length 10:
$s1
GRanges object with 1318 ranges and 1 metadata column:
seqnames ranges strand | value
<Rle> <IRanges> <Rle> | <numeric>
[1] 1 1-576 * | 2.03030
[2] 1 577-1112 * | 1.94532
[3] 1 1113-1511 * | 1.92982
[4] 1 1512-2113 * | 1.86865
[5] 1 2114-2573 * | 1.93882
... ... ... ... . ...
[1314] 22 19081-19153 * | 2.00131
[1315] 22 19154-20059 * | 1.95003
[1316] 22 20060-21926 * | 2.00952
[1317] 22 21927-23554 * | 1.95225
[1318] 22 23555-24465 * | 2.01210
Currently I was not able to find any related solution, so will be happy for any help
Thank you!
I work on remote Linux server, and have difficulties with installing and running rtracklayer. Will try to do it on my local machine, thanks
If you don't want to install rtracklayer you could also build the GRanges semi-manually.
Thank you, this works for one sample! What could be appropriate approach, if I need to make one Grange list object from multiple bedgraphs?
Thank you!
At first it is working, however when trying to run R package CINdex, I still get error
Hello again,
This is the result of my commands (
my_gr
). However, is it possible to get result as in the lower sample (grl.data
)?in
grl.data
file start there are two additional lines:When I try to run downstream analysis, everything is ok with file
grl.data
, but formy_gr
I get output:grl.data
is a sample file, provided by CINdex packageOK, I found this function for making Grange lists: https://rdrr.io/bioc/GenomicRanges/man/makeGRangesListFromDataFrame.html
However, still the question, how to make one Grange object list from multiple bedgraphs
I also tried to make Granges list object from 1 bedgraph file
Trying to run analysis with this new file I got following error:
Stop adding answers unless you're answering the top level post. Use
Add Comment
/Add Reply
instead. I've cleaned up the post now but please be more careul in the future.Please do not paste screenshots of plain text content, it is counterproductive. You can copy paste the content directly here (using the code formatting option shown below), or use a GitHub Gist if the content volume exceeds allowed length here.