File: msms.py

package info (click to toggle)
python-cogent 1.4.1-1.2
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze
  • size: 13,260 kB
  • ctags: 20,087
  • sloc: python: 116,163; ansic: 732; makefile: 74; sh: 9
file content (35 lines) | stat: -rw-r--r-- 894 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
"""Parsers for the MSMS commandline applications.
"""
import numpy as np

__author__ = "Marcin Cieslik"
__copyright__ = "Copyright 2009, The Cogent Project"
__credits__ = ["Marcin Cieslik"]
__license__ = "GPL"
__version__ = "1.4.1"
__maintainer__ = "Marcin Cieslik"
__email__ = "mpc4p@virginia.edu"
__status__ = "Production"


def parse_VertFile(VertFile):
    """Read the vertex file (with vert extension) into a numpy array.
    
    Arguments:
    
        * VertFile - open vertex file as returned by the ``Msms`` application
          controller.
    
    Returns a numpy array of vertices.
    """
    vertex_list = []
    for line in VertFile.readlines():
        elements = line.split()
        try:
            vertex = map(float, elements[0:3])
        except ValueError:
            continue
        vertex_list.append(vertex)
    return np.array(vertex_list)