On Tue, Jul 24, 2012 at 3:19 AM, Xin Yang <xin.yang@cimr.cam.ac.uk> wrote:

>  Hi Tengfei,
>
> Thanks a lot!
>
>
> autoplot(BamFile(bamfile), which=genesymbol["IFIH1"],method = "raw")
> generated the plot successfully , while
>
>
> library(Rsamtools)
> length(biovizBase:::fetch(BamFile(bamfile), which = genesymbol["IFIH1"]))
>
> yields no plot.
>
> Besides, may I ask whether ggbio can plot gtf file? I saw in the
> geom_alignment, you simulated a GRanges object,  is there a way to plot gtf
> file automatically like autoplot?
>
>
yes, autoplot support character which is your file path, currently support
.bam file and other files rtracklayer support, such as gtf and bed, it's
internally use import to import those file as GRanges and plot them. By
default for character, it tries to use 'score' as y automatically, and a
'which' argument is recommended if your file is too large. So you could run

autoplot("you_file_path.gtf", which = GRanges("chr1", IRanges(range_start,
range_end)), color = "gray70")


   -  The color argument is required now for dev-branch, it make sure
   single position are shown in the plot, (ggplot2 default is that the
   rectangle border is transparent).
   - Since your code doesn't work for character .bam file, (I am trying to
   find out why currently), there is a chance the 'which' argument doesn't
   work properly in this case too, in that case, use import function in
   package rtracklayer to import gtf as GRanges object, make sure you use
   asRangedData = FALSE in your import., then just autoplot this GRanges data
   set.




> I saw in your website homepage: http://tengfei.github.com/ggbio/, there
> is a very nice track figure (figure5, see attachment please) and I like it
> very much. May I ask how you did it? If you could share the codes, it would
> be fantastic!
>

around 10 vignettes are added to dev-branch of ggbio, please run

browseVignettes(package = "ggbio")

and read following  4 tutorials:

Get and plot ideogram(make top ideogram track)
How to visualize genomic features from TranscriptDb object.(build genomic
features as bottom track)
Buidling tracks(more features added to make tracks)
Case study: visualize chip-seq data

The vignette will be refined gradually before next release of bioconductor.

Please feel free to report any bug or feature request to me.

Thanks a lot

Tengfei



> Many thanks for your help!!!
> Xin
>
>
> On 23/07/12 18:01, Tengfei Yin wrote:
>
> Hi Xin,
>
>  This works on my bamfile samples, it's probably sample dependent, could
> be a bug in the package, would you mind try runing
> autoplot(BamFile(bamfile), which=genesymbol["IFIH1"],method = "raw")
>
>  and
>
>  library(Rsamtools)
> length(biovizBase:::fetch(BamFile(bamfile), which = genesymbol["IFIH1"]))
>
>  to see what happened?
>
>  Thanks a lot.
>
>  Tengfei
>
>
> On Mon, Jul 23, 2012 at 9:17 AM, Xin Yang <xin.yang@cimr.cam.ac.uk> wrote:
>
>>  Hi Tengfei,
>>
>> Thanks a lot for your reply.
>>
>> Here is my session Info():
>>
>> > sessionInfo()
>>
>> R version 2.15.0 (2012-03-30)
>>
>> Platform: x86_64-pc-linux-gnu (64-bit)
>>
>> locale:
>>
>>  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
>>
>>  [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
>>
>>  [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8
>>
>>  [7] LC_PAPER=C                 LC_NAME=C
>>
>>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>
>> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>>
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>>
>>  [1] BiocInstaller_1.5.12               BSgenome.Hsapiens.UCSC.hg19_1.3.17
>>
>>  [3] BSgenome_1.25.3                    Rsamtools_1.9.24
>>
>>  [5] Biostrings_2.25.8                  GenomicRanges_1.9.39
>>
>>  [7] IRanges_1.15.24                    BiocGenerics_0.3.0
>>
>>  [9] ggbio_1.5.10                       ggplot2_0.9.1
>>
>> loaded via a namespace (and not attached):
>>
>>  [1] AnnotationDbi_1.19.28    Biobase_2.17.6           biomaRt_2.13.1
>>
>>  [4] biovizBase_1.5.6         bitops_1.0-4.1           cluster_1.14.2
>>
>>  [7] colorspace_1.1-1         DBI_0.2-5                dichromat_1.2-4
>>
>> [10] digest_0.5.2             GenomicFeatures_1.9.28   grid_2.15.0
>>
>> [13] gridExtra_0.9            Hmisc_3.9-3              labeling_0.1
>>
>> [16] lattice_0.20-6           MASS_7.3-18              Matrix_1.0-6
>>
>> [19] memoise_0.1              munsell_0.3              plyr_1.7.1
>>
>> [22] proto_0.3-9.2            RColorBrewer_1.0-5       RCurl_1.91-1
>>
>> [25] reshape2_1.2.1           RSQLite_0.11.1           rtracklayer_1.17.13
>>
>> [28] scales_0.2.1             snpStats_1.7.3           splines_2.15.0
>>
>> [31] stats4_2.15.0            stringr_0.6              survival_2.36-14
>>
>> [34] tcltk_2.15.0             tools_2.15.0             VariantAnnotation_1.3.16
>>
>> [37] XML_3.9-4                zlibbioc_1.3.0
>>
>> When I installed the package, actually there were some warnings that
>> might matter...?
>>
>> >useDevel(TRUE)
>>
>> > source("http://bioconductor.org/biocLite.R" <http://bioconductor.org/biocLite.R>)
>>
>> > biocLite("ggbio")
>>
>> BioC_mirror: http://bioconductor.org
>>
>> Using R version 2.15, BiocInstaller version 1.5.12.
>>
>> Installing package(s) 'ggbio'
>>
>> trying URL 'http://bioconductor.org/packages/2.11/bioc/src/contrib/ggbio_1.5.10.tar.gz'
>>
>> Content type 'application/x-gzip' length 5820717 bytes (5.6 Mb)
>>
>> opened URL
>>
>> ==================================================
>>
>> downloaded 5.6 Mb
>>
>> * installing *source* package ‘ggbio’ ...
>>
>> ** R
>>
>> ** inst
>>
>> ** preparing package for lazy loading
>>
>> Warning: No function found corresponding to methods exports from ‘GenomicFeatures’ for: ‘seqnameStyle’
>>
>> Warning: found methods to import for function ‘append’ but not the generic itself
>>
>> Warning: found methods to import for function ‘IQR’ but not the generic itself
>>
>> Warning: found methods to import for function ‘as.table’ but not the generic itself
>>
>> Creating a new generic function for ‘rescale’ in package ‘ggbio’
>>
>> Creating a generic function for ‘summary’ from package ‘base’ in package ‘ggbio’
>>
>> Creating a generic function for ‘print’ from package ‘base’ in package ‘ggbio’
>>
>> Creating a new generic function for ‘xlim’ in package ‘ggbio’
>>
>> Creating a generic function for ‘update’ from package ‘stats’ in package ‘ggbio’
>>
>> Creating a new generic function for ‘geom_rect’ in package ‘ggbio’
>>
>> Creating a new generic function for ‘geom_segment’ in package ‘ggbio’
>>
>> Creating a new generic function for ‘geom_bar’ in package ‘ggbio’
>>
>> Creating a new generic function for ‘stat_identity’ in package ‘ggbio’
>>
>> Creating a new generic function for ‘stat_bin’ in package ‘ggbio’
>>
>> Warning in FUN(X[[1L]], ...) :
>>
>>   Created a package name, ‘2012-07-23 17:11:45’, when none found
>>
>> ** help
>>
>> *** installing help indices
>>
>> ** building package indices
>>
>> ** installing vignettes
>>
>>    ‘Manhattan.Rnw’
>>
>>    ‘autoplot.Rnw’
>>
>>    ‘chip-seq.Rnw’
>>
>>    ‘circular.Rnw’
>>
>>    ‘ideogram.Rnw’
>>
>>    ‘intro.Rnw’
>>
>>    ‘karyogram.Rnw’
>>
>>    ‘mismatch.Rnw’
>>
>>    ‘rangeslinkedtodata.Rnw’
>>
>>    ‘tracks.Rnw’
>>
>>    ‘txdb.Rnw’
>>
>> ** testing if installed package can be loaded
>>
>> Warning: No function found corresponding to methods exports from ‘GenomicFeatures’ for: ‘seqnameStyle’
>>
>> Warning: found methods to import for function ‘as.list’ but not the generic itself
>>
>> Warning: found methods to import for function ‘aggregate’ but not the generic itself
>>
>> Warning: found methods to import for function ‘as.table’ but not the generic itself
>>
>> Warning: found methods to import for function ‘complete.cases’ but not the generic itself
>>
>> Warning: found methods to import for function ‘cor’ but not the generic itself
>>
>> Warning: found methods to import for function ‘append’ but not the generic itself
>>
>> Warning: found methods to import for function ‘as.data.frame’ but not the generic itself
>>
>> Warning: found methods to import for function ‘as.list’ but not the generic itself
>>
>> * DONE (ggbio)
>>
>> The downloaded source packages are in
>>
>>     ‘/tmp/RtmpLWEw0M/downloaded_packages’
>>
>> Warning message:
>>
>> installed directory not writeable, cannot offer to update old packages 'boot',
>>
>>   'class', 'KernSmooth', 'MASS', 'mgcv', 'nnet', 'rpart', 'spatial'
>>
>> And the problem is still there.
>>
>> Many thanks,
>> Xin
>>
>>
>> On 23/07/12 16:28, Tengfei Yin wrote:
>>
>> Hi Xin,
>>
>>  Could you please sent me your sessionInfo().
>>
>>  btw: You can try to install the dev-version of ggbio(by running 'useDevel(TRUE)'
>> in R 2.15 and update ggbio), to see if your problem has been fixed or
>> not.
>>
>>  Thanks a lot.
>>
>>  Tengfei
>>
>>
>>
>> On Mon, Jul 23, 2012 at 6:35 AM, Xin Yang <xin.yang@cimr.cam.ac.uk>wrote:
>>
>>> Dear members,
>>>
>>> I'm using ggbio to get some coverage plot for bam files and I did:
>>>
>>>   autoplot(bamfile, which=genesymbol["IFIH1"],method = "raw")
>>>>
>>>
>>> reading in as Bamfile
>>>
>>> Error in .local(data, ...) : method 'raw' require which argument
>>>
>>>
>>> It seems the "which" argument doesn't work and I checked the
>>> "genesymbol["IFIH1"]" as follows:
>>>
>>>   genesymbol["IFIH1"]
>>>>
>>>
>>> GRanges with 1 range and 2 elementMetadata cols:
>>>
>>>         seqnames                 ranges strand |      symbol
>>>  ensembl_id
>>>
>>>            <Rle>               <IRanges>   <Rle>  |<character>
>>>  <character>
>>>
>>>   IFIH1     chr2 [163123590, 163175039]      - |       IFIH1
>>> ENSG00000115267
>>>
>>>   ---
>>>
>>>   seqlengths:
>>>
>>>                     chr1                 chr10 ...                  chrY
>>>
>>>                       NA                    NA ...                    NA
>>>
>>>   class(genesymbol["IFIH1"])
>>>>
>>>
>>> [1] "GRanges"
>>>
>>> attr(,"package")
>>>
>>> [1] "GenomicRanges"
>>>
>>>
>>> Does anyone have a solution?
>>> Many thanks,
>>>
>>> Xin
>>>
>>> _______________________________________________
>>> 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
>> MCDB PhD student
>> 1620 Howe Hall, 2274,
>> Iowa State University
>> Ames, IA,50011-2274
>> Homepage: www.tengfei.name
>>
>>
>>
>>
>
>
>  --
> Tengfei Yin
> MCDB PhD student
> 1620 Howe Hall, 2274,
> Iowa State University
> Ames, IA,50011-2274
> Homepage: www.tengfei.name
>
>
>
>
> --
> Xin Yang
> JDRF/WT Diabetes and Inflammation Laboratory
> NIHR Cambridge Biomedical Research Centre
> Cambridge Institute for Medical Research, University of Cambridge
> Wellcome Trust/MRC Building, Addenbrooke's Hospital, Cambridge, CB2 0XY
> Tel: 44 (0)1223 763222
> Email: xy249@cam.ac.uk
> Website: http://www-gene.cimr.cam.ac.uk/
>
>


-- 
Tengfei Yin
MCDB PhD student
1620 Howe Hall, 2274,
Iowa State University
Ames, IA,50011-2274
Homepage: www.tengfei.name

	[[alternative HTML version deleted]]

