| 1 | package Bio::Roary::LookupGeneFiles; | ||||||||||
| 2 | 1 | $Bio::Roary::LookupGeneFiles::VERSION = '3.13.0'; | |||||||||
| 3 | # ABSTRACT: Take in an ordering of genes and a directory and return an ordered list of file locations | ||||||||||
| 4 | |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | has 'multifasta_directory' => ( is => 'ro', isa => 'Str', default => 'pan_genome_sequences' ); | |||||||||
| 9 | 1 | has 'ordered_genes' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); | |||||||||
| 10 | |||||||||||
| 11 | 1 | has 'ordered_gene_files' => ( is => 'ro', isa => 'ArrayRef', lazy => 1, builder => '_build_ordered_gene_files' ); | |||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | sub _build_ordered_gene_files | ||||||||||
| 15 | 2 | ▶ | { | ||||||||
|
Subroutine
_build_ordered_gene_files: called CC=3 SCAR=11.1
| |||||||||||
| 16 | 2 | my ($self) = @_; | |||||||||
| 17 | 2 | my @gene_files; | |||||||||
| 18 | 2 | for my $gene (@{$self->ordered_genes}) | |||||||||
| 19 | { | ||||||||||
| 20 | 4 | $gene =~ s!\W!_!gi; | |||||||||
| 21 | 4 | my $filename = $gene.'.fa.aln'; | |||||||||
| 22 | 4 | my $gene_filepath = join('/',($self->multifasta_directory, $filename)); | |||||||||
| 23 | |||||||||||
| 24 | 4 | ▶ | if(! -e $gene_filepath) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | { | ||||||||||
| 26 | 0 | print "Core gene file missing: ". $gene_filepath."\n"; | |||||||||
| 27 | } | ||||||||||
| 28 | else | ||||||||||
| 29 | { | ||||||||||
| 30 | 4 | push(@gene_files, $gene_filepath); | |||||||||
| 31 | } | ||||||||||
| 32 | } | ||||||||||
| 33 | 2 | return \@gene_files; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 37 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 38 | |||||||||||
| 39 | 1 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||