Skip to content
YC.S edited this page Oct 12, 2018 · 66 revisions

spipy : Python tools for Single Particle Imaging analysis and reconstruction


1. Architecture

  • analyse
    • q ------------- tools for pixel transmission between reciprocal space and real space
    • saxs ---------- tools for generating and analyzing averaged intensity profile (SAXS)
    • orientation --- tools for 3D orientation ssampling, analysis and visualization
    • SH_expan ------ (spherical) harmonics analysis
    • criterion ----- metrics for SPI reconstruction
    • rotate -------- 3D matrix rotation and alignment
  • image
    • radp ---------- radial profile tools and spherical/circle shells/solid generation
    • quat ---------- quaternion calculation
    • classify ------ single particle diffraction classification
    • preprocess ---- pretreatment tools for raw data
    • io ------------ read/write data from/to different formats
  • merge
    • emc ----------- orientation recovery and merging using EMC algorithm
    • utils --------- utility functions for merging, such as slices generation and merge, etc
  • phase
    • phase2d ------- 2d phasing algorithms : relaxed averaged alternating reflections, difference map and error reduction
    • phase3d ------- 3d phasing algorithms : relaxed averaged alternating reflections, difference map and error reduction
  • simulate
    • sim ----------- simulate photon patterns from pdb files, by direct Fourier transformation of density map
    • sim_adu ------- simulate add patterns from pdb files, by atom scattering simulation

Example :

from spipy.analyse import saxs
import spipy.image as spiimage

2. Install

The package need Anaconda python2.7 version installed in advance. Download here

2.1 Download

git clone https://github.com/LiuLab-CSRC/spipy.git

2.2 Make file

Skip this step if you don't want to use spipy.image.classify.fTSNE_Spec (function), spipy.merge.emc (module) and spipy.simulation.sim (module)

# After putting the downloaded package to somewhere you want, then cd into the package and run
./make_all.sh

[Notice]

As macos/OSX do not support openMP for its built-in clang, you are required to specify another gcc compiler with MPI and openMP installed (We recommend gcc-7 or higher). Besides, 'mpicc' in Anaconda can not be used to compile this program, you need to install independent openmpi (version >= 2.0.0) in your computer.

[How to install openmpi on Linux or gcc-7/openmpi on Mac ?]

# install gcc-7 for Mac, recommend to use HomeBrew
brew install gcc@7

# build openmpi from source for both Linux and Mac (You can also use HomeBrew in Mac)
wget https://www.open-mpi.org/software/ompi/v3.1/downloads/openmpi-3.1.0.tar.gz
tar -xf openmpi-3.1.0.tar.gz
cd openmpi-3.1.0
./configure --prefix=/Your-Install-Path
make
make install
# add installation path to your ~/.bashrc (or ~/.bash_profile)
vim ~/.bashrc
# export PATH="/Your-Install-path/bin:$PATH"
# export LD_LIBRARY_PATH="/Your-Install_path/lib/:$LD_LIBRARY_PATH"
source ~/.bashrc

# install gsl for both Linux and Mac
# Mac
brew install gsl
# ubnutu
apt-get install libgsl0-dev libgsl0-bin
# Centos
yum install gsl-devel

2.3 Make path

If you have run ./make_all.sh, skip this step

copy or make soft link of this spipy directory into ~/anaconda2/lib/python2.7/site-packages/

ln -fs spipy ~/anaconda2/lib/python2.7/site-packages

2.4 All dependencies for miniconda2 (clean Python 2.7)

numpy , scipy , scikit-learn , matplotlib , h5py , numexpr , psutil , mpi4py


3. Help and examples

You can refer to help function of spipy or its modules to get immediate help. For example :

"Anaconda Ipython 2.7"
>> import spipy
>> spipy.help()
>> spipy.phase.help()
>> spipy.phase.phase2d.help("function_name")

In the test_spipy directory, you can find examples about how to use functions in every modules. For example :

cd ./test_spipy/image
# read file
open test_classify.py
# run file
python test_classify.py   #some scripts need command line parameters
Clone this wiki locally