# Path: lib/gsample.py
# def log(msg):
# def index(reference, fastindex_path = "tools/fastindex"):
# def index_legacy(reference):
# def downsample(index, contig_filename, downsampled_filename, region_count, target_len, single_contig=False,
# 			   region_list=False, spacer_len=200):
# def csample(infile, region_size, sample_fraction, spacer_len=200, fastindex_path=""):
# def ctranslate(reference_file, sampled_index_file, sam_file, target_file, fastindex_path=""):
# 
# Path: tools/fastq2sam.py
# def encode_qname(qname, retain_petag=True):
# 	def __init__(self):
# 	def __init__(self, filename, pe):
# 	def readline(self):
# 	def next_read(self):
# 	def __init__(self):
# 	def align(read):
# 	def align(self, read, paired=False, is_read1=True):
# 	def align_pair(self, read1, read2):
# 	def align(self, read, paired=False, is_read1=True):
# 	def align_pair(self, read1, read2):
# 	def __init__(self, aligner, outfile):
# 	def write(self, what):
# 	def write_sam_header(self, reads):
# 	def write_single(self, read, to):
# 	def align_se(self, infile):
# 	def align_pe(self, infile_1, infile_2):
# class Object:
# class FASTQ:
# class Aligner:
# class DummyAligner(Aligner):
# class dwgsim(Aligner):
# class Converter:
# 
# Path: lib/sam.py
# class SAMRow:
# class SAMFile:
# class Object:
# class FASTQ:
# 	def __init__(self):
# 	def getTag(self,tag_name):
# 	def __init__(self, filename):
# 	def close(self):
# 	def hasLast(self):
# 	def getLast(self):
# 	def getCurr(self):
# 	def getHeader(self):
# 	def isSorted(self):
# 	def next(self):
# 	def __init__(self):
# 	def __init__(self, filename, write=False):
# 	def readline(self):
# 	def next_read(self):
# 	def write_read(self,read):
# 	def close(self):


import os
import shutil
import time
import yaml
import util
import simulator
	import main
from lib import gsample
from tools import fastq2sam
from lib import sam
		if not os.path.exists(test["dir"] + "/reads.fastq") and not (os.path.exists(test["dir"] + "/reads1.fastq") and os.path.exists(test["dir"] + "/reads2.fastq")):
			return False

		return True

	def createTest(self, test):
		start_time = time.time()
		self.mate.getReport().generateProgress()

		self.log("")
		self.log("Creating test %s" % test["name"])
		try:
			os.mkdir(test["dir"])
		except:
			self.log("Failed to create test directory, probably existing")

			self.rm(test["dir"] + "/" + test["name"] + ".yaml")
			self.rm(test["dir"] + "/mapping_comparison.sam")
			self.rm(test["dir"] + "/reads.fastq")
			self.rm(test["dir"] + "/reads1.fastq")
			self.rm(test["dir"] + "/reads2.fastq")

		self.ch(test)

		try:
			if test["type"] == "simulated_teaser":
				if test["sampling"]["enable"]:
					self.makeDatasetDS(test)
				else:
					self.makeDatasetNoDS(test)

# Path: lib/gsample.py
# def log(msg):
# def index(reference, fastindex_path = "tools/fastindex"):
# def index_legacy(reference):
# def downsample(index, contig_filename, downsampled_filename, region_count, target_len, single_contig=False,
# 			   region_list=False, spacer_len=200):
# def csample(infile, region_size, sample_fraction, spacer_len=200, fastindex_path=""):
# def ctranslate(reference_file, sampled_index_file, sam_file, target_file, fastindex_path=""):
# 
# Path: tools/fastq2sam.py
# def encode_qname(qname, retain_petag=True):
# 	def __init__(self):
# 	def __init__(self, filename, pe):
# 	def readline(self):
# 	def next_read(self):
# 	def __init__(self):
# 	def align(read):
# 	def align(self, read, paired=False, is_read1=True):
# 	def align_pair(self, read1, read2):
# 	def align(self, read, paired=False, is_read1=True):
# 	def align_pair(self, read1, read2):
# 	def __init__(self, aligner, outfile):
# 	def write(self, what):
# 	def write_sam_header(self, reads):
# 	def write_single(self, read, to):
# 	def align_se(self, infile):
# 	def align_pe(self, infile_1, infile_2):
# class Object:
# class FASTQ:
# class Aligner:
# class DummyAligner(Aligner):
# class dwgsim(Aligner):
# class Converter:
# 
# Path: lib/sam.py
# class SAMRow:
# class SAMFile:
# class Object:
# class FASTQ:
# 	def __init__(self):
# 	def getTag(self,tag_name):
# 	def __init__(self, filename):
# 	def close(self):
# 	def hasLast(self):
# 	def getLast(self):
# 	def getCurr(self):
# 	def getHeader(self):
# 	def isSorted(self):
# 	def next(self):
# 	def __init__(self):
# 	def __init__(self, filename, write=False):
# 	def readline(self):
# 	def next_read(self):
# 	def write_read(self,read):
# 	def close(self):


# Path: lib/teaser.py
import os
import shutil
import time
import yaml
import util
import simulator
	import main
from lib import gsample
from tools import fastq2sam
from lib import sam

		if not os.path.exists(test["dir"] + "/reads.fastq") and not (os.path.exists(test["dir"] + "/reads1.fastq") and os.path.exists(test["dir"] + "/reads2.fastq")):
			return False

		return True

	def createTest(self, test):
		start_time = time.time()
		self.mate.getReport().generateProgress()

		self.log("")
		self.log("Creating test %s" % test["name"])
		try:
			os.mkdir(test["dir"])
		except:
			self.log("Failed to create test directory, probably existing")

			self.rm(test["dir"] + "/" + test["name"] + ".yaml")
			self.rm(test["dir"] + "/mapping_comparison.sam")
			self.rm(test["dir"] + "/reads.fastq")
			self.rm(test["dir"] + "/reads1.fastq")
			self.rm(test["dir"] + "/reads2.fastq")

		self.ch(test)

		try:
			if test["type"] == "simulated_teaser":
				if test["sampling"]["enable"]:
					self.makeDatasetDS(test)
				else:
					self.makeDatasetNoDS(test)

			elif test["type"] == "simulated_custom" or test["type"] == "real":