Entering edit mode
Tom Oates
▴
60
@tom-oates-5703
Last seen 7.4 years ago
Hi
I am very much a learner in R in general & GenomicRanges in general
I am struggling to find documentation to help me get my head around
distanceToNearest in GenomicRanges
If I have a GRanges object:
GRanges with 6 ranges and 4 metadata columns:
seqnames ranges strand |
<rle> <iranges> <rle> |
[1] 10 [ 96723746, 96723747] - |
[2] 7 [ 13641170, 13641171] + |
[3] 16 [ 17772801, 17772802] - |
[4] 3 [ 88173502, 88173503] - |
[5] 13 [106979682, 106979683] + |
[6] 9 [104393139, 104393140] + |
(You will notice that all the regions are only dinucleotides & I have
removed the metadata )
I have a 2nd GRanges object which is ensembl rat transcripts as below:
39549 ranges and 2 metadata columns:
seqnames ranges strand | tx_id
tx_name
<rle> <iranges> <rle> | <integer>
<character>
[1] 1 [5473, 16844] + | 1
ENSRNOT00000044270
[2] 1 [5526, 16968] + | 2
ENSRNOT00000049921
[3] 1 [5526, 16968] + | 3
ENSRNOT00000051735
[4] 1 [5598, 13520] + | 4
ENSRNOT00000034630
[5] 1 [8268, 16850] + | 5
ENSRNOT00000044505
[6] 1 [8316, 17577] + | 6
ENSRNOT00000042693
[7] 1 [8884, 16850] + | 7
ENSRNOT00000044187
[8] 1 [8956, 9955] + | 8
ENSRNOT00000041082
[9] 1 [9055, 17351] + | 9
ENSRNOT00000050254
If I invoke:
xx<-distanceToNearestdiff.cpgs.gr, rat.transcripts, ignore.strand=F)
xx
DataFrame with 1133 rows and 3 columns
queryHits subjectHits distance
<integer> <integer> <integer>
1 1 7752 0
2 2 32166 11946
3 3 14678 25377
4 4 24286 66747
5 5 10609 34242
6 6 37076 122683
7 7 35184 0
8 8 34180 45561
9 9 19351 50156
... ... ... ...
etc
I am uncertain how I would then use the xx output to gain information
(i.e.
tx_id, tx_name) about the feature which the function has identified as
nearest?
I would be happy to supply any more info as required
Tom
[[alternative HTML version deleted]]