| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | undef $VERSION; | 
| 2 |  |  |  |  |  |  | package Bio::Roary::CommandLine::TransferAnnotationToGroups; | 
| 3 |  |  |  |  |  |  | $Bio::Roary::CommandLine::TransferAnnotationToGroups::VERSION = '3.10.2'; | 
| 4 |  |  |  |  |  |  | # ABSTRACT: Take in a groups file and a set of GFF files and transfer the consensus annotation | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 1 |  |  | 1 |  | 467147 | use Moose; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 15 |  | 
| 8 | 1 |  |  | 1 |  | 6784 | use Getopt::Long qw(GetOptionsFromArray); | 
|  | 1 |  |  |  |  | 8228 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 9 | 1 |  |  | 1 |  | 494 | use Bio::Roary::AnnotateGroups; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 345 |  | 
| 10 |  |  |  |  |  |  | extends 'Bio::Roary::CommandLine::Common'; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | has 'args'        => ( is => 'ro', isa => 'ArrayRef', required => 1 ); | 
| 14 |  |  |  |  |  |  | has 'script_name' => ( is => 'ro', isa => 'Str',      required => 1 ); | 
| 15 |  |  |  |  |  |  | has 'help'        => ( is => 'rw', isa => 'Bool',     default  => 0 ); | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | has 'gff_files'       => ( is => 'rw', isa => 'ArrayRef' ); | 
| 18 |  |  |  |  |  |  | has 'groups_filename' => ( is => 'rw', isa => 'Str' ); | 
| 19 |  |  |  |  |  |  | has 'output_filename' => ( is => 'rw', isa => 'Str', default => 'reannotated_groups' ); | 
| 20 |  |  |  |  |  |  | has 'verbose'         => ( is => 'rw', isa => 'Bool', default => 0 ); | 
| 21 |  |  |  |  |  |  | has '_error_message'  => ( is => 'rw', isa => 'Str' ); | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | sub BUILD { | 
| 24 | 2 |  |  | 2 | 0 | 8 | my ($self) = @_; | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 2 |  |  |  |  | 7 | my ( $gff_files, $output_filename, $groups_filename, @group_names, $action,$verbose,  $help ); | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 2 |  |  |  |  | 88 | GetOptionsFromArray( | 
| 29 |  |  |  |  |  |  | $self->args, | 
| 30 |  |  |  |  |  |  | 'o|output=s'          => \$output_filename, | 
| 31 |  |  |  |  |  |  | 'g|groups_filename=s' => \$groups_filename, | 
| 32 |  |  |  |  |  |  | 'v|verbose'           => \$verbose, | 
| 33 |  |  |  |  |  |  | 'h|help'              => \$help, | 
| 34 |  |  |  |  |  |  | ); | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 2 | 50 |  |  |  | 1681 | if ( defined($verbose) ) { | 
| 37 | 0 |  |  |  |  | 0 | $self->verbose($verbose); | 
| 38 | 0 |  |  |  |  | 0 | $self->logger->level(10000); | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 | 2 | 100 |  |  |  | 42 | $self->help($help) if(defined($help)); | 
| 42 | 2 | 100 |  |  |  | 79 | ( !$self->help ) or die $self->usage_text; | 
| 43 |  |  |  |  |  |  |  | 
| 44 | 1 | 50 |  |  |  | 4 | if ( @{ $self->args } == 0 ) { | 
|  | 1 |  |  |  |  | 47 |  | 
| 45 | 0 |  |  |  |  | 0 | $self->_error_message("Error: You need to provide a FASTA file"); | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 | 1 | 50 |  |  |  | 6 | $self->output_filename($output_filename) if ( defined($output_filename) ); | 
| 49 | 1 | 50 | 33 |  |  | 45 | if ( defined($groups_filename) && ( -e $groups_filename ) ) { | 
| 50 | 1 |  |  |  |  | 65 | $self->groups_filename($groups_filename); | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  | else { | 
| 53 | 0 |  |  |  |  | 0 | $self->_error_message("Error: Cant access the groups file"); | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 1 |  |  |  |  | 3 | for my $filename ( @{ $self->args } ) { | 
|  | 1 |  |  |  |  | 57 |  | 
| 57 | 3 | 50 |  |  |  | 38 | if ( !-e $filename ) { | 
| 58 | 0 |  |  |  |  | 0 | $self->_error_message("Error: Cant access file $filename"); | 
| 59 | 0 |  |  |  |  | 0 | last; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  | } | 
| 62 | 1 |  |  |  |  | 53 | $self->gff_files( $self->args ); | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | sub run { | 
| 67 | 1 |  |  | 1 | 0 | 5 | my ($self) = @_; | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  |  | 
| 70 | 1 | 50 |  |  |  | 61 | if ( defined( $self->_error_message ) ) { | 
| 71 | 0 |  |  |  |  | 0 | print $self->_error_message . "\n"; | 
| 72 | 0 |  |  |  |  | 0 | die $self->usage_text; | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  |  | 
| 76 | 1 |  |  |  |  | 45 | my $obj = Bio::Roary::AnnotateGroups->new( | 
| 77 |  |  |  |  |  |  | gff_files   => $self->gff_files, | 
| 78 |  |  |  |  |  |  | output_filename   => $self->output_filename, | 
| 79 |  |  |  |  |  |  | groups_filename => $self->groups_filename, | 
| 80 |  |  |  |  |  |  | ); | 
| 81 | 1 |  |  |  |  | 17 | $obj->reannotate; | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | } | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | sub usage_text { | 
| 86 | 1 |  |  | 1 | 0 | 4 | my ($self) = @_; | 
| 87 |  |  |  |  |  |  |  | 
| 88 | 1 |  |  |  |  | 29 | return <<USAGE; | 
| 89 |  |  |  |  |  |  | Usage: transfer_annotation_to_groups [options] *.gff | 
| 90 |  |  |  |  |  |  | Take in a groups file and the protein fasta files and output selected data | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | Options: -o STR output filename [reannotated_groups] | 
| 93 |  |  |  |  |  |  | -g STR clusters filename [clustered_proteins] | 
| 94 |  |  |  |  |  |  | -v     verbose output to STDOUT | 
| 95 |  |  |  |  |  |  | -h     this help message | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | For further info see: http://sanger-pathogens.github.io/Roary/ | 
| 98 |  |  |  |  |  |  | USAGE | 
| 99 |  |  |  |  |  |  | } | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 102 | 1 |  |  | 1 |  | 8 | no Moose; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 103 |  |  |  |  |  |  | 1; | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | __END__ | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =pod | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =encoding UTF-8 | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =head1 NAME | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | Bio::Roary::CommandLine::TransferAnnotationToGroups - Take in a groups file and a set of GFF files and transfer the consensus annotation | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =head1 VERSION | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | version 3.10.2 | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | Take in a groups file and a set of GFF files and transfer the consensus annotation | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =head1 AUTHOR | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | Andrew J. Page <ap13@sanger.ac.uk> | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | This is free software, licensed under: | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | The GNU General Public License, Version 3, June 2007 | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =cut |