« lib/Bio/AutomatedAnnotation/ParseGenesFromGFF.pm
↑ Summary
lib/Bio/AutomatedAnnotation/CommandLine/GeneNameOccurances.pm »
| 1 | package Bio::AutomatedAnnotation; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Automated annotation of assemblies | ||||||||||
| 4 | |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use File::Basename; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Cwd; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use File::Temp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Bio::AutomatedAnnotation::Prokka; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | has 'sample_name' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||
| 13 | 1 | has 'dbdir' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||
| 14 | 1 | has 'assembly_file' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||
| 15 | 1 | has 'annotation_tool' => ( is => 'ro', isa => 'Str', default => 'Prokka' ); | |||||||||
| 16 | 1 | has 'outdir' => ( is => 'ro', isa => 'Str', default => 'annotation' ); | |||||||||
| 17 | 1 | has 'tmp_directory' => ( is => 'ro', isa => 'Str', default => '/tmp' ); | |||||||||
| 18 | 1 | has 'sequencing_centre' => ( is => 'ro', isa => 'Str', default => 'SC' ); | |||||||||
| 19 | 1 | has 'genus' => ( is => 'ro', isa => 'Maybe[Str]' ); | |||||||||
| 20 | 1 | has 'accession_number' => ( is => 'ro', isa => 'Maybe[Str]' ); | |||||||||
| 21 | 1 | has 'kingdom' => ( is => 'ro', isa => 'Maybe[Str]' ); | |||||||||
| 22 | 1 | has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 ); | |||||||||
| 23 | 1 | has 'gcode' => ( is => 'ro', isa => 'Int', default => 11 ); | |||||||||
| 24 | 1 | has 'keep_original_order_and_names' => ( is => 'ro', isa => 'Bool', default => 0 ); | |||||||||
| 25 | |||||||||||
| 26 | 1 | has '_annotation_pipeline_class' => | |||||||||
| 27 | ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__annotation_pipeline_class' ); | ||||||||||
| 28 | 1 | has '_temp_directory_obj' => ( is => 'ro', isa => 'File::Temp::Dir', lazy => 1, builder => '_build__temp_directory_obj' ); | |||||||||
| 29 | 1 | has '_temp_directory_name' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__temp_directory_name' ); | |||||||||
| 30 | |||||||||||
| 31 | sub _build__temp_directory_obj { | ||||||||||
| 32 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_build__temp_directory_obj: called CC=1 SCAR=0.0
| |||||||||||
| 33 | 1 | return File::Temp->newdir( DIR => $self->tmp_directory, CLEANUP => 1 ); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub _build__temp_directory_name { | ||||||||||
| 37 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_build__temp_directory_name: called CC=1 SCAR=0.0
| |||||||||||
| 38 | 1 | return $self->_temp_directory_obj->dirname(); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | sub _contig_uniq_id { | ||||||||||
| 42 | 2 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_contig_uniq_id: called CC=2 SCAR=6.9
| |||||||||||
| 43 | 2 | ▶ | if ( defined( $self->accession_number ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 1 | return $self->accession_number; | |||||||||
| 45 | } | ||||||||||
| 46 | else { | ||||||||||
| 47 | 1 | return $self->sample_name; | |||||||||
| 48 | } | ||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | sub _build__annotation_pipeline_class { | ||||||||||
| 52 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_build__annotation_pipeline_class: called CC=1 SCAR=0.0
| |||||||||||
| 53 | 1 | my $annotation_pipeline_class = "Bio::AutomatedAnnotation::" . $self->annotation_tool; | |||||||||
| 54 | 1 | eval "require $annotation_pipeline_class"; | |||||||||
| 55 | 1 | return $annotation_pipeline_class; | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | sub annotate { | ||||||||||
| 59 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
annotate: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 60 | |||||||||||
| 61 | # Run the annotation in the directory containing the assembly | ||||||||||
| 62 | 0 | my $original_cwd = getcwd(); | |||||||||
| 63 | 0 | my ( $filename, $directories, $suffix ) = fileparse( $self->assembly_file ); | |||||||||
| 64 | 0 | chdir($directories); | |||||||||
| 65 | |||||||||||
| 66 | 0 | my $annotation_pipeline = $self->_annotation_pipeline_class->new( | |||||||||
| 67 | assembly_file => $self->assembly_file, | ||||||||||
| 68 | tempdir => $self->_temp_directory_name, | ||||||||||
| 69 | centre => $self->sequencing_centre, | ||||||||||
| 70 | dbdir => $self->dbdir, | ||||||||||
| 71 | prefix => $self->sample_name, | ||||||||||
| 72 | locustag => $self->sample_name, | ||||||||||
| 73 | outdir => $self->outdir, | ||||||||||
| 74 | force => 1, | ||||||||||
| 75 | contig_uniq_id => $self->_contig_uniq_id, | ||||||||||
| 76 | cleanup_prod => 0, | ||||||||||
| 77 | cpus => $self->cpus, | ||||||||||
| 78 | rfam => 1, | ||||||||||
| 79 | gcode => $self->gcode, | ||||||||||
| 80 | keep_original_order_and_names => $self->keep_original_order_and_names, | ||||||||||
| 81 | ); | ||||||||||
| 82 | |||||||||||
| 83 | 0 | ▶ | if ( defined( $self->genus ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 84 | 0 | $annotation_pipeline->genus( $self->genus ); | |||||||||
| 85 | 0 | $annotation_pipeline->usegenus(1); | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 0 | ▶ | if(defined($self->kingdom)) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 89 | { | ||||||||||
| 90 | 0 | $annotation_pipeline->kingdom( $self->kingdom ); | |||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | 0 | $annotation_pipeline->annotate; | |||||||||
| 94 | |||||||||||
| 95 | 0 | chdir($original_cwd); | |||||||||
| 96 | 0 | return $self; | |||||||||
| 97 | } | ||||||||||
| 98 | |||||||||||
| 99 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 100 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 101 | |||||||||||
| 102 | 1 | 1; | |||||||||
| 103 | |||||||||||
| 104 | __END__ | ||||||||||
| 105 | |||||||||||
| 106 | =pod | ||||||||||
| 107 | |||||||||||
| 108 | =encoding UTF-8 | ||||||||||
| 109 | |||||||||||
| 110 | =head1 NAME | ||||||||||
| 111 | |||||||||||
| 112 | Bio::AutomatedAnnotation - Automated annotation of assemblies | ||||||||||
| 113 | |||||||||||
| 114 | =head1 VERSION | ||||||||||
| 115 | |||||||||||
| 116 | version 1.182685 | ||||||||||
| 117 | |||||||||||
| 118 | =head1 SYNOPSIS | ||||||||||
| 119 | |||||||||||
| 120 | Automated annotation of assemblies. | ||||||||||
| 121 | use Bio::AutomatedAnnotation; | ||||||||||
| 122 | |||||||||||
| 123 | my $obj = Bio::AutomatedAnnotation->new( | ||||||||||
| 124 | assembly_file => $assembly_file, | ||||||||||
| 125 | annotation_tool => $annotation_tool, | ||||||||||
| 126 | sample_name => $lane_name, | ||||||||||
| 127 | accession_number => $accession, | ||||||||||
| 128 | dbdir => $dbdir, | ||||||||||
| 129 | tmp_directory => $tmp_directory | ||||||||||
| 130 | ); | ||||||||||
| 131 | $obj->annotate; | ||||||||||
| 132 | |||||||||||
| 133 | =head1 AUTHOR | ||||||||||
| 134 | |||||||||||
| 135 | Andrew J. Page <ap13@sanger.ac.uk> | ||||||||||
| 136 | |||||||||||
| 137 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 138 | |||||||||||
| 139 | This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. | ||||||||||
| 140 | |||||||||||
| 141 | This is free software, licensed under: | ||||||||||
| 142 | |||||||||||
| 143 | The GNU General Public License, Version 3, June 2007 | ||||||||||
| 144 | |||||||||||
| 145 | =cut | ||||||||||