erange 4.0a dev release with integrated cistematic
[erange.git] / cistematic / programs / parent.py
1 ###########################################################################
2 #                                                                         #
3 # C O P Y R I G H T   N O T I C E                                         #
4 #  Copyright (c) 2003-10 by:                                              #
5 #    * California Institute of Technology                                 #
6 #                                                                         #
7 #    All Rights Reserved.                                                 #
8 #                                                                         #
9 # Permission is hereby granted, free of charge, to any person             #
10 # obtaining a copy of this software and associated documentation files    #
11 # (the "Software"), to deal in the Software without restriction,          #
12 # including without limitation the rights to use, copy, modify, merge,    #
13 # publish, distribute, sublicense, and/or sell copies of the Software,    #
14 # and to permit persons to whom the Software is furnished to do so,       #
15 # subject to the following conditions:                                    #
16 #                                                                         #
17 # The above copyright notice and this permission notice shall be          #
18 # included in all copies or substantial portions of the Software.         #
19 #                                                                         #
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,         #
21 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF      #
22 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND                   #
23 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS     #
24 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN      #
25 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN       #
26 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE        #
27 # SOFTWARE.                                                               #
28 ###########################################################################
29 #
30 # parent.py - defines Parent class used by all children classes in cistematic.programs
31 #
32 class Parent:
33     contents = ""
34     tagID = ""
35
36
37     def __init__(self, tagID="", inputFilePath="", outputFilePath=""):
38         self.tagID = ""
39         self.inputFilePath = inputFilePath
40         self.outputFilePath = outputFilePath
41
42
43     def setTagID(self, tid):
44         self.tagID = tid
45
46
47     def name(self):
48         return self.__class__.__name__
49
50
51     def inputFile(self, inputFilePath):
52         self.inputFilePath = inputFilePath
53
54
55     def outputFile(self, outputFilePath):
56         self.outputFilePath = outputFilePath
57
58
59     def setSeqLength(self, length):
60         pass
61
62
63     def run(self):
64         pass
65
66
67     def display(self):
68         for line in self.contents:
69             print line
70
71
72     def load(self, inFilePath):
73         inFile = open(inFilePath, "r")
74         self.contents = inFile.readlines()
75         inFile.close()
76
77
78     def save(self):
79         outFile = open(self.outputFilePath, "w")
80         for line in self.contents:
81             outFile.write(line)
82
83         outFile.close()