0
|
1 #!/usr/bin/env perl
|
|
2 use strict;
|
|
3 use warnings;
|
|
4 use Data::Dumper;
|
|
5 use Moose;
|
|
6 BEGIN { unshift( @INC, './t/lib' ) }
|
|
7 with 'TestHelper';
|
|
8
|
|
9 BEGIN { unshift( @INC, './lib' ) }
|
|
10
|
|
11 BEGIN {
|
|
12 use Test::Most;
|
|
13 use_ok('Bio::Roary::Output::QueryGroups');
|
|
14 }
|
|
15
|
|
16 my $plot_groups_obj = Bio::Roary::AnalyseGroups->new(
|
|
17 fasta_files => [ 't/data/query_1.fa', 't/data/query_2.fa','t/data/query_3.fa' ],
|
|
18 groups_filename => 't/data/query_groups'
|
|
19 );
|
|
20
|
|
21 my $obj;
|
|
22 ok($obj = Bio::Roary::Output::QueryGroups->new(
|
|
23 analyse_groups => $plot_groups_obj,
|
|
24 input_filenames => [ 't/data/query_1.fa', 't/data/query_2.fa','t/data/query_3.fa' ]
|
|
25 ),'initialise groups query object');
|
|
26
|
|
27 ok($obj->groups_union(), 'create the union file');
|
|
28 ok($obj->groups_intersection(), 'create the intersection file');
|
|
29 ok($obj->groups_complement(), 'create the complement file');
|
|
30
|
|
31 compare_files('union_of_groups.gg','t/data/expected_union_of_groups.gg', 'contents of the union groups as expected');
|
|
32 compare_files('intersection_of_groups.gg', 't/data/expected_intersection_of_groups.gg', 'contents of the intersection groups as expected');
|
|
33 compare_files('complement_of_groups.gg', 't/data/expected_complement_of_groups.gg', 'contents of the complement groups as expected');
|
|
34
|
|
35 ######################################
|
|
36 # test varying core definition
|
|
37 ok($obj = Bio::Roary::Output::QueryGroups->new(
|
|
38 analyse_groups => $plot_groups_obj,
|
|
39 input_filenames => [ 't/data/query_1.fa', 't/data/query_2.fa','t/data/query_3.fa' ],
|
|
40 core_definition => 0.66
|
|
41 ),'initialise groups query object');
|
|
42
|
|
43 ok($obj->groups_intersection(), 'create the intersection file');
|
|
44 ok($obj->groups_complement(), 'create the complement file');
|
|
45
|
|
46 compare_files('intersection_of_groups.gg', 't/data/expected_intersection_of_groups_core0.66.gg', 'contents of the intersection groups as expected');
|
|
47 compare_files('complement_of_groups.gg', 't/data/expected_complement_of_groups_core0.66.gg', 'contents of the complement groups as expected');
|
|
48
|
|
49
|
|
50 unlink('union_of_groups.gg');
|
|
51 unlink('intersection_of_groups.gg');
|
|
52 unlink('complement_of_groups.gg');
|
|
53
|
|
54 ######################################
|
|
55
|
|
56 $plot_groups_obj = Bio::Roary::AnalyseGroups->new(
|
|
57 fasta_files => [ 't/data/query_1.fa', 't/data/query_2.fa','t/data/query_3.fa' ],
|
|
58 groups_filename => 't/data/query_groups_paralogs'
|
|
59 );
|
|
60
|
|
61 ok($obj = Bio::Roary::Output::QueryGroups->new(
|
|
62 analyse_groups => $plot_groups_obj,
|
|
63 input_filenames => [ 't/data/query_1.fa', 't/data/query_2.fa','t/data/query_3.fa' ]
|
|
64 ),'initialise groups query object with paralogs');
|
|
65
|
|
66 ok($obj->groups_intersection(), 'create the intersection file');
|
|
67
|
|
68 compare_files('intersection_of_groups.gg', 't/data/expected_intersection_of_groups_paralogs.gg', 'contents of the intersection groups with paralogs as expected');
|
|
69 unlink('intersection_of_groups.gg');
|
|
70
|
|
71
|
|
72 done_testing();
|
|
73
|