lib/Bio/AssemblyImprovement/Assemble/SGA/PreprocessReads.pm

filter: Statementstmt 100% 44 / 44 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 98.1% 54 / 55 CC 3 SCAR 3.4
CC
3
Cov
98%
run
2.0
_prepare_input_files
2.0
BEGIN
1.0
CRAP 1.4
« lib/Bio/AssemblyImprovement/AdapterRemoval/Trimmomatic/Main.pm ↑ Summary lib/Bio/AssemblyImprovement/FillGaps/GapFiller/Iterative.pm »
1 package Bio::AssemblyImprovement::Assemble::SGA::PreprocessReads;
2  
3 # ABSTRACT: Preprocess reads before error correction
4  
5  
6 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Cwd 'abs_path';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 with 'Bio::AssemblyImprovement::Scaffold::SSpace::TempDirectoryRole';
12 3 with 'Bio::AssemblyImprovement::Util::UnzipFileIfNeededRole';
13  
14 3 has 'input_files' => ( is => 'ro', isa => 'ArrayRef' , required => 1);
15 3 has 'output_filename' => ( is => 'rw', isa => 'Str', default => '_sga_preprocessed.fastq' );
16 3 has 'min_length' => ( is => 'ro', isa => 'Num', default => 66); # Change this to be the value of the minimum kmer length used by the assembler later on in the pipeline
17 3 has 'pe_mode' => ( is => 'ro', isa => 'Num', default => 2); #We set default to 2 as the pipeline will almost always send in an interleaved fastq file
18 3 has 'quality_trim' => ( is => 'ro', isa => 'Num', default => 20); # Use a quality score of 20 by default
19 3 has 'sga_exec' => ( is => 'rw', isa => 'Str', required => 1 );
20 3 has 'debug' => ( is => 'ro', isa => 'Bool', default => 0);
21  
22  
23 3 ▶sub run {
Subroutine run: called CC=2 SCAR=6.9
Pod documented
24 3 my ($self) = @_;
25 3 my $prepared_input_files = $self->_prepare_input_files();
26 3 my $original_cwd = getcwd();
27
28 # Do all the steps in a temporary directory
29 3 chdir( $self->_temp_directory );
30
31 3 my $stdout_of_program = '';
32 3 ▶ $stdout_of_program = "> /dev/null 2>&1" if($self->debug == 0);
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug == 0 3 0 3
33
34 3 my $files_string = join (' ', @$prepared_input_files ); #Could be one shuffled file, or two files with forward and reverse reads
35  
36 3 system(
37 join(
38 ' ',
39 (
40 $self->sga_exec, 'preprocess',
41 '--pe-mode', $self->pe_mode,
42 #'--permute-ambiguous', # Do not randomly change ambiguous base calls - we would rather reads with ambiguous bases be thrown away
43 '--min-length', $self->min_length,
44 #'--quality-filter', $self->quality_filter, # Not doing any filtering since 1.3.2013
45 '--quality-trim', $self->quality_trim,
46 '--out', $self->output_filename,
47 $files_string,
48 $stdout_of_program
49 )
50 )
51 );
52
53 # Return to original cwd
54 3 chdir($original_cwd);
55 3 return $self;
56 }
57  
58 6 ▶sub _output_filename {
Subroutine _output_filename: called CC=1 SCAR=0.0
59 6 my ($self) = @_;
60 6 return join ('/', $self->_temp_directory, $self->output_filename);
61 }
62  
63 4 ▶sub _prepare_input_files {
Subroutine _prepare_input_files: called CC=2 SCAR=6.9
64 4 my ($self) = @_;
65 4 my @prepared_input_files;
66
67 # Unzip files if needed (into a temporary directory)
68 4 for my $filename ( @{ $self->input_files } ) {
69
70 7 push( @prepared_input_files, $self->_gunzip_file_if_needed( $filename,$self->_temp_directory));
71 }
72 4 return \@prepared_input_files;
73 }
74  
75  
76  
77 3 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
78 3 __PACKAGE__->meta->make_immutable;
79 3 1;
80  
81 __END__
« lib/Bio/AssemblyImprovement/AdapterRemoval/Trimmomatic/Main.pm ↑ Summary lib/Bio/AssemblyImprovement/FillGaps/GapFiller/Iterative.pm »