motifs order on importing the motifs from bigWig file
1
0
Entering edit mode
@stefandvoretskii-16727
Last seen 6.1 years ago

We have a GRanges object with motifs of interest:

 

>motifs_gr
GRanges object with 78181 ranges and 1 metadata column:
          seqnames              ranges strand |    regionID
             <Rle>           <IRanges>  <Rle> | <character>
      [1]     chr1       829075-829135      + |       donor
      [2]     chr1       847777-847837      + |       donor
      [3]     chr1       849573-849633      + |       donor
      [4]     chr1       852081-852141      + |       donor
      [5]     chr1       852737-852797      + |       donor
      ...      ...                 ...    ... .         ...
  [78177]     chrX 155334340-155334400      - |       donor
  [78178]     chrX 155513955-155514015      - |       donor
  [78179]     chrX 155524425-155524485      - |       donor
  [78180]     chrX 155545065-155545125      - |       donor
  [78181]     chrX 155612761-155612821      - |       donor
  -------
  seqinfo: 23 sequences from an unspecified genome; no seqlengths

We import the scores from BigWigFile like this:

gr_frq_mtx = import.bw(snakemake@input[['g1000SNPTrack']], which = motifs_gr, 
                          as = 'NumericList')%>%as.matrix

It turns out that the indexes of the resulting matrix do not match those of original GRanges objects (i.e., n-th row of the matrix does not necessarilly represent the n-th motif in GRanges). For us it is very important though. How could one overcome that?

 

Thanks in advance,

Stefan.

R rtracklayer data import • 855 views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States

This could be improved, but as it is, there are two options:

  1. Ensure that the GRanges is sorted by the seqlevels as they are in the BigWig file.
  2. The resulting NumericList contains a metadata() field named "ranges", which is the which ranges in the order of the result.
ADD COMMENT

Login before adding your answer.

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