Entering edit mode
                    g.k
        
    
        •
    
    0
        @gk-13275
        Last seen 6.9 years ago
        
    Hello, I have a list having granges as follows:
$File1.bedGRanges object with 3 ranges and 2 metadata columns: seqnames ranges strand | name score <Rle> <IRanges> <Rle> | <character> <numeric> [1] chr1 [ 4, 6] + | TF1 0 [2] chr1 [ 9, 9] + | TF1 0 [3] chr1 [11, 12] - | TF1 0 ------- seqinfo: 2 sequences from an unspecified genome; no seqlengths $File1.bedGRanges object with 3 ranges and 2 metadata columns: seqnames ranges strand | name score <Rle> <IRanges> <Rle> | <character> <numeric> [1] chr2 [ 5, 60] + | TF4 0 [2] chr1 [21, 90] + | TF4 0 [3] chr2 [23, 30] - | TF4 0 ------- seqinfo: 3 sequences from an unspecified genome; no seqlengths
I would like to make these lists one list, to concatenate them into one.
I tried doing
do.call("c",list)
but it would not work, however when I do the following it works:
c(list[[1]],list[[2]])
I am looking for a command that can concatenate them without me having to right it manually.
This is the final result I am looking for:
GRanges object with 6 ranges and 2 metadata columns:
      seqnames    ranges strand |        name     score
         <Rle> <IRanges>  <Rle> | <character> <numeric>
  [1]    chr1   [ 4,  6]      + |         TF1         0
  [2]     chr1  [ 9,  9]      + |         TF1         0
  [3]     chr1  [11, 12]      - |         TF1         0
  [4]    chr1   [ 4,  6]      + |         TF4         0
  [5]     chr1  [ 9,  9]      + |         TF4         0
  [6]     chr1  [11, 12]      - |         TF4         0
  -------
  seqinfo: 2 sequences from an unspecified genome; no seqlengths
Any thoughts?

Or just use
unlist.> unlist(as(glst, "GRangesList")) GRanges object with 15 ranges and 0 metadata columns: seqnames ranges strand <Rle> <IRanges> <Rle> [1] chr1 1-7 * [2] chr2 2-8 * [3] chr3 3-9 * [4] chr4 4-10 * [5] chr5 5-11 * ... ... ... ... [11] chr2 1-7 * [12] chr3 2-8 * [13] chr4 3-9 * [14] chr1 4-10 * [15] chr5 5-11 * ------- seqinfo: 5 sequences from an unspecified genome; no seqlengths