--- /dev/null
+###########################################################################
+# #
+# C O P Y R I G H T N O T I C E #
+# Copyright (c) 2003-10 by: #
+# * California Institute of Technology #
+# #
+# All Rights Reserved. #
+# #
+# Permission is hereby granted, free of charge, to any person #
+# obtaining a copy of this software and associated documentation files #
+# (the "Software"), to deal in the Software without restriction, #
+# including without limitation the rights to use, copy, modify, merge, #
+# publish, distribute, sublicense, and/or sell copies of the Software, #
+# and to permit persons to whom the Software is furnished to do so, #
+# subject to the following conditions: #
+# #
+# The above copyright notice and this permission notice shall be #
+# included in all copies or substantial portions of the Software. #
+# #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, #
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF #
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND #
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS #
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN #
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN #
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
+# SOFTWARE. #
+###########################################################################
+#
+# a simple use of the experiment class
+from experiment import Experiment
+from analyzeMotifs import AnalyzeMotifs
+from conservation import Conservation
+from draw import Draw
+from cistematic.core.homology import homologyDB
+
+class PhyloTest(Experiment, AnalyzeMotifs, Conservation, Draw):
+ experimentType = "phyloTest"
+ phyloTestMap = {}
+ useConservation = True
+
+
+ def initialize(self, sGenome="", rGenes=[], tGenomes=[], analysisDB="", conservationDB="", maskNonConserved=True):
+ wholeDataset = []
+ try:
+ self.createAnalysis(dbName=analysisDB)
+ self.createConservation(dbName=conservationDB)
+ except:
+ pass
+
+ if sGenome == "":
+ sGenome = self.startingGenome
+ else:
+ self.startingGenome = sGenome
+
+ if len(rGenes) == 0:
+ rGenes = self.refGenes
+ else:
+ self.refGenes = rGenes
+
+ if len(tGenomes) == 0:
+ tGenomes = self.targetGenomes
+ else:
+ self.targetGenomes = tGenomes
+
+ self.useConservation = maskNonConserved
+ self.phyloTestMap[sGenome] = []
+ for gene in rGenes:
+ self.phyloTestMap[sGenome].append((sGenome, gene))
+
+ for genome in self.targetGenomes:
+ self.phyloTestMap[genome] = []
+
+ self.targetGenomes.append(sGenome)
+ try:
+ for gene in rGenes:
+ wholeDataset.append((sGenome, [gene]))
+ hGenes = self.returnHomologs((sGenome, gene))
+ for oneGene in hGenes:
+ wholeDataset.append((oneGene[0], [oneGene[1]]))
+ self.phyloTestMap[oneGene[0]].append(oneGene)
+ except:
+ self.mlog("could not load from homology for (%s,%s,%s)" % (sGenome, str(rGenes), str(tGenomes)))
+
+ Experiment.initialize(self, wholeDataset)
+
+
+ def run(self):
+ for genome in self.targetGenomes:
+ dset = self.phyloTestMap[genome]
+ datasetID = self.setSettingsID("dataset-%s" % genome, dset)
+ if self.useConservation:
+ fastaFile = self.createDataFile(datasetID, geneDict = self.maskNonConservedSequence(datasetID))
+ else:
+ fastaFile = self.createDataFile(datasetID)
+
+ for (prog, settingsID) in self.programs:
+ prog.inputFile(fastaFile)
+ runID = self.setRun(prog.name(), datasetID, settingsID)
+ tag = str(runID)
+ prog.setTagID(tag)
+ prog.run()
+ theMotifs = prog.getMotifs()
+ for mot in theMotifs:
+ self.appendResults(mot)
\ No newline at end of file