about autoplot in ggbio
1
0
Entering edit mode
Bogdan ▴ 670
@bogdan-2367
Last seen 13 months ago
Palo Alto, CA, USA
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$i ntensity) --------------------------to display the data in the region "region" --------------------- er_plots <- autoplot(er_ranges,geom="bar",aes(col=score)) + xlim(start,end) 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]]
• 2.2k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States
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]]
ADD COMMENT
0
Entering edit mode
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 [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Thank you all gentlemen, I appreciate your help ! 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=e r$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 > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
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 at="" 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 at gene.com> wrote: > >> Hi, couple of tips below: >> >> >> On Wed, Sep 25, 2013 at 11:19 PM, Bogdan Tanasa <tanasa at="" 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=e r$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 at 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 at 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 > -------------- next part -------------- A non-text attachment was scrubbed... Name: ESR_chr2_version1.png Type: image/png Size: 12222 bytes Desc: not available URL: <https: stat.ethz.ch="" pipermail="" bioconductor="" attachments="" 20130926="" 4841b3d7="" attachment.png=""> -------------- next part -------------- A non-text attachment was scrubbed... Name: ESR_chr2_version2.png Type: image/png Size: 5752 bytes Desc: not available URL: <https: stat.ethz.ch="" pipermail="" bioconductor="" attachments="" 20130926="" 4841b3d7="" attachment-0001.png="">
ADD REPLY
0
Entering edit mode
Tengfei might need to help us understand why the xlim() is not working. It looks like we have panels for chromosomes even when there is not any data, or at least the data are not visible. In my opinion, panels should be hidden when there is no data, just like ggplot2. On Thu, Sep 26, 2013 at 10:44 AM, 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 >> > > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Thanks Michael ... Oh, well, xlim() worked in the previous versions . Thanks also to Tengfei for his time and help. On Thu, Sep 26, 2013 at 10:54 AM, Michael Lawrence < lawrence.michael@gene.com> wrote: > Tengfei might need to help us understand why the xlim() is not working. It > looks like we have panels for chromosomes even when there is not any data, > or at least the data are not visible. In my opinion, panels should be > hidden when there is no data, just like ggplot2. > > > > > On Thu, Sep 26, 2013 at 10:44 AM, 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 >>> >> >> > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Hi Michael, Thanks for the comment 1. There is no good default for such a case yet, use xlim for single region while we have many levels. I guess a solution would be subset the data automatically for users. 2. We don't know the purpose of use case like setting xlim on all chromosomes to the same start and end? but I could make it a default to drop panel with no data in current view. Tengfei On Thu, Sep 26, 2013 at 1:54 PM, Michael Lawrence <lawrence.michael@gene.com> wrote: > Tengfei might need to help us understand why the xlim() is not working. It > looks like we have panels for chromosomes even when there is not any data, > or at least the data are not visible. In my opinion, panels should be > hidden when there is no data, just like ggplot2. > > > > > On Thu, Sep 26, 2013 at 10:44 AM, 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]]
ADD REPLY
0
Entering edit mode
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]]
ADD REPLY
0
Entering edit mode
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]]
ADD REPLY
0
Entering edit mode
Michael, Sorry to miss this message, I replied some your question. I totally agree it should support filter by chromosome, I mean it's not supported yet in ggbio, that's what happened to the plot. I noticed that too, overlapping is ggplot2 issue, but sequnit is not default for that, that's my bad ... will change that. Thanks Tengfei On Thu, Sep 26, 2013 at 2:06 PM, Michael Lawrence <lawrence.michael@gene.com> wrote: > 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="*",scor e=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 >> > > -- Tengfei Yin, PhD Seven Bridges Genomics sbgenomics.com 625 Mt. Auburn St. Suite #208 Cambridge, MA 02138 (617) 866-0446 [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Hi Bogdan, Please run er_plots + scale_x_sequnit() or er_plots + scale_x_sequnit() + theme(axis.text.x = element_text(angle = 90, hjust = 1)) for a quick fix when you have lots panels. Tengfei On Thu, Sep 26, 2013 at 2:12 PM, Tengfei Yin <tengfei.yin@sbgenomics.com>wrote: > Michael, > > Sorry to miss this message, I replied some your question. I totally agree > it should support filter by chromosome, I mean it's not supported yet in > ggbio, that's what happened to the plot. > > I noticed that too, overlapping is ggplot2 issue, but sequnit is not > default for that, that's my bad ... will change that. > > Thanks > > Tengfei > > > On Thu, Sep 26, 2013 at 2:06 PM, Michael Lawrence < > lawrence.michael@gene.com> wrote: > >> 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="*",sco re=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 >>> >> >> > > > -- > 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]]
ADD REPLY
0
Entering edit mode
Thanks Tengfei ...it looks really nice ! will get back to you later, when you will have an extra minute ;) On Thu, Sep 26, 2013 at 11:15 AM, Tengfei Yin <tengfei.yin@sbgenomics.com>wrote: > Hi Bogdan, > > Please run > > er_plots + scale_x_sequnit() > or > er_plots + scale_x_sequnit() + theme(axis.text.x = element_text(angle = > 90, hjust = 1)) > > for a quick fix when you have lots panels. > > Tengfei > > > > > On Thu, Sep 26, 2013 at 2:12 PM, Tengfei Yin <tengfei.yin@sbgenomics.com>wrote: > >> Michael, >> >> Sorry to miss this message, I replied some your question. I totally agree >> it should support filter by chromosome, I mean it's not supported yet in >> ggbio, that's what happened to the plot. >> >> I noticed that too, overlapping is ggplot2 issue, but sequnit is not >> default for that, that's my bad ... will change that. >> >> Thanks >> >> Tengfei >> >> >> On Thu, Sep 26, 2013 at 2:06 PM, Michael Lawrence < >> lawrence.michael@gene.com> wrote: >> >>> 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="*",sc ore=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 >>>> >>> >>> >> >> >> -- >> 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]]
ADD REPLY
0
Entering edit mode
Thank you again gentlemen ... it works now fine; the only thing would be that I have to prepare a sub-routine/module for each chromosome ;) 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]]
ADD REPLY

Login before adding your answer.

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