Why shouldn't the xlim also filter by chromosome? Only considering the
start/end is totally confusing and unexpected. Granted, it's not really X
at that point, but "sequence" but I think it's intuitive to also restrict
by sequence.

Why is the scale not using "sequnit" by default? Another weird thing is
happening: the X axis from one panel will overlap with another. Does that
happen with ggplot2? I haven't noticed it.




On Thu, Sep 26, 2013 at 10:59 AM, Tengfei Yin <tengfei.yin@sbgenomics.com>wrote:

> Hi Bogdan,
>
> What's regionb? is it a GRanges for only chr2? It's not going to work this
> way.
>
> 1. Your ESR_chr2.bed data actually contains all chr2, chr20, chr21 and
> chr22, so when you import it, you  have 4 levels, and it will be
> automatically faceted.
> 2. It doesn't make biological sense to set the same xlim on every
> chromosome, though it does work.
> 3. Since your goal is to keep just chr2, you have to drop data from other
> chromsomes, and use keepSeqlevels or seqlevels <- to keep only chr2 in
> seqlevels. Then just set xlim.
>
> cheers
>
> Tengfei
>
>
> On Thu, Sep 26, 2013 at 1:44 PM, Bogdan Tanasa <tanasa@gmail.com> wrote:
>
>> Dear Michael, and Tengfei,
>>
>> thank you again for your suggestions. When you have a few more minutes,
>> if I may ask for further advice :
>>
>> I am using the R code below,
>>
>> er_ranges <-  rtracklayer::import("ESR_chr2.bed", format = "bed")
>> er_plots <- autoplot(er_ranges,geom="bar",aes(col=score)) + xlim(regionb)
>>
>> and/or
>>
>> er_plots <- autoplot("ESR_chr2.bed") + xlim(regionb)
>>
>> and the input file  "ESR_chr2.bed" (attached) ,
>>
>> however the output looks different than expected (please see the attached
>> png files).
>>
>> I would love to display the data only in the specified genome interval -
>> and I would appreciate any further advice.
>>
>> thank you so much, with much appreciation,
>>
>> Bogdan
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Sep 26, 2013 at 7:37 AM, Tengfei Yin <tengfei.yin@sbgenomics.com>wrote:
>>
>>> Hi Bogdan,
>>>
>>> Sorry that I missed your email in my gmail account, I just replied.
>>>
>>> Thanks Michael for the suggestion.
>>>
>>> btw, the gene symbol support for txdb view you mentioned in your email
>>> will be solved in October release, I was just working on that yesterday.
>>>
>>> cheers
>>>
>>> Tengfei
>>>
>>>
>>>
>>>
>>> On Thu, Sep 26, 2013 at 9:25 AM, Michael Lawrence <
>>> lawrence.michael@gene.com> wrote:
>>>
>>>> Hi, couple of tips below:
>>>>
>>>>
>>>> On Wed, Sep 25, 2013 at 11:19 PM, Bogdan Tanasa <tanasa@gmail.com>
>>>> wrote:
>>>>
>>>> > Dear all,
>>>> >
>>>> > I would need a simple suggestion : I am using AUTOPLOT function in
>>>> GGBIO
>>>> > package in order to display a set of ChIP-seq peaks in a specific
>>>> region
>>>> > (chr-start-end).
>>>> >
>>>> > I am reading the set of ChIP-seq peaks in BED format, please could
>>>> you let
>>>> > me know how I could  display the data only in the specific region
>>>> > (chr-start-end).
>>>> >
>>>> > The R code I am using is :
>>>> >
>>>> > -------------------to specify the region -------------------
>>>> > chr <-"chr2"
>>>> > start <- 10898631
>>>> > end <- 11859944
>>>> > region <- GRanges(chr, IRanges(start,end))
>>>> >
>>>> > --------------------to read the file with ChIP-seq peaks
>>>> ----------------
>>>> >
>>>> > er<-read.delim("ChIP-seq.peaks",header=TRUE)
>>>> > er_ranges <-
>>>> >
>>>> >
>>>> GRanges(seqnames=er$chr,IRanges(er$start,er$end),strand="*",score=er$intensity)
>>>> >
>>>> >
>>>> For the above, you could use:
>>>>
>>>> er_ranges <-  rtracklayer::import("ChIP-seq.peaks", format = "bed"))
>>>>
>>>>
>>>> > --------------------------to display the data in the region "region"
>>>> > ---------------------
>>>> >
>>>> > er_plots <- autoplot(er_ranges,geom="bar",aes(col=score)) +
>>>> xlim(start,end)
>>>> >
>>>> >
>>>> You could do something like:
>>>>
>>>> er_plots <- autoplot(er_ranges, geom = "bar", aes(fill=score)) +
>>>> xlim(region)
>>>>
>>>> That is, there is an xlim method for GRanges. Also note that you
>>>> probably
>>>> want "fill" instead of "col" for the aesthetic, because you are filling
>>>> the
>>>> bars. The color will only affect the lines (border). But note that since
>>>> you already have the height mapped to score, I'm not sure you need the
>>>> color.
>>>>
>>>> Btw, it's also possible to pass the filename directly to ggbio, as long
>>>> as
>>>> its file extension is "bed". In the future, we should support
>>>> rtracklayer
>>>> file objects, but for now you need to rename to do this:
>>>>
>>>> er_plots <- autoplot("ChIP-seq.peaks.bed") + xlim(region)
>>>>
>>>> If "score" is present, it automatically uses the bar geom. Not sure if
>>>> this
>>>> is the best behavior...
>>>>
>>>>
>>>> OR
>>>> >
>>>> > er_plots <- autoplot(er_ranges,geom="bar",which = regionb, stat =
>>>> > "identity", color = "blue", fill = "blue")
>>>> >
>>>>
>>>>
>>>> -------------------------------------------------------------------------------------------------------------
>>>> >
>>>> > thank you very much !
>>>> >
>>>> > Bogdan
>>>> >
>>>> >         [[alternative HTML version deleted]]
>>>> >
>>>> > _______________________________________________
>>>> > Bioconductor mailing list
>>>> > Bioconductor@r-project.org
>>>> > 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@r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>>>> Search the archives:
>>>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>>>
>>>
>>>
>>>
>>> --
>>> Tengfei Yin, PhD
>>> Seven Bridges Genomics
>>> sbgenomics.com
>>> 625 Mt. Auburn St. Suite #208
>>> Cambridge, MA 02138
>>> (617) 866-0446
>>>
>>
>>
>
>
> --
> Tengfei Yin, PhD
> Seven Bridges Genomics
> sbgenomics.com
> 625 Mt. Auburn St. Suite #208
> Cambridge, MA 02138
> (617) 866-0446
>

	[[alternative HTML version deleted]]

