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.
Create Simple GUI Applications has been updated! New chapters on multithreading and packaging your apps.
The keys, values and items from a dictionary can be accessed using the
.items() methods. These methods return view objects which provide a view on the source dictionary.
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.
The first step in creating desktop applications with PyQt is getting a window to show up on your desktop. Thankfully, with PyQt that is pretty simple.
With the release of Qt 5.5 the Qt WebKit API was deprecated and replaced with the new
QtWebEngine API, based on Chromium.
The WebKit API was subsequently removed from Qt entirely with the release of Qt 5.6 in mid-2016.
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.
A common problem when building GUI applications is "locking up" of the interface when attempting to perform long-running background tasks. In this tutorial I'll cover one of the simplest ways to achieve concurrent execution in PyQt.
Partial least squares discriminant analysis (PLS-DA) is an adaptation of PLS regression methods to the problem of supervised1 clustering. It has seen extensive use in the analysis of multivariate datasets, such as that derived from NMR-based metabolomics.
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].
Wooey is a simple web interface to run command line Python scripts. Think of it as an easy way to get your scripts up on the web for routine data analysis, file processing, or anything else.
A new live demo of Wooey is now up and running with a few simple example scripts. Features:
PyQtConfig: a simple API for handling, persisting and synchronising configuration within PyQt applications. This module was built initially as part of the Pathomx data analysis platform but spun out into a standalone module when it became clear it was quite useful.
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.
This notebook demonstrates automatic phase correction algorithms implemented for nmrglue. Two standard algorithms are implemented:
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.
This notebook contains snippets of code that are useful when working with MATLAB in IPython Notebooks.
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.
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.
QtIPy: The data automator! a simple GUI-based run-automator for IPython notebooks. It allows you to attach triggers to files, folders or timers to automatically run notebooks.
This short demo shows analysis of a publically available GEO dataset using Pathomx, with a workflow build using the new visual editor (available in the next release).
The NCBI Gene Expression Omnibus (GEO) is 'is a public functional genomics data repository supporting MIAME-compliant data submissions.' In other words, its a online database of freely available experimental gene-expression data. Quite useful.
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.
Pathomx is a unique workflow-based analysis tool that provides complete analytical control while maximising usability.
A Python implementation of the Icoshift algorithm, a versatile tool for the rapid alignment of 1D NMR spectra
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:
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.
A short one liner to quickly serve any folder via a http server.