comparison Roary/t/Bio/Roary/ExtractCoreGenesFromSpreadsheet.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::ExtractCoreGenesFromSpreadsheet');
12 }
13
14 my $obj;
15
16 ok(
17 $obj = Bio::Roary::ExtractCoreGenesFromSpreadsheet->new(
18 spreadsheet => 't/data/core_group_statistics.csv',
19 ),
20 'initalise obj'
21 );
22 is_deeply( $obj->ordered_core_genes, [ 'argF', 'speH', 'group_5' ], 'Correct ordering' );
23 is_deeply(
24 $obj->sample_names_to_genes,
25 {
26 'query_2' => {
27 '2_3' => 1,
28 '2_7' => 1,
29 '2_2' => 1
30 },
31 'query_1' => {
32 '1_6' => 1,
33 '1_3' => 1,
34 '1_2' => 1
35 }
36 },
37 'Correct of sample names to genes is correct'
38 );
39
40 ok(
41 $obj = Bio::Roary::ExtractCoreGenesFromSpreadsheet->new(
42 spreadsheet => 't/data/core_group_statistics.csv',
43 allow_paralogs => 1,
44 ),
45 'initalise obj where paralogs allowed'
46 );
47 is_deeply( $obj->ordered_core_genes, [ 'argF', 'hly', 'speH', 'group_5' ], 'Correct ordering where paralogs allowed' );
48
49 is_deeply(
50 $obj->sample_names_to_genes,
51 {
52 'query_2' => {
53 '2_3' => 1,
54 '2_7' => 1,
55 '2_1' => 1,
56 '2_2' => 1
57 },
58 'query_1' => {
59 '1_6' => 1,
60 '1_3' => 1,
61 '1_1' => 1,
62 '1_2' => 1
63 }
64 },
65 'Correct of sample names to genes is correct where paralogs allowed'
66 );
67
68 done_testing();