Using ARIA Python API
Some tips for using ARIA python sources as an API
add aria sources to python:
- on the fly
import os, sys
aria_path = os.path.join(os.environ['ARIA2'], 'src/py')
sys.path.insert(0, aria_path)
- PYTHONPATH
# bash
export PYTHONPATH=$PYTHONPATH:$ARIA2/src/py
# csh
setenv PYTHONPATH ${PYTHONPATH}:${ARIA2}/src/py
# zsh
export PYTHONPATH=$PYTHONPATH:$ARIA2/src/py
aria data manipulation
read an aria project
from aria import *
import AriaXML
pickler = AriaXML.AriaXMLPickler()
project = pickler.load(project_file)
read sequence in aria XML format
molecule = pickler.load(molecule_file)
- navigating in the molecule
for chain in molecule.get_chains():
for residue in c.getResidues():
for atom in r.getAtoms():
print a
reading shifts assignments
shift_list = pickler.load(shifts_file)
assignments = shift_list.getShiftAssignments()
reading spectra
spectrum = pickler.load(spectrum_file)
crosspeaks = spectrum.getPeaks()
reading noe_restraints.pickle
from tools import Load
aria_peaks = Load(pickle_file)
- navigating in the peaks
for p in aria_peaks:
for c in p.getContributions():
for sp in c.getSpinPairs():
a, b = sp.getAtoms()
print a, b, p.getDistance()
reading an cns structure ensemble created by aria
import StructureEnsemble as SE
from glob import glob
list_of_pdb = glob(os.path.join(iteration_path, '*.pdb'))
se_settings = SE.StructureEnsembleSettings()
ensemble = SE.StructureEnsemble(se_settings)
ensemble.read(list_of_pdb, molecule, format='cns')