#!/usr/bin/perl -w

use strict;

my ($IN, $OUT);

open ($OUT, ">merged.fq") or die "Can't open merged fastq file: $!\n";

system ("flux-simulator -p example.par  --threads 15 --force -x -l -s");

for (my $i = 1; $i <= 100; $i++) {
	system ("flux-simulator -p example.par  --threads 15 --force -l -s");
	open ($IN, "tmp/example.fastq") or die "Can't open input for rep $i: $!\n";
	while (my $line = readline($IN)) {
		chomp $line;
		next unless $line =~ /^@/;
		my $id = $line;
		my $seq = readline($IN);
		my $filler = readline($IN);
		my $qual = readline($IN);
		$id =~ s/\s/:/g;
#		print length($seq). "\n";
		print $OUT "$id\n$seq$filler$qual" if length($seq) == 77;
	}
}
