Personal tools
You are here: Home pyCoAn

pyCoAn Introduction

Python framework for Computational Analysis of electron microscopy data

pyCoAnThe pyCoAn project is dedicated to providing image, data, and structural analysis tools for data from electron microscopy in a modern, object-oriented python framework.  pyCoAn provides a fully scriptable and interactive environment for data analysis.  Volume and image data from different sources such as MRC and CCP4 maps, IMAGIC stacks (used by EMAN), a plethora of common and not-so-common image formats, PDB files etc. can be accessed with ease, removing the busy and error-prone work of file format conversions and manipulation.  Once loaded, the data is presented as a series of objects which can be manipulated and modified without worrying about the underlying file structures, and operations such as transformations, statistical analysis, filtering, or highly complex types of multi-step analyses can be tested, tweaked, and applied quickly and easily.


Documentationdownload pyCoAn


Introductory Demonstration

The power of a number of external viewers and software packages such as UCSF Chimera, PyMol and IMOD can be called up to display objects as they are modified, allowing the researcher to instantly evaluate different approaches to analyzing his or her data.  Once an optimal set of operations has been determined, they can be combined into a pyCoAn script which can be run with the command pycoan repeatedly on larger datasets, with support for parallel computation if desired.

To illustrate this concept, here is a transcript and screenshots of a number of filtering operation on an IMAGIC image stack and an MRC format map, which are provided in the testdata folder included in the pyCoAn base distribution download. This demonstration makes use of UCSF Chimera and IMOD for display, which have to be installed separately.  Input is denoted in green, output in grey.


First, we start an interactive pyCoAn session by typing coan at the command prompt:

$ coan 
Activating auto-logging. Current session state plus future input saved.
Filename           : .coan
Mode                : append
Output logging : False
Raw input log   : False
Timestamping  : False
State                 : active
Welcome to pyCoAn, the Correlative Analysis Environment for EM Image Processing
The current time is Wed May 10 04:09:43 PDT 2016


The first couple of lines provide information about the command logging which is written to a file named .coan in the current directory. This file can later be edited and can serve as a starting point for developing pyCoAn scripts. Logging can be turned off by using coan -nl instead of coan.


Next, we show how to read an IMAGIC stack and display a subset of images from the stack with IMOD:

>>> stack = ImgStack('classes.img')
>>> print stack
CoAn LImg list object  (100 items)
>>> stack[0:5].imod()

Imod 1



Now we read our 3-D density map in MRC format and display it in UCSF Chimera:

>>> viewer = Chimera()
>>> mp = Map('standard.mrc')
>>> print mp
DeMan Map object (80, 80, 80)
>>> viewer.send(mp)

Chimera 1


We are now ready to apply a transform followed by a set of filters to the volume, displaying each change in Chimera:

>>> mp.rotate(z=45.0, adjust=False) 
>>> viewer.send(mp)

Chimera 2



>>> gauss = gaussFilt(mp, kernel=7)
>>> viewer.send(gauss)

Chimera 3


>>> output = median_filter(gauss,5)
>>> viewer.send(output)

Chimera 4 


Finally, this shows how to convert a 3-D volume into a stack of images, and display a subset of them with IMOD:

>>> final = ImgStack(output)
>>> print final
CoAn LImg list object  (80 items)
>>> final[35:45].imod()

Imod 2



This finishes our little demonstration.  If you want to try this out yourself, grab the latest release from here.  More detailed documentation on how to install pyCoAn, and the API documentation are both available in the Documentation section of the site.


Enjoy working with pyCoAn!!  Please contact us with any questions, suggestions, bug reports, or feedback - all are much appreciated.