Publications by Xianjun Dong

whisker of boxplot

15.06.2012

From Wiki:“… the bottom and top of the box are always the 25th and 75th percentile (the lower and upper quartiles, respectively), and the band near the middle of the box is always the 50th percentile (the median). But the ends of the whiskers can represent several possible alternative values…”In R’s default boxplot{gra...

1562 sym 2 img 1 tbl

about boxplot

15.06.2012

From Wiki:“… the bottom and top of the box are always the 25th and 75th percentile (the lower and upper quartiles, respectively), and the band near the middle of the box is always the 50th percentile (the median). But the ends of the whiskers can represent several possible alternative values…”In R’s default boxplot{gra...

1215 sym

Two tips: adding title for graph with multiple plots; add significance asterix onto a boxplot

28.06.2012

I’ve not added tips for a while. Here is it for today:1. How to add title for graph with multiple plots?par(mfrow=c(1,2),oma = c(0, 0, 2, 0))plot(1:10,  main=”Plot 1″)plot(1:100,  main=”Plot 2″)mtext(“Title for Two Plots”, outer = TRUE, cex = 1.5)2. How to add text (e.g. asterix for significance) onto a boxplot?boxpl...

917 sym 4 img

bubble plot in R

18.07.2012

Motived by the post from FlowingData(http://flowingdata.com/2010/11/23/how-to-make-bubble-charts/), I made this plot with R code below:par(mfrow=c(3,1), mar=c(4,6,4,4))for(ty in c(“protein_coding”,”lincRNA”,”piRNA”)){             res1=subset(res,type==ty & readsCount>10 & speciesCount>8)             symbols(log(res1$leng...

1052 sym 2 img

self-organizing map in R

19.07.2012

This is my first SOM figure 🙂Thanks to the som package and example code from Jun Yan. Here is my code for the figure:require(som)rpkm rpkm.f # rpkm.f=log(rpkm.f+0.1) # this doesn’t really change much of the resultrpkm.f.n foo png(“../results/clustering.SOM.RNAseq.png”,width=800, height=800)plot(foo,yadj=0.15, main=”Expression profiles...

6962 sym 6 img

get UCSC images for a list of regions in batch

24.07.2012

Here is my working R code for the task. It can be simplified as 3 lines.# example of controling individual track#theURL=”http://genome.ucsc.edu/cgi-bin/hgTracks?db=mm9&wgRna=hide&cpgIslandExt=pack&ensGene=hide&mrna=hide&intronEst=hide&mgcGenes=hide&hgt.psOutput=on&cons44way=hide&snp130=hide&snpArray=hide&wgEncodeReg=hide&pix=1000&refGene=pack&k...

8629 sym 4 img

difference between NA and NaN in R

23.08.2012

We usually see NA and NaN in R. What’s the difference between them?Here a good post for that topic:http://stats.stackexchange.com/questions/5686/what-is-the-difference-between-nan-and-naIn summary here:NaN (“Not a Number”) means 0/0NA (“Not Available”) is generally interpreted as a missing value and has various forms – NA...

2789 sym

draw figures in CMYK mode in R

31.10.2012

Print publication usually ask to use CMYK (instead of RGB) color mode for figures (because not every color can be print out), while we usually use RGB for screen reading (because screen has larger range of color scale). Of course we can convert RGB to CMYK in external software, like PS.  But why not using CMYK directly while producin...

952 sym 4 img

write.table with proper column number in the header

05.12.2012

Did you notice that the file generated from write.table() in R has missed a tab (\t) in the top-left corner, when row.names=T (by default)?I found the solution here:http://stackoverflow.com/questions/2478352/write-table-in-r-screws-up-header-when-has-rownameswrite.table(“filename.xls”, sep=”\t”, col.names = NA, row.names = TRUE)Actually...

976 sym

line width in R and in Illustrator

17.12.2012

I’ve drawn figure in R with lwd=1, e.g.pdf(‘test.pdf’)plot(1:10, type=’o’, lwd=2, axes=F) box(lwd=1, col=’red’) dev.off()And then you open the PDF in Illustrator, you will see the border width is 0.75pt, and the line is 1.5pt, which seems that the unit of 1 in R is 0.75pt in Illustrator.How is this defined? Where can I ...

2631 sym 4 img