File: ExtractCoreGenesFromSpreadsheet.t

package info (click to toggle)
roary 3.13.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 3,944 kB
  • sloc: perl: 10,536; sh: 211; makefile: 9
file content (68 lines) | stat: -rwxr-xr-x 1,526 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;

BEGIN { unshift( @INC, './lib' ) }
$ENV{PATH} .= ":./bin";

BEGIN {
    use Test::Most;
    use_ok('Bio::Roary::ExtractCoreGenesFromSpreadsheet');
}

my $obj;

ok(
    $obj = Bio::Roary::ExtractCoreGenesFromSpreadsheet->new(
        spreadsheet => 't/data/core_group_statistics.csv',
    ),
    'initalise obj'
);
is_deeply( $obj->ordered_core_genes, [ 'argF', 'speH', 'group_5' ], 'Correct ordering' );
is_deeply(
    $obj->sample_names_to_genes,
    {
        'query_2' => {
            '2_3' => 1,
            '2_7' => 1,
            '2_2' => 1
        },
        'query_1' => {
            '1_6' => 1,
            '1_3' => 1,
            '1_2' => 1
        }
    },
    'Correct of sample names to genes is correct'
);

ok(
    $obj = Bio::Roary::ExtractCoreGenesFromSpreadsheet->new(
        spreadsheet    => 't/data/core_group_statistics.csv',
        allow_paralogs => 1,
    ),
    'initalise obj where paralogs allowed'
);
is_deeply( $obj->ordered_core_genes, [ 'argF', 'hly', 'speH', 'group_5' ], 'Correct ordering where paralogs allowed' );

is_deeply(
    $obj->sample_names_to_genes,
    {
        'query_2' => {
            '2_3' => 1,
            '2_7' => 1,
            '2_1' => 1,
            '2_2' => 1
        },
        'query_1' => {
            '1_6' => 1,
            '1_3' => 1,
            '1_1' => 1,
            '1_2' => 1
        }
    },
    'Correct of sample names to genes is correct where paralogs allowed'
);

done_testing();