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.