1 ###########################################################################
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 #
7 # All Rights Reserved. #
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: #
17 # The above copyright notice and this permission notice shall be #
18 # included in all copies or substantial portions of the Software. #
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 #
28 ###########################################################################
30 # a simple use of the experiment class
31 from experiment import Experiment
32 from analyzeMotifs import AnalyzeMotifs
33 from conservation import Conservation
35 from cistematic.core.homology import homologyDB
37 class PhyloFoot(Experiment, AnalyzeMotifs, Conservation, Draw):
38 experimentType = "phyloFoot"
39 startingGenome = "scerevisiae"
43 useConservation = True
46 def initialize(self, sGenome="", rGenes=[], tGenomes=[], analysisDB="", conservationDB="", maskNonConserved=True):
49 self.createAnalysis(dbName=analysisDB)
50 if self.consDBName == "":
51 self.createConservation(dbName=conservationDB)
56 sGenome = self.startingGenome
58 self.startingGenome = sGenome
61 rGenes = self.refGenes
63 self.refGenes = rGenes
65 if len(tGenomes) == 0:
66 tGenomes = self.targetGenomes
68 self.targetGenomes = tGenomes
70 self.useConservation = maskNonConserved
73 wholeDataset.append((sGenome, [gene]))
74 hGenes = self.returnHomologs((sGenome, gene))
75 self.phyloMap[(sGenome, gene)] = hGenes
76 for oneGene in hGenes:
77 wholeDataset.append((oneGene[0], [oneGene[1]]))
79 self.mlog("could not load from homology for (%s,%s,%s)" % (sGenome, str(rGenes), str(tGenomes)))
81 Experiment.initialize(self, wholeDataset)
85 for gene in self.refGenes:
86 dset = self.phyloMap[(self.startingGenome, gene)]
87 dset.append((self.startingGenome, gene))
88 datasetID = self.setSettingsID("dataset-%s-%s" % (self.startingGenome, gene), dset)
89 if self.useConservation:
90 fastaFile = self.createDataFile(datasetID, geneDict= self.maskNonConservedSequence(datasetID))
92 fastaFile = self.createDataFile(datasetID)
94 for (prog, settingsID) in self.programs:
95 prog.inputFile(fastaFile)
96 runID = self.setRun(prog.name(), datasetID, settingsID)
101 theMotifs = prog.getMotifs()
102 for mot in theMotifs:
103 self.appendResults(mot)
105 self.mlog("problem with run %s" % tag)