Question: Chippeakanno Distance To Tss In Up And Downstream
gravatar for antgomo
5.6 years ago by
antgomo30 wrote:

Hi All, i have a list of differentially methylated regions (DMRs) and I am trying to get the distance of these particular DMRs to known TSS, so I am using the ChIPpeakAnno package from Bioconductor, the question is: Is able this package to get the nearest start to up and downstream genes. From what I see, the package displays only one NearestStart, probably the downstream one, I tried setting the parameters up with both, but I got apart from Nearest if it is overlapping or not.

I add my script



annotatedPeak <-annotatePeakInBatch(dmrs.ranges, AnnotationData =TSS.human.GRCh37,output="both")


I read somewhere that using precede function in GenomicRanges, is the point, but I don't know how to get it, Could anybody help me with this point?

Thanks in advance

R bioconductor • 2.9k views
ADD COMMENTlink modified 5.6 years ago by seidel6.8k • written 5.6 years ago by antgomo30
gravatar for seidel
5.6 years ago by
United States
seidel6.8k wrote:

With ChIPpeakAnno it's easy to confuse NearestStart with the start site of a gene, rather than simply the beginning coordinate of the closest feature to the left or right of the current position.

One way to solve your problem would be to reduce your genes to a single point located at the start of the gene:

# use resize with a ranges object
foo <- resize(as(TSS.human.GRCh37, "GRanges"), fix="start", width=1)

# convert the result back to RangedData for use with ChipPeakAnno
tss <- as(foo,"RangedData")

However, once you're in GRanges space, it's easy to stay there. You might try: <- resize(as(TSS.human.GRCh37, "GRanges"), fix="start", width=1)

# create a Granges object with your DMRs <- GRanges(seqnames=Rle(space), ranges=IRanges(start_DMR,end_DMR,names=id), strand=Rle("*", length(space)))

# for each DMR get the nearest TSS,

Edit: If you need to get the upstream and downstream TSS for each peak, you already mentioned the answer, you could stick with and simply use precede() and follow(). (Read the documentation: ?nearest). You'd have to stitch the results together, but it should be fairly easy if you can get this far.

ADD COMMENTlink modified 5.6 years ago • written 5.6 years ago by seidel6.8k

Many thanks!, but the question is, Will I get the distance of TSS for each DMR for upstream and downstream? I mean, one TSS nearest distance for up and once for down ??

ADD REPLYlink written 5.6 years ago by antgomo30

I tried and I didn't get more than one TSS, and I a expecting both, one upstream DMR and one downstream. Maybe is a silly question what I am asking to, but it is possible?

ADD REPLYlink written 5.6 years ago by antgomo30

I didn't realize you needed both the up and down stream sites. I edited my answer to include a scenario for that, but there may be more elegant ways.

ADD REPLYlink written 5.6 years ago by seidel6.8k

Thanks! but I got problems subsetting TSS by strand, strand is not a metadata column

ADD REPLYlink written 5.6 years ago by antgomo30

done it,

tss.upstream <-[ == "+"] tss.downstream <-[ == "-"]

ADD REPLYlink written 5.6 years ago by antgomo30

Sorry again for the questions, but probably is a point important that I missed in all the conversation. When I was talking about downstream and upstream is not about the strand orientation but the TSS that are upstream and downstream for this particular DMR in positive strand and the same for the negative. For this I was talking about precede and follow

ADD REPLYlink written 5.6 years ago by antgomo30

Sorry to confuse you, my suggestion about strand was not going to help (this is what I get for answering questions late at night), and I even coded it wrong (yet another option would have been:[ == "+"] ). So I deleted that part of my edit. Using precede() and follow() is the best and easiest way I can think of.

ADD REPLYlink written 5.6 years ago by seidel6.8k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 766 users visited in the last hour