Transitions in R redux

April 28, 2010

(This article was first published on The Praise of Insects, and kindly contributed to R-bloggers)

Previously, I shared with the world a function to create a pairwise matrix of the number of transitions and transversions between two DNA sequences. Klaus Schliep kindly pointed out the possibility of a bug in the function and offered a faster, more accurate version. Thanks Klaus!

res<-matrix(NA, ncol=dim(mat)[1], nrow=dim(mat)[1], dimnames=list(x=names(dat), y=names(dat)))
for(i in 1:(dim(mat)[1] – 1)){
for(j in (i+1):dim(mat)[1]){

The previous version of the function considered the difference between an unknown base (coded as N) and a T as a transition. The new version does not detect this difference.

To leave a comment for the author, please follow the link and comment on their blog: The Praise of Insects. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


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)