• ### Special Cron Job

Oct 16, 2019

Today, I encountered a really nasty scripting “bug” that involves running a cron job. I have a simple script called run_monitor.sh that:

1. Curls a website to get its response status
2. Checks the response status
3. Updates the cron job depending on the status

• ### Convert a Pandas DataFrame to Numeric

Dec 15, 2015

Pandas has deprecated the use of convert_object to convert a dataframe into, say, float or datetime. Instead, for a series, one should use:

or, for an entire dataframe:

• ### Python 2 Unicode Problem

Dec 1, 2015

The following Python error is one of the most annoying one’s I’ve ever encountered:

Essentially, you can’t write unicode characters as string unless you’ve converted the text to a string first before printing it. A detailed explanation can be found in Kumar McMillan’s wonderful talk titled ‘Unicode in Python, Completely Demystified’. To summarize, McMillan offers three useful yet simple rules:

• ### 2015 Nobel Prize in Chemistry Awarded to DNA Repair

Oct 7, 2015

Today, the 2015 Nobel Prize in Chemistry was awarded to the field of DNA repair. I am especially excited by this news since I had spent six years researching the role that DNA base-flipping plays in DNA repair when I was a graduate student studying at Michigan State University under the mentorship of Dr. Michael Feig. Thus, my research sat at the crossroads between the exciting worlds of computational chemistry (which was awarded the Nobel Prize in Chemistry two years ago in 2013) and DNA repair which have ultimately shaped my appreciation for doing science.

Dr. Paul Modrich, one of the three Nobel Prize recipients this year, is a pioneer in the field of DNA mismatch repair and has spent decades trying to understand the mechanism by which humans (and other eukaryotes) maintain the efficacy and fidelity of their genome. As a computational biochemist/biophysicist, I am honored to have had the opportunity to make significant contributions to this field of research and am delighted to see this area be recognized!

Others scientists who have also made an impact in the area of DNA mismatch repair include (in no particular order) Drs. Richard Kolodner, Richard Fishel, Thomas Kunkel, Dorothy Erie, Manju Hingorani, Peggy Hsieh, Shayantani Mukherjee, Alexander Predeus, Meindert Lamers, Titia Sixma, et al.

Congratulations to all!

Sep 22, 2015

If you work in a secure network at your job then conda may not be able to hit the Anaconda repositories directly even if it’s for accessing free packages. Additionally, it’s not recommended to use pip over conda when installing new packages. However, installing new packages can be done manually by:

2. And installing the tar.bz2 file using conda install ./package_name.tar.bz2

• ### Using NumPy Argmin or Argmax Along with a Conditional

Sep 10, 2015

It’s no secret that I love me some Python! Yes, even more than Perl, my first love from my graduate school days.

I’ve always found NumPy to be great for manipulating, analyzing, or transforming arrays containing large numerical data sets. It is both fast and efficient and it comes with a tonne of great functions.

• ### Modern Data Scientist

Aug 8, 2015

The qualities of a modern data scientist is summed up very nicely in this article/guide and image by Marketing Distillery. As they point out, the team should be composed of people with a “mixture of broad, multidisciplinary skills ranging from an intersection of mathematics, statistics, computer science, communication and business”. More importantly:

“Being a data scientist is not only about data crunching. It’s about understanding the business challenge, creating some valuable actionable insights to the data, and communicating their findings to the business”.

I couldn’t agree more!

• ### Anaconda Environment

Jul 9, 2015

I’ve been using Continuum’s enterprise Python distribution package, Anaconda, for several months now and I love it. Recently, people have been asking about Python 2.7 vs Python 3.x and so I looked into how to switch between these environments using Anaconda.

In fact, it’s quite straightforward and painless with Anaconda.

To set up a new environment with Python 3.4:

• ### Stitch Fix Loves UNIX

May 27, 2015

The wonderful group of people at Stitch Fix has shared an informative list of useful UNIX commands. Go check it out now!

• ### Drafts in Jekyll

Mar 14, 2015

The great thing about Jekyll is that you can start writing a draft without publishing it and still be able to see the post locally.

1. Create a draft directory called _drafts in the root directory
2. Create a new post in this directory but omit the date in the file name
3. Serve up the page locally using jekyll serve --drafts

Then, Jekyll will automatically adjust the date of the post to today’s date and display the post as the most recent post. Note that this post won’t be displayed on your github pages since they aren’t using the --drafts option. So, you’ll be able to save all of your drafts without worrying about them showing up on your live site. Once the post is ready for the prime time, then simply move it over to the _posts directory and prepend a date to the file name. That’s it!

• ### 3D Coordinates Represented on a 2D Triangle

Mar 6, 2015

I came across this interesting way of showing 3D coordinates on a 2D triangle published in the Journal of Physical Chemistry B. It takes a minute to orient yourself and figure out how best to interpret the results but the idea is pretty cool. I wonder what type of geometric transformation is need to create this plot. Once I figure it out, I’ll be sure to blog about it and prototype it in Python!

• ### MathJax

Feb 28, 2015

As I embark on the PyESL project, I’ll need to include math equations in future blog posts. The easiest way to accomplish this is to use MathJax so that I can incorporate Tex/LaTeX/MathML-based equations within HTML. In Jekyll, all you need to do is add the MathJax javascript to the header section of your default.html and add a new variable to your _config.yml file.

<head>
...
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
...


markdown: kramdown


For example, this markdown:

Inline equation \$${y} = {m}{x} + {b} \$$ and block equation \${y} = {m}{x}+{b} \$


produces:

Inline equation $${y} = {m}{x}+{b}$$ and block equation ${y} = {m}{x}+{b}$

Here, the parentheses denote an inline equation while the square brackets denote a block equation.

And this is a multiline equation:

• ### Tag Aware Previous/Next Links for Jekyll

Feb 22, 2015

Creating and maintaining a vanilla Jekyll-Boostrap website is pretty straightforward. However, I couldn’t find an obvious way to customize the previous/next links below each blog post so that:

1. The links were aware of the tags listed in the front matter
2. The method did not depend on plugin (since my site is being hosted on Github)

After tonnes of digging, I managed to piece together a Liquid-based solution (see my last post, to see how I add Liquid code in Jekyll)!

• ### Escaping Liquid Code in Jekyll

Feb 21, 2015

To document some of my challenges in customizing this site, I’ve had to delve into Liquid code. However, adding Liquid code tags in Jekyll can be quite tricky and painful. Luckily, some smart people have identified a couple of nice solutions exists. Below is the markdown code that I’ve adopted for use in future posts:

• ### Elements of Statistical Learning

Feb 20, 2015

My new book purchase, Elements of Statistical Learning by Trevor Hastie, Robert Tibshirani, and Jerome Friedman arrived in the mail the last week and I’m excited to get reading! Springer was also kind enough to make this classic book available free to download. Get your copy here! Python implementations of each chapter will be added in the PyESL section.

• ### Github and Jekyll-Bootstrap, FTW!

Feb 17, 2015

My blog is finally up and running! Currently, it’s being hosted (for free) and backed up on Github pages using vanilla Jekyll-Bootstrap. Font awesome, which definitely lives up to its name, was used to produce the social icons along the navigation bar and Dropbox is being used for redundancy. More design customizations will follow but I’m loving how easy the process has been!