| 1 |
#! perl |
| 2 |
|
| 3 |
use strictscip-perl cpan Grinder 0.005004 strict/; |
| 4 |
use warningsscip-perl cpan Grinder 0.005004 warnings/; |
| 5 |
use Test::Morescip-perl cpan Grinder 0.005004 Test/More/; |
| •6 |
use libscip-perl cpan Grinder 0.005004 lib/ '.'; |
| 7 |
use t::TestUtilsscip-perl cpan Grinder 0.005004 t/TestUtils/; |
| 8 |
use Grinderscip-perl cpan Grinder 0.005004 Grinder/; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
my ($factory, $nof_reads, $read, %sources); |
| 13 |
|
| 14 |
|
| 15 |
# Specified genome abundance for a single library |
| 16 |
|
| 17 |
ok $factory = Grinder->new( |
| 18 |
-reference_file => data('shotgun_database.fa'), |
| 19 |
-abundance_file => data('abundances.txt') , |
| 20 |
-length_bias => 1 , |
| 21 |
-random_seed => 1910567890 , |
| 22 |
-total_reads => 1000 , |
| 23 |
), 'Genome abundance for a single libraries'; |
| 24 |
|
| 25 |
while ( $read = $factory->next_readscip-perl cpan Grinder 0.005004 main/next_read(). ) { |
| 26 |
my $source = $read->referencescip-perl cpan Grinder 0.005004 main/reference().->idscip-perl cpan Grinder 0.005004 main/id().; |
| 27 |
if (not existsscip-perl cpan Grinder 0.005004 main/exists(). $sources{$source}) { |
| 28 |
$sources{$source} = 1; |
| 29 |
} else { |
| 30 |
$sources{$source}++; |
| 31 |
} |
| 32 |
}; |
| 33 |
|
| 34 |
okscip-perl cpan Grinder 0.005004 main/ok(). existsscip-perl cpan Grinder 0.005004 main/exists(). $sources{'seq1'}; |
| 35 |
okscip-perl cpan Grinder 0.005004 main/ok(). existsscip-perl cpan Grinder 0.005004 main/exists(). $sources{'seq2'}; |
| 36 |
ok not existsscip-perl cpan Grinder 0.005004 main/exists(). $sources{'seq3'}; |
| 37 |
okscip-perl cpan Grinder 0.005004 main/ok(). existsscip-perl cpan Grinder 0.005004 main/exists(). $sources{'seq4'}; |
| 38 |
okscip-perl cpan Grinder 0.005004 main/ok(). existsscip-perl cpan Grinder 0.005004 main/exists(). $sources{'seq5'}; |
| 39 |
|
| 40 |
|
| 41 |
# These tests are quite sensitive to the seed used |
| 42 |
between_okscip-perl cpan Grinder 0.005004 main/between_ok().( $sources{'seq1'}, 414, 477 ); # avg = 444 |
| 43 |
between_okscip-perl cpan Grinder 0.005004 main/between_ok().( $sources{'seq2'}, 303, 363 ); # avg = 333 |
| 44 |
between_okscip-perl cpan Grinder 0.005004 main/between_ok().( $sources{'seq4'}, 81, 141 ); # avg = 111 |
| 45 |
between_okscip-perl cpan Grinder 0.005004 main/between_ok().( $sources{'seq5'}, 81, 141 ); # avg = 111 |
| 46 |
|
| 47 |
done_testingscip-perl cpan Grinder 0.005004 main/done_testing().(); |