CLIPSeqTools/PreprocessApp/all.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 44 CC 1 SCAR 6.9
CC
1
Cov
0%
validate_args
2.0
run
2.0
BEGIN
2.0
CRAP 2.0
1 =head1 NAME
2  
3 CLIPSeqTools::PreprocessApp::all - Run all clipseqtools-preprocess analyses.
4  
5 =head1 SYNOPSIS
6  
7 clipseqtools-preprocess all [options/parameters]
8  
9 =head1 DESCRIPTION
10  
11 Runs all tools to process a CLIP-Seq FastQ file to a database compatible with clipseqtools.
12 Specifically it will:
13 1) Trim the adaptor sequence from the end of the reads.
14 2) Align the reads on a reference genome using STAR aligner.
15 3) Convert SAM file with alignments into an SQLite database table.
16 4) Annotate alignments with genic information.
17 5) Annotate alignments with Repeat Masker.
18 6) Annotate alignments with deletions.
19 7) Annotate alignments with conservation.
20  
21 =head1 OPTIONS
22  
23 Input.
24 --fastq <Str> FastQ file with the reads.
25 --adaptor <Str> adaptor sequence.
26 --star_genome <Str> directory with STAR genome index.
27 --rmsk <Str> BED file with repeat masker regions.
28 --gtf <Str> GTF file with genes/transcripts.
29  
30 Output
31 --o_prefix <Str> output path prefix. Script will create and add
32 extension to path. Default: ./
33  
34 Other input
35 --rname_sizes <Str> file with sizes for reference alignment
36 sequences (rnames). Must be tab delimited
37 (chromosome\tsize) with one line per rname.
38 --cons_dir <Str> directory with phastCons or phyloP files.
39  
40 Other options.
41 --cutadapt_path <Str> path to cutadapt executable. [Default: cutadapt].
42 --star_path <Str> path to STAR executable. [Default: STAR].
43 --threads <Int> number of threads to use. [Default: 4].
44 -v --verbose print progress lines and extra information.
45 -h -? --usage --help print help message
46  
47 =cut
48  
49 package CLIPSeqTools::PreprocessApp::all;
50 $CLIPSeqTools::PreprocessApp::all::VERSION = '1.0.0';
51  
52 # Make it an app command
53 use MooseX::App::Command;
54 extends 'CLIPSeqTools::PreprocessApp';
55  
56  
57 #######################################################################
58 ####################### Load External modules #####################
59 #######################################################################
60 use Modern::Perl;
61 use autodie;
62 use namespace::autoclean;
63  
64  
65 #######################################################################
66 ####################### Command line options ######################
67 #######################################################################
68 option 'fastq' => (
69 is => 'rw',
70 isa => 'Str',
71 required => 1,
72 documentation => 'FastQ file with the reads.',
73 );
74  
75 option 'adaptor' => (
76 is => 'rw',
77 isa => 'Str',
78 required => 1,
79 documentation => 'adaptor sequence.',
80 );
81  
82 option 'cutadapt_path' => (
83 is => 'rw',
84 isa => 'Str',
85 default => 'cutadapt',
86 documentation => 'path to cutadapt executable.',
87 );
88  
89 option 'star_genome' => (
90 is => 'rw',
91 isa => 'Str',
92 required => 1,
93 documentation => 'directory with STAR genome index.',
94 );
95  
96 option 'star_path' => (
97 is => 'rw',
98 isa => 'Str',
99 default => 'STAR',
100 documentation => 'path to STAR executable.',
101 );
102  
103 option 'threads' => (
104 is => 'rw',
105 isa => 'Int',
106 default => 4,
107 documentation => 'number of threads to use.',
108 );
109  
110 option 'rmsk' => (
111 is => 'rw',
112 isa => 'Str',
113 required => 1,
114 documentation => 'BED file with repeat masker regions.',
115 );
116  
117 option 'rname_sizes' => (
118 is => 'rw',
119 isa => 'Str',
120 required => 1,
121 documentation => 'file with sizes for reference alignment sequences (rnames). Must be tab delimited (chromosome\tsize) with one line per rname.',
122 );
123  
124 option 'cons_dir' => (
125 is => 'rw',
126 isa => 'Str',
127 required => 1,
128 documentation => 'directory with phastCons or phyloP files.',
129 );
130  
131  
132 #######################################################################
133 ########################## Consume Roles ##########################
134 #######################################################################
135 with
136 "CLIPSeqTools::Role::Option::Genes" => {
137 -alias => { validate_args => '_validate_args_for_genes' },
138 -excludes => 'validate_args',
139 },
140 "CLIPSeqTools::Role::Option::OutputPrefix" => {
141 -alias => { validate_args => '_validate_args_for_output_prefix' },
142 -excludes => 'validate_args',
143 };
144  
145  
146 #######################################################################
147 ######################## Interface Methods ########################
148 #######################################################################
149 sub validate_args {
150 my ($self) = @_;
151  
152 $self->_validate_args_for_plot;
153 $self->_validate_args_for_output_prefix;
154 }
155  
156 sub run {
157 my ($self) = @_;
158  
159 CLIPSeqTools::PreprocessApp->initialize_command_class('CLIPSeqTools::PreprocessApp::cut_adaptor',
160 fastq => $self->fastq,
161 adaptor => $self->adaptor,
162 o_prefix => $self->o_prefix,
163 cutadapt_path => $self->cutadapt_path,
164 verbose => $self->verbose,
165 )->run();
166  
167 CLIPSeqTools::PreprocessApp->initialize_command_class('CLIPSeqTools::PreprocessApp::star_alignment',
168 fastq => $self->o_prefix . 'reads.adtrim.fastq',
169 star_genome => $self->star_genome,
170 o_prefix => $self->o_prefix . 'reads.adtrim.',,
171 star_path => $self->star_path,
172 threads => $self->threads,
173 verbose => $self->verbose,
174 )->run();
175  
176 CLIPSeqTools::PreprocessApp->initialize_command_class('CLIPSeqTools::PreprocessApp::cleanup_alignment',
177 sam => $self->o_prefix . 'reads.adtrim.star_Aligned.out.sam',
178 o_prefix => $self->o_prefix . 'reads.adtrim.star_Aligned.out.',
179 verbose => $self->verbose,
180 )->run();
181  
182 CLIPSeqTools::PreprocessApp->initialize_command_class('CLIPSeqTools::PreprocessApp::sam_to_sqlite',
183 sam_file => $self->o_prefix . 'reads.adtrim.star_Aligned.out.single.sorted.collapsed.sam',
184 database => $self->o_prefix . 'reads.adtrim.star_Aligned.out.single.sorted.collapsed.db',
185 table => 'sample',
186 drop => 1,
187 verbose => $self->verbose,
188 )->run();
189  
190 CLIPSeqTools::PreprocessApp->initialize_command_class('CLIPSeqTools::PreprocessApp::annotate_with_genic_elements',
191 database => $self->o_prefix.'reads.adtrim.star_Aligned.out.single.sorted.collapsed.db',
192 table => 'sample',
193 gtf => $self->gtf,
194 drop => 1,
195 verbose => $self->verbose,
196 )->run();
197  
198 CLIPSeqTools::PreprocessApp->initialize_command_class('CLIPSeqTools::PreprocessApp::annotate_with_file',
199 database => $self->o_prefix.'reads.adtrim.star_Aligned.out.single.sorted.collapsed.db',
200 table => 'sample',
201 a_file => $self->rmsk,
202 column => 'rmsk',
203 both_strands => 1,
204 verbose => $self->verbose,
205 )->run();
206  
207 CLIPSeqTools::PreprocessApp->initialize_command_class('CLIPSeqTools::PreprocessApp::annotate_with_deletions',
208 database => $self->o_prefix.'reads.adtrim.star_Aligned.out.single.sorted.collapsed.db',
209 table => 'sample',
210 drop => 1,
211 verbose => $self->verbose,
212 )->run();
213  
214 CLIPSeqTools::PreprocessApp->initialize_command_class('CLIPSeqTools::PreprocessApp::annotate_with_conservation',
215 database => $self->o_prefix.'reads.adtrim.star_Aligned.out.single.sorted.collapsed.db',
216 table => 'sample',
217 cons_dir => $self->cons_dir,
218 rname_sizes => $self->rname_sizes,
219 drop => 1,
220 verbose => $self->verbose,
221 )->run();
222 }
223  
224 1;