... | ... |
@@ -7,7 +7,8 @@ all: rd readme check clean |
7 | 7 |
alldocs: site rd readme |
8 | 8 |
|
9 | 9 |
rd: |
10 |
- Rscript -e 'roxygen2::roxygenise(".")' |
|
10 |
+ Rscript -e 'library(methods); devtools::document()' |
|
11 |
+# Rscript -e 'roxygen2::roxygenise(".")' |
|
11 | 12 |
|
12 | 13 |
readme: |
13 | 14 |
Rscript -e 'rmarkdown::render("README.Rmd")' |
... | ... |
@@ -28,11 +29,11 @@ install: |
28 | 29 |
cd ..;\ |
29 | 30 |
R CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz |
30 | 31 |
|
31 |
-check: build |
|
32 |
+check: rd build |
|
32 | 33 |
cd ..;\ |
33 | 34 |
Rscript -e 'rcmdcheck::rcmdcheck("$(PKGNAME)_$(PKGVERS).tar.gz")' |
34 | 35 |
|
35 |
-check2: build |
|
36 |
+check2: rd build |
|
36 | 37 |
cd ..;\ |
37 | 38 |
R CMD check $(PKGNAME)_$(PKGVERS).tar.gz |
38 | 39 |
|
... | ... |
@@ -2,8 +2,6 @@ |
2 | 2 |
|
3 | 3 |
S3method(as.binary,phylo) |
4 | 4 |
S3method(as.data.frame,phylo) |
5 |
-S3method(as_data_frame,phylo) |
|
6 |
-S3method(as_data_frame,treedata) |
|
7 | 5 |
S3method(fortify,multiPhylo) |
8 | 6 |
S3method(fortify,obkData) |
9 | 7 |
S3method(fortify,phylo) |
... | ... |
@@ -184,13 +182,14 @@ importFrom(methods,setGeneric) |
184 | 182 |
importFrom(methods,setOldClass) |
185 | 183 |
importFrom(rvcheck,get_fun_from_pkg) |
186 | 184 |
importFrom(scales,alpha) |
187 |
-importFrom(tibble,as_data_frame) |
|
188 | 185 |
importFrom(tibble,data_frame) |
189 | 186 |
importFrom(tidyr,gather) |
187 |
+importFrom(tidytree,as_data_frame) |
|
190 | 188 |
importFrom(treeio,Nnode) |
191 | 189 |
importFrom(treeio,Ntip) |
192 | 190 |
importFrom(treeio,as.phylo) |
193 | 191 |
importFrom(treeio,as.treedata) |
192 |
+importFrom(treeio,get_tree_data) |
|
194 | 193 |
importFrom(treeio,groupClade) |
195 | 194 |
importFrom(treeio,groupOTU) |
196 | 195 |
importFrom(utils,modifyList) |
197 | 196 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,63 @@ |
1 |
+## not used. |
|
2 |
+## we don't guess mrsd from tip labels |
|
3 |
+## user should provide mrsd parameter in ggtree if they want to use time-scaled tree |
|
4 |
+scaleX_by_time <- function(df, as.Date=FALSE) { |
|
5 |
+ time <- with(df, gsub(".*[_/]{1}(\\d+\\.*\\d+)$", "\\1", label[isTip])) %>% as.numeric |
|
6 |
+ latest <- which.max(time) |
|
7 |
+ |
|
8 |
+ scaleX_by_time_from_mrsd(df, decimal2Date(time[latest]), as.Date) |
|
9 |
+} |
|
10 |
+ |
|
11 |
+ |
|
12 |
+scaleX_by_time_from_mrsd <- function(df, mrsd, as.Date) { |
|
13 |
+ mrsd %<>% as.Date |
|
14 |
+ date <- Date2decimal(mrsd) |
|
15 |
+ |
|
16 |
+ df$x <- df$x + date - max(df$x) |
|
17 |
+ df$branch <- with(df, (x[match(parent, node)] + x)/2) |
|
18 |
+ ## df$branch <- (df[df$parent, "x"] + df[, "x"])/2 |
|
19 |
+ |
|
20 |
+ if (as.Date) { |
|
21 |
+ df$x <- decimal2Date(df$x) |
|
22 |
+ df$branch <- decimal2Date(df$branch) |
|
23 |
+ } |
|
24 |
+ |
|
25 |
+ return(df) |
|
26 |
+} |
|
27 |
+ |
|
28 |
+ |
|
29 |
+##' convert Date to decimal format, eg "2014-05-05" to "2014.34" |
|
30 |
+##' |
|
31 |
+##' |
|
32 |
+##' @title Date2decimal |
|
33 |
+##' @param x Date |
|
34 |
+##' @return numeric |
|
35 |
+##' @export |
|
36 |
+##' @author Guangchuang Yu |
|
37 |
+Date2decimal <- function(x) { |
|
38 |
+ if (is(x, "numeric")) { |
|
39 |
+ return(x) |
|
40 |
+ } |
|
41 |
+ |
|
42 |
+ if (is(x, "character")) { |
|
43 |
+ x <- as.Date(x) |
|
44 |
+ } |
|
45 |
+ year <- format(x, "%Y") |
|
46 |
+ y <- x - as.Date(paste0(year, "-01-01")) |
|
47 |
+ as.numeric(year) + as.numeric(y)/365 |
|
48 |
+} |
|
49 |
+ |
|
50 |
+##' convert decimal format to Date, eg "2014.34" to "2014-05-05" |
|
51 |
+##' |
|
52 |
+##' |
|
53 |
+##' @title decimal2Date |
|
54 |
+##' @param x numerical number, eg 2014.34 |
|
55 |
+##' @return Date |
|
56 |
+##' @export |
|
57 |
+##' @author Guangchuang Yu |
|
58 |
+decimal2Date <- function(x) { |
|
59 |
+ date <- as.Date(paste0(floor(x), "-01-01")) |
|
60 |
+ date + as.numeric(sub("^\\d+", "0", x)) * 365 |
|
61 |
+} |
|
62 |
+ |
|
63 |
+ |
14 | 15 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,158 @@ |
1 |
+##' @importFrom ggplot2 fortify |
|
2 |
+##' @method fortify treedata |
|
3 |
+##' @export |
|
4 |
+fortify.treedata <- function(model, data, |
|
5 |
+ layout = "rectangular", |
|
6 |
+ yscale = "none", |
|
7 |
+ ladderize = TRUE, |
|
8 |
+ right = FALSE, |
|
9 |
+ branch.length = "branch.length", |
|
10 |
+ mrsd = NULL, |
|
11 |
+ as.Date = FALSE, ...) { |
|
12 |
+ |
|
13 |
+ model <- set_branch_length(model, branch.length) |
|
14 |
+ |
|
15 |
+ fortify.phylo(model, data, |
|
16 |
+ layout = layout, |
|
17 |
+ yscale = yscale, |
|
18 |
+ ladderize = ladderize, |
|
19 |
+ right = right, |
|
20 |
+ branch.length = branch.length, |
|
21 |
+ mrsd = mrsd, |
|
22 |
+ as.Date = as.Date, ...) |
|
23 |
+} |
|
24 |
+ |
|
25 |
+##' @importFrom ape ladderize |
|
26 |
+##' @importFrom treeio as.phylo |
|
27 |
+##' @importFrom treeio Nnode |
|
28 |
+##' @importFrom tibble data_frame |
|
29 |
+##' @importFrom dplyr full_join |
|
30 |
+##' @importFrom tidytree as_data_frame |
|
31 |
+##' @method fortify phylo |
|
32 |
+##' @export |
|
33 |
+fortify.phylo <- function(model, data, |
|
34 |
+ layout = "rectangular", |
|
35 |
+ ladderize = TRUE, |
|
36 |
+ right = FALSE, |
|
37 |
+ branch.length = "branch.length", |
|
38 |
+ mrsd = NULL, |
|
39 |
+ as.Date = FALSE, |
|
40 |
+ yscale = "none", |
|
41 |
+ ...) { |
|
42 |
+ |
|
43 |
+ x <- as.phylo(model) ## reorder.phylo(get.tree(model), "postorder") |
|
44 |
+ if (ladderize == TRUE) { |
|
45 |
+ x <- ladderize(x, right=right) |
|
46 |
+ } |
|
47 |
+ |
|
48 |
+ if (! is.null(x$edge.length)) { |
|
49 |
+ if (anyNA(x$edge.length)) { |
|
50 |
+ warning("'edge.length' contains NA values...\n## setting 'edge.length' to NULL automatically when plotting the tree...") |
|
51 |
+ x$edge.length <- NULL |
|
52 |
+ } |
|
53 |
+ } |
|
54 |
+ |
|
55 |
+ if (is.null(x$edge.length) || branch.length == "none") { |
|
56 |
+ xpos <- getXcoord_no_length(x) |
|
57 |
+ } else { |
|
58 |
+ xpos <- getXcoord(x) |
|
59 |
+ } |
|
60 |
+ |
|
61 |
+ ypos <- getYcoord(x) |
|
62 |
+ N <- Nnode(x, internal.only=FALSE) |
|
63 |
+ xypos <- data_frame(node=1:N, x=xpos, y=ypos) |
|
64 |
+ |
|
65 |
+ df <- as_data_frame(model) |
|
66 |
+ |
|
67 |
+ res <- full_join(df, xypos, by = "node") |
|
68 |
+ |
|
69 |
+ ## add branch mid position |
|
70 |
+ res <- calculate_branch_mid(res) |
|
71 |
+ |
|
72 |
+ if (!is.null(mrsd)) { |
|
73 |
+ res <- scaleX_by_time_from_mrsd(res, mrsd, as.Date) |
|
74 |
+ } |
|
75 |
+ |
|
76 |
+ if (layout == "slanted") { |
|
77 |
+ res <- add_angle_slanted(res) |
|
78 |
+ } else { |
|
79 |
+ ## angle for all layout, if 'rectangular', user use coord_polar, can still use angle |
|
80 |
+ res <- calculate_angle(res) |
|
81 |
+ } |
|
82 |
+ scaleY(as.phylo(model), res, yscale, layout, ...) |
|
83 |
+} |
|
84 |
+ |
|
85 |
+##' @importFrom treeio get_tree_data |
|
86 |
+set_branch_length <- function(tree_object, branch.length) { |
|
87 |
+ if (branch.length == "branch.length") { |
|
88 |
+ return(tree_object) |
|
89 |
+ } else if (branch.length == "none") { |
|
90 |
+ tree_object@phylo$edge.length <- NULL |
|
91 |
+ return(tree_object) |
|
92 |
+ } |
|
93 |
+ |
|
94 |
+ if (is(tree_object, "phylo")) { |
|
95 |
+ return(tree_object) |
|
96 |
+ } |
|
97 |
+ |
|
98 |
+ tree_anno <- get_tree_data(tree_object) |
|
99 |
+ tree_anno$node <- as.integer(tree_anno$node) |
|
100 |
+ |
|
101 |
+ phylo <- as.phylo(tree_object) |
|
102 |
+ |
|
103 |
+ cn <- colnames(tree_anno) |
|
104 |
+ cn <- cn[!cn %in% c('node', 'parent')] |
|
105 |
+ |
|
106 |
+ length <- match.arg(branch.length, cn) |
|
107 |
+ |
|
108 |
+ if (all(is.na(as.numeric(tree_anno[[length]])))) { |
|
109 |
+ stop("branch.length should be numerical attributes...") |
|
110 |
+ } |
|
111 |
+ |
|
112 |
+ edge <- as_data_frame(phylo$edge) |
|
113 |
+ colnames(edge) <- c("parent", "node") |
|
114 |
+ |
|
115 |
+ dd <- full_join(edge, tree_anno, by = "node") |
|
116 |
+ |
|
117 |
+ dd <- dd[match(edge[['node']], dd[['node']]),] |
|
118 |
+ len <- unlist(dd[[length]]) |
|
119 |
+ len <- as.numeric(len) |
|
120 |
+ len[is.na(len)] <- 0 |
|
121 |
+ |
|
122 |
+ phylo$edge.length <- len |
|
123 |
+ |
|
124 |
+ tree_object@phylo <- phylo |
|
125 |
+ return(tree_object) |
|
126 |
+} |
|
127 |
+ |
|
128 |
+ |
|
129 |
+calculate_angle <- function(data) { |
|
130 |
+ data$angle <- 360/(diff(range(data$y)) + 1) * data$y |
|
131 |
+ return(data) |
|
132 |
+} |
|
133 |
+ |
|
134 |
+ |
|
135 |
+ |
|
136 |
+scaleY <- function(phylo, df, yscale, layout, ...) { |
|
137 |
+ if (yscale == "none") { |
|
138 |
+ return(df) |
|
139 |
+ } |
|
140 |
+ if (! yscale %in% colnames(df)) { |
|
141 |
+ warning("yscale is not available...\n") |
|
142 |
+ return(df) |
|
143 |
+ } |
|
144 |
+ if (is.numeric(df[[yscale]])) { |
|
145 |
+ y <- getYcoord_scale_numeric(phylo, df, yscale, ...) |
|
146 |
+ ## if (order.y) { |
|
147 |
+ ## y <- getYcoord_scale2(phylo, df, yscale) |
|
148 |
+ ## } else { |
|
149 |
+ ## y <- getYcoord_scale(phylo, df, yscale) |
|
150 |
+ ## } |
|
151 |
+ } else { |
|
152 |
+ y <- getYcoord_scale_category(phylo, df, yscale, ...) |
|
153 |
+ } |
|
154 |
+ |
|
155 |
+ df[, "y"] <- y |
|
156 |
+ |
|
157 |
+ return(df) |
|
158 |
+} |
... | ... |
@@ -17,8 +17,6 @@ |
17 | 17 |
inset <- function(tree_view, insets, width=0.1, height=0.1, hjust=0, vjust=0, |
18 | 18 |
x="node", reverse_x=FALSE, reverse_y=FALSE) { |
19 | 19 |
|
20 |
- message("The inset function will be defunct in next release, please use ggimage::geom_subview() instead.") |
|
21 |
- |
|
22 | 20 |
df <- tree_view$data[as.numeric(names(insets)),] |
23 | 21 |
x <- match.arg(x, c("node", "branch", "edge")) |
24 | 22 |
|
... | ... |
@@ -764,3 +764,717 @@ getNodesBreadthFirst.df <- function(df){ |
764 | 764 |
|
765 | 765 |
|
766 | 766 |
|
767 |
+##' convert tip or node label(s) to internal node number |
|
768 |
+##' |
|
769 |
+##' |
|
770 |
+##' @title nodeid |
|
771 |
+##' @param x tree object or graphic object return by ggtree |
|
772 |
+##' @param label tip or node label(s) |
|
773 |
+##' @return internal node number |
|
774 |
+##' @importFrom methods is |
|
775 |
+##' @export |
|
776 |
+##' @author Guangchuang Yu |
|
777 |
+nodeid <- function(x, label) { |
|
778 |
+ if (is(x, "gg")) |
|
779 |
+ return(nodeid.gg(x, label)) |
|
780 |
+ |
|
781 |
+ nodeid.tree(x, label) |
|
782 |
+} |
|
783 |
+ |
|
784 |
+nodeid.tree <- function(tree, label) { |
|
785 |
+ tr <- get.tree(tree) |
|
786 |
+ lab <- c(tr$tip.label, tr$node.label) |
|
787 |
+ match(label, lab) |
|
788 |
+} |
|
789 |
+ |
|
790 |
+nodeid.gg <- function(p, label) { |
|
791 |
+ p$data$node[match(label, p$data$label)] |
|
792 |
+} |
|
793 |
+ |
|
794 |
+ |
|
795 |
+reroot_node_mapping <- function(tree, tree2) { |
|
796 |
+ root <- getRoot(tree) |
|
797 |
+ |
|
798 |
+ node_map <- data.frame(from=1:getNodeNum(tree), to=NA, visited=FALSE) |
|
799 |
+ node_map[1:Ntip(tree), 2] <- match(tree$tip.label, tree2$tip.label) |
|
800 |
+ node_map[1:Ntip(tree), 3] <- TRUE |
|
801 |
+ |
|
802 |
+ node_map[root, 2] <- root |
|
803 |
+ node_map[root, 3] <- TRUE |
|
804 |
+ |
|
805 |
+ node <- rev(tree$edge[,2]) |
|
806 |
+ for (k in node) { |
|
807 |
+ ip <- getParent(tree, k) |
|
808 |
+ if (node_map[ip, "visited"]) |
|
809 |
+ next |
|
810 |
+ |
|
811 |
+ cc <- getChild(tree, ip) |
|
812 |
+ node2 <- node_map[cc,2] |
|
813 |
+ if (anyNA(node2)) { |
|
814 |
+ node <- c(node, k) |
|
815 |
+ next |
|
816 |
+ } |
|
817 |
+ |
|
818 |
+ to <- unique(sapply(node2, getParent, tr=tree2)) |
|
819 |
+ to <- to[! to %in% node_map[,2]] |
|
820 |
+ node_map[ip, 2] <- to |
|
821 |
+ node_map[ip, 3] <- TRUE |
|
822 |
+ } |
|
823 |
+ node_map <- node_map[, -3] |
|
824 |
+ return(node_map) |
|
825 |
+} |
|
826 |
+ |
|
827 |
+ |
|
828 |
+ |
|
829 |
+##' Get parent node id of child node. |
|
830 |
+##' |
|
831 |
+##' @title getParent.df |
|
832 |
+##' @param df tree data.frame |
|
833 |
+##' @param node is the node id of child in tree. |
|
834 |
+##' @return integer node id of parent |
|
835 |
+getParent.df <- function(df, node) { |
|
836 |
+ i <- which(df$node == node) |
|
837 |
+ parent_id <- df$parent[i] |
|
838 |
+ if (parent_id == node | is.na(parent_id)) { |
|
839 |
+ ## root node |
|
840 |
+ return(0) |
|
841 |
+ } |
|
842 |
+ return(parent_id) |
|
843 |
+} |
|
844 |
+ |
|
845 |
+ |
|
846 |
+getAncestor.df <- function(df, node) { |
|
847 |
+ anc <- getParent.df(df, node) |
|
848 |
+ anc <- anc[anc != 0] |
|
849 |
+ if (length(anc) == 0) { |
|
850 |
+ # stop("selected node is root...") |
|
851 |
+ return(0) |
|
852 |
+ } |
|
853 |
+ i <- 1 |
|
854 |
+ while(i<= length(anc)) { |
|
855 |
+ anc <- c(anc, getParent.df(df, anc[i])) |
|
856 |
+ anc <- anc[anc != 0] |
|
857 |
+ i <- i+1 |
|
858 |
+ } |
|
859 |
+ return(anc) |
|
860 |
+} |
|
861 |
+ |
|
862 |
+ |
|
863 |
+ |
|
864 |
+##' Get list of child node id numbers of parent node |
|
865 |
+##' |
|
866 |
+##' @title getChild.df |
|
867 |
+##' @param df tree data.frame |
|
868 |
+##' @param node is the node id of child in tree. |
|
869 |
+##' @return list of child node ids of parent |
|
870 |
+getChild.df <- function(df, node) { |
|
871 |
+ i <- which(df$parent == node) |
|
872 |
+ if (length(i) == 0) { |
|
873 |
+ return(0) # it has no children, hence tip node. |
|
874 |
+ } |
|
875 |
+ res <- df$node[i] |
|
876 |
+ res <- res[res != node] ## node may root |
|
877 |
+ return(res) |
|
878 |
+} |
|
879 |
+ |
|
880 |
+get.offspring.df <- function(df, node) { |
|
881 |
+ sp <- getChild.df(df, node) |
|
882 |
+ sp <- sp[sp != 0] # Remove root node. |
|
883 |
+ if (length(sp) == 0) { |
|
884 |
+ #stop("input node is a tip...") |
|
885 |
+ return(0) |
|
886 |
+ } |
|
887 |
+ |
|
888 |
+ i <- 1 |
|
889 |
+ while(i <= length(sp)) { |
|
890 |
+ sp <- c(sp, getChild.df(df, sp[i])) |
|
891 |
+ sp <- sp[sp != 0] |
|
892 |
+ i <- i + 1 |
|
893 |
+ } |
|
894 |
+ return(sp) |
|
895 |
+} |
|
896 |
+ |
|
897 |
+ |
|
898 |
+ |
|
899 |
+##' extract offspring tips |
|
900 |
+##' |
|
901 |
+##' |
|
902 |
+##' @title get.offspring.tip |
|
903 |
+##' @param tr tree |
|
904 |
+##' @param node node |
|
905 |
+##' @return tip label |
|
906 |
+##' @author ygc |
|
907 |
+##' @importFrom ape extract.clade |
|
908 |
+##' @export |
|
909 |
+get.offspring.tip <- function(tr, node) { |
|
910 |
+ if ( ! node %in% tr$edge[,1]) { |
|
911 |
+ ## return itself |
|
912 |
+ return(tr$tip.label[node]) |
|
913 |
+ } |
|
914 |
+ clade <- extract.clade(tr, node) |
|
915 |
+ clade$tip.label |
|
916 |
+} |
|
917 |
+ |
|
918 |
+ |
|
919 |
+ |
|
920 |
+ |
|
921 |
+getParent <- function(tr, node) { |
|
922 |
+ if ( node == getRoot(tr) ) |
|
923 |
+ return(0) |
|
924 |
+ edge <- tr[["edge"]] |
|
925 |
+ parent <- edge[,1] |
|
926 |
+ child <- edge[,2] |
|
927 |
+ res <- parent[child == node] |
|
928 |
+ if (length(res) == 0) { |
|
929 |
+ stop("cannot found parent node...") |
|
930 |
+ } |
|
931 |
+ if (length(res) > 1) { |
|
932 |
+ stop("multiple parent found...") |
|
933 |
+ } |
|
934 |
+ return(res) |
|
935 |
+} |
|
936 |
+ |
|
937 |
+ |
|
938 |
+ |
|
939 |
+ |
|
940 |
+getChild <- function(tr, node) { |
|
941 |
+ # Get edge matrix from phylo object. |
|
942 |
+ edge <- tr[["edge"]] |
|
943 |
+ # Select all rows that match "node". |
|
944 |
+ res <- edge[edge[,1] == node, 2] |
|
945 |
+ ## if (length(res) == 0) { |
|
946 |
+ ## ## is a tip |
|
947 |
+ ## return(NA) |
|
948 |
+ ## } |
|
949 |
+ return(res) |
|
950 |
+} |
|
951 |
+ |
|
952 |
+ |
|
953 |
+getSibling <- function(tr, node) { |
|
954 |
+ root <- getRoot(tr) |
|
955 |
+ if (node == root) { |
|
956 |
+ return(NA) |
|
957 |
+ } |
|
958 |
+ |
|
959 |
+ parent <- getParent(tr, node) |
|
960 |
+ child <- getChild(tr, parent) |
|
961 |
+ sib <- child[child != node] |
|
962 |
+ return(sib) |
|
963 |
+} |
|
964 |
+ |
|
965 |
+ |
|
966 |
+getAncestor <- function(tr, node) { |
|
967 |
+ root <- getRoot(tr) |
|
968 |
+ if (node == root) { |
|
969 |
+ return(NA) |
|
970 |
+ } |
|
971 |
+ parent <- getParent(tr, node) |
|
972 |
+ res <- parent |
|
973 |
+ while(parent != root) { |
|
974 |
+ parent <- getParent(tr, parent) |
|
975 |
+ res <- c(res, parent) |
|
976 |
+ } |
|
977 |
+ return(res) |
|
978 |
+} |
|
979 |
+ |
|
980 |
+ |
|
981 |
+isRoot <- function(tr, node) { |
|
982 |
+ getRoot(tr) == node |
|
983 |
+} |
|
984 |
+ |
|
985 |
+getNodeName <- function(tr) { |
|
986 |
+ if (is.null(tr$node.label)) { |
|
987 |
+ n <- length(tr$tip.label) |
|
988 |
+ nl <- (n + 1):(2 * n - 2) |
|
989 |
+ nl <- as.character(nl) |
|
990 |
+ } |
|
991 |
+ else { |
|
992 |
+ nl <- tr$node.label |
|
993 |
+ } |
|
994 |
+ nodeName <- c(tr$tip.label, nl) |
|
995 |
+ return(nodeName) |
|
996 |
+} |
|
997 |
+ |
|
998 |
+ |
|
999 |
+ |
|
1000 |
+get.trunk <- function(tr) { |
|
1001 |
+ root <- getRoot(tr) |
|
1002 |
+ path_length <- sapply(1:(root-1), function(x) get.path_length(tr, root, x)) |
|
1003 |
+ i <- which.max(path_length) |
|
1004 |
+ return(get.path(tr, root, i)) |
|
1005 |
+} |
|
1006 |
+ |
|
1007 |
+##' path from start node to end node |
|
1008 |
+##' |
|
1009 |
+##' |
|
1010 |
+##' @title get.path |
|
1011 |
+##' @param phylo phylo object |
|
1012 |
+##' @param from start node |
|
1013 |
+##' @param to end node |
|
1014 |
+##' @return node vectot |
|
1015 |
+##' @export |
|
1016 |
+##' @author Guangchuang Yu |
|
1017 |
+get.path <- function(phylo, from, to) { |
|
1018 |
+ anc_from <- getAncestor(phylo, from) |
|
1019 |
+ anc_from <- c(from, anc_from) |
|
1020 |
+ anc_to <- getAncestor(phylo, to) |
|
1021 |
+ anc_to <- c(to, anc_to) |
|
1022 |
+ mrca <- intersect(anc_from, anc_to)[1] |
|
1023 |
+ |
|
1024 |
+ i <- which(anc_from == mrca) |
|
1025 |
+ j <- which(anc_to == mrca) |
|
1026 |
+ |
|
1027 |
+ path <- c(anc_from[1:i], rev(anc_to[1:(j-1)])) |
|
1028 |
+ return(path) |
|
1029 |
+} |
|
1030 |
+ |
|
1031 |
+ |
|
1032 |
+get.path_length <- function(phylo, from, to, weight=NULL) { |
|
1033 |
+ path <- get.path(phylo, from, to) |
|
1034 |
+ if (is.null(weight)) { |
|
1035 |
+ return(length(path)-1) |
|
1036 |
+ } |
|
1037 |
+ |
|
1038 |
+ df <- fortify(phylo) |
|
1039 |
+ if ( ! (weight %in% colnames(df))) { |
|
1040 |
+ stop("weight should be one of numerical attributes of the tree...") |
|
1041 |
+ } |
|
1042 |
+ |
|
1043 |
+ res <- 0 |
|
1044 |
+ |
|
1045 |
+ get_edge_index <- function(df, from, to) { |
|
1046 |
+ which((df[,1] == from | df[,2] == from) & |
|
1047 |
+ (df[,1] == to | df[,2] == to)) |
|
1048 |
+ } |
|
1049 |
+ |
|
1050 |
+ for(i in 1:(length(path)-1)) { |
|
1051 |
+ ee <- get_edge_index(df, path[i], path[i+1]) |
|
1052 |
+ res <- res + df[ee, weight] |
|
1053 |
+ } |
|
1054 |
+ |
|
1055 |
+ return(res) |
|
1056 |
+} |
|
1057 |
+ |
|
1058 |
+##' @importFrom ape reorder.phylo |
|
1059 |
+getNodes_by_postorder <- function(tree) { |
|
1060 |
+ tree <- reorder.phylo(tree, "postorder") |
|
1061 |
+ unique(rev(as.vector(t(tree$edge[,c(2,1)])))) |
|
1062 |
+} |
|
1063 |
+ |
|
1064 |
+getXcoord2 <- function(x, root, parent, child, len, start=0, rev=FALSE) { |
|
1065 |
+ x[root] <- start |
|
1066 |
+ x[-root] <- NA ## only root is set to start, by default 0 |
|
1067 |
+ |
|
1068 |
+ currentNode <- root |
|
1069 |
+ direction <- 1 |
|
1070 |
+ if (rev == TRUE) { |
|
1071 |
+ direction <- -1 |
|
1072 |
+ } |
|
1073 |
+ |
|
1074 |
+ while(anyNA(x)) { |
|
1075 |
+ idx <- which(parent %in% currentNode) |
|
1076 |
+ newNode <- child[idx] |
|
1077 |
+ x[newNode] <- x[parent[idx]]+len[idx] * direction |
|
1078 |
+ currentNode <- newNode |
|
1079 |
+ } |
|
1080 |
+ |
|
1081 |
+ return(x) |
|
1082 |
+} |
|
1083 |
+ |
|
1084 |
+ |
|
1085 |
+ |
|
1086 |
+ |
|
1087 |
+ |
|
1088 |
+ |
|
1089 |
+getXcoord_no_length <- function(tr) { |
|
1090 |
+ edge <- tr$edge |
|
1091 |
+ parent <- edge[,1] |
|
1092 |
+ child <- edge[,2] |
|
1093 |
+ root <- getRoot(tr) |
|
1094 |
+ |
|
1095 |
+ len <- tr$edge.length |
|
1096 |
+ |
|
1097 |
+ N <- getNodeNum(tr) |
|
1098 |
+ x <- numeric(N) |
|
1099 |
+ ntip <- Ntip(tr) |
|
1100 |
+ currentNode <- 1:ntip |
|
1101 |
+ x[-currentNode] <- NA |
|
1102 |
+ |
|
1103 |
+ cl <- split(child, parent) |
|
1104 |
+ child_list <- list() |
|
1105 |
+ child_list[as.numeric(names(cl))] <- cl |
|
1106 |
+ |
|
1107 |
+ while(anyNA(x)) { |
|
1108 |
+ idx <- match(currentNode, child) |
|
1109 |
+ pNode <- parent[idx] |
|
1110 |
+ ## child number table |
|
1111 |
+ p1 <- table(parent[parent %in% pNode]) |
|
1112 |
+ p2 <- table(pNode) |
|
1113 |
+ np <- names(p2) |
|
1114 |
+ i <- p1[np] == p2 |
|
1115 |
+ newNode <- as.numeric(np[i]) |
|
1116 |
+ |
|
1117 |
+ exclude <- rep(NA, max(child)) |
|
1118 |
+ for (j in newNode) { |
|
1119 |
+ x[j] <- min(x[child_list[[j]]]) - 1 |
|
1120 |
+ exclude[child_list[[j]]] <- child_list[[j]] |
|
1121 |
+ } |
|
1122 |
+ exclude <- exclude[!is.na(exclude)] |
|
1123 |
+ |
|
1124 |
+ ## currentNode %<>% `[`(!(. %in% exclude)) |
|
1125 |
+ ## currentNode %<>% c(., newNode) %>% unique |
|
1126 |
+ currentNode <- currentNode[!currentNode %in% exclude] |
|
1127 |
+ currentNode <- unique(c(currentNode, newNode)) |
|
1128 |
+ |
|
1129 |
+ } |
|
1130 |
+ x <- x - min(x) |
|
1131 |
+ return(x) |
|
1132 |
+} |
|
1133 |
+ |
|
1134 |
+ |
|
1135 |
+ |
|
1136 |
+ |
|
1137 |
+getXcoord <- function(tr) { |
|
1138 |
+ edge <- tr$edge |
|
1139 |
+ parent <- edge[,1] |
|
1140 |
+ child <- edge[,2] |
|
1141 |
+ root <- getRoot(tr) |
|
1142 |
+ |
|
1143 |
+ len <- tr$edge.length |
|
1144 |
+ |
|
1145 |
+ N <- getNodeNum(tr) |
|
1146 |
+ x <- numeric(N) |
|
1147 |
+ x <- getXcoord2(x, root, parent, child, len) |
|
1148 |
+ return(x) |
|
1149 |
+} |
|
1150 |
+ |
|
1151 |
+ |
|
1152 |
+ |
|
1153 |
+ |
|
1154 |
+## scale the branch (the line plotted) to the actual value of edge length |
|
1155 |
+## but it seems not the good idea as if we want to add x-axis (e.g. time-scaled tree) |
|
1156 |
+## then the x-value is not corresponding to edge length as in rectangular layout |
|
1157 |
+## getXYcoord_slanted <- function(tr) { |
|
1158 |
+## edge <- tr$edge |
|
1159 |
+## parent <- edge[,1] |
|
1160 |
+## child <- edge[,2] |
|
1161 |
+## root <- getRoot(tr) |
|
1162 |
+ |
|
1163 |
+## N <- getNodeNum(tr) |
|
1164 |
+## len <- tr$edge.length |
|
1165 |
+## y <- getYcoord(tr, step=min(len)/2) |
|
1166 |
+## len <- sqrt(len^2 - (y[parent]-y[child])^2) |
|
1167 |
+## x <- numeric(N) |
|
1168 |
+## x <- getXcoord2(x, root, parent, child, len) |
|
1169 |
+## res <- data.frame(x=x, y=y) |
|
1170 |
+## return(res) |
|
1171 |
+## } |
|
1172 |
+ |
|
1173 |
+ |
|
1174 |
+ |
|
1175 |
+## @importFrom magrittr %>% |
|
1176 |
+##' @importFrom magrittr equals |
|
1177 |
+getYcoord <- function(tr, step=1) { |
|
1178 |
+ Ntip <- length(tr[["tip.label"]]) |
|
1179 |
+ N <- getNodeNum(tr) |
|
1180 |
+ |
|
1181 |
+ edge <- tr[["edge"]] |
|
1182 |
+ parent <- edge[,1] |
|
1183 |
+ child <- edge[,2] |
|
1184 |
+ |
|
1185 |
+ cl <- split(child, parent) |
|
1186 |
+ child_list <- list() |
|
1187 |
+ child_list[as.numeric(names(cl))] <- cl |
|
1188 |
+ |
|
1189 |
+ y <- numeric(N) |
|
1190 |
+ tip.idx <- child[child <= Ntip] |
|
1191 |
+ y[tip.idx] <- 1:Ntip * step |
|
1192 |
+ y[-tip.idx] <- NA |
|
1193 |
+ |
|
1194 |
+ ## use lookup table |
|
1195 |
+ pvec <- integer(max(tr$edge)) |
|
1196 |
+ pvec[child] = parent |
|
1197 |
+ |
|
1198 |
+ currentNode <- 1:Ntip |
|
1199 |
+ while(anyNA(y)) { |
|
1200 |
+ ## pNode <- unique(parent[child %in% currentNode]) |
|
1201 |
+ pNode <- unique(pvec[currentNode]) |
|
1202 |
+ |
|
1203 |
+ ## piping of magrittr is slower than nested function call. |
|
1204 |
+ ## pipeR is fastest, may consider to use pipeR |
|
1205 |
+ ## |
|
1206 |
+ ## child %in% currentNode %>% which %>% parent[.] %>% unique |
|
1207 |
+ ## idx <- sapply(pNode, function(i) all(child[parent == i] %in% currentNode)) |
|
1208 |
+ idx <- sapply(pNode, function(i) all(child_list[[i]] %in% currentNode)) |
|
1209 |
+ newNode <- pNode[idx] |
|
1210 |
+ |
|
1211 |
+ y[newNode] <- sapply(newNode, function(i) { |
|
1212 |
+ mean(y[child_list[[i]]], na.rm=TRUE) |
|
1213 |
+ ##child[parent == i] %>% y[.] %>% mean(na.rm=TRUE) |
|
1214 |
+ }) |
|
1215 |
+ |
|
1216 |
+ currentNode <- c(currentNode[!currentNode %in% unlist(child_list[newNode])], newNode) |
|
1217 |
+ ## currentNode <- c(currentNode[!currentNode %in% child[parent %in% newNode]], newNode) |
|
1218 |
+ ## parent %in% newNode %>% child[.] %>% |
|
1219 |
+ ## `%in%`(currentNode, .) %>% `!` %>% |
|
1220 |
+ ## currentNode[.] %>% c(., newNode) |
|
1221 |
+ } |
|
1222 |
+ |
|
1223 |
+ return(y) |
|
1224 |
+} |
|
1225 |
+ |
|
1226 |
+ |
|
1227 |
+getYcoord_scale <- function(tr, df, yscale) { |
|
1228 |
+ |
|
1229 |
+ N <- getNodeNum(tr) |
|
1230 |
+ y <- numeric(N) |
|
1231 |
+ |
|
1232 |
+ root <- getRoot(tr) |
|
1233 |
+ y[root] <- 0 |
|
1234 |
+ y[-root] <- NA |
|
1235 |
+ |
|
1236 |
+ edge <- tr$edge |
|
1237 |
+ parent <- edge[,1] |
|
1238 |
+ child <- edge[,2] |
|
1239 |
+ |
|
1240 |
+ currentNodes <- root |
|
1241 |
+ while(anyNA(y)) { |
|
1242 |
+ newNodes <- c() |
|
1243 |
+ for (currentNode in currentNodes) { |
|
1244 |
+ idx <- which(parent %in% currentNode) |
|
1245 |
+ newNode <- child[idx] |
|
1246 |
+ direction <- -1 |
|
1247 |
+ for (i in seq_along(newNode)) { |
|
1248 |
+ y[newNode[i]] <- y[currentNode] + df[newNode[i], yscale] * direction |
|
1249 |
+ direction <- -1 * direction |
|
1250 |
+ } |
|
1251 |
+ newNodes <- c(newNodes, newNode) |
|
1252 |
+ } |
|
1253 |
+ currentNodes <- unique(newNodes) |
|
1254 |
+ } |
|
1255 |
+ if (min(y) < 0) { |
|
1256 |
+ y <- y + abs(min(y)) |
|
1257 |
+ } |
|
1258 |
+ return(y) |
|
1259 |
+} |
|
1260 |
+ |
|
1261 |
+ |
|
1262 |
+getYcoord_scale2 <- function(tr, df, yscale) { |
|
1263 |
+ root <- getRoot(tr) |
|
1264 |
+ |
|
1265 |
+ pathLength <- sapply(1:length(tr$tip.label), function(i) { |
|
1266 |
+ get.path_length(tr, i, root, yscale) |
|
1267 |
+ }) |
|
1268 |
+ |
|
1269 |
+ ordered_tip <- order(pathLength, decreasing = TRUE) |
|
1270 |
+ ii <- 1 |
|
1271 |
+ ntip <- length(ordered_tip) |
|
1272 |
+ while(ii < ntip) { |
|
1273 |
+ sib <- getSibling(tr, ordered_tip[ii]) |
|
1274 |
+ if (length(sib) == 0) { |
|
1275 |
+ ii <- ii + 1 |
|
1276 |
+ next |
|
1277 |
+ } |
|
1278 |
+ jj <- which(ordered_tip %in% sib) |
|
1279 |
+ if (length(jj) == 0) { |
|
1280 |
+ ii <- ii + 1 |
|
1281 |
+ next |
|
1282 |
+ } |
|
1283 |
+ sib <- ordered_tip[jj] |
|
1284 |
+ ordered_tip <- ordered_tip[-jj] |
|
1285 |
+ nn <- length(sib) |
|
1286 |
+ if (ii < length(ordered_tip)) { |
|
1287 |
+ ordered_tip <- c(ordered_tip[1:ii],sib, ordered_tip[(ii+1):length(ordered_tip)]) |
|
1288 |
+ } else { |
|
1289 |
+ ordered_tip <- c(ordered_tip[1:ii],sib) |
|
1290 |
+ } |
|
1291 |
+ |
|
1292 |
+ ii <- ii + nn + 1 |
|
1293 |
+ } |
|
1294 |
+ |
|
1295 |
+ |
|
1296 |
+ long_branch <- getAncestor(tr, ordered_tip[1]) %>% rev |
|
1297 |
+ long_branch <- c(long_branch, ordered_tip[1]) |
|
1298 |
+ |
|
1299 |
+ N <- getNodeNum(tr) |
|
1300 |
+ y <- numeric(N) |
|
1301 |
+ |
|
1302 |
+ y[root] <- 0 |
|
1303 |
+ y[-root] <- NA |
|
1304 |
+ |
|
1305 |
+ ## yy <- df[, yscale] |
|
1306 |
+ ## yy[is.na(yy)] <- 0 |
|
1307 |
+ |
|
1308 |
+ for (i in 2:length(long_branch)) { |
|
1309 |
+ y[long_branch[i]] <- y[long_branch[i-1]] + df[long_branch[i], yscale] |
|
1310 |
+ } |
|
1311 |
+ |
|
1312 |
+ parent <- df[, "parent"] |
|
1313 |
+ child <- df[, "node"] |
|
1314 |
+ |
|
1315 |
+ currentNodes <- root |
|
1316 |
+ while(anyNA(y)) { |
|
1317 |
+ newNodes <- c() |
|
1318 |
+ for (currentNode in currentNodes) { |
|
1319 |
+ idx <- which(parent %in% currentNode) |
|
1320 |
+ newNode <- child[idx] |
|
1321 |
+ newNode <- c(newNode[! newNode %in% ordered_tip], |
|
1322 |
+ rev(ordered_tip[ordered_tip %in% newNode])) |
|
1323 |
+ direction <- -1 |
|
1324 |
+ for (i in seq_along(newNode)) { |
|
1325 |
+ if (is.na(y[newNode[i]])) { |
|
1326 |
+ y[newNode[i]] <- y[currentNode] + df[newNode[i], yscale] * direction |
|
1327 |
+ direction <- -1 * direction |
|
1328 |
+ } |
|
1329 |
+ } |
|
1330 |
+ newNodes <- c(newNodes, newNode) |
|
1331 |
+ } |
|
1332 |
+ currentNodes <- unique(newNodes) |
|
1333 |
+ } |
|
1334 |
+ if (min(y) < 0) { |
|
1335 |
+ y <- y + abs(min(y)) |
|
1336 |
+ } |
|
1337 |
+ return(y) |
|
1338 |
+} |
|
1339 |
+ |
|
1340 |
+ |
|
1341 |
+ |
|
1342 |
+getYcoord_scale_numeric <- function(tr, df, yscale, ...) { |
|
1343 |
+ df <- .assign_parent_status(tr, df, yscale) |
|
1344 |
+ df <- .assign_child_status(tr, df, yscale) |
|
1345 |
+ |
|
1346 |
+ y <- df[, yscale] |
|
1347 |
+ |
|
1348 |
+ if (anyNA(y)) { |
|
1349 |
+ warning("NA found in y scale mapping, all were setting to 0") |
|
1350 |
+ y[is.na(y)] <- 0 |
|
1351 |
+ } |
|
1352 |
+ |
|
1353 |
+ return(y) |
|
1354 |
+} |
|
1355 |
+ |
|
1356 |
+ |
|
1357 |
+.assign_parent_status <- function(tr, df, variable) { |
|
1358 |
+ yy <- df[[variable]] |
|
1359 |
+ na.idx <- which(is.na(yy)) |
|
1360 |
+ if (length(na.idx) > 0) { |
|
1361 |
+ tree <- get.tree(tr) |
|
1362 |
+ nodes <- getNodes_by_postorder(tree) |
|
1363 |
+ for (curNode in nodes) { |
|
1364 |
+ children <- getChild(tree, curNode) |
|
1365 |
+ if (length(children) == 0) { |
|
1366 |
+ next |
|
1367 |
+ } |
|
1368 |
+ idx <- which(is.na(yy[children])) |
|
1369 |
+ if (length(idx) > 0) { |
|
1370 |
+ yy[children[idx]] <- yy[curNode] |
|
1371 |
+ } |
|
1372 |
+ } |
|
1373 |
+ } |
|
1374 |
+ df[, variable] <- yy |
|
1375 |
+ return(df) |
|
1376 |
+} |
|
1377 |
+ |
|
1378 |
+ |
|
1379 |
+.assign_child_status <- function(tr, df, variable, yscale_mapping=NULL) { |
|
1380 |
+ yy <- df[[variable]] |
|
1381 |
+ if (!is.null(yscale_mapping)) { |
|
1382 |
+ yy <- yscale_mapping[yy] |
|
1383 |
+ } |
|
1384 |
+ |
|
1385 |
+ na.idx <- which(is.na(yy)) |
|
1386 |
+ if (length(na.idx) > 0) { |
|
1387 |
+ tree <- get.tree(tr) |
|
1388 |
+ nodes <- rev(getNodes_by_postorder(tree)) |
|
1389 |
+ for (curNode in nodes) { |
|
1390 |
+ parent <- getParent(tree, curNode) |
|
1391 |
+ if (parent == 0) { ## already reach root |
|
1392 |
+ next |
|
1393 |
+ } |
|
1394 |
+ idx <- which(is.na(yy[parent])) |
|
1395 |
+ if (length(idx) > 0) { |
|
1396 |
+ child <- getChild(tree, parent) |
|
1397 |
+ yy[parent[idx]] <- mean(yy[child], na.rm=TRUE) |
|
1398 |
+ } |
|
1399 |
+ } |
|
1400 |
+ } |
|
1401 |
+ df[, variable] <- yy |
|
1402 |
+ return(df) |
|
1403 |
+} |
|
1404 |
+ |
|
1405 |
+ |
|
1406 |
+getYcoord_scale_category <- function(tr, df, yscale, yscale_mapping=NULL, ...) { |
|
1407 |
+ if (is.null(yscale_mapping)) { |
|
1408 |
+ stop("yscale is category variable, user should provide yscale_mapping, |
|
1409 |
+ which is a named vector, to convert yscale to numberical values...") |
|
1410 |
+ } |
|
1411 |
+ if (! is(yscale_mapping, "numeric") || |
|
1412 |
+ is.null(names(yscale_mapping))) { |
|
1413 |
+ stop("yscale_mapping should be a named numeric vector...") |
|
1414 |
+ } |
|
1415 |
+ |
|
1416 |
+ if (yscale == "label") { |
|
1417 |
+ yy <- df[[yscale]] |
|
1418 |
+ ii <- which(is.na(yy)) |
|
1419 |
+ if (length(ii)) { |
|
1420 |
+ df[ii, yscale] <- df[ii, "node"] |
|
1421 |
+ } |
|
1422 |
+ } |
|
1423 |
+ |
|
1424 |
+ ## assign to parent status is more prefer... |
|
1425 |
+ df <- .assign_parent_status(tr, df, yscale) |
|
1426 |
+ df <- .assign_child_status(tr, df, yscale, yscale_mapping) |
|
1427 |
+ |
|
1428 |
+ y <- df[[yscale]] |
|
1429 |
+ |
|
1430 |
+ if (anyNA(y)) { |
|
1431 |
+ warning("NA found in y scale mapping, all were setting to 0") |
|
1432 |
+ y[is.na(y)] <- 0 |
|
1433 |
+ } |
|
1434 |
+ return(y) |
|
1435 |
+} |
|
1436 |
+ |
|
1437 |
+ |
|
1438 |
+add_angle_slanted <- function(res) { |
|
1439 |
+ x <- res[["x"]] |
|
1440 |
+ y <- res[["y"]] |
|
1441 |
+ dy <- (y - y[match(res$parent, res$node)]) / diff(range(y)) |
|
1442 |
+ dx <- (x - x[match(res$parent, res$node)]) / diff(range(x)) |
|
1443 |
+ theta <- atan(dy/dx) |
|
1444 |
+ theta[is.na(theta)] <- 0 ## root node |
|
1445 |
+ res$angle <- theta/pi * 180 |
|
1446 |
+ |
|
1447 |
+ branch.y <- (y[match(res$parent, res$node)] + y)/2 |
|
1448 |
+ idx <- is.na(branch.y) |
|
1449 |
+ branch.y[idx] <- y[idx] |
|
1450 |
+ res[, "branch.y"] <- branch.y |
|
1451 |
+ return(res) |
|
1452 |
+} |
|
1453 |
+ |
|
1454 |
+ |
|
1455 |
+calculate_branch_mid <- function(res) { |
|
1456 |
+ res$branch <- with(res, (x[match(parent, node)] + x)/2) |
|
1457 |
+ if (!is.null(res$branch.length)) { |
|
1458 |
+ res$branch.length[is.na(res$branch.length)] <- 0 |
|
1459 |
+ } |
|
1460 |
+ res$branch[is.na(res$branch)] <- 0 |
|
1461 |
+ return(res) |
|
1462 |
+} |
|
1463 |
+ |
|
1464 |
+ |
|
1465 |
+re_assign_ycoord_df <- function(df, currentNode) { |
|
1466 |
+ while(anyNA(df$y)) { |
|
1467 |
+ pNode <- with(df, parent[match(currentNode, node)]) %>% unique |
|
1468 |
+ idx <- sapply(pNode, function(i) with(df, all(node[parent == i & parent != node] %in% currentNode))) |
|
1469 |
+ newNode <- pNode[idx] |
|
1470 |
+ ## newNode <- newNode[is.na(df[match(newNode, df$node), "y"])] |
|
1471 |
+ |
|
1472 |
+ df[match(newNode, df$node), "y"] <- sapply(newNode, function(i) { |
|
1473 |
+ with(df, mean(y[parent == i], na.rm = TRUE)) |
|
1474 |
+ }) |
|
1475 |
+ traced_node <- as.vector(sapply(newNode, function(i) with(df, node[parent == i]))) |
|
1476 |
+ currentNode <- c(currentNode[! currentNode %in% traced_node], newNode) |
|
1477 |
+ } |
|
1478 |
+ return(df) |
|
1479 |
+} |
|
1480 |
+ |
... | ... |
@@ -4,7 +4,7 @@ ggtree: an R package for visualization and annotation of phylogenetic trees with |
4 | 4 |
|
5 | 5 |
<img src="https://raw.githubusercontent.com/Bioconductor/BiocStickers/master/ggtree/ggtree.png" height="200" align="right" /> |
6 | 6 |
|
7 |
-[](https://bioconductor.org/packages/ggtree) [](https://github.com/guangchuangyu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
7 |
+[](https://bioconductor.org/packages/ggtree) [](https://github.com/guangchuangyu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
8 | 8 |
|
9 | 9 |
[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
10 | 10 |
|
... | ... |
@@ -344,36 +344,66 @@ |
344 | 344 |
<h1>Gallery </h1> |
345 | 345 |
|
346 | 346 |
<p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"></p> |
347 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2017_science.jpg" /></p> |
|
347 |
+<div class="figure"> |
|
348 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2017_science.jpg" /> |
|
349 |
+ |
|
350 |
+</div> |
|
348 | 351 |
<p><a href="http://dx.doi.org/10.1126/science.aao2136" class="uri">http://dx.doi.org/10.1126/science.aao2136</a></p> |
349 | 352 |
<hr /> |
350 |
-<p><img src="http://media.springernature.com/lw785/springer-static/image/art%3A10.1186%2Fs40168-017-0331-1/MediaObjects/40168_2017_331_Fig3_HTML.gif" /></p> |
|
353 |
+<div class="figure"> |
|
354 |
+<img src="http://media.springernature.com/lw785/springer-static/image/art%3A10.1186%2Fs40168-017-0331-1/MediaObjects/40168_2017_331_Fig3_HTML.gif" /> |
|
355 |
+ |
|
356 |
+</div> |
|
351 | 357 |
<p><a href="https://doi.org/10.1186/s40168-017-0331-1" class="uri">https://doi.org/10.1186/s40168-017-0331-1</a></p> |
352 | 358 |
<hr /> |
353 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/syen12249-fig-0002.png" /></p> |
|
359 |
+<div class="figure"> |
|
360 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/syen12249-fig-0002.png" /> |
|
361 |
+ |
|
362 |
+</div> |
|
354 | 363 |
<p><a href="https://doi.org/10.1111/syen.12249" class="uri">https://doi.org/10.1111/syen.12249</a></p> |
355 | 364 |
<hr /> |
356 |
-<p><img src="http://media.springernature.com/full/springer-static/image/art%3A10.1186%2Fs12915-017-0402-6/MediaObjects/12915_2017_402_Fig2_HTML.gif" /></p> |
|
365 |
+<div class="figure"> |
|
366 |
+<img src="http://media.springernature.com/full/springer-static/image/art%3A10.1186%2Fs12915-017-0402-6/MediaObjects/12915_2017_402_Fig2_HTML.gif" /> |
|
367 |
+ |
|
368 |
+</div> |
|
357 | 369 |
<p><a href="https://doi.org/10.1186/s12915-017-0402-6" class="uri">https://doi.org/10.1186/s12915-017-0402-6</a></p> |
358 | 370 |
<hr /> |
359 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/fmicb-08-00543-g0002.jpg" /></p> |
|
371 |
+<div class="figure"> |
|
372 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/fmicb-08-00543-g0002.jpg" /> |
|
373 |
+ |
|
374 |
+</div> |
|
360 | 375 |
<p><a href="http://dx.doi.org/10.3389/fmicb.2017.00543" class="uri">http://dx.doi.org/10.3389/fmicb.2017.00543</a></p> |
361 | 376 |
<hr /> |
362 |
-<p><img src="http://www.frontiersin.org/files/Articles/220056/fmicb-08-00456-HTML-r1/image_m/fmicb-08-00456-g002.jpg" /></p> |
|
377 |
+<div class="figure"> |
|
378 |
+<img src="http://www.frontiersin.org/files/Articles/220056/fmicb-08-00456-HTML-r1/image_m/fmicb-08-00456-g002.jpg" /> |
|
379 |
+ |
|
380 |
+</div> |
|
363 | 381 |
<p><a href="https://doi.org/10.3389/fmicb.2017.00456" class="uri">https://doi.org/10.3389/fmicb.2017.00456</a></p> |
364 | 382 |
<hr /> |
365 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/40168_2017_232_Fig2_HTML.gif" /></p> |
|
383 |
+<div class="figure"> |
|
384 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/40168_2017_232_Fig2_HTML.gif" /> |
|
385 |
+ |
|
386 |
+</div> |
|
366 | 387 |
<p><a href="http://dx.doi.org/10.1186/s40168-017-0232-3" class="uri">http://dx.doi.org/10.1186/s40168-017-0232-3</a></p> |
367 | 388 |
<hr /> |
368 | 389 |
<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/C2mxyBuUcAEt391.jpg" /> <a href="http://dx.doi.org/10.1111/2041-210X.12628" class="uri">http://dx.doi.org/10.1111/2041-210X.12628</a></p> |
369 | 390 |
<hr /> |
370 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2017-01-21-115646_969x444_scrot.png" /></p> |
|
391 |
+<div class="figure"> |
|
392 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2017-01-21-115646_969x444_scrot.png" /> |
|
393 |
+ |
|
394 |
+</div> |
|
371 | 395 |
<p><a href="http://dx.doi.org/10.1128/AEM.02307-16" class="uri">http://dx.doi.org/10.1128/AEM.02307-16</a></p> |
372 | 396 |
<hr /> |
373 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2016_fcimb-06-00036-g003.jpg" /></p> |
|
397 |
+<div class="figure"> |
|
398 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2016_fcimb-06-00036-g003.jpg" /> |
|
399 |
+ |
|
400 |
+</div> |
|
374 | 401 |
<p><a href="http://dx.doi.org/10.3389%2Ffcimb.2016.00036">http://dx.doi.org/10.3389%2Ffcimb.2016.00036</a></p> |
375 | 402 |
<hr /> |
376 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" /></p> |
|
403 |
+<div class="figure"> |
|
404 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" /> |
|
405 |
+ |
|
406 |
+</div> |
|
377 | 407 |
<p><a href="http://dx.doi.org/10.1016/j.meegid.2015.12.006" class="uri">http://dx.doi.org/10.1016/j.meegid.2015.12.006</a></p> |
378 | 408 |
|
379 | 409 |
|
... | ... |
@@ -19,16 +19,16 @@ |
19 | 19 |
|
20 | 20 |
<guid>https://guangchuangyu.github.io/ggtree/gallery/</guid> |
21 | 21 |
<description>http://dx.doi.org/10.1126/science.aao2136 |
22 |
-https://doi.org/10.1186/s40168-017-0331-1 |
|
23 |
-https://doi.org/10.1111/syen.12249 |
|
24 |
-https://doi.org/10.1186/s12915-017-0402-6 |
|
25 |
-http://dx.doi.org/10.3389/fmicb.2017.00543 |
|
26 |
-https://doi.org/10.3389/fmicb.2017.00456 |
|
27 |
-http://dx.doi.org/10.1186/s40168-017-0232-3 |
|
22 |
+ https://doi.org/10.1186/s40168-017-0331-1 |
|
23 |
+ https://doi.org/10.1111/syen.12249 |
|
24 |
+ https://doi.org/10.1186/s12915-017-0402-6 |
|
25 |
+ http://dx.doi.org/10.3389/fmicb.2017.00543 |
|
26 |
+ https://doi.org/10.3389/fmicb.2017.00456 |
|
27 |
+ http://dx.doi.org/10.1186/s40168-017-0232-3 |
|
28 | 28 |
http://dx.doi.org/10.1111/2041-210X.12628 |
29 |
-http://dx.doi.org/10.1128/AEM.02307-16 |
|
30 |
-http://dx.doi.org/10.3389%2Ffcimb.2016.00036 |
|
31 |
-http://dx.doi.org/10.1016/j.meegid.2015.12.006</description> |
|
29 |
+ http://dx.doi.org/10.1128/AEM.02307-16 |
|
30 |
+ http://dx.doi.org/10.3389%2Ffcimb.2016.00036 |
|
31 |
+ http://dx.doi.org/10.1016/j.meegid.2015.12.006</description> |
|
32 | 32 |
</item> |
33 | 33 |
|
34 | 34 |
</channel> |
... | ... |
@@ -346,7 +346,7 @@ |
346 | 346 |
|
347 | 347 |
<p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"> <link rel="stylesheet" href="https://guangchuangyu.github.io/css/academicons.min.css"></p> |
348 | 348 |
<p><img src="https://raw.githubusercontent.com/Bioconductor/BiocStickers/master/ggtree/ggtree.png" height="200" align="right" /></p> |
349 |
-<p><a href="https://bioconductor.org/packages/ggtree"><img src="https://img.shields.io/badge/release%20version-1.10.0-blue.svg?style=flat" alt="releaseVersion" /></a> <a href="https://github.com/guangchuangyu/ggtree"><img src="https://img.shields.io/badge/devel%20version-1.11.1-blue.svg?style=flat" alt="develVersion" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-21911/total-blue.svg?style=flat" alt="total" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-1156/month-blue.svg?style=flat" alt="month" /></a></p> |
|
349 |
+<p><a href="https://bioconductor.org/packages/ggtree"><img src="https://img.shields.io/badge/release%20version-1.10.0-blue.svg?style=flat" alt="releaseVersion" /></a> <a href="https://github.com/guangchuangyu/ggtree"><img src="https://img.shields.io/badge/devel%20version-1.11.3-blue.svg?style=flat" alt="develVersion" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-22066/total-blue.svg?style=flat" alt="total" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-1218/month-blue.svg?style=flat" alt="month" /></a></p> |
|
350 | 350 |
<p>The <code>ggtree</code> package extending the <em>ggplot2</em> package. It based on grammar of graphics and takes all the good parts of <em>ggplot2</em>. <em>ggtree</em> is designed for not only viewing phylogenetic tree but also displaying annotation data on the tree. <em>ggtree</em> is released within the <a href="https://bioconductor.org/packages/ggtree/">Bioconductor</a> project and the source code is hosted on <a href="https://github.com/GuangchuangYu/ggtree"><i class="fa fa-github fa-lg"></i> GitHub</a>.</p> |
351 | 351 |
<div id="authors" class="section level2"> |
352 | 352 |
<h2><i class="fa fa-user"></i> Authors</h2> |
... | ... |
@@ -355,12 +355,15 @@ |
355 | 355 |
<div id="citation" class="section level2"> |
356 | 356 |
<h2><i class="fa fa-book"></i> Citation</h2> |
357 | 357 |
<p>Please cite the following article when using <code>ggtree</code>:</p> |
358 |
-<p><a href="http://dx.doi.org/10.1111/2041-210X.12628"><img src="https://img.shields.io/badge/doi-10.1111/2041--210X.12628-blue.svg?style=flat" alt="doi" /></a> <a href="https://www.altmetric.com/details/10533079"><img src="https://img.shields.io/badge/Altmetric-333-blue.svg?style=flat" alt="Altmetric" /></a> <a href="https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627"><img src="https://img.shields.io/badge/cited%20by-51-blue.svg?style=flat" alt="citation" /></a></p> |
|
358 |
+<p><a href="http://dx.doi.org/10.1111/2041-210X.12628"><img src="https://img.shields.io/badge/doi-10.1111/2041--210X.12628-blue.svg?style=flat" alt="doi" /></a> <a href="https://www.altmetric.com/details/10533079"><img src="https://img.shields.io/badge/Altmetric-334-blue.svg?style=flat" alt="Altmetric" /></a> <a href="https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627"><img src="https://img.shields.io/badge/cited%20by-52-blue.svg?style=flat" alt="citation" /></a></p> |
|
359 | 359 |
<p><strong>G Yu</strong>, DK Smith, H Zhu, Y Guan, TTY Lam<sup>*</sup>. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. <strong><em>Methods in Ecology and Evolution</em></strong>. 2017, 8(1):28-36.</p> |
360 | 360 |
</div> |
361 | 361 |
<div id="featured-articles" class="section level2"> |
362 | 362 |
<h2><i class="fa fa-pencil"></i> Featured Articles</h2> |
363 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" /></p> |
|
363 |
+<div class="figure"> |
|
364 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" /> |
|
365 |
+ |
|
366 |
+</div> |
|
364 | 367 |
<p><i class="fa fa-hand-o-right"></i> Find out more on <i class="fa fa-pencil"></i> <a href="https://guangchuangyu.github.io/ggtree/featuredArticles/">Featured Articles</a>.</p> |
365 | 368 |
</div> |
366 | 369 |
<div id="installation" class="section level2"> |
... | ... |
@@ -62,16 +62,16 @@ Gut metagenomes of type 2 diabetic patients have characteristic single-nucleotid |
62 | 62 |
|
63 | 63 |
<guid>https://guangchuangyu.github.io/ggtree/gallery/</guid> |
64 | 64 |
<description>http://dx.doi.org/10.1126/science.aao2136 |
65 |
-https://doi.org/10.1186/s40168-017-0331-1 |
|
66 |
-https://doi.org/10.1111/syen.12249 |
|
67 |
-https://doi.org/10.1186/s12915-017-0402-6 |
|
68 |
-http://dx.doi.org/10.3389/fmicb.2017.00543 |
|
69 |
-https://doi.org/10.3389/fmicb.2017.00456 |
|
70 |
-http://dx.doi.org/10.1186/s40168-017-0232-3 |
|
65 |
+ https://doi.org/10.1186/s40168-017-0331-1 |
|
66 |
+ https://doi.org/10.1111/syen.12249 |
|
67 |
+ https://doi.org/10.1186/s12915-017-0402-6 |
|
68 |
+ http://dx.doi.org/10.3389/fmicb.2017.00543 |
|
69 |
+ https://doi.org/10.3389/fmicb.2017.00456 |
|
70 |
+ http://dx.doi.org/10.1186/s40168-017-0232-3 |
|
71 | 71 |
http://dx.doi.org/10.1111/2041-210X.12628 |
72 |
-http://dx.doi.org/10.1128/AEM.02307-16 |
|
73 |
-http://dx.doi.org/10.3389%2Ffcimb.2016.00036 |
|
74 |
-http://dx.doi.org/10.1016/j.meegid.2015.12.006</description> |
|
72 |
+ http://dx.doi.org/10.1128/AEM.02307-16 |
|
73 |
+ http://dx.doi.org/10.3389%2Ffcimb.2016.00036 |
|
74 |
+ http://dx.doi.org/10.1016/j.meegid.2015.12.006</description> |
|
75 | 75 |
</item> |
76 | 76 |
|
77 | 77 |
<item> |
... | ... |
@@ -81,11 +81,9 @@ http://dx.doi.org/10.1016/j.meegid.2015.12.006</description> |
81 | 81 |
|
82 | 82 |
<guid>https://guangchuangyu.github.io/ggtree/tweets/</guid> |
83 | 83 |
<description>Leave me a message on |
84 |
-Thank you so much @guangchuangyu! #ggtree is the easy way for my phd data analysis &lt;3 love it! |
|
85 |
-&mdash; Francisco Romero (@pinchehippie) October 17, 2017 Now on https://t.co/50tYJLLZqc - a spotlight on the Top Tools for R Programming: |
|
86 |
-ggtree made the list!https://t.co/YQv7FeegpM pic.twitter.com/hGn7nBfbEJ |
|
87 |
-&mdash; LabWorm (@TheLabWorm) September 27, 2017 geom_hilight_encircle for unrooted layout #ggtree #rstats pic.twitter.com/1wIwgwUduf |
|
88 |
-&mdash; Guangchuang Yu (@guangchuangyu) September 12, 2017 New Post: Plotting a Sequential Binary Partition on a Tree in R @alex_washburne @guangchuangyu https://t.</description> |
|
84 |
+Also, thanks to @guangchuangyu for the R package ggtree - these visualizations are made possible by the reliability that sweet #rstats package! |
|
85 |
+&mdash; Alex Washburne (@alex_washburne) November 30, 2017 Thank you so much @guangchuangyu! #ggtree is the easy way for my phd data analysis &lt;3 love it! |
|
86 |
+&mdash; Francisco Romero (@pinchehippie) October 17, 2017 Now on https://t.co/50tYJLLZqc - a spotlight on the Top Tools for R Programming:</description> |
|
89 | 87 |
</item> |
90 | 88 |
|
91 | 89 |
</channel> |
... | ... |
@@ -345,7 +345,9 @@ |
345 | 345 |
|
346 | 346 |
<p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"></p> |
347 | 347 |
<p><font size="4"><strong>Leave me a message on <a href="https://twitter.com/hashtag/ggtree"><i class="fa fa-twitter fa-lg"></i></a></strong></font></p> |
348 |
-<p><blockquote class="twitter-tweet"><p lang="en" dir="ltr">Thank you so much <a href="https://twitter.com/guangchuangyu?ref_src=twsrc%5Etfw">@guangchuangyu</a>! <a href="https://twitter.com/hashtag/ggtree?src=hash&ref_src=twsrc%5Etfw">#ggtree</a> is the easy way for my phd data analysis <3 love it!</p>— Francisco Romero (@pinchehippie) <a href="https://twitter.com/pinchehippie/status/920370392451178496?ref_src=twsrc%5Etfw">October 17, 2017</a></blockquote> |
|
348 |
+<p><blockquote class="twitter-tweet"><p lang="en" dir="ltr">Also, thanks to <a href="https://twitter.com/guangchuangyu?ref_src=twsrc%5Etfw">@guangchuangyu</a> for the R package ggtree - these visualizations are made possible by the reliability that sweet <a href="https://twitter.com/hashtag/rstats?src=hash&ref_src=twsrc%5Etfw">#rstats</a> package!</p>— Alex Washburne (@alex_washburne) <a href="https://twitter.com/alex_washburne/status/936241103585517568?ref_src=twsrc%5Etfw">November 30, 2017</a></blockquote> |
|
349 |
+<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> |
|
350 |
+<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Thank you so much <a href="https://twitter.com/guangchuangyu?ref_src=twsrc%5Etfw">@guangchuangyu</a>! <a href="https://twitter.com/hashtag/ggtree?src=hash&ref_src=twsrc%5Etfw">#ggtree</a> is the easy way for my phd data analysis <3 love it!</p>— Francisco Romero (@pinchehippie) <a href="https://twitter.com/pinchehippie/status/920370392451178496?ref_src=twsrc%5Etfw">October 17, 2017</a></blockquote> |
|
349 | 351 |
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> |
350 | 352 |
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Now on <a href="https://t.co/50tYJLLZqc">https://t.co/50tYJLLZqc</a> - a spotlight on the Top Tools for R Programming:<br>ggtree made the list!<a href="https://t.co/YQv7FeegpM">https://t.co/YQv7FeegpM</a> <a href="https://t.co/hGn7nBfbEJ">pic.twitter.com/hGn7nBfbEJ</a></p>— LabWorm (@TheLabWorm) <a href="https://twitter.com/TheLabWorm/status/912971120198012929?ref_src=twsrc%5Etfw">September 27, 2017</a></blockquote> |
351 | 353 |
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> |
... | ... |
@@ -19,11 +19,9 @@ |
19 | 19 |
|
20 | 20 |
<guid>https://guangchuangyu.github.io/ggtree/tweets/</guid> |
21 | 21 |
<description>Leave me a message on |
22 |
-Thank you so much @guangchuangyu! #ggtree is the easy way for my phd data analysis &lt;3 love it! |
|
23 |
-&mdash; Francisco Romero (@pinchehippie) October 17, 2017 Now on https://t.co/50tYJLLZqc - a spotlight on the Top Tools for R Programming: |
|
24 |
-ggtree made the list!https://t.co/YQv7FeegpM pic.twitter.com/hGn7nBfbEJ |
|
25 |
-&mdash; LabWorm (@TheLabWorm) September 27, 2017 geom_hilight_encircle for unrooted layout #ggtree #rstats pic.twitter.com/1wIwgwUduf |
|
26 |
-&mdash; Guangchuang Yu (@guangchuangyu) September 12, 2017 New Post: Plotting a Sequential Binary Partition on a Tree in R @alex_washburne @guangchuangyu https://t.</description> |
|
22 |
+Also, thanks to @guangchuangyu for the R package ggtree - these visualizations are made possible by the reliability that sweet #rstats package! |
|
23 |
+&mdash; Alex Washburne (@alex_washburne) November 30, 2017 Thank you so much @guangchuangyu! #ggtree is the easy way for my phd data analysis &lt;3 love it! |
|
24 |
+&mdash; Francisco Romero (@pinchehippie) October 17, 2017 Now on https://t.co/50tYJLLZqc - a spotlight on the Top Tools for R Programming:</description> |
|
27 | 25 |
</item> |
28 | 26 |
|
29 | 27 |
</channel> |
... | ... |
@@ -7,34 +7,64 @@ weight: 40 |
7 | 7 |
|
8 | 8 |
|
9 | 9 |
<p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"></p> |
10 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2017_science.jpg" /></p> |
|
10 |
+<div class="figure"> |
|
11 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2017_science.jpg" /> |
|
12 |
+ |
|
13 |
+</div> |
|
11 | 14 |
<p><a href="http://dx.doi.org/10.1126/science.aao2136" class="uri">http://dx.doi.org/10.1126/science.aao2136</a></p> |
12 | 15 |
<hr /> |
13 |
-<p><img src="http://media.springernature.com/lw785/springer-static/image/art%3A10.1186%2Fs40168-017-0331-1/MediaObjects/40168_2017_331_Fig3_HTML.gif" /></p> |
|
16 |
+<div class="figure"> |
|
17 |
+<img src="http://media.springernature.com/lw785/springer-static/image/art%3A10.1186%2Fs40168-017-0331-1/MediaObjects/40168_2017_331_Fig3_HTML.gif" /> |
|
18 |
+ |
|
19 |
+</div> |
|
14 | 20 |
<p><a href="https://doi.org/10.1186/s40168-017-0331-1" class="uri">https://doi.org/10.1186/s40168-017-0331-1</a></p> |
15 | 21 |
<hr /> |
16 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/syen12249-fig-0002.png" /></p> |
|
22 |
+<div class="figure"> |
|
23 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/syen12249-fig-0002.png" /> |
|
24 |
+ |
|
25 |
+</div> |
|
17 | 26 |
<p><a href="https://doi.org/10.1111/syen.12249" class="uri">https://doi.org/10.1111/syen.12249</a></p> |
18 | 27 |
<hr /> |
19 |
-<p><img src="http://media.springernature.com/full/springer-static/image/art%3A10.1186%2Fs12915-017-0402-6/MediaObjects/12915_2017_402_Fig2_HTML.gif" /></p> |
|
28 |
+<div class="figure"> |
|
29 |
+<img src="http://media.springernature.com/full/springer-static/image/art%3A10.1186%2Fs12915-017-0402-6/MediaObjects/12915_2017_402_Fig2_HTML.gif" /> |
|
30 |
+ |
|
31 |
+</div> |
|
20 | 32 |
<p><a href="https://doi.org/10.1186/s12915-017-0402-6" class="uri">https://doi.org/10.1186/s12915-017-0402-6</a></p> |
21 | 33 |
<hr /> |
22 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/fmicb-08-00543-g0002.jpg" /></p> |
|
34 |
+<div class="figure"> |
|
35 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/fmicb-08-00543-g0002.jpg" /> |
|
36 |
+ |
|
37 |
+</div> |
|
23 | 38 |
<p><a href="http://dx.doi.org/10.3389/fmicb.2017.00543" class="uri">http://dx.doi.org/10.3389/fmicb.2017.00543</a></p> |
24 | 39 |
<hr /> |
25 |
-<p><img src="http://www.frontiersin.org/files/Articles/220056/fmicb-08-00456-HTML-r1/image_m/fmicb-08-00456-g002.jpg" /></p> |
|
40 |
+<div class="figure"> |
|
41 |
+<img src="http://www.frontiersin.org/files/Articles/220056/fmicb-08-00456-HTML-r1/image_m/fmicb-08-00456-g002.jpg" /> |
|
42 |
+ |
|
43 |
+</div> |
|
26 | 44 |
<p><a href="https://doi.org/10.3389/fmicb.2017.00456" class="uri">https://doi.org/10.3389/fmicb.2017.00456</a></p> |
27 | 45 |
<hr /> |
28 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/40168_2017_232_Fig2_HTML.gif" /></p> |
|
46 |
+<div class="figure"> |
|
47 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/40168_2017_232_Fig2_HTML.gif" /> |
|
48 |
+ |
|
49 |
+</div> |
|
29 | 50 |
<p><a href="http://dx.doi.org/10.1186/s40168-017-0232-3" class="uri">http://dx.doi.org/10.1186/s40168-017-0232-3</a></p> |
30 | 51 |
<hr /> |
31 | 52 |
<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/C2mxyBuUcAEt391.jpg" /> <a href="http://dx.doi.org/10.1111/2041-210X.12628" class="uri">http://dx.doi.org/10.1111/2041-210X.12628</a></p> |
32 | 53 |
<hr /> |
33 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2017-01-21-115646_969x444_scrot.png" /></p> |
|
54 |
+<div class="figure"> |
|
55 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2017-01-21-115646_969x444_scrot.png" /> |
|
56 |
+ |
|
57 |
+</div> |
|
34 | 58 |
<p><a href="http://dx.doi.org/10.1128/AEM.02307-16" class="uri">http://dx.doi.org/10.1128/AEM.02307-16</a></p> |
35 | 59 |
<hr /> |
36 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2016_fcimb-06-00036-g003.jpg" /></p> |
|
60 |
+<div class="figure"> |
|
61 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2016_fcimb-06-00036-g003.jpg" /> |
|
62 |
+ |
|
63 |
+</div> |
|
37 | 64 |
<p><a href="http://dx.doi.org/10.3389%2Ffcimb.2016.00036">http://dx.doi.org/10.3389%2Ffcimb.2016.00036</a></p> |
38 | 65 |
<hr /> |
39 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" /></p> |
|
66 |
+<div class="figure"> |
|
67 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" /> |
|
68 |
+ |
|
69 |
+</div> |
|
40 | 70 |
<p><a href="http://dx.doi.org/10.1016/j.meegid.2015.12.006" class="uri">http://dx.doi.org/10.1016/j.meegid.2015.12.006</a></p> |
... | ... |
@@ -9,7 +9,7 @@ weight: 1 |
9 | 9 |
|
10 | 10 |
<p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"> <link rel="stylesheet" href="https://guangchuangyu.github.io/css/academicons.min.css"></p> |
11 | 11 |
<p><img src="https://raw.githubusercontent.com/Bioconductor/BiocStickers/master/ggtree/ggtree.png" height="200" align="right" /></p> |
12 |
-<p><a href="https://bioconductor.org/packages/ggtree"><img src="https://img.shields.io/badge/release%20version-1.10.0-blue.svg?style=flat" alt="releaseVersion" /></a> <a href="https://github.com/guangchuangyu/ggtree"><img src="https://img.shields.io/badge/devel%20version-1.11.1-blue.svg?style=flat" alt="develVersion" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-21911/total-blue.svg?style=flat" alt="total" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-1156/month-blue.svg?style=flat" alt="month" /></a></p> |
|
12 |
+<p><a href="https://bioconductor.org/packages/ggtree"><img src="https://img.shields.io/badge/release%20version-1.10.0-blue.svg?style=flat" alt="releaseVersion" /></a> <a href="https://github.com/guangchuangyu/ggtree"><img src="https://img.shields.io/badge/devel%20version-1.11.3-blue.svg?style=flat" alt="develVersion" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-22066/total-blue.svg?style=flat" alt="total" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-1218/month-blue.svg?style=flat" alt="month" /></a></p> |
|
13 | 13 |
<p>The <code>ggtree</code> package extending the <em>ggplot2</em> package. It based on grammar of graphics and takes all the good parts of <em>ggplot2</em>. <em>ggtree</em> is designed for not only viewing phylogenetic tree but also displaying annotation data on the tree. <em>ggtree</em> is released within the <a href="https://bioconductor.org/packages/ggtree/">Bioconductor</a> project and the source code is hosted on <a href="https://github.com/GuangchuangYu/ggtree"><i class="fa fa-github fa-lg"></i> GitHub</a>.</p> |
14 | 14 |
<div id="authors" class="section level2"> |
15 | 15 |
<h2><i class="fa fa-user"></i> Authors</h2> |
... | ... |
@@ -18,12 +18,15 @@ weight: 1 |
18 | 18 |
<div id="citation" class="section level2"> |
19 | 19 |
<h2><i class="fa fa-book"></i> Citation</h2> |
20 | 20 |
<p>Please cite the following article when using <code>ggtree</code>:</p> |
21 |
-<p><a href="http://dx.doi.org/10.1111/2041-210X.12628"><img src="https://img.shields.io/badge/doi-10.1111/2041--210X.12628-blue.svg?style=flat" alt="doi" /></a> <a href="https://www.altmetric.com/details/10533079"><img src="https://img.shields.io/badge/Altmetric-333-blue.svg?style=flat" alt="Altmetric" /></a> <a href="https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627"><img src="https://img.shields.io/badge/cited%20by-51-blue.svg?style=flat" alt="citation" /></a></p> |
|
21 |
+<p><a href="http://dx.doi.org/10.1111/2041-210X.12628"><img src="https://img.shields.io/badge/doi-10.1111/2041--210X.12628-blue.svg?style=flat" alt="doi" /></a> <a href="https://www.altmetric.com/details/10533079"><img src="https://img.shields.io/badge/Altmetric-334-blue.svg?style=flat" alt="Altmetric" /></a> <a href="https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627"><img src="https://img.shields.io/badge/cited%20by-52-blue.svg?style=flat" alt="citation" /></a></p> |
|
22 | 22 |
<p><strong>G Yu</strong>, DK Smith, H Zhu, Y Guan, TTY Lam<sup>*</sup>. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. <strong><em>Methods in Ecology and Evolution</em></strong>. 2017, 8(1):28-36.</p> |
23 | 23 |
</div> |
24 | 24 |
<div id="featured-articles" class="section level2"> |
25 | 25 |
<h2><i class="fa fa-pencil"></i> Featured Articles</h2> |
26 |
-<p><img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" /></p> |
|
26 |
+<div class="figure"> |
|
27 |
+<img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" /> |
|
28 |
+ |
|
29 |
+</div> |
|
27 | 30 |
<p><i class="fa fa-hand-o-right"></i> Find out more on <i class="fa fa-pencil"></i> <a href="https://guangchuangyu.github.io/ggtree/featuredArticles/">Featured Articles</a>.</p> |
28 | 31 |
</div> |
29 | 32 |
<div id="installation" class="section level2"> |
... | ... |
@@ -8,4 +8,4 @@ weight: 50 |
8 | 8 |
|
9 | 9 |
<p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"></p> |
10 | 10 |
<p><font size="4"><strong>Leave me a message on <a href="https://twitter.com/hashtag/ggtree"><i class="fa fa-twitter fa-lg"></i></a></strong></font></p> |
11 |
-<p>{{% tweet "920370392451178496" %}}{{% tweet "912971120198012929" %}}{{% tweet "907543915686793217" %}}{{% tweet "910671384069722112" %}}{{% tweet "903786057182957568" %}}{{% tweet "899635001247059969" %}}{{% tweet "898729425168080897" %}}{{% tweet "891144389715783680" %}}{{% tweet "883301626022375424" %}}{{% tweet "883246854695256064" %}}{{% tweet "877576023109390336" %}}{{% tweet "875594411584782337" %}}{{% tweet "871775262152810496" %}}{{% tweet "867408666852511744" %}}{{% tweet "857665638600507393" %}}{{% tweet "840181267542994944" %}}{{% tweet "839831849736232962" %}}{{% tweet "830023569887391744" %}}{{% tweet "829398997735313408" %}}{{% tweet "824264788456984576" %}}{{% tweet "822383911258890242" %}}{{% tweet "811666431452450816" %}}{{% tweet "811661275889549312" %}}{{% tweet "797041236867686400" %}}{{% tweet "797037016403820546" %}}{{% tweet "794278716859879424" %}}{{% tweet "831952966701678592" %}}{{% tweet "788751417746059264" %}}{{% tweet "693123105707986944" %}}{{% tweet "691762302492790788" %}}{{% tweet "687933344219312128" %}}{{% tweet "684411780412526592" %}}{{% tweet "665188011047563268" %}}{{% tweet "664040586001915904" %}}{{% tweet "639507420054749184" %}}{{% tweet "671673570259509248" %}}{{% tweet "667490462693912576" %}}{{% tweet "660278158663401473" %}}{{% tweet "641251456595685376" %}}{{% tweet "559734740488818688" %}}{{% tweet "559762891478667264" %}}{{% tweet "561514846291001344" %}}{{% tweet "559542705663905793" %}}{{% tweet "561056244782227456" %}}{{% tweet "664085841766195200" %}}{{% tweet "664431087683260416" %}}{{% tweet "667706456045694976" %}}{{% tweet "663937183791759360" %}}{{% tweet "663771499589861376" %}}{{% tweet "667433534756397057" %}}{{% tweet "640573716733169664" %}}{{% tweet "664407764001779712" %}}{{% tweet "630500659960254464" %}}{{% tweet "547497335412899840" %}}{{% tweet "610364467939913728" %}}</p> |
|
11 |
+<p>{{% tweet "936241103585517568" %}}{{% tweet "920370392451178496" %}}{{% tweet "912971120198012929" %}}{{% tweet "907543915686793217" %}}{{% tweet "910671384069722112" %}}{{% tweet "903786057182957568" %}}{{% tweet "899635001247059969" %}}{{% tweet "898729425168080897" %}}{{% tweet "891144389715783680" %}}{{% tweet "883301626022375424" %}}{{% tweet "883246854695256064" %}}{{% tweet "877576023109390336" %}}{{% tweet "875594411584782337" %}}{{% tweet "871775262152810496" %}}{{% tweet "867408666852511744" %}}{{% tweet "857665638600507393" %}}{{% tweet "840181267542994944" %}}{{% tweet "839831849736232962" %}}{{% tweet "830023569887391744" %}}{{% tweet "829398997735313408" %}}{{% tweet "824264788456984576" %}}{{% tweet "822383911258890242" %}}{{% tweet "811666431452450816" %}}{{% tweet "811661275889549312" %}}{{% tweet "797041236867686400" %}}{{% tweet "797037016403820546" %}}{{% tweet "794278716859879424" %}}{{% tweet "831952966701678592" %}}{{% tweet "788751417746059264" %}}{{% tweet "693123105707986944" %}}{{% tweet "691762302492790788" %}}{{% tweet "687933344219312128" %}}{{% tweet "684411780412526592" %}}{{% tweet "665188011047563268" %}}{{% tweet "664040586001915904" %}}{{% tweet "639507420054749184" %}}{{% tweet "671673570259509248" %}}{{% tweet "667490462693912576" %}}{{% tweet "660278158663401473" %}}{{% tweet "641251456595685376" %}}{{% tweet "559734740488818688" %}}{{% tweet "559762891478667264" %}}{{% tweet "561514846291001344" %}}{{% tweet "559542705663905793" %}}{{% tweet "561056244782227456" %}}{{% tweet "664085841766195200" %}}{{% tweet "664431087683260416" %}}{{% tweet "667706456045694976" %}}{{% tweet "663937183791759360" %}}{{% tweet "663771499589861376" %}}{{% tweet "667433534756397057" %}}{{% tweet "640573716733169664" %}}{{% tweet "664407764001779712" %}}{{% tweet "630500659960254464" %}}{{% tweet "547497335412899840" %}}{{% tweet "610364467939913728" %}}</p> |