Tag Archives: R

flip and rotate branches in ggtree

flip function is a feature request from ggtree user. It accepts a tree view and two node numbers and exchange the positions of the selected clades.

?View Code RSPLUS
1
2
3
4
5
require(ggtree)
set.seed(2015-07-01)
tr < - rtree(30)
p <- ggtree(tr) + geom_text(aes(label=node))
gridExtra::grid.arrange(p, flip(p, 38, 33), ncol=2)

It's chainable and all possible position adjustment can be achieved via multiple flip operations.
Read more »

dotplot for enrichment result

This is a feature request from clusterProfiler user. It's similar to what I implemented in clusterProfiler for comparing biological themes. For comparing different enrichment results, the x-axis represent different gene clusters while for a single enrichment result, the x-axis can be gene count or gene ratio. This is actually similar to traditional barplot, with dot position as bar height and dot color as bar color. But dotplot can represent one more feature nicely by dot size and it can be a good alternative to barplot.

?View Code RSPLUS
1
2
3
4
library(DOSE)
deg = names(geneList)[abs(geneList) > 1]
do = enrichDO(deg)
dotplot(do, showCategory=20)


Read more »

ggtree with funny fonts

showtext is a neat solution to use various types of fonts in R graphs and make it easy to use funny fonts.

With showtext, we can draw phylogenetic tree with different types of fonts even with symbolic/icon fonts.

?View Code RSPLUS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require(showtext)
 
font.add.google("Gochi Hand", "gochi")
font.add.google("Rock Salt", "rock")
 
link = "http://img.dafont.com/dl/?f=wm_people_1";
download.file(link, "wmpeople1.zip", mode = "wb");
unzip("wmpeople1.zip");
font.add("wmpeople1", "wmpeople1.TTF");
 
link = "http://img.dafont.com/dl/?f=emoticons";
download.file(link, "emoticons.zip", mode = "wb");
unzip("emoticons.zip");
font.add("emoticons", "emoticons.ttf");
 
 
showtext.auto()
set.seed(2015-05-14)
 
library(ggplot2)
library(ggtree)
 
tree < - rtree(30)
ggtree(tree, color="darkgreen") + geom_tiplab(family="gochi") + theme_classic() +
    theme(axis.text.x=element_text(size=rel(4), family="emoticons", color="firebrick")) +
        scale_y_continuous(breaks=seq(0, 30, 4), labels=letters[c(12:17, 20, 21)]) +
            theme(axis.text.y=element_text(size=rel(4), family="wmpeople1", color="#FDAC4F")) +
                annotate("text", x=2, y=18, label="Have fun with ggtree!",
                         family="rock", angle=30, size=12, color="steelblue")

Read more »

BMC favors source code plagiarism

I found source code plagiarism a year ago and reported this case to BMC Systems Biology:

I listed source code of many functions that are exactly copied from GOSemSim with only function name changed in my email. The detail of source code plagiarism can also be found at Proper use of GOSemSim.

I got reply from the Editor 3 days after (see screenshot).
Read more »

use clusterProfiler as an universal enrichment analysis tool

clusterProfiler supports enrichment analysis of both hypergeometric test and gene set enrichment analysis. It internally supports Gene Ontology analysis of about 20 species, Kyoto Encyclopedia of Genes and Genomes (KEGG) with all species that have annotation available in KEGG database, DAVID annotation (only hypergeometric test supported), Disease Ontology and Network of Cancer Genes (via DOSE for human) and Reactome Pathway (via ReactomePA for several species). This is still not enough for users may want to analyze their data with unsupported organisms, slim version of GO, novel functional annotation (eg GO via blastgo and KEGG via KAAS), unsupported ontology/pathway or customized annotation.

clusterProfiler provides enricher function for hypergeometric test and GSEA function for gene set enrichment analysis that are designed to accept user defined annotation. They accept two additional parameters TERM2GENE and TERM2NAME. As indicated in the parameter names, TERM2GENE is a data.frame with first column of term ID and second column of corresponding mapped gene and TERM2NAME is a data.frame with first column of term ID and second column of corresponding term name. TERM2NAME is optional.
Read more »

Page 1 of 29 1 2 3 4 5 6 7 8 ...Last »