File Coverage

lib/Bio/VertRes/Config/Pipelines/QC.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::QC;
2              
3             # ABSTRACT: A class for generating the QC pipeline config file. This is done on a per study basis ususally (and filtered by species).
4              
5              
6 1     1   140862 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             extends 'Bio::VertRes::Config::Pipelines::Common';
11             with 'Bio::VertRes::Config::Pipelines::Roles::MetaDataFilter';
12              
13             has 'pipeline_short_name' => ( is => 'ro', isa => 'Str', default => 'qc' );
14             has 'module' => ( is => 'ro', isa => 'Str', default => 'VertRes::Pipelines::TrackQC_Fastq' );
15             has 'reference' => ( is => 'ro', isa => 'Str', required => 1 );
16             has 'reference_lookup_file' => ( is => 'ro', isa => 'Str', required => 1 );
17             has 'toplevel_action' => ( is => 'ro', isa => 'Str', default => '__VRTrack_QC__' );
18              
19             has '_max_failures' => ( is => 'ro', isa => 'Int', default => 3 );
20             has '_bwa_ref' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__bwa_ref' );
21             has '_fa_ref' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__fa_ref' );
22             has '_fai_ref' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__fai_ref' );
23             has '_stats_ref' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__stats_ref' );
24             has '_mapper' => ( is => 'ro', isa => 'Str', default => 'bwa' );
25             has '_bwa_exec' => ( is => 'ro', isa => 'Str', default => '/software/pathogen/external/apps/usr/local/bwa-0.6.1/bwa' );
26             has '_samtools' => ( is => 'ro', isa => 'Str', default => '/software/pathogen/external/apps/usr/bin/samtools' );
27             has '_glf' => ( is => 'ro', isa => 'Str', default => '/software/pathogen/external/apps/usr/bin/glf' );
28             has '_mapviewdepth' => ( is => 'ro', isa => 'Str', default => '/software/pathogen/external/apps/usr/bin/bindepth' );
29             has '_adapters' => ( is => 'ro', isa => 'Str', default => '/lustre/scratch108/pathogen/pathpipe/usr/share/solexa-adapters.fasta' );
30             has '_snps' => ( is => 'ro', isa => 'Str', default => '/lustre/scratch108/pathogen/pathpipe/usr/share/mousehapmap.snps.bin' );
31             has '_skip_genotype' => ( is => 'ro', isa => 'Int', default => 1 );
32             has '_gtype_confidence' => ( is => 'ro', isa => 'Num', default => 1.2 );
33             has '_chr_regex' => ( is => 'ro', isa => 'Str', default => '.*' );
34             has '_do_samtools_rmdup' => ( is => 'ro', isa => 'Int', default => 1 );
35             has '_gcdepth_R' => ( is => 'ro', isa => 'Str', default => '/software/pathogen/external/apps/usr/local/gcdepth/gcdepth.R' );
36              
37              
38              
39              
40             sub _build__bwa_ref {
41             my ($self) = @_;
42             return $self->_fa_ref;
43             }
44              
45             sub _build__fa_ref {
46             my ($self) = @_;
47             Bio::VertRes::Config::References->new( reference_lookup_file => $self->reference_lookup_file )
48             ->get_reference_location_on_disk( $self->reference );
49             }
50              
51             sub _build__fai_ref {
52             my ($self) = @_;
53             return join( '.', ( $self->_fa_ref, 'fai' ) );
54             }
55              
56             sub _build__stats_ref {
57             my ($self) = @_;
58             return join( '.', ( $self->_fa_ref, 'refstats' ) );
59             }
60              
61             override 'to_hash' => sub {
62             my ($self) = @_;
63             my $output_hash = super();
64             $output_hash->{data}{exit_on_errors} = 0;
65             $output_hash->{max_failures} = $self->_max_failures;
66             $output_hash->{limits} = $self->_escaped_limits;
67              
68             $output_hash->{data}{bwa_ref} = $self->_bwa_ref;
69             $output_hash->{data}{fa_ref} = $self->_fa_ref;
70             $output_hash->{data}{fai_ref} = $self->_fai_ref;
71             $output_hash->{data}{stats_ref} = $self->_stats_ref;
72             $output_hash->{data}{assembly} = $self->reference;
73             $output_hash->{data}{mapper} = $self->_mapper;
74             $output_hash->{data}{bwa_exec} = $self->_bwa_exec;
75             $output_hash->{data}{samtools} = $self->_samtools;
76             $output_hash->{data}{glf} = $self->_glf;
77             $output_hash->{data}{mapviewdepth} = $self->_mapviewdepth;
78             $output_hash->{data}{adapters} = $self->_adapters;
79             $output_hash->{data}{snps} = $self->_snps;
80             $output_hash->{data}{skip_genotype} = $self->_skip_genotype;
81             $output_hash->{data}{gtype_confidence} = $self->_gtype_confidence;
82             $output_hash->{data}{chr_regex} = $self->_chr_regex;
83             $output_hash->{data}{do_samtools_rmdup} = $self->_do_samtools_rmdup;
84             $output_hash->{data}{gcdepth_R} = $self->_gcdepth_R;
85              
86             return $output_hash;
87             };
88              
89              
90             sub _construct_filename
91             {
92             my ($self, $suffix) = @_;
93             my $output_filename = $self->_limits_values_part_of_filename();
94              
95             return $self->_filter_characters_truncate_and_add_suffix($output_filename,$suffix);
96             }
97              
98             override 'log_file_name' => sub {
99             my ($self) = @_;
100             return $self->_construct_filename('log');
101             };
102              
103             override 'config_file_name' => sub {
104             my ($self) = @_;
105             return $self->_construct_filename('conf');
106             };
107              
108              
109             __PACKAGE__->meta->make_immutable;
110             no Moose;
111             1;
112              
113             __END__
114              
115             =pod
116              
117             =head1 NAME
118              
119             Bio::VertRes::Config::Pipelines::QC - A class for generating the QC pipeline config file. This is done on a per study basis ususally (and filtered by species).
120              
121             =head1 VERSION
122              
123             version 1.133090
124              
125             =head1 SYNOPSIS
126              
127             A class for generating the QC pipeline config file.
128             use Bio::VertRes::Config::Pipelines::QC;
129              
130             my $pipeline = Bio::VertRes::Config::Pipelines::QC->new(
131             database => 'abc',
132             reference => 'Staphylococcus_aureus_subsp_aureus_ABC_v1',
133             limits => {
134             project => ['ABC study'],
135             species => ['EFG']
136             }
137              
138             );
139             $pipeline->to_hash();
140              
141             =head1 AUTHOR
142              
143             Andrew J. Page <ap13@sanger.ac.uk>
144              
145             =head1 COPYRIGHT AND LICENSE
146              
147             This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
148              
149             This is free software, licensed under:
150              
151             The GNU General Public License, Version 3, June 2007
152              
153             =cut