Programming pages.

Mailcap files, defined in RFC 1524, allow you to tell you mail clients, web browsers, and other programs how you want to view and edit various MIME types. Since interaction with your mailcap files often occurs deep within the bowels of your program, I've written up a very simple Python script to test your mailcap entries: mailcap-test.py. Enjoy!

Posted Thu Dec 1 20:43:14 2011 Tags: programming

Available in a git repository.
Repository: cookbook
Author: W. Trevor King

I've been running a home-rolled recipe webapp for a year now, and it worked fairly well in a bare-bones sort of way. However, I recently had to make some changes to my personal website (since EveryDNS and aparently most other free DNS providers were bought by Dyn), which prompted me to translate cookbook into a Django app. Thanks to the wonders of Django, Grappelli, and django-taggit, the code is now leaner, meaner, and prettier!

See the README for details.

Posted Fri Aug 5 13:59:01 2011 Tags: programming

Available in a git repository.
Repository: h5config
Author: W. Trevor King

Since the number of packages mooching off pypiezo's configuration scheme was growing, I've split it out into it's own package. Now there's a general package for all your HDF5-based configuration needs.

The README is posted on the PyPI page.

Posted Thu Jul 28 12:25:06 2011 Tags: programming

Available in a git repository.
Repository: pypid
Author: W. Trevor King

I've just finished rewriting my PID temperature control package in pure-Python, and it's now clean enough to go up on PyPI. Features:

  • Backend-agnostic architecture. I've written a first-order process with dead time (FOPDT) test backend and a pymodbus-based backend for our Melcor MTCA controller, but it should be easy to plug in your own custom backend.
  • The general PID controller will automatically tune your backend using any of a variety of tuning rules.

The README is posted on the PyPI page.

Posted Wed Jul 27 12:06:19 2011 Tags: programming

Available in a git repository.
Repository: insider
Author: W. Trevor King

Insider is a little Django app I wrote to help my brother, Garrett, track insider trading with a simple, familiar web interface. It's a pretty simple app, partly thanks to Bradley Ayers' django-tables2, which does the table formatting. Just goes to show that a good scripting language and framework make developing simple apps a breeze!

The README is posted on the PyPI page.

Posted Thu Jul 21 18:30:33 2011 Tags: programming

There are a number of open source packages dealing with aspects of single-molecule force spectroscopy. Here's a list of everything I've heard about to date.

PackageLicensePurpose
calibcantGPL v3+ Cantilever thermal calibration
fs_kitGPL v2+ Force spectra analysis pattern recognition
HookeLGPL v3+ Force spectra analysis and unfolding force extraction
sawsimGPL v3+ Monte Carlo unfolding/refolding simulation and fitting
refoldingApache v2.0 Double-pulse experiment control and analysis

calibcant

Calibcant is my Python module for AFM cantilever calibration via the thermal tune method. It's based on Comedi, so it needs work if you want to use it on a non-Linux system. If you're running a Linux kernel, it should be pretty easy to get it running on your system. Email me if there's any way I can help set it up for your lab.

fs_kit

fs_kit is a package for force spectra analysis pattern recognition. It was developed by Michael Kuhn and Maurice Hubain at Daniel Müller's lab when they were at TU Dresden (paper). It has an Igor interface, but the bulk of the project is in C++ with a wxWidgets interface. fs_kit is versioned in CVS at bioinformatics.org, and you can check out their code with:

$ cvs -d:pserver:anonymous@bioinformatics.org:/cvsroot checkout fskit

The last commit was on 2005/05/16, so it's a bit crusty. I patched things up back in 2008 so it would compile again,

0001-Added-math.h-include-to-fs align histogram2d.h.patch
Posted Sat Apr 23 15:00:17 2011

0002-changed-abs-double-to-fabs-double-in-fs fit spectr.patch
Posted Sat Apr 23 15:00:17 2011

0003-Updated-wxWindows-code-to-compile-on-wx-2.8.patch
Posted Sat Apr 23 15:00:17 2011

0004-Added-wxglade-entry-to-Makefile-for-regenerating-aut.patch
Posted Sat Apr 23 15:00:17 2011

but when I emailed Michael with the patches I got this:

On Thu, Oct 23, 2008 at 11:21:42PM +0200, Michael Kuhn wrote:
> Hi Trevor,
>
> I'm glad you could fix fs-kit, the project is otherwise pretty dead,
> as was the link. I found an old file which should be the tutorial,
> hopefully in the latest version. The PDF is probably lost.
>
> bw, Michael

So, it's a bit of a fixer-upper, but it was the first open source package in this field that I know of. I've put up a PDF version of the tutorial Michael sent me in case you're interested.

Hooke

Hooke is a force spectroscopy data analysis package written in Python. It was initially developed by Massimo Sandal, Fabrizio Benedetti, Marco Brucale, Alberto Gomez-Casado while at Bruno Samorì's lab at U Bologna (paper; surprisingly, there are commits by all of the authors except Samorì himself). Hooke provides the interface between your raw data and theory. It has a drivers for reading most force spectroscopy file formats, and a large number of commands for manipulating and analyzing the data.

I liked Hooke so much I threw out my already-written package that had been performing a similar role and proceeded to work over Hooke to merge together the diverging command-line and GUI forks. Unfortunately, my fork has not yet been merged back in as the main branch, but I'm optimistic that it will eventually. The homepage for my branch is here.

sawsim

While programs like Hooke can extract unfolding forces from velocity-clamp experiments, the unfolding force histograms are generally compared to simulated data to estimate the underlying kinetic parameters. Sawsim is my package for performing such simulations and fitting them to the experimental histograms (paper). The single-pull simulator is written in C, and there is a nice Python wrapper that manages the thousands of simulated pulls needed to explore the possible model parameter space. The whole package ends up being pretty fast, flexible, and convenient.

refolding

Refolding is a suite for performing and analyzing double-pulse refolding experiments. It was initially developed by Daniel Aioanei, also at the Samorí lab in Bologna (these guys are great!). The experiment-driver is mostly written in Java with the analysis code in Python. The driver is curious; it uses the NanoScope scripting interface to drive the experiment through the NanoScope software by impersonating a mouse-wielding user (like Selenium does for web browsers). See the RobotNanoDriver.java code for details.

Posted Sat Apr 23 15:00:17 2011 Tags: programming

Available in a git repository.
Repository: pyrisk
Author: W. Trevor King

Play Risk (or similar games) over email!

The README is posted on the PyPI page.

Posted Tue Apr 19 15:18:29 2011 Tags: programming

Available in a git repository.
Repository: pycomedi
Author: W. Trevor King

I was getting frustrated with Comedi's SWIG wrappers, so I wrote a more object-oriented wrapper using Cython.

The README is posted on the PyPI page.

Posted Tue Apr 19 15:18:29 2011 Tags: programming

Available in a git repository.
Repository: pypiezo
Author: W. Trevor King

This is a piezo-actuator control library based on pycomedi. It also contains some atomic-force-microscope-specific logic. The higher-level library pyafm extends the AFM-control framework with coarse positioning.

The README is posted on the PyPI page.

Posted Tue Apr 19 15:18:29 2011 Tags: programming

Available in a git repository.
Repository: pyafm
Author: W. Trevor King

Here is my Python module for AFM cantilever positioning, combining both the fine adjustment of pypiezo and the coarse adjustment of stepper.

The README is posted on the PyPI page.

Posted Tue Apr 19 15:18:29 2011 Tags: programming