help with flank()
2
0
Entering edit mode
joseph ▴ 330
@joseph-1270
Last seen 10.2 years ago
Hello I have an IRanges object ir1: ir1 <- IRanges(c(100,500), c(200,600)) > ir1 IRanges of length 2 start end width [1] 100 200 101 [2] 500 600 101 can you please show me how to use flank() to create a second IRanges object ir2 with coordinates that are 50 upstream of ir1 'start' and 20 downstream of the same ir1 'start'? ir2 should look like this: start end width [1] 50 120 71 [2] 450 520 71 Thanks joseph [[alternative HTML version deleted]]
IRanges IRanges • 1.9k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States
On Fri, Oct 15, 2010 at 4:48 PM, joseph <jdsandjd@yahoo.com> wrote: > Hello > I have an IRanges object ir1: > ir1 <- IRanges(c(100,500), c(200,600)) > > ir1 > IRanges of length 2 > start end width > [1] 100 200 101 > [2] 500 600 101 > > can you please show me how to use flank() to create a second IRanges object > ir2 > with coordinates that are 50 upstream of ir1 'start' and 20 downstream of > the > same ir1 'start'? > > This really isn't possible with flank() all by itself unfortunately. With both = TRUE, it will define a range that overlaps the start, but it's symmetric, not 50/20. You can define ranges for the 50bp upstream of start: upstream <- flank(x, 50) And then resize to 70, anchoring on the start, so that they extend 20 into the gene: resize(upstream, 70) Note that you'll want to use GRanges, not IRanges, to do this based on the strand (and thus the direction of transcription). If you're just going to use IRanges, just do: IRanges(start(x) - 50, width = 70) ir2 should look like this: > start end width > [1] 50 120 71 > [2] 450 520 71 > > Thanks > joseph > > > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
Hi Michael my goal is to create promoter regions 350 bases upstream and 150 downstream of the TSS. I used GRanges and not IRanges, as you suggested: > refGene = transcripts(makeTranscriptDbFromUCSC("hg18", "refGene")) > refGene_promoter=resize(flank(hg18_refGene, 350), 500) Warning message: In `start<-`(`*tmp*`, value = c(58604L, 313405L, 313405L, 313405L, : trimmed start values to be positive Am I doing right and what is the meaning of the Warning message? Thank you for your help Joseph ________________________________ From: Michael Lawrence <lawrence.michael@gene.com> Cc: bioconductor@stat.math.ethz.ch Sent: Fri, October 15, 2010 6:23:06 PM Subject: Re: [BioC] help with flank() Hello >I have an IRanges object ir1: >ir1 <- IRanges(c(100,500), c(200,600)) >> ir1 >IRanges of length 2 > start end width >[1] 100 200 101 >[2] 500 600 101 > >can you please show me how to use flank() to create a second IRanges object ir2 >with coordinates that are 50 upstream of ir1 'start' and 20 downstream of the >same ir1 'start'? > > This really isn't possible with flank() all by itself unfortunately. With both = TRUE, it will define a range that overlaps the start, but it's symmetric, not 50/20. You can define ranges for the 50bp upstream of start: upstream <- flank(x, 50) And then resize to 70, anchoring on the start, so that they extend 20 into the gene: resize(upstream, 70) Note that you'll want to use GRanges, not IRanges, to do this based on the strand (and thus the direction of transcription). If you're just going to use IRanges, just do: IRanges(start(x) - 50, width = 70) ir2 should look like this: > start end width >[1] 50 120 71 >[2] 450 520 71 > >Thanks >joseph > > > > > [[alternative HTML version deleted]] > >_______________________________________________ >Bioconductor mailing list >Bioconductor@stat.math.ethz.ch >https://stat.ethz.ch/mailman/listinfo/bioconductor >Search the archives: >http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
On 10/16/2010 12:28 PM, joseph wrote: > Hi Michael > my goal is to create promoter regions 350 bases upstream and 150 downstream of > the TSS. > > > I used GRanges and not IRanges, as you suggested: >> refGene = transcripts(makeTranscriptDbFromUCSC("hg18", "refGene")) >> refGene_promoter=resize(flank(hg18_refGene, 350), 500) > Warning message: > In `start<-`(`*tmp*`, value = c(58604L, 313405L, 313405L, 313405L, : > trimmed start values to be positive > Am I doing right and what is the meaning of the Warning message? Joseph -- One of your TSS is close enough to 1 that trying to define the region makes it less than 1. > gr = GRanges("chrA", IRanges(10, width=1), seqlengths=c(chrA=100)) > flank(gr, 11) GRanges with 1 range and 0 elementMetadata values seqnames ranges strand | <rle> <iranges> <rle> | [1] chrA [1, 9] * | seqlengths chrA 100 Warning message: In `start<-`(`*tmp*`, value = -1L) : trimmed start values to be positive This check is done when you've provided GRanges with a seqlength. Nothing to be concerned about, except if it doesn't make (biological) sense for the TSS to be that close to the start of the sequence... Martin > Thank you for your help > Joseph > > > ________________________________ > From: Michael Lawrence <lawrence.michael at="" gene.com=""> > > Cc: bioconductor at stat.math.ethz.ch > Sent: Fri, October 15, 2010 6:23:06 PM > Subject: Re: [BioC] help with flank() > > > > > > > Hello >> I have an IRanges object ir1: >> ir1 <- IRanges(c(100,500), c(200,600)) >>> ir1 >> IRanges of length 2 >> start end width >> [1] 100 200 101 >> [2] 500 600 101 >> >> can you please show me how to use flank() to create a second IRanges object ir2 >> with coordinates that are 50 upstream of ir1 'start' and 20 downstream of the >> same ir1 'start'? >> >> > > This really isn't possible with flank() all by itself unfortunately. With both = > TRUE, it will define a range that overlaps the start, but it's symmetric, not > 50/20. > > You can define ranges for the 50bp upstream of start: > > upstream <- flank(x, 50) > > And then resize to 70, anchoring on the start, so that they extend 20 into the > gene: > > resize(upstream, 70) > > Note that you'll want to use GRanges, not IRanges, to do this based on the > strand (and thus the direction of transcription). > > If you're just going to use IRanges, just do: > > IRanges(start(x) - 50, width = 70) > > > ir2 should look like this: >> start end width >> [1] 50 120 71 >> [2] 450 520 71 >> >> Thanks >> joseph >> >> >> >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > > > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793
ADD REPLY
0
Entering edit mode
@vincent-j-carey-jr-4
Last seen 10 weeks ago
United States
it isn't clear to me that flank can do it directly. but resize( shift(ir1, -50), width=71 ) does what you asked. On Fri, Oct 15, 2010 at 7:48 PM, joseph <jdsandjd at="" yahoo.com=""> wrote: > Hello > I have an IRanges object ir1: > ir1 <- IRanges(c(100,500), c(200,600)) >> ir1 > IRanges of length 2 > ? ?start end width > [1] ? 100 200 ? 101 > [2] ? 500 600 ? 101 > > can you please show me how to use flank() to create a second IRanges object ir2 > with coordinates that are 50 upstream of ir1 'start' and 20 downstream of the > same ir1 'start'? > > ir2 should look like this: > ? ?start end width > [1] ? ?50 ?120 ? ?71 > [2] ? ?450 520 ? ?71 > > Thanks > joseph > > > > > ? ? ? ?[[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor >
ADD COMMENT

Login before adding your answer.

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