Personal tools
You are here: Home pyCoAn

pyCoan Introduction

Python framework for CoAn

pyCoAnThe pyCoAn project is dedicated to providing the useful correlative analysis software originally released in the CoAn command line tools, in a modern object orientated python framework.  Rather than providing a simple set of command line tools, pyCoAn provides a fully scriptable and interactive approach to structural analysis.  Structural data from different sources such as MRC and CCP4 maps, IMAGIC stacks (used by EMAN), various image formats, PDB files etc. can be accessed with ease, removing the busy work of file format conversions and manipulation.  Structural data is then 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 and filtering can be 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 python script which can be run repeatedly on larger datasets, with support for parallel computation if desired.

To illustrate this concept, here's a transcript and screenshot of a number of filtering operation on an MRC format map, which is provided in the testdata folder included in the pyCoAn download, and makes use of UCSF chimera and pymol for display.  Input is denoted in green, output in grey.


First we load the required pyCoAn modules from the package:

$ python
Python 2.5.5 (r255:77872, Apr  5 2010, 14:51:58)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from coan.deman import Map
>>> from coan.deman.stacks import LImg
>>> from coan.deman.filters import *
>>> from coan.viewers import Chimera


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

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

Imod 1



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

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

Chimera 1


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

>>> map.rotate(z=45.0, adjust=False)
>>> viewer.Send(map)

Chimera 2



>>> gauss = gaussFilt(map, kernel=7)
>>> viewer.Send(gauss)

Chimera 3


>>> output = imedFilt(gauss)
>>> viewer.Send(output)

Chimera 4 


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

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

Imod 2



From this demonstration you can see how easy it is to work with the pyCoAn framework.  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 set for pyCoAn 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.