My PyQt GUI book Create Simple GUI Applications has been updated, with new chapters on Qt Designer and multithreading. Get it here.

Packaging PyQt5 apps with fbs

fbs is a cross-platform PyQt5 packaging system which supports building desktop applications for Windows, Mac and Linux (Ubuntu, Fedora and Arch). Built on top of PyInstaller it wraps some of the rough edges and defines a standard project structure which allows the build process to be entirely automated. The included resource API is particularly useful, simplifying the handling of external data files, images or third-party libraries — a common pain point when bundling apps.

Dictionary Views & Set Operations

The keys, values and items from a dictionary can be accessed using the .keys(), .values() and .items() methods. These methods return view objects which provide a view on the source dictionary.

Dictionaries

Dictionaries are key-value stores, meaning they store, and allow retrieval of data (or values) through a unique key. This is analogous with a real dictionary where you look up definitions (data) using a given key — the word. Unlike a language dictionary however, keys in Python dictionaries are not alphabetically sorted.

System tray & Mac menu bar applications in PyQt

System tray applications (or menu bar applications) can be useful for making common functions or information available in a small number of clicks. For full desktop applications they're a useful shortcut to control apps without opening up the whole window.

1D 1H NMR data processing

1D 1H NMR is a common technique applied to metabolomic studies, being well suited to untargeted analysis of complex biofluids. It has been successfully applied to the classification and diagnosis of a number of diseases including [ref].

Getting Started with Pathomx

This is quick start-up guide for new users of Pathomx. Following it should give you everything that you need to know to start using Pathomx right away. Once you've been through the basics you might like to see some of the demos to see what Pathomx is capable of.

Gremlins in the Machine

Pathomx is a workflow-based data analysis tool built on IPython. It began as a metabolomic-analysis toolkit, but has extended to support general data analysis workflows. It aims to be simple to use for non-experts while powerful enough for complex analysis tasks. Key to both of these goals is the ability to create 'custom tools' that can be drag-dropped together to form larger workflows.

NMRLab 1D NMR processing (MATLAB)

This notebook uses a subset of the available processing features in NMRLab (+Metabolab) to process 1D NMR spectra. The output is saved as a CSV file that can be imported into pandas, PLS_Toolbox or any other package for subsequent analysis.

BioCyc Interface Demo

This notebook is a quick demo of a BioCyc Web API I've released for Python. While incomplete the API offers access to most basic attributes for metabolites, proteins, reactions, pathways and organisms in the database. The Python interface comes with an disk-based caching mechanism under ~/.biocyc that greatly reduces the delay (and load) for BioCyc servers.

mplstyler StylesManager demo

Now we've got the classes for the data plotted, we can now plot the mean values (of the spectra). To get a style assignment for a given class we need to call .get_style_for_class() on the styles manager. This returns a useable style object that can output the keyword arguments needed to correctly style matplotlib plots.

Dot Blot Analysis with ImageJ

Analyzing a dot blot in ImageJ by background subtraction and measuring the integrated density of each dot. This dot blot image is available in the File/Open Samples menu in ImageJ 1.33s or later.

QColorButton

Below is a short snippet to implement a color-picker attached to a button in Qt. Clicking on the button pops up a dialog (native) to select a color. The color is shown by the color of the button face. A right-click option is included to allow clearing of the color setting (returning the value to None).

Pathomx: Example Analysis

Short demo of an experimental analysis of metabolomic (NMR) data using Pathomx. Metabolomic test dataset produced from THP-1 cells grown under normal and hypoxic conditions. Spectra (2D 1H JRES) have been pre-processed and quantified using the BML-NMR service.

Cytoscape v3.0.2 on Mac OS X

Cytoscape 3.0.2 was released on 1st August, a bugfix release for the 3.x series. However, there is a compatibility issue with the latest Java update from Apple resulting in Cytoscape hanging on startup. I'd followed advice found elsewhere to update to the latest Java version with no success, until I found this post from Tim Hull, outlining a simple way to check what version you have installed.

cx_Freeze and PySide on Mac

I'd had success using py2app for building Mac binaries for distribution but wanted to give cx_Freeze a go since it's cross platform - allowing builds for Windows, Linux, and more. Unfortunately, attempting to build using cx_Freeze was resulting in errors:

Pelicans on Webfaction

As mentioned in the previous post, I recently migrated this site over to the very clever Pelican. Setting it up was relatively straightforward using a combination of the official docs, this post and linked github repo from Dominic Rodger. That said, there were a few things that I stumbled at and non-obvious decisions that I've documented below.

Speed up MATLAB on MacOS X

On MacOS X 10.5 there is considerable slow-down in the MATLAB editor and other GUI elements. The issue is related to a change in the default Mac Java 2D rendering engine from Quartz2D (10.4) and Sun2D (10.5). This newer rendering engine improves performance for figure drawing, but other GUI operations are slower.