Esempio n. 1
0
#!/usr/bin/python

# The purpose of this script is to run an automated param search
from Operations.BioNano.Parameterize.ParameterSearch import ParameterSearch
from Utils.Workspace import Workspace
from Utils.CD import CD
from Operations.SBATCHCodeFormatter import CodeFormatter

work_dir="/path/to/work/dir/" ### SET ME
input_file="input_file.bnx" ### SET ME
workspace=Workspace(work_dir, input_file)
workspace.errorNotificationEmail='*****@*****.**' ### SET ME
workspace.addBinary("bng_assembler", "/path/to/Assembler") ### SET ME
workspace.addBinary("bng_ref_aligner", "/path/to/RefAligner") ### SET ME

genome_size_mb=900 ### SET ME
parameter_search=ParameterSearch(workspace, genome_size_mb)

#average_label_density=7.0 ### SET ME MAYBE
#expected_label_density=13.5 ### SET ME MAYBE
#parameter_search.optimizeFalsehoods(average_label_density, expected_label_density) ### UNCOMMENT ME MAYBE
#parameter_search.autoGeneratePrereqs() ### UNCOMMENT ME MAYBE

with CD(work_dir):
	formatter=CodeFormatter()
	formatter.runSeveralSteps(parameter_search.writeCode())
Esempio n. 2
0
	def test_parameterSearch(self):
		search=ParameterSearch(self.workspace, 900)
		
		expected_lines={
			"total": 2559,
			"blank": 428,
			"level6": 405,
			"sbatch_$level5": 405,
			"level5": 9,
			"sbatch_$level4": 9,
			"level4": 9,
			"sbatch_$level3": 9,
			"level3": 1,
			"sbatch_$level2": 1,
			"level2": 1,
			"sbatch_$level1": 1,
			"level1": 1,
			"sbatch__level1": 1
		}
		BLANK=re.compile("^$")
		LEVEL6=re.compile("level6_.*=\"-d afterok\"")
		LEVEL5=re.compile("level5_.*=\"-d afterok\"")
		LEVEL4=re.compile("level4_.*=\"-d afterok\"")
		LEVEL3=re.compile("level3_.*=\"-d afterok\"")
		LEVEL2=re.compile("level2_.*=\"-d afterok\"")
		LEVEL1=re.compile("level1_.*=\"-d afterok\"")
		SBATCH_LEVEL5=re.compile("sbatch \$level5")
		SBATCH_LEVEL4=re.compile("sbatch \$level4")
		SBATCH_LEVEL3=re.compile("sbatch \$level3")
		SBATCH_LEVEL2=re.compile("sbatch \$level2")
		SBATCH_LEVEL1=re.compile("sbatch \$level1")
		SBATCH_NADA=re.compile("sbatch  level1_")

		self.formatter.runSeveralSteps(search.writeCode())

		actual_lines={
			"total": 0,
			"blank": 0,
			"level6": 0,
			"sbatch_$level5": 0,
			"level5": 0,
			"sbatch_$level4": 0,
			"level4": 0,
			"sbatch_$level3": 0,
			"level3": 0,
			"sbatch_$level2": 0,
			"level2": 0,
			"sbatch_$level1": 0,
			"level1": 0,
			"sbatch__level1": 0
		}
		output=self.buffer_stdout.getvalue()
		for line in output.split("\n"):
			actual_lines["total"]+=1
			if BLANK.search(line) is not None:
				actual_lines["blank"]+=1
			if LEVEL6.search(line) is not None:
				actual_lines["level6"]+=1
			if LEVEL5.search(line) is not None:
				actual_lines["level5"]+=1
			if LEVEL4.search(line) is not None:
				actual_lines["level4"]+=1
			if LEVEL3.search(line) is not None:
				actual_lines["level3"]+=1
			if LEVEL2.search(line) is not None:
				actual_lines["level2"]+=1
			if LEVEL1.search(line) is not None:
				actual_lines["level1"]+=1
			if SBATCH_LEVEL5.search(line) is not None:
				actual_lines["sbatch_$level5"]+=1
			if SBATCH_LEVEL4.search(line) is not None:
				actual_lines["sbatch_$level4"]+=1
			if SBATCH_LEVEL3.search(line) is not None:
				actual_lines["sbatch_$level3"]+=1
			if SBATCH_LEVEL2.search(line) is not None:
				actual_lines["sbatch_$level2"]+=1
			if SBATCH_LEVEL1.search(line) is not None:
				actual_lines["sbatch_$level1"]+=1
			if SBATCH_NADA.search(line) is not None:
				actual_lines["sbatch__level1"]+=1

		self.maxDiff=None
		self.assertEqual(expected_lines, actual_lines)