[BioC] help with flank()

Martin Morgan mtmorgan at fhcrc.org
Sat Oct 16 22:24:02 CEST 2010


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



More information about the Bioconductor mailing list