« blib/lib/Bio/AutomatedAnnotation/Prokka.pm
↑ Summary
blib/lib/Bio/AutomatedAnnotation/CommandLine/ParseGenesFromGFFs.pm »
| 1 | package Bio::AutomatedAnnotation::CommandLine::AnnotateBacteria; | ||
| 2 | |||
| 3 | # ABSTRACT: provide a commandline interface to the annotation wrappers | ||
| 4 | |||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use Getopt::Long qw(GetOptionsFromArray); | ||
| 8 | use Bio::AutomatedAnnotation; | ||
| 9 | |||
| 10 | has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); | ||
| 11 | has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 ); | ||
| 12 | has 'help' => ( is => 'rw', isa => 'Bool', default => 0 ); | ||
| 13 | |||
| 14 | has 'sample_name' => ( is => 'rw', isa => 'Str' ); | ||
| 15 | has 'dbdir' => ( is => 'rw', isa => 'Str', default => '/lustre/scratch118/infgen/pathogen/pathpipe/prokka' ); | ||
| 16 | has 'assembly_file' => ( is => 'rw', isa => 'Str' ); | ||
| 17 | has 'annotation_tool' => ( is => 'rw', isa => 'Str', default => 'Prokka' ); | ||
| 18 | has 'tmp_directory' => ( is => 'rw', isa => 'Str', default => '/tmp' ); | ||
| 19 | has 'sequencing_centre' => ( is => 'rw', isa => 'Str', default => 'SC' ); | ||
| 20 | has 'accession_number' => ( is => 'rw', isa => 'Maybe[Str]' ); | ||
| 21 | has 'genus' => ( is => 'rw', isa => 'Str' ); | ||
| 22 | has 'kingdom' => ( is => 'rw', isa => 'Str', default => 'Bacteria' ); | ||
| 23 | has 'cpus' => ( is => 'rw', isa => 'Int', default => 1); | ||
| 24 | has 'gcode' => ( is => 'rw', isa => 'Int', default => 11 ); | ||
| 25 | has 'outdir' => ( is => 'rw', isa => 'Str', default => 'annotation' ); | ||
| 26 | has 'keep_original_order_and_names' => ( is => 'rw', isa => 'Bool', default => 0 ); | ||
| 27 | |||
| 28 | sub BUILD { | ||
| 29 | my ($self) = @_; | ||
| 30 | |||
| 31 | my ( $sample_name, $kingdom, $dbdir, $assembly_file, $annotation_tool, $tmp_directory, $sequencing_centre, $accession_number,$genus, $cpus, $gcode, | ||
| 32 | $help, $keep_original_order_and_names, $outdir ); | ||
| 33 | |||
| 34 | GetOptionsFromArray( | ||
| 35 | $self->args, | ||
| 36 | 's|sample_name=s' => \$sample_name, | ||
| 37 | 'd|dbdir=s' => \$dbdir, | ||
| 38 | 'a|assembly_file=s' => \$assembly_file, | ||
| 39 | 't|tmp_directory=s' => \$tmp_directory, | ||
| 40 | 'p|annotation_tool=s' => \$annotation_tool, | ||
| 41 | 'c|sequencing_centre=s' => \$sequencing_centre, | ||
| 42 | 'g|genus=s' => \$genus, | ||
| 43 | 'k|kingdom=s' => \$kingdom, | ||
| 44 | 'i|cpus=s' => \$cpus, | ||
| 45 | 'n|accession_number=s' => \$accession_number, | ||
| 46 | 'h|help' => \$help, | ||
| 47 | 'o|outdir=s' => \$outdir, | ||
| 48 | 'gcode=i' => \$gcode, | ||
| 49 | 'keep_original_order_and_names' => \$keep_original_order_and_names, | ||
| 50 | ); | ||
| 51 | |||
| 52 | $self->sample_name($sample_name) if ( defined($sample_name) ); | ||
| 53 | $self->dbdir($dbdir) if ( defined($dbdir) ); | ||
| 54 | $self->assembly_file($assembly_file) if ( defined($assembly_file) ); | ||
| 55 | $self->annotation_tool($annotation_tool) if ( defined($annotation_tool) ); | ||
| 56 | $self->tmp_directory($tmp_directory) if ( defined($tmp_directory) ); | ||
| 57 | $self->sequencing_centre($sequencing_centre) if ( defined($sequencing_centre) ); | ||
| 58 | $self->accession_number($accession_number) if ( defined($accession_number) ); | ||
| 59 | $self->genus($genus) if ( defined($genus) ); | ||
| 60 | $self->kingdom($kingdom) if ( defined($kingdom) ); | ||
| 61 | $self->cpus($cpus) if ( defined($cpus) ); | ||
| 62 | $self->gcode($gcode) if ( defined($gcode) ); | ||
| 63 | $self->outdir($outdir) if ( defined($outdir) ); | ||
| 64 | $self->keep_original_order_and_names($keep_original_order_and_names) if ( defined($keep_original_order_and_names) ); | ||
| 65 | } | ||
| 66 | |||
| 67 | sub run { | ||
| 68 | my ($self) = @_; | ||
| 69 | (( -e $self->assembly_file ) && ! $self->help ) or die $self->usage_text; | ||
| 70 | |||
| 71 | my $obj = Bio::AutomatedAnnotation->new( | ||
| 72 | assembly_file => $self->assembly_file, | ||
| 73 | annotation_tool => $self->annotation_tool, | ||
| 74 | sample_name => $self->sample_name, | ||
| 75 | accession_number => $self->accession_number, | ||
| 76 | dbdir => $self->dbdir, | ||
| 77 | tmp_directory => $self->tmp_directory, | ||
| 78 | genus => $self->genus, | ||
| 79 | kingdom => $self->kingdom, | ||
| 80 | cpus => $self->cpus, | ||
| 81 | gcode => $self->gcode, | ||
| 82 | outdir => $self->outdir, | ||
| 83 | keep_original_order_and_names => $self->keep_original_order_and_names, | ||
| 84 | ); | ||
| 85 | $obj->annotate; | ||
| 86 | |||
| 87 | } | ||
| 88 | |||
| 89 | sub usage_text { | ||
| 90 | my ($self) = @_; | ||
| 91 | my $script_name = $self->script_name; | ||
| 92 | |||
| 93 | return <<USAGE; | ||
| 94 | Usage: $script_name [options] | ||
| 95 | Annotate bacteria with Prokka | ||
| 96 | |||
| 97 | Seemann T. Prokka: rapid prokaryotic genome annotation. Bioinformatics. 2014 Jul 15;30(14):2068-9. PMID:24642063 | ||
| 98 | |||
| 99 | # Annotate a bacteria with a genus specific database (recommended usage) | ||
| 100 | $script_name -a contigs.fa --sample_name Sample123 --genus Klebsiella | ||
| 101 | |||
| 102 | # Annotate a bacteria without a genus specific database | ||
| 103 | $script_name -a contigs.fa --sample_name Sample123 | ||
| 104 | |||
| 105 | # Use multiple processors (faster) | ||
| 106 | $script_name -a contigs.fa --sample_name Sample123 --cpus 10 | ||
| 107 | |||
| 108 | # Use a different translation table (defaults to 11) | ||
| 109 | $script_name -a contigs.fa --sample_name Sample123 --gcode 1 | ||
| 110 | |||
| 111 | # Annotate a virus | ||
| 112 | $script_name -a contigs.fa --sample_name Sample123 --kingdom Viruses | ||
| 113 | |||
| 114 | # Keep original order and names of sequences from input assembly | ||
| 115 | $script_name -a contigs.fa --sample_name Sample123 --keep_original_order_and_names | ||
| 116 | |||
| 117 | # Set output directory | ||
| 118 | $script_name -a contigs.fa --sample_name Sample123 -o output_dir | ||
| 119 | |||
| 120 | # This help message | ||
| 121 | annotate_bacteria -h | ||
| 122 | |||
| 123 | This software uses Prokka by Torsten Seemann | ||
| 124 | http://bioinformatics.net.au/prokka-manual.html | ||
| 125 | |||
| 126 | The databases are searched in the following order: | ||
| 127 | |||
| 128 | Genus specific RefSeq databases (optional) | ||
| 129 | UniprotKB - bacteria/viruses only | ||
| 130 | Clusters | ||
| 131 | Conserved domain database | ||
| 132 | tigrfams | ||
| 133 | pfam (A) | ||
| 134 | rfam | ||
| 135 | |||
| 136 | USAGE | ||
| 137 | } | ||
| 138 | |||
| 139 | __PACKAGE__->meta->make_immutable; | ||
| 140 | no Moose; | ||
| 141 | 1; | ||
| 142 | |||
| 143 | __END__ | ||
| 144 | |||
| 145 | =pod | ||
| 146 | |||
| 147 | =encoding UTF-8 | ||
| 148 | |||
| 149 | =head1 NAME | ||
| 150 | |||
| 151 | Bio::AutomatedAnnotation::CommandLine::AnnotateBacteria - provide a commandline interface to the annotation wrappers | ||
| 152 | |||
| 153 | =head1 VERSION | ||
| 154 | |||
| 155 | version 1.182685 | ||
| 156 | |||
| 157 | =head1 SYNOPSIS | ||
| 158 | |||
| 159 | provide a commandline interface to the annotation wrappers | ||
| 160 | |||
| 161 | =head1 AUTHOR | ||
| 162 | |||
| 163 | Andrew J. Page <ap13@sanger.ac.uk> | ||
| 164 | |||
| 165 | =head1 COPYRIGHT AND LICENSE | ||
| 166 | |||
| 167 | This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. | ||
| 168 | |||
| 169 | This is free software, licensed under: | ||
| 170 | |||
| 171 | The GNU General Public License, Version 3, June 2007 | ||
| 172 | |||
| 173 | =cut |