# Path: lib/test.py
# class Test:
# 	def __init__(self, id, name, directory, mate, mapper):
# 	def _(self, field, default=None):
# 	def setc(self, field, new_value):
# 	def getReportDirectory(self):
# 	def log(self, text, level=2, newline="\n"):
# 	def dbg(self, text, prefix="INFO"):
# 	def warn(self, text, affected_file=None, affected_pos=None):
# 	def error(self, text, affected_file=None, affected_pos=None):
# 	def fatal_error(self, text, affected_file=None, affected_pos=None):
# 	def getWarnings(self):
# 	def getErrors(self):
# 	def getSuccess(self):
# 	def getErrorCount(self):
# 	def getWarningCount(self):
# 	def getComment(self):
# 	def getVersionHash(self):
# 	def serialize(self):
# 	def unserialize(self, ser):
# 	def getLocals(self):
# 	def buildAbsoluteScriptPath(self, filename):
# 	def getTestDirectoryByPath(self, test_name_full):
# 	def getTestNameByPath(self, test_name_full):
# 	def load(self):
# 	def getParentTest(self):
# 	def evaluate(self):
# 	def getMapper(self):
# 	def getName(self):
# 	def getFullName(self):
# 	def getId(self):
# 	def getTitle(self):
# 	def getPath(self):
# 	def getConfig(self):
# 	def getRunTime(self):
# 	def getCreateTime(self):
# 	def getShouldRun(self):
# 	def getWasRun(self):
# 	def getWasFinished(self):
# 	def getSuccess(self):
# 	def getIsBasic(self):
# 	def getResultOverviewText(self, indent=""):
# 	def consoleReport(self):
# 	def executePipeline(self, event, args=()):
# 	def run(self):
# 	def sub(self,command,description="",detailed=False):
# 	def enterWorkingDirectory(self):
# 	def restoreWorkingDirectory(self):
# 	def cleanup(self):
# 	def setRunResults(self, results):
# 	def getRunResults(self):
# 	def setHumanizedRunResults(self, results):
# 	def getHumanizedRunResults(self):
# 	def getSubResults(self):
# 	def getComparisonTest(self):
# 	def setComparisonTest(self, comp):
# 	def getCSVPath(self,title):
# 	def writeCSV(self,title,csv):
# 
# Path: lib/util.py
# STATUS_NORMAL=1
# STATUS_MAX_MEMORY_EXCEEDED=2
# STATUS_MAX_RUNTIME_EXCEEDED=3
# MAX_LEN_OUT = 10000
# def runAndMeasure(command,detailed=True,maxtime=0,maxmem=0):
# def runSimple(command):
# def runAndMeasureInternal(return_queue,command,maxtime=0,maxmem=0):
# def runInternal(control_queue,command,max_memory):
# def measureProcess(queue, initial_pids, command, measurement_interval=1, max_runtime=0, max_memory=0, debug=False):
# 	def extendTargets(targets, proc):
# 	def killTargets(targets):
# 	def updateTargets(targets, metrics):
# 	def updateMetrics(target, metrics):
# def loadConfig(name, parent_dir="", already_included=[]):
# def setCallDir(d):
# def setRootDir(d):
# def enterCallDir():
# def enterRootDir():
# def getRootDir():
# def nl2br(text):
# def msg(text="", level=1):
# def yes_no(b):
# def md5(text):
# def merge(x, y):
# def formatFilesize(n):
# def percent(val, base, offset=0):
# def abs_path(path):
# def get_sam_header_line_count(filename):
# def is_sam_sorted(filename):
# def sort_sam(filename,threads=1):
# def sort_sam_picard(filename,threads=-1):
# def line_count(filename):
# def sanitize_string(s):
# def makeExportDropdown(plot_id,csv_filename):
# def parseMD(md,seq):
# 
# Path: lib/report.py
# class ReportHTMLGenerator:
# 	def __init__(self, mate, plotgen):
# 	def nltobr(self, text):
# 	def write(self, text):
# 	def openPanel(self, title="Panel", style="default"):
# 	def closePanel(self):
# 	def collapsible(self, heading, text, opened=False):
# 	def openCollapsiblePanel(self, heading, opened=False):
# 	def closeCollapsiblePanel(self):
# 	def getMapperBinaryPath(self, mapper):
# 	def makeTestNavList(self):
# 	def makeTestMapperNavList(self, test_objects):
# 	def generateMainErrorList(self):
# 	def generateErrorList(self, test):
# 	def generateMainErrorList(self):
# 	def generateTestList(self):
# 	def generateSetup(self):
# 	def generateLogs(self):
# 	def generateSubprocessOutputs(self, test):
# 	def generateOverviewPlot(self, page, measure):
# 	def generate(self):
# 	def generateProgress(self):


				from lib import teaser
from datetime import datetime
from lib import test
from lib import util
from lib import report
import os
import time
import copy
import sys
import pickle
import yaml
import argparse
import hashlib
import traceback
import fnmatch
			mapper_class = "MapperNGM"
		else:
			mapper_class = mapper_conf["type"]

		the_class = getattr(mapper_module, mapper_class)

		inst = the_class(mapper_id,mapper_conf)
		try:
			bin_hash = inst.getBinaryHash()
		except:
			self.error("Failed to access mapper binary %s for mapper %s" % (str(inst.getBinaryPath()),mapper_id))
			return []

		tests = {}

		for test_directory in self.config["test_directories"]:
			for test_short_name in os.listdir(test_directory):
				test_id = test_directory.replace("/", "_") + "_" + mapper_id + "_" + test_short_name
				test_name = test_short_name

				try:
					if not os.path.isdir(test_directory + "/" + test_short_name):
						continue

					self.pushLogPrefixRaw("[Load " + test_short_name + "] ")

					mapper_inst = the_class(mapper_id, mapper_conf)
					mapper_inst.setThreadCount(self._("threads"))

					# Try to load test object from cache

# Path: lib/test.py
# class Test:
# 	def __init__(self, id, name, directory, mate, mapper):
# 	def _(self, field, default=None):
# 	def setc(self, field, new_value):
# 	def getReportDirectory(self):
# 	def log(self, text, level=2, newline="\n"):
# 	def dbg(self, text, prefix="INFO"):
# 	def warn(self, text, affected_file=None, affected_pos=None):
# 	def error(self, text, affected_file=None, affected_pos=None):
# 	def fatal_error(self, text, affected_file=None, affected_pos=None):
# 	def getWarnings(self):
# 	def getErrors(self):
# 	def getSuccess(self):
# 	def getErrorCount(self):
# 	def getWarningCount(self):
# 	def getComment(self):
# 	def getVersionHash(self):
# 	def serialize(self):
# 	def unserialize(self, ser):
# 	def getLocals(self):
# 	def buildAbsoluteScriptPath(self, filename):
# 	def getTestDirectoryByPath(self, test_name_full):
# 	def getTestNameByPath(self, test_name_full):
# 	def load(self):
# 	def getParentTest(self):
# 	def evaluate(self):
# 	def getMapper(self):
# 	def getName(self):
# 	def getFullName(self):
# 	def getId(self):
# 	def getTitle(self):
# 	def getPath(self):
# 	def getConfig(self):
# 	def getRunTime(self):
# 	def getCreateTime(self):
# 	def getShouldRun(self):
# 	def getWasRun(self):
# 	def getWasFinished(self):
# 	def getSuccess(self):
# 	def getIsBasic(self):
# 	def getResultOverviewText(self, indent=""):
# 	def consoleReport(self):
# 	def executePipeline(self, event, args=()):
# 	def run(self):
# 	def sub(self,command,description="",detailed=False):
# 	def enterWorkingDirectory(self):
# 	def restoreWorkingDirectory(self):
# 	def cleanup(self):
# 	def setRunResults(self, results):
# 	def getRunResults(self):
# 	def setHumanizedRunResults(self, results):
# 	def getHumanizedRunResults(self):
# 	def getSubResults(self):
# 	def getComparisonTest(self):
# 	def setComparisonTest(self, comp):
# 	def getCSVPath(self,title):
# 	def writeCSV(self,title,csv):
# 
# Path: lib/util.py
# STATUS_NORMAL=1
# STATUS_MAX_MEMORY_EXCEEDED=2
# STATUS_MAX_RUNTIME_EXCEEDED=3
# MAX_LEN_OUT = 10000
# def runAndMeasure(command,detailed=True,maxtime=0,maxmem=0):
# def runSimple(command):
# def runAndMeasureInternal(return_queue,command,maxtime=0,maxmem=0):
# def runInternal(control_queue,command,max_memory):
# def measureProcess(queue, initial_pids, command, measurement_interval=1, max_runtime=0, max_memory=0, debug=False):
# 	def extendTargets(targets, proc):
# 	def killTargets(targets):
# 	def updateTargets(targets, metrics):
# 	def updateMetrics(target, metrics):
# def loadConfig(name, parent_dir="", already_included=[]):
# def setCallDir(d):
# def setRootDir(d):
# def enterCallDir():
# def enterRootDir():
# def getRootDir():
# def nl2br(text):
# def msg(text="", level=1):
# def yes_no(b):
# def md5(text):
# def merge(x, y):
# def formatFilesize(n):
# def percent(val, base, offset=0):
# def abs_path(path):
# def get_sam_header_line_count(filename):
# def is_sam_sorted(filename):
# def sort_sam(filename,threads=1):
# def sort_sam_picard(filename,threads=-1):
# def line_count(filename):
# def sanitize_string(s):
# def makeExportDropdown(plot_id,csv_filename):
# def parseMD(md,seq):
# 
# Path: lib/report.py
# class ReportHTMLGenerator:
# 	def __init__(self, mate, plotgen):
# 	def nltobr(self, text):
# 	def write(self, text):
# 	def openPanel(self, title="Panel", style="default"):
# 	def closePanel(self):
# 	def collapsible(self, heading, text, opened=False):
# 	def openCollapsiblePanel(self, heading, opened=False):
# 	def closeCollapsiblePanel(self):
# 	def getMapperBinaryPath(self, mapper):
# 	def makeTestNavList(self):
# 	def makeTestMapperNavList(self, test_objects):
# 	def generateMainErrorList(self):
# 	def generateErrorList(self, test):
# 	def generateMainErrorList(self):
# 	def generateTestList(self):
# 	def generateSetup(self):
# 	def generateLogs(self):
# 	def generateSubprocessOutputs(self, test):
# 	def generateOverviewPlot(self, page, measure):
# 	def generate(self):
# 	def generateProgress(self):


# Path: teaser.py
				from lib import teaser
from datetime import datetime
from lib import test
from lib import util
from lib import report
import os
import time
import copy
import sys
import pickle
import yaml
import argparse
import hashlib
import traceback
import fnmatch

			mapper_class = "MapperNGM"
		else:
			mapper_class = mapper_conf["type"]

		the_class = getattr(mapper_module, mapper_class)

		inst = the_class(mapper_id,mapper_conf)
		try:
			bin_hash = inst.getBinaryHash()
		except:
			self.error("Failed to access mapper binary %s for mapper %s" % (str(inst.getBinaryPath()),mapper_id))
			return []

		tests = {}

		for test_directory in self.config["test_directories"]:
			for test_short_name in os.listdir(test_directory):
				test_id = test_directory.replace("/", "_") + "_" + mapper_id + "_" + test_short_name
				test_name = test_short_name

				try:
					if not os.path.isdir(test_directory + "/" + test_short_name):
						continue

					self.pushLogPrefixRaw("[Load " + test_short_name + "] ")

					mapper_inst = the_class(mapper_id, mapper_conf)
					mapper_inst.setThreadCount(self._("threads"))

					# Try to load test object from cache

					the_test = test.Test(test_id, test_short_name, test_directory, self, mapper_inst)