我正在尝试将纯文本与斜体文本组合在由ggbio生成的组合曲目()图表的标题中,但我不能在斜体字体中包含我想要的标题部分。
这里有几个标题的例子,它们允许使用表达式斜体(斜体(x)),最后一个是不适用于我的标题。
library(ggbio)
library(grDevices)
这是我想要使用的标题:“ AAAA 基因的变异”
我可以使用此代码获取它:
plot_title <- expression(paste("Variation in ", italic("AAAA"), " gene"))
x <- c(2*5)
y <- c(2^5)
plot(x,y, main = plot_title)
test_a = GRanges('chr1', IRanges(start = 150, end = 180))
t_a <- autoplot(test_a, main = plot_title)
fixed(t_a) <- TRUE
t_a
test_b = GRanges('chr1', IRanges(start = 100, end = 200))
t_b <- autoplot(test_b, main = plot_title)
fixed(t_b) <- TRUE
t_b
combined_tracks <- tracks(t_a, t_b, title = "Variation in AAAA gene") + xlim (100, 200)
combined_tracks
combined_tracks2 <- tracks(t_a, t_b, title = plot_title) + xlim (100, 200)
combined_tracks2
我收到以下错误:
Error in validObject(.Object) :
invalid class "Tracks" object: invalid object for slot "main" in class "Tracks": got class "expression", should be or extend class "characterORNULL"
有人如何解决这个错误,
我在互联网上看过,但我没有找到这个特定track()函数的答案。
非常感谢,
最佳,
R version 3.3.1 (2016-06-21)
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] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] Homo.sapiens_1.3.1 TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
[3] org.Hs.eg.db_3.3.0 GO.db_3.3.0
[5] OrganismDbi_1.14.1 GenomicFeatures_1.24.5
[7] AnnotationDbi_1.34.4 Biobase_2.32.0
[9] GenomicRanges_1.24.3 GenomeInfoDb_1.8.7
[11] IRanges_2.6.1 S4Vectors_0.10.3
[13] biovizBase_1.20.0 ggbio_1.20.2
[15] ggplot2_2.1.0 BiocGenerics_0.18.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 lattice_0.20-34 Rsamtools_1.24.0
[4] Biostrings_2.40.2 digest_0.6.10 mime_0.5
[7] R6_2.1.3 plyr_1.8.4 chron_2.3-47
[10] acepack_1.3-3.3 RSQLite_1.0.0 httr_1.2.1
[13] BiocInstaller_1.22.3 zlibbioc_1.18.0 data.table_1.9.6
[16] rpart_4.1-10 Matrix_1.2-7.1 labeling_0.3
[19] splines_3.3.1 BiocParallel_1.6.6 AnnotationHub_2.4.2
[22] stringr_1.1.0 foreign_0.8-67 RCurl_1.95-4.8
[25] biomaRt_2.28.0 munsell_0.4.3 shiny_0.14
[28] httpuv_1.3.3 rtracklayer_1.32.2 htmltools_0.3.5
[31] nnet_7.3-12 SummarizedExperiment_1.2.3 gridExtra_2.2.1
[34] interactiveDisplayBase_1.10.3 Hmisc_3.17-4 XML_3.98-1.4
[37] reshape_0.8.5 GenomicAlignments_1.8.4 bitops_1.0-6
[40] RBGL_1.48.1 grid_3.3.1 xtable_1.8-2
[43] GGally_1.2.0 gtable_0.2.0 DBI_0.5-1
[46] magrittr_1.5 scales_0.4.0 graph_1.50.0
[49] stringi_1.1.1 XVector_0.12.1 reshape2_1.4.1
[52] latticeExtra_0.6-28 Formula_1.2-1 RColorBrewer_1.1-2
[55] ensembldb_1.4.7 tools_3.3.1 dichromat_2.0-0
[58] BSgenome_1.40.1 survival_2.39-5 colorspace_1.2-6
[61] cluster_2.0.4 VariantAnnotation_1.18.7