# Articles by Xianjun Dong

### R / Bioconductor for High-Throughput Sequence Analysis

December 6, 2013 |

I would like to recommend a recent workshop material on R/Bioconductor from Marc Carlson et al.http://www.bioconductor.org/help/course-materials/2013/SeattleMay2013/PDF: IntermediateSequenceAnalysis2013.pdfR script: IntermediateSequenceAnalysis201... [Read more...]

### Google Developers R Programming Video Lectures

August 8, 2013 |

I got this Google Developers R Programming Video Lectures from Stephen's blog - Getting Genetics Done.Very useful R tutorial for beginner! Short and efficient. Here is what I learned after watching the lectures:4.3 - Add a Warning or Stop the Func... [Read more...]

### methods of calling differential region of ChIP-seq

August 7, 2013 |

Related papers to read:Model-based Analysis of ChIP-Seq (MACS)MACS can also be applied to differential binding between two conditions by treating one of the samples as the control. Since peaks from either sample are likely to be biologically meaningful... [Read more...]

### counts numbers in a interval

February 5, 2013 |

Say I have a list of values, and I cut them by some break points, how do I know the number of values in each interval?We know cut() function in R works for the purpose.  For example,tx0 [Read more...]

### line width in R and in Illustrator

December 17, 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 ... [Read more...]

### write.table with proper column number in the header

December 5, 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-r... [Read more...]

### draw figures in CMYK mode in R

October 31, 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 ... [Read more...]

### difference between NA and NaN in R

August 23, 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_integer_, ... [Read more...]

### get UCSC images for a list of regions in batch

July 24, 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=hi... [Read more...]

### self-organizing map in R

July 19, 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 [Read more...]

### bubble plot in R

July 18, 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")){          ... [Read more...]

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

June 28, 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 =... [Read more...]

June 15, 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 th... [Read more...]

### whisker of boxplot

June 15, 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..."... [Read more...]

### Clustering analysis and its implementation in R

April 29, 2012 |

Earlier I posted a blog for "k-means + heatmap" used for clustering analysis. Recently to prepare for the "Bioinformatics Tools" meeting, I made a slide with more details on "clustering analysis". Here it is:https://docs.google.com/presentation/d/1vMS3... [Read more...]

### Ternary ifelse ( ?: ) in different languages

February 23, 2012 |

AWK$awk 'ORS=NR%3?",":"\n"' student-marksPerl /PHP$result = ($a __$b) ? $x :$y;In Per6, use double ? and ! instead.$result = ($a __ $b) ??$x !! \$y;Rifelse(a__0,a,0)Ternary operator (if?true:false)bash/linuxternary operator ? : is ju... [Read more...]

### an easy way to writing data.frame to Excel

November 16, 2011 |

you can write it aswrite.table(r.data.frame, "excel.file.xls", sep="\t", na="", row.names=F)which I can usually open in Excel just by clicking on it.Credit: http://tolstoy.newcastle.edu.au/R/help/05/04/3388.html [Read more...]

### match vs. %in%

November 4, 2011 |

match and %in% are two very commonly-used function in R. So, what's the difference of them?First, how to use them -- (copy from R manual)match returns a vector of the positions of (first) matches of its first argument in its second.%in% is a ... [Read more...]

### single-column data frame

October 10, 2011 |

This is a trivial but very useful tip:__ x=data.frame(a=1:4, c=5)__ x a c1 1 52 2 53 3 54 4 5__ x[1,] a c1 1 5__ x[,1][1] 1 2 3 4__ x[,1, drop=F] a1 12 23 34 4where you can see that:to avoid a[, i] become a vector, rather than a... [Read more...]
1 2 3

# Never miss an update! Subscribe to R-bloggers to receive e-mails with the latest R posts.(You will not see this message again.)

Click here to close (This popup will not appear again)