def testCactusSetup(self): """Creates a bunch of random inputs and then passes them to cactus setup. """ for test in xrange(self.testNo): tempDir = os.path.relpath(getTempDirectory(os.getcwd())) sequenceNumber = random.choice(xrange(100)) sequences, newickTreeString = getCactusInputs_random( tempDir=tempDir, sequenceNumber=sequenceNumber) #Setup the flower disk. experiment = getCactusWorkflowExperimentForTest( sequences, newickTreeString, os.path.join('/data', os.path.relpath(tempDir))) cactusDiskDatabaseString = experiment.getDiskDatabaseString() cactusSequencesPath = os.path.join(experiment.getDbDir(), "cactusSequences") runCactusSetup(cactusDiskDatabaseString=cactusDiskDatabaseString, cactusSequencesPath=cactusSequencesPath, sequences=sequences, newickTreeString=newickTreeString) runCactusSetup(cactusDiskDatabaseString=cactusDiskDatabaseString, cactusSequencesPath=cactusSequencesPath, sequences=sequences, newickTreeString=newickTreeString) experiment.cleanupDb() system("rm -rf %s" % tempDir) logger.info("Finished test %i of cactus_setup.py", test)
def testCactus_Random_UseSubtreeRoot(self): """Tests that cactus doesn't crash when aligning a subtree of a larger species tree.""" getBigSpeciesTree = lambda regionNumber=0,tempDir=None: getCactusInputs_random(regionNumber, tempDir, treeLeafNumber=5) runWorkflow_multipleExamples(getBigSpeciesTree, testNumber=1, batchSystem=self.batchSystem, buildToilStats=True, progressive=True, configFile=self.configFile, cactusWorkflowFunction=self.progressiveWithSubtreeRootFunction)
def testCactusSetup(self): """Creates a bunch of random inputs and then passes them to cactus setup. """ for test in xrange(self.testNo): tempDir = getTempDirectory(os.getcwd()) sequenceNumber = random.choice(xrange(100)) sequences, newickTreeString = getCactusInputs_random(tempDir=tempDir, sequenceNumber=sequenceNumber) #Setup the flower disk. experiment = getCactusWorkflowExperimentForTest(sequences, newickTreeString, tempDir) cactusDiskDatabaseString = experiment.getDiskDatabaseString() runCactusSetup(cactusDiskDatabaseString, sequences, newickTreeString) runCactusSetup(cactusDiskDatabaseString, sequences, newickTreeString) experiment.cleanupDb() system("rm -rf %s" % tempDir) logger.info("Finished test %i of cactus_setup.py", test)
def testCactus_Random_UseSubtreeRoot(self): # TODO: this doesn't actually need the test data, but this is # being used as a signal that the tester doesn't want to run # the long tests. The tests should be refactored soon. if "SON_TRACE_DATASETS" not in os.environ: return """Tests that cactus doesn't crash when aligning a subtree of a larger species tree.""" getBigSpeciesTree = lambda regionNumber=0, tempDir=None: getCactusInputs_random( regionNumber, tempDir, treeLeafNumber=5) runWorkflow_multipleExamples( getBigSpeciesTree, testNumber=1, testRestrictions=(TestStatus.TEST_SHORT, ), batchSystem=self.batchSystem, buildToilStats=True, progressive=True, configFile=self.configFile, cactusWorkflowFunction=self.progressiveWithSubtreeRootFunction)
def testCactus_Random_fixedAncestor(self): """Tests that cactus doesn't crash when aligning to a fixed ancestral sequence.""" sequences, _ = getCactusInputs_random(treeLeafNumber=3) rootSeq = sequences.pop() # Create a star tree tree = '(%s)root;' % ",".join([str(x) + ":1.0" for x in range(len(sequences))]) outputDir = getTempDirectory() experiment = getCactusWorkflowExperimentForTest(sequences, tree, outputDir, progressive=True) experiment.setSequenceID("root", rootSeq) experiment.setRootReconstructed(False) experimentFile = os.path.join(outputDir, "experiment.xml") experiment.writeXML(experimentFile) jobTreeDir = os.path.join(outputDir, "jobTree") self.progressiveFunction(experimentFile, jobTreeDir, 'singleMachine', False, True, True, False)