File Coverage

lib/Bio/VertRes/Config/Pipelines/SnpCalling.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::SnpCalling;
2              
3             # ABSTRACT: The base class for the SNP calling pipeline.
4              
5              
6 1     1   143261 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             with 'Bio::VertRes::Config::Pipelines::Roles::FilenameWithReference';
15              
16             has 'pipeline_short_name' => ( is => 'ro', isa => 'Str', default => 'snps' );
17             has 'module' => ( is => 'ro', isa => 'Str', default => 'VertRes::Pipelines::SNPs' );
18             has 'reference' => ( is => 'ro', isa => 'Str', required => 1 );
19             has 'reference_lookup_file' => ( is => 'ro', isa => 'Str', required => 1 );
20             has 'toplevel_action' => ( is => 'ro', isa => 'Str', default => '__VRTrack_SNPs__' );
21             has 'run_after_bam_improvement' => ( is => 'ro', isa => 'Bool', default => 0);
22              
23             has '_max_lanes' => ( is => 'ro', isa => 'Int', default => 300 );
24             has '_pseudo_genome' => ( is => 'ro', isa => 'Bool', default => 1 );
25             has '_bam_suffix' => ( is => 'ro', isa => 'Str', default => 'markdup.bam' );
26              
27             has '_bsub_opts' => (
28             is => 'ro',
29             isa => 'Str',
30             default => "-q normal -M3500000 -R 'select[type==X86_64 && mem>3500] rusage[mem=3500,thouio=1,tmp=16000]'"
31             );
32             has '_bsub_opts_long' => (
33             is => 'ro',
34             isa => 'Str',
35             default => "-q normal -M3500000 -R 'select[type==X86_64 && mem>3500] rusage[mem=3500,thouio=1,tmp=16000]'"
36             );
37             has '_bsub_opts_mpileup' =>
38             ( is => 'ro', isa => 'Str', default => "-q normal -R 'select[type==X86_64] rusage[thouio=1]'" );
39             has '_split_size_mpileup' => ( is => 'ro', isa => 'Int', default => 300000000 );
40             has '_tmp_dir' => ( is => 'ro', isa => 'Str', default => '/lustre/scratch108/pathogen/tmp' );
41             has '_mpileup_cmd' => ( is => 'ro', isa => 'Str', default => 'samtools mpileup -d 1000 -DSug ' );
42             has '_max_jobs' => ( is => 'ro', isa => 'Int', default => 100 );
43             has '_fai_chr_regex' => ( is => 'ro', isa => 'Str', default => '[\w\.\#]+' );
44             has '_fa_ref' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__fa_ref' );
45             has '_fai_ref' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__fai_ref' );
46             has '_ignore_snp_called_status' => ( is => 'ro', isa => 'Int', default => 1 );
47              
48             sub _build__fa_ref {
49             my ($self) = @_;
50             Bio::VertRes::Config::References->new( reference_lookup_file => $self->reference_lookup_file )
51             ->get_reference_location_on_disk( $self->reference );
52             }
53              
54             sub _build__fai_ref {
55             my ($self) = @_;
56             return join( '.', ( $self->_fa_ref, 'fai' ) );
57             }
58              
59             override 'to_hash' => sub {
60             my ($self) = @_;
61             my $output_hash = super();
62              
63             $output_hash->{max_lanes} = $self->_max_lanes;
64             $output_hash->{vrtrack_processed_flags} = { import => 1, qc => 1, stored => 1, mapped => 1};
65             $output_hash->{vrtrack_processed_flags}{improved} = 1 if($self->run_after_bam_improvement);
66              
67             if ( $self->_pseudo_genome ) {
68             $output_hash->{data}{task} = 'pseudo_genome,mpileup,update_db,cleanup';
69             }
70             else {
71             $output_hash->{data}{task} = 'mpileup,update_db,cleanup';
72             }
73             $output_hash->{data}{bam_suffix} = $self->_bam_suffix;
74             $output_hash->{data}{bsub_opts} = $self->_bsub_opts;
75             $output_hash->{data}{bsub_opts_long} = $self->_bsub_opts_long;
76             $output_hash->{data}{bsub_opts_mpileup} = $self->_bsub_opts_mpileup;
77             $output_hash->{data}{split_size_mpileup} = $self->_split_size_mpileup;
78             $output_hash->{data}{tmp_dir} = $self->_tmp_dir;
79             $output_hash->{data}{mpileup_cmd} = $self->_mpileup_cmd;
80             $output_hash->{data}{max_jobs} = $self->_max_jobs;
81             $output_hash->{data}{fai_chr_regex} = $self->_fai_chr_regex;
82             $output_hash->{data}{fa_ref} = $self->_fa_ref;
83             $output_hash->{data}{fai_ref} = $self->_fai_ref;
84             $output_hash->{data}{ignore_snp_called_status} = $self->_ignore_snp_called_status;
85             $output_hash->{limits} = $self->_escaped_limits;
86             return $output_hash;
87             };
88              
89             __PACKAGE__->meta->make_immutable;
90             no Moose;
91             1;
92              
93             __END__
94              
95             =pod
96              
97             =head1 NAME
98              
99             Bio::VertRes::Config::Pipelines::SnpCalling - The base class for the SNP calling pipeline.
100              
101             =head1 VERSION
102              
103             version 1.133090
104              
105             =head1 SYNOPSIS
106              
107             he base class for the SNP calling pipeline.
108             use Bio::VertRes::Config::Pipelines::SnpCalling;
109              
110             my $pipeline = Bio::VertRes::Config::Pipelines::Mapping->new(
111             database => 'abc',
112             reference => 'Staphylococcus_aureus_subsp_aureus_ABC_v1',
113             limits => {
114             project => ['ABC study'],
115             species => ['EFG']
116             },
117              
118             );
119             $pipeline->to_hash();
120              
121             =head1 AUTHOR
122              
123             Andrew J. Page <ap13@sanger.ac.uk>
124              
125             =head1 COPYRIGHT AND LICENSE
126              
127             This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
128              
129             This is free software, licensed under:
130              
131             The GNU General Public License, Version 3, June 2007
132              
133             =cut