for my$i(0..($replication_rounds-1)) { for my $j (0..(@{$allgen{$i}})) { my $month=(int($i/30)+1); # the counter divided by 30 will give a decimal, the int rounds it down... therefore .2 -->0 (then the +1) yields a january if ($month<10){$month="0".$month;} ## too add a zero which mat lab reads easier so 09 instead of 9 for sept my $date="000".(int($month/12))."/".$month."/".($i-(($month-1)*30)); # year is set at 0000 for now.... change 000 to 200 or whatever to make it a specific year print "\>RandomHA ". $date ." "."\n" . $allgen{$i}[$j-1] . "\n"; # to print a file automatically in fasta format #open(FILE,">>Rand_HA_.txt"); #print FILE "\>RandomHA ". $date ." " ."\n" . $allgen{$i}[$j-1] . "\n"; #close(FILE); } } #### for my $i ( 0 .. ( $replication_rounds - 1 ) ) { for my $j ( 0 .. ( @{ $allgen{$i} } ) ) { # the counter divided by 30 will give a decimal, #~ the int rounds it down... #~ therefore .2 -->0 (then the +1) yields a january my $month = ( int( $i / 30 ) + 1 ); if ( $month < 10 ) { $month = "0" . $month; } ## too add a zero which mat lab reads easier so 09 instead of 9 for sept my $date = "000" . ( int( $month / 12 ) ) . "/" . $month . "/" . ( $i - ( ( $month - 1 ) * 30 ) ) ; # year is set at 0000 for now.... # change 000 to 200 or whatever to make it a specific year print "\>RandomHA " . $date . " " . "\n" . $allgen{$i}[ $j - 1 ] . "\n"; } ## end for my $j ( 0 .. ( @{ $allgen...})) } ## end for my $i ( 0 .. ( $replication_rounds...)) ################### #### for my $i ( 0 .. ( $replication_rounds - 1 ) ) { for my $j ( 0 .. ( @{ $allgen{$i} } ) ) { my $date = BlahIjMeSomeDate( 200, $i, $j ); print "\>RandomHA $date \n" . $allgen{$i}[ $j - 1 ] ."\n"; } } #### for my $i ( 0 .. ( $replication_rounds - 1 ) ) { for my $j ( 0 .. $#{ $allgen{$i} } ) { my $date = BlahIjMeSomeDate( 200, $i, $j ); print "\>RandomHA $date \n" . $allgen{$i}[ $j ] ."\n"; } } #### foreach my $nucleotide (@nucleotide_array) { chomp $nucleotide; my $score = ( int rand(100000) ) / 100000; ModifyNucleotideBasedOnScore( \$nucleotide, $score ); } sub ModifyNucleotideBasedOnScore { my( $nucleotide, $score ) = @_; ... $$nucleotide =~ s/A/T/g; #### my $maxNumberOfThreads = 5; my $threadCount = 0; for ( $i = 1 ; $i < $replication_rounds ; $i++ ) { my $thr = threads->create( {'context' => 'list'}, \&ReturnSomeFilteredNewGen, ); $threadCount++; next if $threadCount < $maxNumberOfThreads ; JoinJoinables(\%allgen); } JoinJoinables(\%allgen); sub JoinJoinables { my( $allgen ) = @_; while( my @joinable = threads->list(threads::joinable) ){ for my $thr( @joinable ){ my( $i, @filtered_new_gen ) = $thr->join(); $$allgen{$i} = \@filtered_new_gen; } } }