# Path: seqio.py
# def fastaIterator(fh):
# 
#     l = fh.readline()
#     if(not l or not l.startswith(">")):
#         raise Exception("No \">\" at start of Fasta File")
#     name = l.strip()[1:]
#     seq = ""
#     while True:
#         l = fh.readline()
#         if not l or l.startswith(">"):
#             yield FastaRecord(name,seq)
#             if not l:
#                 break
#             name = l.strip()[1:]
#             seq = ""
#         else:
#             seq += l.strip()


import sys
import misc
import random
from collections import namedtuple
from seqio import fastaIterator
from itertools import dropwhile,count,repeat
#!/usr/bin/env python

##Simulates reads from genome



def insertion(pos, seq):
    return seq[:pos] + random.choice(["A","C","G","T"]) + seq[pos:]

def deletion(pos,seq):
    return seq[:pos] + seq[pos+1:]

def mismatch(pos,seq):
    return seq[:pos] + random.choice(["A","C","G","T"]) + seq[pos+1:]
            
#read.lens is just a file with a list of read lengths
if not len(sys.argv) == 5:
    print "simulate_reads.py genome.fa read.lens error_rate out_prefix"
    sys.exit(1)


Chromosome = namedtuple("Chromosome", ["name","seq"])

gfh = open(sys.argv[1])

# Path: seqio.py
# def fastaIterator(fh):
# 
#     l = fh.readline()
#     if(not l or not l.startswith(">")):
#         raise Exception("No \">\" at start of Fasta File")
#     name = l.strip()[1:]
#     seq = ""
#     while True:
#         l = fh.readline()
#         if not l or l.startswith(">"):
#             yield FastaRecord(name,seq)
#             if not l:
#                 break
#             name = l.strip()[1:]
#             seq = ""
#         else:
#             seq += l.strip()


# Path: simulate_reads.py
import sys
import misc
import random
from collections import namedtuple
from seqio import fastaIterator
from itertools import dropwhile,count,repeat

#!/usr/bin/env python

##Simulates reads from genome



def insertion(pos, seq):
    return seq[:pos] + random.choice(["A","C","G","T"]) + seq[pos:]

def deletion(pos,seq):
    return seq[:pos] + seq[pos+1:]

def mismatch(pos,seq):
    return seq[:pos] + random.choice(["A","C","G","T"]) + seq[pos+1:]
            
#read.lens is just a file with a list of read lengths
if not len(sys.argv) == 5:
    print "simulate_reads.py genome.fa read.lens error_rate out_prefix"
    sys.exit(1)


Chromosome = namedtuple("Chromosome", ["name","seq"])

gfh = open(sys.argv[1])

lfh = open(sys.argv[2])