comparison Roary/t/Bio/Roary/AnalyseGroups.t @ 0:c47a5f61bc9f draft

Uploaded
author dereeper
date Fri, 14 May 2021 20:27:06 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c47a5f61bc9f
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use Data::Dumper;
5
6 BEGIN { unshift( @INC, './lib' ) }
7 $ENV{PATH} .= ":./bin";
8
9 BEGIN {
10 use Test::Most;
11 use_ok('Bio::Roary::AnalyseGroups');
12 }
13
14 ok(
15 my $plot_groups_obj = Bio::Roary::AnalyseGroups->new(
16 fasta_files => [ 't/data/example_1.faa', 't/data/example_2.faa' ],
17 groups_filename => 't/data/example_groups'
18 ),
19 'initialise with two fasta files'
20 );
21
22 is( $plot_groups_obj->_number_of_isolates, 2, 'Number of isolates' );
23
24 is_deeply(
25 $plot_groups_obj->_genes_to_file,
26 {
27 '1234#10_00003' => 't/data/example_1.faa',
28 '1234#10_00017' => 't/data/example_2.faa',
29 '1234#10_00001' => 't/data/example_1.faa',
30 '1234#10_00016' => 't/data/example_2.faa',
31 '1234#10_00007' => 't/data/example_1.faa',
32 '1234#10_00006' => 't/data/example_1.faa',
33 '1234#10_00018' => 't/data/example_2.faa',
34 '1234#10_00005' => 't/data/example_1.faa',
35 '1234#10_00002' => 't/data/example_1.faa'
36 },
37 'genes map to the correct files'
38 );
39
40
41 is_deeply(
42 $plot_groups_obj->_groups_to_genes,
43 {
44 'group_3' => [ '1234#10_00005', '1234#10_00005' ],
45 'group_5' => [ '1234#10_00016' ],
46 'group_4' => [ '1234#10_00006', '1234#10_00007' ],
47 'group_6' => [ '1234#10_00017' ],
48 'group_1' => [ '1234#10_00001', '1234#10_00002' ],
49 'group_2' => [ '1234#10_00003', '1234#10_00018', '1234#10_00005' ]
50 },
51 'Groups to genes hash'
52 );
53
54 is_deeply(
55 $plot_groups_obj->_genes_to_groups,
56 {
57 '1234#10_00003' => 'group_2',
58 '1234#10_00017' => 'group_6',
59 '1234#10_00001' => 'group_1',
60 '1234#10_00016' => 'group_5',
61 '1234#10_00007' => 'group_4',
62 '1234#10_00006' => 'group_4',
63 '1234#10_00018' => 'group_2',
64 '1234#10_00005' => 'group_3',
65 '1234#10_00002' => 'group_1'
66 },
67 'genes to groups hash'
68 );
69
70 done_testing();