CLIPSeqTools/PreprocessApp/cut_adaptor.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 49 CC 6 SCAR 31.7
CC
6
Cov
0%
run
42.0
validate_args
2.0
BEGIN
2.0
CRAP 23.8
1 =head1 NAME
2  
3 CLIPSeqTools::PreprocessApp::cut_adaptor - Cut the adaptor sequence from the 3'end of reads.
4  
5 =head1 SYNOPSIS
6  
7 clipseqtools-preprocess cut_adaptor [options/parameters]
8  
9 =head1 DESCRIPTION
10  
11 Cut the adaptor sequence from the 3'end of reads.
12 Uses cutadapt to remove the adaptor which is usually ligated at the 3'end of reads.
13  
14 =head1 OPTIONS
15  
16 Input.
17 --fastq <Str> FastQ file with the reads.
18 --adaptor <Str> adaptor sequence.
19  
20 Output
21 --o_prefix <Str> output path prefix. Script will create and add
22 extension to path. [Default: ./]
23  
24 Other options.
25 --cutadapt_path <Str> path to cutadapt executable. [Default: cutadapt].
26 -v --verbose print progress lines and extra information.
27 -h -? --usage --help print help message
28  
29 =cut
30  
31 package CLIPSeqTools::PreprocessApp::cut_adaptor;
32 $CLIPSeqTools::PreprocessApp::cut_adaptor::VERSION = '1.0.0';
33  
34 # Make it an app command
35 use MooseX::App::Command;
36 extends 'CLIPSeqTools::PreprocessApp';
37  
38  
39 #######################################################################
40 ####################### Load External modules #####################
41 #######################################################################
42 use Modern::Perl;
43 use autodie;
44 use namespace::autoclean;
45  
46  
47 #######################################################################
48 ####################### Command line options ######################
49 #######################################################################
50 option 'fastq' => (
51 is => 'rw',
52 isa => 'Str',
53 required => 1,
54 documentation => 'FastQ file with the reads.',
55 );
56  
57 option 'adaptor' => (
58 is => 'rw',
59 isa => 'Str',
60 required => 1,
61 documentation => 'adaptor sequence.',
62 );
63  
64 option 'cutadapt_path' => (
65 is => 'rw',
66 isa => 'Str',
67 default => 'cutadapt',
68 documentation => 'path to cutadapt executable.',
69 );
70  
71 #######################################################################
72 ########################## Consume Roles ##########################
73 #######################################################################
74 with
75 "CLIPSeqTools::Role::Option::OutputPrefix" => {
76 -alias => { validate_args => '_validate_args_for_output_prefix' },
77 -excludes => 'validate_args',
78 };
79  
80
81 #######################################################################
82 ######################## Interface Methods ########################
83 #######################################################################
84 sub validate_args {
85 my ($self) = @_;
86
87 $self->_validate_args_for_output_prefix;
88 }
89  
90 sub run {
91 my ($self) = @_;
92
93 warn "Starting job: cut_adaptor\n";
94
95 warn "Validating arguments\n" if $self->verbose;
96 $self->validate_args();
97
98 warn "Preparing command\n" if $self->verbose;
99 my $cmd = join(' ',
100 $self->cutadapt_path,
101 $self->fastq,
102 '-n 3',
103 '-m 15',
104 '-e 0.25',
105 '-a ' . $self->adaptor,
106 '-o ' . $self->o_prefix . 'reads.adtrim.fastq'
107 );
108
109 warn "Creating output path\n" if $self->verbose;
110 $self->make_path_for_output_prefix();
111
112 warn "Running cutadapt\n" if $self->verbose;
113 warn "Command: $cmd\n" if $self->verbose;
114 system "$cmd";
115 }
116  
117  
118 1;