Wednesday, February 16, 2011

Adding Biopython dependency to your Python project in Eclipse

This short post helps you to configure your Python project in Eclipse to use of biopython library.

First, you have to install separately NumPy (biopython required dependency) and biopython itself as explained in the biopython installation help.

Then, in Eclipse, open your Python project properties (Alt+ENTER when the project is selected).

Select the section PyDev - PYTHONPATH, then the tab External Libraries and make sure you have the source folder '...\site-packages' (or any other root folder you may have chosen to install Biopython). You should get the following screen:


Then you should be able to run a program such as the following:

parser = PDBParser()
structure = parser.get_structure("2BEG", "C:\\svn\\sporna\\2BEG.pdb")
for atom in structure.get_atoms():
print atom.get_name(), " coord:", atom.get_coord()


Tested on:
  • Eclipse Helios Service Release 1
  • Python 2.7
  • Numerical Python library (NumPy) v1.5.1
  • Biopython v1.56

No comments:

Post a Comment