1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 from MolKit.molecule import Atom
16 import warnings
17
19 - def __init__(self, filename=None, allLines=None):
20 """Supply the filename for reading by readFile, or
21 supply the lines directly via allLines
22 """
23 self.filename = filename
24 self.allLines = allLines
25
26
28 try:
29 f = open(self.filename)
30 self.allLines = f.readlines()
31 if len(self.allLines)==1:
32
33 self.allLines = self.allLines[0].split('\r')
34 warnings.warn('Only 1 line read from PDB file, splitting on \r')
35 f.close()
36 import string
37 self.allLines = filter( lambda x,s=string.strip: len(s(x)),
38 self.allLines )
39 except:
40 self.allLines = None
41