0
|
1 #!/usr/bin/env perl
|
|
2 use strict;
|
|
3 use warnings;
|
|
4 use Data::Dumper;
|
|
5 use File::Basename;
|
|
6
|
|
7 BEGIN { unshift( @INC, './lib' ) }
|
|
8 $ENV{PATH} .= ":./bin";
|
|
9
|
|
10 BEGIN {
|
|
11 use Test::Most;
|
|
12 use_ok('Bio::Roary::PrepareInputFiles');
|
|
13 }
|
|
14
|
|
15 my $obj;
|
|
16
|
|
17 ok(
|
|
18 $obj = Bio::Roary::PrepareInputFiles->new(
|
|
19 input_files => [
|
|
20 't/data/example_annotation.gff', 't/data/example_1.faa',
|
|
21 't/data/example_annotation_2.gff', 't/data/example_2.faa','t/data/sequences_with_unknowns.faa'
|
|
22 ],
|
|
23 ),
|
|
24 'initalise'
|
|
25 );
|
|
26
|
|
27 my @sorted_fasta_files = sort map { basename($_) } sort @{$obj->fasta_files};
|
|
28 my @expected_fasta_files = sort((
|
|
29 'example_1.faa.tmp.filtered.fa',
|
|
30 'example_2.faa.tmp.filtered.fa',
|
|
31 'example_annotation.gff.proteome.faa',
|
|
32 'example_annotation_2.gff.proteome.faa',
|
|
33 'sequences_with_unknowns.faa.tmp.filtered.fa'
|
|
34 ));
|
|
35
|
|
36 is_deeply(
|
|
37 \@sorted_fasta_files,
|
|
38 \@expected_fasta_files,
|
|
39 'proteome extracted from gff files, input fasta files filtered'
|
|
40 );
|
|
41
|
|
42 my @input_files_lookup = sort map { basename($_) } @{$obj->lookup_fasta_files_from_unknown_input_files( [ 't/data/example_annotation_2.gff', 't/data/example_1.faa' ] )};
|
|
43 is_deeply(
|
|
44 \@input_files_lookup,
|
|
45 ['example_1.faa.tmp.filtered.fa','example_annotation_2.gff.proteome.faa'],
|
|
46 'previously created faa file looked up from gff filename'
|
|
47 );
|
|
48
|
|
49 unlink('example_annotation.gff.proteome.faa');
|
|
50 unlink('example_annotation_2.gff.proteome.faa');
|
|
51 unlink('sequences_with_unknowns.faa.tmp.filtered.fa');
|
|
52 unlink('example_1.faa.tmp.filtered.fa');
|
|
53 unlink('example_2.faa.tmp.filtered.fa');
|
|
54
|
|
55 done_testing();
|
|
56
|