# 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/page.py
# class Page:
# 	def __init__(self):
# 	def addSection(self, title, content, footer=None, description=None, container=True):
# 	def addSectionFront(self, title, content, footer=None, description=None, container=True):
# 	def addNav(self, nav_list, active_title=""):
# 	def enableNavSeparators(self,enable):
# 	def addScript(self, script):
# 	def addStyle(self, style):
# 	def setNavRight(self, nav):
# 	def setSidebarFooter(self, html):
# 	def enableFullscreenSections(self):
# 	def enableSidebar(self,enable):
# 	def setFooter(self,footer):
# 	def html(self):
# 
# 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):


import tornado.ioloop
import tornado.web
import tornado.wsgi
import tornado.options
import yaml
import sys
import os
import time
import subprocess
import shutil
import sys
import datetime
import logging
from lib import util
from lib import page
from lib import util

						param_title = parameter_id
					mapper_options += """<option value="p%s">%s - %s</option>""" % (parameter_id, mapper_title, param_title)

			mapper_options += """</optgroup>"""

		page.addSection("Evaluation", """
        	Finally, select the mappers and parameter sets that should be evaluated. Community-created parameter sets are available for download at: <a href="https://github.com/Cibiv/Teaser">https://github.com/Cibiv/Teaser</a>. <br><hr>
			<div class="form-horizontal">
               <div class="form-group">
                <label for="mappers" class="col-sm-2 control-label">Mappers and Parameter Settings</label>
                <div class="col-sm-4">
                    <select class="selectpicker" name="mappers" id="mappers" data-width="100%" multiple>
                       """ + mapper_options + """
                    </select>
                </div>
              </div>

              <div class="form-group">
                <label for="evaluator" class="col-sm-2 control-label">Alignment Evaluation Method</label>
                <div class="col-sm-4">
                  <select id="evaluator" class="form-control" name="evaluator">
                     <option value="1" selected>Basic</option>
                  </select>
                </div>
              </div>
            </div>
            """, """<div class="form-group">
                <a href="#section2" class="btn btn-info" role="button">Back</a> <button type="submit" class="btn btn-primary" id="submitButton" name="submitButton">Run Teaser</button> <a href="#section4" class="btn btn-info" role="button">Advanced Options</a>
              </div>""")


# 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/page.py
# class Page:
# 	def __init__(self):
# 	def addSection(self, title, content, footer=None, description=None, container=True):
# 	def addSectionFront(self, title, content, footer=None, description=None, container=True):
# 	def addNav(self, nav_list, active_title=""):
# 	def enableNavSeparators(self,enable):
# 	def addScript(self, script):
# 	def addStyle(self, style):
# 	def setNavRight(self, nav):
# 	def setSidebarFooter(self, html):
# 	def enableFullscreenSections(self):
# 	def enableSidebar(self,enable):
# 	def setFooter(self,footer):
# 	def html(self):
# 
# 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/server.py
import tornado.ioloop
import tornado.web
import tornado.wsgi
import tornado.options
import yaml
import sys
import os
import time
import subprocess
import shutil
import sys
import datetime
import logging
from lib import util
from lib import page
from lib import util

						param_title = parameter_id
					mapper_options += """<option value="p%s">%s - %s</option>""" % (parameter_id, mapper_title, param_title)

			mapper_options += """</optgroup>"""

		page.addSection("Evaluation", """
        	Finally, select the mappers and parameter sets that should be evaluated. Community-created parameter sets are available for download at: <a href="https://github.com/Cibiv/Teaser">https://github.com/Cibiv/Teaser</a>. <br><hr>
			<div class="form-horizontal">
               <div class="form-group">
                <label for="mappers" class="col-sm-2 control-label">Mappers and Parameter Settings</label>
                <div class="col-sm-4">
                    <select class="selectpicker" name="mappers" id="mappers" data-width="100%" multiple>
                       """ + mapper_options + """
                    </select>
                </div>
              </div>

              <div class="form-group">
                <label for="evaluator" class="col-sm-2 control-label">Alignment Evaluation Method</label>
                <div class="col-sm-4">
                  <select id="evaluator" class="form-control" name="evaluator">
                     <option value="1" selected>Basic</option>
                  </select>
                </div>
              </div>
            </div>
            """, """<div class="form-group">
                <a href="#section2" class="btn btn-info" role="button">Back</a> <button type="submit" class="btn btn-primary" id="submitButton" name="submitButton">Run Teaser</button> <a href="#section4" class="btn btn-info" role="button">Advanced Options</a>
              </div>""")


		page.addScript("""window.onload = function () {$('.selectpicker').selectpicker();}""")
