File Coverage

lib/Bio/VertRes/Config/Pipelines/Mapping.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package Bio::VertRes::Config::Pipelines::Mapping;
2              
3             # ABSTRACT: The base class for the mapping pipeline.
4              
5              
6 1     1   133198 use Moose;
  0            
  0            
7             use Bio::VertRes::Config::Pipelines::Common;
8             use Bio::VertRes::Config::References;
9             use Bio::VertRes::Config::Pipelines::Roles::MetaDataFilter;
10             use Bio::VertRes::Config::Pipelines::Roles::MultiplePrefix;
11             extends 'Bio::VertRes::Config::Pipelines::Common';
12             with 'Bio::VertRes::Config::Pipelines::Roles::MetaDataFilter';
13             with 'Bio::VertRes::Config::Pipelines::Roles::MultiplePrefix';
14              
15             has 'pipeline_short_name' => ( is => 'ro', isa => 'Str', default => 'mapping' );
16             has 'module' => ( is => 'ro', isa => 'Str', default => 'VertRes::Pipelines::Mapping' );
17             has 'reference' => ( is => 'ro', isa => 'Str', required => 1 );
18             has 'reference_lookup_file' => ( is => 'ro', isa => 'Str', required => 1 );
19             has 'toplevel_action' => ( is => 'ro', isa => 'Str', default => '__VRTrack_Mapping__' );
20              
21             has 'slx_mapper' => ( is => 'ro', isa => 'Str', required => 1 );
22             has 'slx_mapper_exe' => ( is => 'ro', isa => 'Str', required => 1 );
23              
24             has '_reference_fasta' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__reference_fasta');
25             has '_mark_duplicates' => ( is => 'ro', isa => 'Int', default => 1 );
26             has '_do_cleanup' => ( is => 'ro', isa => 'Int', default => 1 );
27             has '_do_recalibration' => ( is => 'ro', isa => 'Int', default => 0 );
28             has '_exit_on_errors' => ( is => 'ro', isa => 'Int', default => 0 );
29             has '_get_genome_coverage' => ( is => 'ro', isa => 'Int', default => 1 );
30             has '_add_index' => ( is => 'ro', isa => 'Int', default => 1 );
31             has '_ignore_mapped_status' => ( is => 'ro', isa => 'Int', default => 1 );
32             has '_dont_use_get_lanes' => ( is => 'ro', isa => 'Bool', default => 1 );
33              
34             sub _build__reference_fasta {
35             my ($self) = @_;
36             Bio::VertRes::Config::References->new( reference_lookup_file => $self->reference_lookup_file )
37             ->get_reference_location_on_disk( $self->reference );
38             }
39              
40             sub _construct_filename
41             {
42             my ($self, $suffix) = @_;
43             my $output_filename = $self->_limits_values_part_of_filename();
44            
45             $output_filename = join( '_', ($output_filename, $self->reference, $self->slx_mapper ) );
46              
47             return $self->_filter_characters_truncate_and_add_suffix($output_filename,$suffix);
48             }
49              
50              
51             override 'log_file_name' => sub {
52             my ($self) = @_;
53             return $self->_construct_filename('log');
54             };
55              
56              
57             override 'config_file_name' => sub {
58             my ($self) = @_;
59             return $self->_construct_filename('conf');
60             };
61              
62              
63             override 'to_hash' => sub {
64             my ($self) = @_;
65             my $output_hash = super();
66              
67             $output_hash->{vrtrack_processed_flags} = { import => 1, qc => 1, stored => 1 };
68             $output_hash->{limits} = $self->_escaped_limits;
69             $output_hash->{data}{mark_duplicates} = $self->_mark_duplicates;
70             $output_hash->{data}{reference} = $self->_reference_fasta;
71             $output_hash->{data}{assembly_name} = $self->reference;
72             $output_hash->{data}{do_cleanup} = $self->_do_cleanup;
73             $output_hash->{data}{do_recalibration} = $self->_do_recalibration;
74             $output_hash->{data}{exit_on_errors} = $self->_exit_on_errors;
75             $output_hash->{data}{get_genome_coverage} = $self->_get_genome_coverage;
76             $output_hash->{data}{add_index} = $self->_add_index;
77             $output_hash->{data}{ignore_mapped_status} = $self->_ignore_mapped_status;
78             $output_hash->{data}{slx_mapper} = $self->slx_mapper;
79             $output_hash->{data}{slx_mapper_exe} = $self->slx_mapper_exe;
80             $output_hash->{dont_use_get_lanes} = $self->_dont_use_get_lanes;
81              
82             return $output_hash;
83             };
84              
85             __PACKAGE__->meta->make_immutable;
86             no Moose;
87             1;
88              
89             __END__
90              
91             =pod
92              
93             =head1 NAME
94              
95             Bio::VertRes::Config::Pipelines::Mapping - The base class for the mapping pipeline.
96              
97             =head1 VERSION
98              
99             version 1.133090
100              
101             =head1 SYNOPSIS
102              
103             The base class for the mapping pipeline. It wont produce useable output on its own, you need to call a sub classed mapper for that.
104             use Bio::VertRes::Config::Pipelines::Mapping;
105              
106             my $pipeline = Bio::VertRes::Config::Pipelines::Mapping->new(
107             database => 'abc',
108             reference => 'Staphylococcus_aureus_subsp_aureus_ABC_v1',
109             limits => {
110             project => ['ABC study'],
111             species => ['EFG']
112             },
113             slx_mapper => 'bwa',
114             slx_mapper_exe => '/path/to/mapper/mapper.exe'
115              
116             );
117             $pipeline->to_hash();
118              
119             =head1 AUTHOR
120              
121             Andrew J. Page <ap13@sanger.ac.uk>
122              
123             =head1 COPYRIGHT AND LICENSE
124              
125             This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
126              
127             This is free software, licensed under:
128              
129             The GNU General Public License, Version 3, June 2007
130              
131             =cut