ggbio tracks () does not allow "call" class in the "main" slot of the function
1
0
Entering edit mode
@oswaldolorenzo-11449
Last seen 7.2 years ago

Hello,

The change Michael Lawrence made a few months ago on the tracks() to allow italics in the plot titles works well if you work with expression class objects, but I found an additional issue. I need to generate several plots and instead of writing each gene name manually, I would like to parse a variable to the italic function.

That means, instead of generating the plot title like this:

plot_title <- expression(paste("Variation in ", italic("AAAA"), " gene")) , I would like to replace "AAAA" by the variable gene_name.

In order to do so, I need to use the bquote function like this:

plot_title <- bquote('Variation in'~italic(.(gene_name))~'gene')

This function returns a "call" class object. Whenever I generate the plot title this way, it works with the plot or autoplot function, but the tracks function does not recognize it, and it returns the following error:

Error in validObject(.Object) :  invalid class "Tracks" object: invalid object for slot "main" in class "Tracks": got class "call", should be or extend class "characterORexpressionORNULL"

 

Can the "call" class be added to the "main" argument of the tracks function?

 

R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                         
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods 
[9] base     

other attached packages:
[1] Homo.sapiens_1.3.1                      TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
[3] org.Hs.eg.db_3.4.0                      GO.db_3.4.0                           
[5] OrganismDbi_1.16.0                      GenomicFeatures_1.26.2                
[7] AnnotationDbi_1.36.0                    Biobase_2.34.0                        
[9] biovizBase_1.22.0                       ggbio_1.22.3                          
[11] ggplot2_2.2.0                           GenomicRanges_1.26.1                  
[13] GenomeInfoDb_1.10.2                     IRanges_2.8.1                         
[15] S4Vectors_0.12.1                        BiocGenerics_0.20.0                   
[17] RSQLite_1.1-1                          

loaded via a namespace (and not attached):
[1] httr_1.2.1                    AnnotationHub_2.6.4         
[3] splines_3.3.2                 Formula_1.2-1               
[5] shiny_0.14.2                  assertthat_0.1              
[7] interactiveDisplayBase_1.12.0 latticeExtra_0.6-28         
[9] RBGL_1.50.0                   BSgenome_1.42.0             
[11] Rsamtools_1.26.1              yaml_2.1.14                 
[13] lattice_0.20-34               digest_0.6.10               
[15] RColorBrewer_1.1-2            XVector_0.14.0              
[17] colorspace_1.3-2              htmltools_0.3.5             
[19] httpuv_1.3.3                  Matrix_1.2-7.1              
[21] plyr_1.8.4                    XML_3.98-1.5                
[23] biomaRt_2.30.0                zlibbioc_1.20.0             
[25] xtable_1.8-2                  scales_0.4.1                
[27] BiocParallel_1.8.1            htmlTable_1.7               
[29] tibble_1.2                    openssl_0.9.5               
[31] SummarizedExperiment_1.4.0    nnet_7.3-12                 
[33] lazyeval_0.2.0                survival_2.40-1             
[35] magrittr_1.5                  mime_0.5                    
[37] memoise_1.0.0                 GGally_1.3.0                
[39] foreign_0.8-67                graph_1.52.0                
[41] BiocInstaller_1.24.0          tools_3.3.2                 
[43] data.table_1.10.0             stringr_1.1.0               
[45] munsell_0.4.3                 cluster_2.0.5               
[47] ensembldb_1.6.2               Biostrings_2.42.1           
[49] base64_2.0                    grid_3.3.2                  
[51] RCurl_1.95-4.8                dichromat_2.0-0             
[53] VariantAnnotation_1.20.2      labeling_0.3                
[55] bitops_1.0-6                  gtable_0.2.0                
[57] DBI_0.5-1                     reshape_0.8.6               
[59] reshape2_1.4.2                R6_2.2.0                    
[61] GenomicAlignments_1.10.0      gridExtra_2.2.1             
[63] knitr_1.15.1                  rtracklayer_1.34.1          
[65] Hmisc_4.0-1                   stringi_1.1.2               
[67] Rcpp_0.12.8                   rpart_4.1-10                
[69] acepack_1.4.1   

Thank you very much,

Best,

Oswaldo

ggbio ggplot2 call plot • 1.5k views
ADD COMMENT
1
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States

For now, I think you could just put the call object in an expression, i.e., expression(bquote(...)). I'll look into making it more user friendly.

ADD COMMENT
0
Entering edit mode

Dear Michael Lawrence,

This was my first guess, that turning the bquote(...)) into an expression(bquote(..)) object would work.

The problem I get with this approach is that instead of getting the real gene name into the output plot title, I get the following character string:

"bquote(Variation in .(gene_name) gene)"

That was the reason to ask you to include the call object into the accepted formats for the main class of the tracks function.

Thank you very much for your time,

Best,

Oswaldo

ADD REPLY
1
Entering edit mode

Sorry, I meant as.expression(bquote(...)).

ADD REPLY
0
Entering edit mode

Thank you,

That was my fault. I wasn't converting the bquote function into an expression in the right way.

This will work for me like this.

Best,

Oswaldo

ADD REPLY

Login before adding your answer.

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