Jean-Philippe Fortin

Postdoctoral Fellow in Biostatistics at the University of Pennsylvania

wordpressR

Writing WordPress posts that contain R code becomes a piece of cake with the R packages RWordpress, rmarkdown and knitr. Thanks to John Muschelli who shared his code with me (code inspired by Yihui).

You really need only a few lines of code to transform any R Markdown document into a WordPress post. Look at the RStudio documentation here to learn how to write R Markdown documents.

Assuming that you already have the devtools package installed, make sure to install the following packages as well:

install.packages('RWordPress', repos = 'http://www.omegahat.org/R', type = 'source')
install.packages('knitr')
devtools::install_github("rstudio/rmarkdown")

Here is an example code to publish “my_first_post.Rmd” (located in my directory “~/Dropbox/Wordpress”) under the title “My First Post” (the script can be found on my GitHub):

library(knitr)
library(RWordPress)

# 1. Your WP password:
password <- "myPassword"

# 2. Replace "fortin946"" by your WP username
options(WordPressLogin = c(fortin946 = password))

# 3. Replace "http://jfortinbiostats.com" by your url
options( WordPressURL = 'https://jfortinbiostats.com/xmlrpc.php')

# 4. wpdir must be the directory path of your rmarkdown document
wpdir <- path.expand(file.path("~/Dropbox/Wordpress"))

# 5. Replace "my_first_post.Rmd" by your rmarkdown file
file <- "my_first_post.Rmd" 
rmdname <- file.path(wpdir, file)

# WP will automatically source the images from imgur.com
opts_knit$set(upload.fun = imgur_upload, base.url = NULL) 

# 6. Push your post to WP:
knit2wp(input=rmdname, title="My First post", publish=FALSE) 

Go try shareLatex

Last semester, John Muschelli and I had to collaborate on two class projects, one consisting of writing a report for a DNA methylation data analysis, the other about presenting a fascinating paper on the asymptotics of subsampling estimators.

That means we had 3 latex documents — one article and two beamer presentations that we were simultaneously working on every day (and every night). Synchronizing the files, even if we both use regularly version control (like GitHub or BitBucket), would have been a nightmare: who really wants to commit every 30 seconds? Thankfully, John knew about shareLatex, and I called it an end-of-semester miracle.

Here is why shareLatex is awesome:

  • It hosts your latex documents online, and you can add as many contributors to the project as you want.
  • You can simultaneously type in the document, and you can see the mouse cursors of your friends moving on the screen, in real-time.
  • You can upload figures into the project so that you have your full presentation ready online
  • There are 6 ready-to-use templates: Journal Article, Presentation, Thesis, Bibliography, CV and Cover Letter. Pretty handy.
  • You can export projects to your laptop in one click
  • You can synchronize your projects with Dropbox (beta version)
  • Finally, it’s free!

Lost in Translation

Have you ever been lost in translation (or to be L.I.T. as Muschelli likes to say)? I experience the L.I.T. on a daily basis, and believe me, it is sometimes really embarrassing. Thankfully, I have good friends out there to help me.

L.I.T. Type 1: Inappropriate Words

  • The verb “to fondle”
    At lunchtime, I wanted to comfort my friend whose cat had passed away the night before. Sadly, the first word that Google returned to me for “to comfort” was “to fondle”.  I then learned that it is not OK in a crowded cafeteria to ask your friend if you can “fondle” her. Awful L.I.T. due to unreliable Google translate.
  • “That’s what she said”
    One way I practice my English speaking skills is to watch the TV show The Office.  Everyone knows what “That’s what she said” means. Everyone but me. After constantly using it in my department in any context, often in front of faculty members, my friend Elizabeth was kind enough to explain to me the sexual connotation of the quote. No need to tell you that I felt horribly mortified and embarrassed.
  • I don’t “own” people
    One day, my friend Elizabeth brought sushi to share. I told her “I own you”. She got pretty mad and said that nobody “owns” her.  I reaffirmed that I really owned her. That’s how I learnt to pronounce “owe”. And towel, and owl. Thanks Elizabeth, I owe you that.
  • “Tinkle” is a home word
    I’m learning idioms fast because I live with a native English speaker. But this also has its disadvantages. It is not OK to say “I need to go tinkle” at school.

L.I.T. Type 2: The Unpronounceable Words

  • Coin
    I have a major deficiency for this word. Thanks to Mandy for spending many hours improving my pronunciation. The trick is to start with “coy” (like “boy”), add an “n”, but avoid pronouncing it as “corn”.  We realized that it works perfectly after two or three beers.
  • Worcestershire sauce
    That’s a classic. We spent an entire night plugging Worcestershire sauce randomly into conversations. Here is a nice You Tube tutorial to teach you how to pronounce it.

Screen Shot 2013-12-09 at 10.31.02 PM

L.I.T. Type 3: Incorrectly Stressed Words

French, contrary to English or Spanish, is a pretty flat language.  We don’t stress words. In English, the meaning of the words can change when the stress changes.

  • “Bag” versus “Bike”
    I went to the gym, but forgot my bike lock. I asked the woman at the front desk if there was room inside for my bike. She said that there was no problem, I could just leave it in one of the gym lockers. I said kindly, trying to pronounce “bike” very distinctly with a harsh “k” at the end, that my bike would not fit. She laughed because she was positive it would fit. She obviously heard “bag” twice. There was no way I was going to repeat it a third time; I have some pride. I had no option left, I decided to go ahead, and started to walk my bike to the locker room, waiting for her to stop me.  She looked at me, she looked at my bike, and told me I was not allowed to bring my bike inside. I told her that she told me that she thought it would fit into a locker room. She told me it was stupid. I told her bye. I felt so lame.  Now I use the word bicycle. “Bike” is on my black list forever.

L.I.T. Miscellaneous

My friends always repeat my L.I.T.s to tease me. I like that. It reminds me that I am learning everyday.

  • Now Alyssa likes to say mentally “hill”
  • Frazer likes to say “What day we are? We are Fridays!”
  • Elizabeth always “pays” me a drink
  • Mandy thinks that I’m hhhonest

My conclusion

At the end of the day, L.I.T.s are a lot of fun. Muschelli loves to impersonate my French-Canadian accent everyday. And now I often pretend to be L.I.T. to joke around. We call it “playing the L.I.T. card”. Sometimes they think I’m faking to be L.I.T.. Sometimes they think I am L.I.T. because I’m saying crazy things, but no, that’s just because I am crazy.

Annotation in minfi

With the release of Bioconductor 2.13 comes a new release of minfi, a powerful tool for the analysis of methylation data from Illumina 450k arrays.  Some of you may have noticed that in Bioconductor 2.13, the annotation package IlluminaHumanMethylation450kanno.ilmn.v1.2, required by the previous versions of minfi, does not exist anymore.  What’s happening. Well, a new annotation package took its place, and is called IlluminaHumanMethylation450kanno.ilmn12.hg19. But when one tries to manipulate previously created RGChannelSet‘s with the new version of minfi, the following error is thrown:

“there is no package called ‘IlluminaHumanMethylation450k.anno.ilmn.v1.2”

That’s because you need to update your annotation. But don’t worry, minfi’s authors have thought about it; here is how to quickly fix it:


library(minfi)
yourRGSet <- updateObject(yourRGSet)

and your RGSet will now have the right annotation. Simple. In particular, shinyMethyl could not load on a new BioC session because of the non-existence of the old annotation package. Now it’s fixed, and users are invited to reinstall the package from gitHub. 

Coming soon…

In the meantime, go to see these awesome blogs, all from Hopkins Biostats:
HopStat and Jump Away (John Muschelli, 2nd year PhD Student)
Elizabeth Sweeney’s blog (1st year PhD Student)
Alyssa Frazee’s blog (4th year PhD Student)
Fellgernon Bit (Leo Collado Torres, 2nd year PhD Student)
and
Simply Statistics (Jeff Leek, Roger Peng and Rafael Irizarry)