...
|
...
|
@@ -137,7 +137,7 @@
|
137
|
137
|
},
|
138
|
138
|
{
|
139
|
139
|
"location": "/faq/",
|
140
|
|
- "text": "Installation\n\n\n Could not find function\n\n\nIf you got \nthis error\n, please make sure you are using the latest R and \nggtree\n.\n\n\nPackages in Bioconductor, like \nggtree\n, have different release policy compare to CRAN. There are two branches, release and devel, in parallel. Release branch is more stable and only document improvement and bug fixes will commit to it. New functions will only commit to \ndevel\n branch.\n\n\nSometimes I may write blog post to introduce new functions which is not available in \nrelease\n branch, you need to install the \ndevel\n version of \nggtree\n in order to use these new functions.\n\n\nYou can download the \ndevel\n version of \nggtree\n from \nhttp://bioconductor.org/packages/devel/bioc/html/ggtree.html\n and install it, or install the github version of \nggtree\n.\n\n\nThis also applied to other of my packages, including \nGOSemSim\n, \nDOSE\n, \nclusterProfiler\n, \nReactomePA\n and \nChIPseeker\n. If you got the \ncould not find function\n error, upgrade your installation to latest release. If the error still exists after upgrading to latest release, you need to install the devel version.\n\n\n Text \n Label\n\n\n Tip label truncated\n\n\nggplot2 can't auto adjust xlim based on added text.\n\n\nlibrary(ggtree)\n## example tree from https://support.bioconductor.org/p/72398/\ntree\n-read.tree(text=\n(Organism1.006G249400.1:0.03977,(Organism2.022118m:0.01337,(Organism3.J34265.1:0.00284,Organism4.G02633.1:0.00468)0.51:0.0104):0.02469);\n)\nggtree(tree) + geom_tiplab()\n\n\n\n\nThis is because the units are in two different spaces (data and pixel). Users can use xlim to allocate more space for tip label.\n\n\nggtree(tree) + geom_tiplab() + xlim(0, 0.06)\n\n\n\n\n Modify (tip) labels\n\n\nThis could be easily done via the \n%\n+%\n operator to attach the\nmodified version of the labels and than use \ngeom_tiplab\n to display\nthe modified version.\n\n\nraxml_file \n- system.file(\nextdata/RAxML\n, \nRAxML_bipartitionsBranchLabels.H3\n, package=\nggtree\n)\nraxml \n- read.raxml(raxml_file)\n\nlb = get.tree(raxml)$tip.label\nd = data.frame(label=lb, label2 = paste(\nAA\n, substring(lb, 1, 5)))\nggtree(raxml) %\n+% d + geom_tiplab(aes(label=label2))\n\n\n\n\nsee also\n\n1\n\nand \n2\n.\n\n\n Formatting (tip) labels\n\n\nIf you want to format labels, you need to set \nparse=TRUE\n in \ngeom_text\n/\ngeom_tiplab\n and the \nlabel\n should be string that can be parsed into expression and displayed as described in \n?plotmath\n.\n\n\nFor example, the tiplabels contains two parts, species name and accession number and we want to display species name in \nitalic\n, we can use command like this:\n\n\nggtree(rtree(30)) + geom_tiplab(aes(subset=node==35), label='paste(italic(\nspecies name\n), \naccession number\n)', parse=T)\n\n\n\n\n Avoid overlapping text labels\n\n\nUser can use \nggrepel\n package to repel overlapping text labels.\n\n\nFor example:\n\n\nlibrary(ggrepel)\nlibrary(ggtree)\nraxml_file \n- system.file(\nextdata/RAxML\n, \nRAxML_bipartitionsBranchLabels.H3\n, package=\nggtree\n)\nraxml \n- read.raxml(raxml_file)\nggtree(raxml) + geom_label_repel(aes(label=bootstrap, fill=bootstrap))\n\n\n\n\nFor details, please refer to \nggrepel usage examples\n.\n\n\n bootstrap values from newick format\n\n\nIt's quite command to store \nbootstrap\n value as node label in \nnewick\n format. Visualizing node label is easy using \ngeom_text2(aes(subset = !isTip, label=label))\n.\n\n\nIf you want to only display a subset of \nbootstrap\n (e.g. bootstrap \n 80), you can't simply using \ngeom_text2(subset= (label \n 80), label=label)\n since \nlabel\n is a character vector, which contains node label (bootstrap value) and tip label (taxa name). If we use \ngeom_text2(subset=(as.numeric(label) \n 80), label=label)\n, it will also fail since \nNAs\n were introduced by coercion. We need to convert \nNAs\n to logical \nFALSE\n, this can be done by the following code:\n\n\nnwk \n- system.file(\nextdata/RAxML\n,\nRAxML_bipartitions.H3\n, package='ggtree')\ntr \n- read.tree(nwk)\nggtree(tr) + geom_text2(aes(label=label, subset = !is.na(as.numeric(label)) \n as.numeric(label) \n 80))\n\n\n\n\nAnother solution is converting the bootstrap value outside \nggtree\n as I recommended in \ngoogle group\n.\n\n\nq \n- ggtree(tr)\nd \n- q$data\nd \n- d[!d$isTip,]\nd$label \n- as.numeric(d$label)\nd \n- d[d$label \n 80,]\n\nq + geom_text(data=d, aes(label=label))\n\n\n\n\n \naesthetic\n mapping\n\n\n inherit \naes\n\n\nggtree(rtree(30)) + geom_point()\n\n\n\n\nFor example, we can add symbolic points to nodes with \ngeom_point()\n directly.\nThe magic here is we don't need to map \nx\n and \ny\n position of the points by providing \naes(x, y)\n to \ngeom_point()\n since it was already mapped by \nggtree\n function and it serves as a global mapping for all layers.\n\n\nBut what if we provide a \ndataset\n in a layer and the \ndataset\n doesn't contain column of \nx\n and/or \ny\n,\nthe layer function also try to map \nx\n and \ny\n and also others if you map them in \nggtree\n function.\nAs these variable is not available in your \ndataset\n, you will get the following error:\n\n\nError in eval(expr, envir, enclos) : object 'x' not found\n\n\n\n\nThis can be fixed by using parameter \ninherit.aes=FALSE\n which will disable inheriting mapping from \nggtree\n function.\n\n\n use \n$\n in aes\n\n\nNEVER DO THIS.\n\n\nsee the explaination in the \nggplot2 book 2ed\n:\n\n\n\n\nNever refer to a variable with \n$\n (e.g., \ndiamonds$carat\n) in \naes()\n. This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting. \\indexc{\\$}\n\n\n\n\nsee also\n\n1\n\nand \n2\n.\n\n\n Annotation\n\n\n colouring edges by user data\n\n\nsee my answer on \nhttps://github.com/GuangchuangYu/ggtree/issues/76\n\nand \nhttps://groups.google.com/forum/#!topic/bioc-ggtree/4GgivKqVjB8\n.",
|
|
140
|
+ "text": "Installation\n\n\n Could not find function\n\n\nIf you got \nthis error\n, please make sure you are using the latest R and \nggtree\n.\n\n\nPackages in Bioconductor, like \nggtree\n, have different release policy compare to CRAN. There are two branches, release and devel, in parallel. Release branch is more stable and only document improvement and bug fixes will commit to it. New functions will only commit to \ndevel\n branch.\n\n\nSometimes I may write blog post to introduce new functions which is not available in \nrelease\n branch, you need to install the \ndevel\n version of \nggtree\n in order to use these new functions.\n\n\nYou can download the \ndevel\n version of \nggtree\n from \nhttp://bioconductor.org/packages/devel/bioc/html/ggtree.html\n and install it, or install the github version of \nggtree\n.\n\n\nThis also applied to other of my packages, including \nGOSemSim\n, \nDOSE\n, \nclusterProfiler\n, \nReactomePA\n and \nChIPseeker\n. If you got the \ncould not find function\n error, upgrade your installation to latest release. If the error still exists after upgrading to latest release, you need to install the devel version.\n\n\n Text \n Label\n\n\n Tip label truncated\n\n\nggplot2 can't auto adjust xlim based on added text.\n\n\nlibrary(ggtree)\n## example tree from https://support.bioconductor.org/p/72398/\ntree\n-read.tree(text=\n(Organism1.006G249400.1:0.03977,(Organism2.022118m:0.01337,(Organism3.J34265.1:0.00284,Organism4.G02633.1:0.00468)0.51:0.0104):0.02469);\n)\nggtree(tree) + geom_tiplab()\n\n\n\n\nThis is because the units are in two different spaces (data and pixel). Users can use xlim to allocate more space for tip label.\n\n\nggtree(tree) + geom_tiplab() + xlim(0, 0.06)\n\n\n\n\n Modify (tip) labels\n\n\nThis could be easily done via the \n%\n+%\n operator to attach the\nmodified version of the labels and than use \ngeom_tiplab\n to display\nthe modified version.\n\n\nraxml_file \n- system.file(\nextdata/RAxML\n, \nRAxML_bipartitionsBranchLabels.H3\n, package=\nggtree\n)\nraxml \n- read.raxml(raxml_file)\n\nlb = get.tree(raxml)$tip.label\nd = data.frame(label=lb, label2 = paste(\nAA\n, substring(lb, 1, 5)))\nggtree(raxml) %\n+% d + geom_tiplab(aes(label=label2))\n\n\n\n\nsee also\n\n1\n\nand \n2\n.\n\n\n Formatting (tip) labels\n\n\nIf you want to format labels, you need to set \nparse=TRUE\n in \ngeom_text\n/\ngeom_tiplab\n and the \nlabel\n should be string that can be parsed into expression and displayed as described in \n?plotmath\n.\n\n\nFor example, the tiplabels contains two parts, species name and accession number and we want to display species name in \nitalic\n, we can use command like this:\n\n\nggtree(rtree(30)) + geom_tiplab(aes(subset=node==35), label='paste(italic(\nspecies name\n), \naccession number\n)', parse=T)\n\n\n\n\n Avoid overlapping text labels\n\n\nUser can use \nggrepel\n package to repel overlapping text labels.\n\n\nFor example:\n\n\nlibrary(ggrepel)\nlibrary(ggtree)\nraxml_file \n- system.file(\nextdata/RAxML\n, \nRAxML_bipartitionsBranchLabels.H3\n, package=\nggtree\n)\nraxml \n- read.raxml(raxml_file)\nggtree(raxml) + geom_label_repel(aes(label=bootstrap, fill=bootstrap))\n\n\n\n\nFor details, please refer to \nggrepel usage examples\n.\n\n\n bootstrap values from newick format\n\n\nIt's quite command to store \nbootstrap\n value as node label in \nnewick\n format. Visualizing node label is easy using \ngeom_text2(aes(subset = !isTip, label=label))\n.\n\n\nIf you want to only display a subset of \nbootstrap\n (e.g. bootstrap \n 80), you can't simply using \ngeom_text2(subset= (label \n 80), label=label)\n since \nlabel\n is a character vector, which contains node label (bootstrap value) and tip label (taxa name). If we use \ngeom_text2(subset=(as.numeric(label) \n 80), label=label)\n, it will also fail since \nNAs\n were introduced by coercion. We need to convert \nNAs\n to logical \nFALSE\n, this can be done by the following code:\n\n\nnwk \n- system.file(\nextdata/RAxML\n,\nRAxML_bipartitions.H3\n, package='ggtree')\ntr \n- read.tree(nwk)\nggtree(tr) + geom_text2(aes(label=label, subset = !is.na(as.numeric(label)) \n as.numeric(label) \n 80))\n\n\n\n\nAnother solution is converting the bootstrap value outside \nggtree\n as I recommended in \ngoogle group\n.\n\n\nq \n- ggtree(tr)\nd \n- q$data\nd \n- d[!d$isTip,]\nd$label \n- as.numeric(d$label)\nd \n- d[d$label \n 80,]\n\nq + geom_text(data=d, aes(label=label))\n\n\n\n\n \naesthetic\n mapping\n\n\n inherit \naes\n\n\nggtree(rtree(30)) + geom_point()\n\n\n\n\nFor example, we can add symbolic points to nodes with \ngeom_point()\n directly.\nThe magic here is we don't need to map \nx\n and \ny\n position of the points by providing \naes(x, y)\n to \ngeom_point()\n since it was already mapped by \nggtree\n function and it serves as a global mapping for all layers.\n\n\nBut what if we provide a \ndataset\n in a layer and the \ndataset\n doesn't contain column of \nx\n and/or \ny\n,\nthe layer function also try to map \nx\n and \ny\n and also others if you map them in \nggtree\n function.\nAs these variable is not available in your \ndataset\n, you will get the following error:\n\n\nError in eval(expr, envir, enclos) : object 'x' not found\n\n\n\n\nThis can be fixed by using parameter \ninherit.aes=FALSE\n which will disable inheriting mapping from \nggtree\n function.\n\n\n use \n$\n in aes\n\n\nNEVER DO THIS.\n\n\nsee the explaination in the \nggplot2 book 2ed\n:\n\n\n\n\nNever refer to a variable with \n$\n (e.g., \ndiamonds$carat\n) in \naes()\n. This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting.\n\n\n\n\nsee also\n\n1\n\nand \n2\n.\n\n\n Annotation\n\n\n colouring edges by user data\n\n\nsee my answer on \nhttps://github.com/GuangchuangYu/ggtree/issues/76\n\nand \nhttps://groups.google.com/forum/#!topic/bioc-ggtree/4GgivKqVjB8\n.",
|
141
|
141
|
"title": "FAQ"
|
142
|
142
|
},
|
143
|
143
|
{
|
...
|
...
|
@@ -192,7 +192,7 @@
|
192
|
192
|
},
|
193
|
193
|
{
|
194
|
194
|
"location": "/faq/#use-in-aes",
|
195
|
|
- "text": "NEVER DO THIS. see the explaination in the ggplot2 book 2ed : Never refer to a variable with $ (e.g., diamonds$carat ) in aes() . This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting. \\indexc{\\$} see also 1 \nand 2 .",
|
|
195
|
+ "text": "NEVER DO THIS. see the explaination in the ggplot2 book 2ed : Never refer to a variable with $ (e.g., diamonds$carat ) in aes() . This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting. see also 1 \nand 2 .",
|
196
|
196
|
"title": " use $ in aes"
|
197
|
197
|
},
|
198
|
198
|
{
|
...
|
...
|
@@ -207,7 +207,7 @@
|
207
|
207
|
},
|
208
|
208
|
{
|
209
|
209
|
"location": "/featuredArticles/",
|
210
|
|
- "text": "Let us know\n if you have published using \nggtree\n and your publication will be featured here.\n\n\n\n\n\n\n\n\n\n\n\n\n\n .rChart {\n display: block;\n margin-left: auto; \n margin-right: auto;\n width: 800px;\n height: 300px;\n } \n \n\n\n\n\n\n\n\n var chartParams = {\n \"element\": \"chart4057456ed9b\",\n\"width\": 800,\n\"height\": 400,\n\"xkey\": \"year\",\n\"ykeys\": [\n \"cites\" \n],\n\"data\": [\n {\n \"year\": 2016,\n\"cites\": 1,\n\"pubid\": \"HtEfBTGE9r8C\" \n} \n],\n\"id\": \"chart4057456ed9b\",\n\"labels\": \"cites\" \n},\n chartType = \"Bar\"\n new Morris[chartType](chartParams)\n\n\n\n\n 2016\n\n\nLack of GLYCOLATE OXIDASE 1, but not GLYCOLATE OXIDASE 2, attenuates the photorespiratory phenotype of CATALASE2-deficient \nArabidopsis\n\n\nPlant Physiology\n May. 2016 \n\n\n\n\nRange overlap drives chromosome inversion fixation in passerine birds\n\n\nbioRxiv\n May. 2016 \nhttp://dx.doi.org/10.1101/053371\n\n\n\n\nPhenotypic and Genotypic Characteristics of Shiga Toxin-Producing Escherichia coli Isolated from Surface Waters and Sediments in a Canadian Urban-Agricultural Landscape\n\n\nFront. Cell. Infect. Microbiol.\n Apr. 2016 \nhttp://dx.doi.org/10.3389%2Ffcimb.2016.00036\n\n\n\n\nWs-2\n Introgression in a Proportion of \nArabidopsis thaliana Col-0\n Stock Seed Produces Specific Phenotypes and Highlights the Importance of Routine Genetic Verification\n\n\nPlant Cell\n Mar. 2016 \nhttp://dx.doi.org/10.1105/tpc.16.00053\n\n\n\n\n 2015\n\n\nThe population genetics of drug resistance evolution in natural populations of viral, bacterial and eukaryotic pathogens\n\n\nMolecuar Ecology\n Dec. 2015 \nhttp://dx.doi.org/10.1111/mec.13474\n\n\n\n\nGenetic characterization of highly pathogenic H5 influenza viruses from poultry in Taiwan, 2015\n\n\nInfection, Genetics and Evolution\n Dec. 2015 \nhttp://dx.doi.org/10.1016/j.meegid.2015.12.006\n\n\n\n\nTrans-species polymorphism at antimicrobial innate immunity cathelicidin genes of Atlantic cod and related species\n\n\nPeerJ\n May 2015 \nhttps://doi.org/10.7717/peerj.976",
|
|
210
|
+ "text": "Let us know\n if you have published using \nggtree\n and your publication will be featured here.\n\n\n\n\n\n\n\n\n\n\n\n\n\n .rChart {\n display: block;\n margin-left: auto; \n margin-right: auto;\n width: 800px;\n height: 300px;\n } \n \n\n\n\n\n\n\n\n var chartParams = {\n \"element\": \"chart47cdaaf4ab\",\n\"width\": 800,\n\"height\": 400,\n\"xkey\": \"year\",\n\"ykeys\": [\n \"cites\" \n],\n\"data\": [\n {\n \"year\": 2016,\n\"cites\": 1,\n\"pubid\": \"HtEfBTGE9r8C\" \n} \n],\n\"id\": \"chart47cdaaf4ab\",\n\"labels\": \"cites\" \n},\n chartType = \"Bar\"\n new Morris[chartType](chartParams)\n\n\n\n\n 2016\n\n\nLack of GLYCOLATE OXIDASE 1, but not GLYCOLATE OXIDASE 2, attenuates the photorespiratory phenotype of CATALASE2-deficient \nArabidopsis\n\n\nPlant Physiology\n May. 2016 \n\n\n\n\nRange overlap drives chromosome inversion fixation in passerine birds\n\n\nbioRxiv\n May. 2016 \nhttp://dx.doi.org/10.1101/053371\n\n\n\n\nPhenotypic and Genotypic Characteristics of Shiga Toxin-Producing Escherichia coli Isolated from Surface Waters and Sediments in a Canadian Urban-Agricultural Landscape\n\n\nFront. Cell. Infect. Microbiol.\n Apr. 2016 \nhttp://dx.doi.org/10.3389%2Ffcimb.2016.00036\n\n\n\n\nWs-2\n Introgression in a Proportion of \nArabidopsis thaliana Col-0\n Stock Seed Produces Specific Phenotypes and Highlights the Importance of Routine Genetic Verification\n\n\nPlant Cell\n Mar. 2016 \nhttp://dx.doi.org/10.1105/tpc.16.00053\n\n\n\n\n 2015\n\n\nThe population genetics of drug resistance evolution in natural populations of viral, bacterial and eukaryotic pathogens\n\n\nMolecuar Ecology\n Dec. 2015 \nhttp://dx.doi.org/10.1111/mec.13474\n\n\n\n\nGenetic characterization of highly pathogenic H5 influenza viruses from poultry in Taiwan, 2015\n\n\nInfection, Genetics and Evolution\n Dec. 2015 \nhttp://dx.doi.org/10.1016/j.meegid.2015.12.006\n\n\n\n\nTrans-species polymorphism at antimicrobial innate immunity cathelicidin genes of Atlantic cod and related species\n\n\nPeerJ\n May 2015 \nhttps://doi.org/10.7717/peerj.976",
|
211
|
211
|
"title": "Featured Articles"
|
212
|
212
|
},
|
213
|
213
|
{
|