Debian Codegraph @

t/14-genome-length-bias.t

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #! perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6 use t::TestUtils;
7 use Grinder;
8
9
10
11 my ($factory, $nof_reads, $read, %sources);
12
13
14 # Specified genome abundance for a single library
15
16 ok $factory = Grinder->new(
17 -reference_file => data('shotgun_database.fa'),
18 -abundance_file => data('abundances.txt') ,
19 -length_bias => 1 ,
20 -random_seed => 1910567890 ,
21 -total_reads => 1000 ,
22 ), 'Genome abundance for a single libraries';
23
24 while ( $read = $factory->next_read ) {
25 my $source = $read->reference->id;
26 if (not exists $sources{$source}) {
27 $sources{$source} = 1;
28 } else {
29 $sources{$source}++;
30 }
31 };
32
33 ok exists $sources{'seq1'};
34 ok exists $sources{'seq2'};
35 ok not exists $sources{'seq3'};
36 ok exists $sources{'seq4'};
37 ok exists $sources{'seq5'};
38
39
40 # These tests are quite sensitive to the seed used
41 between_ok( $sources{'seq1'}, 414, 477 ); # avg = 444
42 between_ok( $sources{'seq2'}, 303, 363 ); # avg = 333
43 between_ok( $sources{'seq4'}, 81, 141 ); # avg = 111
44 between_ok( $sources{'seq5'}, 81, 141 ); # avg = 111
45
46 done_testing();