from Bio import SeqIO
from mutation_orchestrator import Mutation_Orchestrator
import copy

input_fasta_file = '../data/subsampled_hg38.fa'
iterations = 100
output_fasta_file = 'tests/output.fasta'

def main():
    # read genome fasta
    original_genome = {}
    mutated_genome = {}
    for seq_record in SeqIO.parse(input_fasta_file, "fasta"):
        original_genome[seq_record.id] = seq_record
        mutated_genome[seq_record.id] = seq_record.seq.tomutable()

    orchestrator = Mutation_Orchestrator()

    # add SNVs
    for i in range(iterations):
        mutated_genome = orchestrator.snv(mutated_genome)

    # write fasta
    output_seqs = []
    for chrom in mutated_genome:
        output_seq = SeqIO.SeqRecord(seq=mutated_genome[chrom].toseq(),
              id=chrom, description='', name='')
        output_seqs.append(output_seq)

    with open(output_fasta_file, "w") as output_handle:
        SeqIO.write(output_seqs, output_handle, "fasta")

if __name__ == "__main__":
    main()

@@ -191,16 +191,458 @@
 fasta'%0A%0A
+def write_bam(mutated_genome):%0A    raise NotImplementedError%0A%0Adef write_fasta(mutated_genome):%0A    # write fasta%0A    output_seqs = %5B%5D%0A    for chrom in mutated_genome:%0A        output_seq = SeqIO.SeqRecord(seq=mutated_genome%5Bchrom%5D.toseq(),%0A              id=chrom, description='', name='')%0A        output_seqs.append(output_seq)%0A%0A    with open(output_fasta_file, %22w%22) as output_handle:%0A        SeqIO.write(output_seqs, output_handle, %22fasta%22)%0A%0A
 def main
@@ -645,16 +645,16 @@
 main():%0A
-
     # re
@@ -1057,349 +1057,65 @@
 %0A   
- #
  write
- 
+_
 fasta
-%0A    output_seqs = %5B%5D%0A    for chrom in mutated_genome:%0A        output_seq = SeqIO.SeqRecord(seq=mutated_genome%5Bchrom%5D.toseq(),%0A              id=chrom, description='', name='')%0A        output_seqs.append(output_seq)%0A%0A    with open(output_fasta_file, %22w%22) as output_handle:%0A        SeqIO.write(output_seqs, output_handle, %22fasta%22
+(mutated_genome)%0A    write_bam(mutated_genome
 )%0A%0Ai

write bam unimplemented error