As the doctor gone rogue

April 30, 2010

Image processing in R — Convert EPS to PDF and others

Filed under: bash, genetics, R — Tags: , , , — hypotheses @ 1:53 am

I do a lot of plots and graphs in R, and I found that most fonts will look disproportionate if I originally save the graphic output from R using a function such as png(). So the solution I have till now is to save all of my plots using

#as I normally want the plot to be in the size of most paper used to print here in the US
#by default the paper size is "A4" though.

Then, the next problem seems to be how do I convert these EPS files into PDF or other format.On Linux, so far my solution seems to be using ImageMagick,


. However, on OsX, if you don’t want to install ImageMagick, they already have a command built-in.

Through a series of these command, you will convert your file into a subfolder with the appropriate extension.

#echo *.eps | xargs -n1 pstopdf && mkdir png; sips -s format png *.pdf --out png/
<pre>echo *.eps | xargs -n1 pstopdf && mkdir png; sips -s format png *.pdf --out png</pre>

Although you will get a warning that the extension has been change to png, look inside “png” directory, and you will find all your files inside neatly converted to the format you want. You can use


to convert to jpeg or other format as well.

April 23, 2010

The Sopranos

Filed under: miscellaneous — Tags: , — hypotheses @ 4:48 am

“Sigh…I don’t know. The morning the day I got sick I’ve been thinking…it’s good to be in something from the ground floor. I came too late for that. I know. But, lately I’m getting the feeling that I came in at the end. The best is over.”

“I think about my father. He never reached heights like me. But in a lot of way, he had it better. He had his people. They had their standard. They had their pride.”

Tony Sopranos

Modern society seems to make life more and more complicated. Modern statistical techniques seem to do the same thing to this society.

April 22, 2010

How do I delete a large chunk of file?

Filed under: bash, Wordpress — hypotheses @ 2:17 pm

Posting Source Code « Support —

This might not be a good way to start a blog, but at least it gets me started about what I would like to do about my blog, and integrate this into part of my everyday work, which is writing some code/program/analysis in genetic epidemiology or statistical genetics. It should be an archive of examples and resources for readers.

## Here's a way to delete a large chuck of files which gives you error that "argument too long"

find .|grep 'merlin.*[(dat)|(freq)|(tbl)|(ped)|(map)]$' | xargs rm

– first the last part of grep enable you to match many types of file extension

– second : xargs allow you to execute any command to a long arguments that you parse to it “one by one”

April 20, 2010

Hello world!

Filed under: Uncategorized — hypotheses @ 3:48 pm

Welcome to This is your first post. Edit or delete it and start blogging!

Blog at