line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
undef $VERSION; |
2
|
|
|
|
|
|
|
package Bio::Roary::CommandLine::RoaryReorderSpreadsheet; |
3
|
|
|
|
|
|
|
$Bio::Roary::CommandLine::RoaryReorderSpreadsheet::VERSION = '3.10.1'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Take in a tree and a spreadsheet and output a reordered spreadsheet |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
486925
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
6569
|
use Getopt::Long qw(GetOptionsFromArray); |
|
1
|
|
|
|
|
7776
|
|
|
1
|
|
|
|
|
3
|
|
9
|
1
|
|
|
1
|
|
392
|
use Bio::Roary::ReorderSpreadsheet; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
437
|
|
10
|
|
|
|
|
|
|
extends 'Bio::Roary::CommandLine::Common'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); |
13
|
|
|
|
|
|
|
has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 ); |
14
|
|
|
|
|
|
|
has 'help' => ( is => 'rw', isa => 'Bool', default => 0 ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'tree_file' => ( is => 'rw', isa => 'Str' ); |
17
|
|
|
|
|
|
|
has 'spreadsheet_filename' => ( is => 'rw', isa => 'Str', default => 'gene_presence_absence.csv' ); |
18
|
|
|
|
|
|
|
has 'output_filename' => ( is => 'rw', isa => 'Str', default => 'reordered_spreadsheet.csv' ); |
19
|
|
|
|
|
|
|
has 'tree_format' => ( is => 'rw', isa => 'Str', default => 'newick' ); |
20
|
|
|
|
|
|
|
has 'search_strategy' => ( is => 'rw', isa => 'Str', default => 'depth' ); |
21
|
|
|
|
|
|
|
has 'sortby' => ( is => 'rw', isa => 'Str', default => 'height'); |
22
|
|
|
|
|
|
|
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub BUILD { |
26
|
14
|
|
|
14
|
0
|
28
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
14
|
|
|
|
|
45
|
my ( $output_filename, $tree_file,$search_strategy, $sortby, $tree_format, $spreadsheet_filename,$verbose, $help ); |
29
|
|
|
|
|
|
|
|
30
|
14
|
|
|
|
|
425
|
GetOptionsFromArray( |
31
|
|
|
|
|
|
|
$self->args, |
32
|
|
|
|
|
|
|
'o|output_filename=s' => \$output_filename, |
33
|
|
|
|
|
|
|
't|tree_file=s' => \$tree_file, |
34
|
|
|
|
|
|
|
'f|tree_format=s' => \$tree_format, |
35
|
|
|
|
|
|
|
's|spreadsheet_filename=s' => \$spreadsheet_filename, |
36
|
|
|
|
|
|
|
'a|search_strategy=s' => \$search_strategy, |
37
|
|
|
|
|
|
|
'b|sortby=s' => \$sortby, |
38
|
|
|
|
|
|
|
'v|verbose' => \$verbose, |
39
|
|
|
|
|
|
|
'h|help' => \$help, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
14
|
50
|
|
|
|
13003
|
if ( defined($verbose) ) { |
43
|
0
|
|
|
|
|
0
|
$self->verbose($verbose); |
44
|
0
|
|
|
|
|
0
|
$self->logger->level(10000); |
45
|
|
|
|
|
|
|
} |
46
|
14
|
100
|
|
|
|
93
|
$self->help($help) if(defined($help)); |
47
|
14
|
100
|
|
|
|
62
|
$self->output_filename($output_filename) if ( defined($output_filename) ); |
48
|
14
|
100
|
|
|
|
424
|
$self->tree_file($tree_file) if ( defined($tree_file) ); |
49
|
14
|
100
|
|
|
|
60
|
$self->tree_format($tree_format) if ( defined($tree_format) ); |
50
|
14
|
100
|
|
|
|
349
|
$self->spreadsheet_filename($spreadsheet_filename) if ( defined($spreadsheet_filename) ); |
51
|
14
|
100
|
|
|
|
244
|
$self->sortby($sortby) if ( defined($sortby) ); |
52
|
14
|
100
|
|
|
|
367
|
$self->search_strategy($search_strategy) if ( defined($search_strategy) ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub run { |
56
|
14
|
|
|
14
|
0
|
33
|
my ($self) = @_; |
57
|
14
|
50
|
66
|
|
|
362
|
( defined($self->spreadsheet_filename) && defined($self->tree_file) && ( -e $self->spreadsheet_filename ) && ( -e $self->tree_file ) && ( !$self->help ) ) or die $self->usage_text; |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
33
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
13
|
50
|
100
|
|
|
323
|
($self->sortby eq "height" || $self->sortby eq "creation" || $self->sortby eq "alpha" || $self->sortby eq "revalpha") or die $self->usage_text; |
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
60
|
13
|
50
|
66
|
|
|
326
|
($self->search_strategy eq "breadth" || $self->search_strategy eq "depth") or die $self->usage_text; |
61
|
|
|
|
|
|
|
|
62
|
13
|
|
|
|
|
308
|
my $obj = Bio::Roary::ReorderSpreadsheet->new( |
63
|
|
|
|
|
|
|
tree_file => $self->tree_file, |
64
|
|
|
|
|
|
|
spreadsheet => $self->spreadsheet_filename, |
65
|
|
|
|
|
|
|
output_filename => $self->output_filename, |
66
|
|
|
|
|
|
|
sortby => $self->sortby, |
67
|
|
|
|
|
|
|
search_strategy => $self->search_strategy |
68
|
|
|
|
|
|
|
); |
69
|
13
|
|
|
|
|
63
|
$obj->reorder_spreadsheet(); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub usage_text { |
74
|
1
|
|
|
1
|
0
|
5
|
my ($self) = @_; |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
17
|
return <<USAGE; |
77
|
|
|
|
|
|
|
Usage: pan_genome_reorder_spreadsheet [options] -t tree.newick |
78
|
|
|
|
|
|
|
Reorder the columns in the gene presence and absence spreadsheet against a phylogenetic tree. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Options: -t STR tree filename [] |
81
|
|
|
|
|
|
|
-o STR output filename [reordered_spreadsheet.csv] |
82
|
|
|
|
|
|
|
-f STR tree format (newick/nexus/nhx/svggraph/tabtree/lintree) [newick] |
83
|
|
|
|
|
|
|
-s STR input gene presence and absence spreadsheet [gene_presence_absence.csv] |
84
|
|
|
|
|
|
|
-a STR search strategy (depth/breadth) [depth] |
85
|
|
|
|
|
|
|
-b STR sorting method (height/creation/alpha/revalpha) [height] |
86
|
|
|
|
|
|
|
-v verbose output to STDOUT |
87
|
|
|
|
|
|
|
-h this help message |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
For further info see: http://sanger-pathogens.github.io/Roary/ |
90
|
|
|
|
|
|
|
USAGE |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
94
|
1
|
|
|
1
|
|
9
|
no Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=pod |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=encoding UTF-8 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 NAME |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Bio::Roary::CommandLine::RoaryReorderSpreadsheet - Take in a tree and a spreadsheet and output a reordered spreadsheet |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 VERSION |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
version 3.10.1 |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SYNOPSIS |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Take in a tree and a spreadsheet and output a reordered spreadsheet |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 AUTHOR |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This is free software, licensed under: |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |