我一直在尝试使用ggbio中的tracks()函数来组合几个基因组轨道,但似乎无论何时组合它们,x轴都不会保持原始比例。您可以在下面找到显示我的问题的示例的代码。如果您查看两个图的x轴,无论是combined_tracks1还是combined_tracks2,即使您指定了特定的xlim坐标,并且t_a和t_b具有正确的比例,两者都会将x轴标记在错误的位置!
library(ggbio)
test_a = GRanges('chr1', IRanges(start = 150, end = 180))
t_a <- autoplot(test_a)
t_a
test_b = GRanges('chr1', IRanges(start = 100, end = 200))
t_b <- autoplot(test_b)
t_b
## ORDER A, B
combined_tracks1 <- tracks(t_a, t_b) + xlim (100, 200)
combined_tracks1
## ORDER B, A
combined_tracks2 <- tracks(t_b, t_a) + xlim (100, 200)
combined_tracks2
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 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] SNPlocs.Hsapiens.dbSNP142.GRCh37_0.99.5 VariantAnnotation_1.18.7 Rsamtools_1.24.0
[4] SummarizedExperiment_1.2.3 BSgenome.Hsapiens.UCSC.hg19_1.4.0 BSgenome_1.40.1
[7] Biostrings_2.40.2 XVector_0.12.1 rtracklayer_1.32.2
[10] cowplot_0.6.2 scales_0.4.0 plyr_1.8.4
[13] reshape_0.8.5 Homo.sapiens_1.3.1 TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
[16] org.Hs.eg.db_3.3.0 GO.db_3.3.0 OrganismDbi_1.14.1
[19] GenomicFeatures_1.24.5 AnnotationDbi_1.34.4 Biobase_2.32.0
[22] GenomicRanges_1.24.2 GenomeInfoDb_1.8.3 IRanges_2.6.1
[25] S4Vectors_0.10.3 biovizBase_1.20.0 ggbio_1.20.2
[28] ggplot2_2.1.0 BiocGenerics_0.18.0
loaded via a namespace (and not attached):
[1] httr_1.2.1 AnnotationHub_2.4.2 splines_3.3.1 Formula_1.2-1
[5] shiny_0.13.2 interactiveDisplayBase_1.10.3 latticeExtra_0.6-28 RBGL_1.48.1
[9] RSQLite_1.0.0 lattice_0.20-33 chron_2.3-47 digest_0.6.10
[13] RColorBrewer_1.1-2 colorspace_1.2-6 htmltools_0.3.5 httpuv_1.3.3
[17] Matrix_1.2-6 XML_3.98-1.4 biomaRt_2.28.0 zlibbioc_1.18.0
[21] xtable_1.8-2 BiocParallel_1.6.6 nnet_7.3-12 survival_2.39-5
[25] magrittr_1.5 mime_0.5 GGally_1.2.0 foreign_0.8-66
[29] graph_1.50.0 BiocInstaller_1.22.3 tools_3.3.1 data.table_1.9.6
[33] stringr_1.1.0 munsell_0.4.3 cluster_2.0.4 ensembldb_1.4.7
[37] grid_3.3.1 RCurl_1.95-4.8 dichromat_2.0-0 bitops_1.0-6
[41] labeling_0.3 gtable_0.2.0 DBI_0.5 reshape2_1.4.1
[45] R6_2.1.3 GenomicAlignments_1.8.4 gridExtra_2.2.1 Hmisc_3.17-4
[49] stringi_1.1.1 Rcpp_0.12.6 rpart_4.1-10 acepack_1.3-3.3
ggpl
非常感谢,
最佳,
Yatrosin
答案 0 :(得分:1)
我对自己的问题有答案。您需要以下列方式修复x轴:
fixed(t_a) <- TRUE
fixed(t_b) <- TRUE
每个单一地块。
这样,在track()函数生成的最终图中不会修改x轴。
最佳,