How to annotate one GenomicRanges object using another?
1
0
Entering edit mode
7.9 years ago
endrebak ▴ 960

I have two genomicranges, one containing the gencode GFF v24

library(GenomicFeatures)

gen = makeTxDbFromGFF("gencode.gff")

tss = promoters(gen, upstream = 5000, downstream = 5000)

# > tss
# GRanges object with 199169 ranges and 2 metadata columns:
# seqnames     ranges strand  |   tx_id      tx_name
# <Rle>   <IRanges> <Rle>  | <integer>    <character>
# [1]   chr1 [ 6869, 16868]  +  |     1 ENST00000456328.2
# [2]   chr1 [ 7010, 17009]   +  |     2 ENST00000450305.2
# ...
# [199169]   chrM [11024, 21023]   -  |  199169 ENST00000387461.2
# -------
# seqinfo: 25 sequences (1 circular) from an unspecified genome; no seqlengths

another containing the regions I want annotated:

> mydata
GRanges object with 322394 ranges and 0 metadata columns:
           seqnames                 ranges strand
              <Rle>              <IRanges>  <Rle>
       [1]    chr10 [100005001, 100005200]      *
       [2]    chr10 [100005201, 100005400]      *

  [322394]     chrY   [56881001, 56881200]      *
  -------
  seqinfo: 25 sequences from an unspecified genome; no seqlengths

How do I transfer the gene names (tx_name) from my annotation to the data I want annotated?

GenomicFeatures R • 2.4k views
ADD COMMENT
0
Entering edit mode
7.9 years ago
EVR ▴ 610

Hi,

I think you can coerce the "tss" and "mydata" object into a data.frame and later and using a column which is common between the "tss" and "mydata", you can create a new data frame which you can later convert into genomic Ranges.

ADD COMMENT
0
Entering edit mode

There is no mapping between the two genomicRanges.

ADD REPLY

Login before adding your answer.

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