lib/Bio/Tradis/RunTradis.pm

filter: Statementstmt 48.7% 131 / 269 Branchbran 35.1% 19 / 54 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 22 / 33 Podpod 0.0% 0 / 1 totaltotal 48.1% 172 / 357 CC 31 SCAR 24.6
CC
31
Cov
46%
run_tradis
36.7
_stats
20.0
_make_plot
12.0
CRAP 11.7
« blib/lib/Bio/Tradis/CommandLine/PlotTradis.pm ↑ Summary lib/Bio/Tradis/Parser/Cigar.pm »
1 package Bio::Tradis::RunTradis;
2 2 $Bio::Tradis::RunTradis::VERSION = '1.4.1';
3 # ABSTRACT: Perform all steps required for a tradis analysis
4  
5  
6 2 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use File::Temp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use File::Path 'rmtree';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Bio::Tradis::FilterTags;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Bio::Tradis::RemoveTags;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Bio::Tradis::Map;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Bio::Tradis::TradisPlot;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Bio::Tradis::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use Bio::Tradis::Samtools;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 2 has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
18 2 has 'fastqfile' => ( is => 'rw', isa => 'Str', required => 1 );
19 2 has '_unzipped_fastq' =>
20 ( is => 'rw', isa => 'Str', lazy => 1, builder => '_build__unzipped_fastq' );
21 2 has 'tag' => ( is => 'ro', isa => 'Str', required => 1 );
22 2 has 'tagdirection' =>
23 ( is => 'ro', isa => 'Str', required => 1, default => '3' );
24 2 has 'mismatch' => ( is => 'rw', isa => 'Int', required => 1, default => 0 );
25 2 has 'mapping_score' =>
26 ( is => 'ro', isa => 'Int', required => 1, default => 30 );
27 2 has 'reference' => ( is => 'rw', isa => 'Str', required => 1 );
28 has 'outfile' => (
29 is => 'rw',
30 isa => 'Str',
31 required => 0,
32 default => sub {
33 1 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
34 1 my @dirs = split( '/', $self->fastqfile );
35 1 my $o = pop(@dirs);
36 1 $o =~ s/fastq/out/;
37 1 return $o;
38 }
39 2 );
40 2 has 'smalt_k' => ( is => 'rw', isa => 'Maybe[Int]', required => 0 );
41 2 has 'smalt_s' => ( is => 'rw', isa => 'Maybe[Int]', required => 0 );
42 2 has 'smalt_y' => ( is => 'rw', isa => 'Maybe[Num]', required => 0, default => 0.96 );
43 2 has 'smalt_r' => ( is => 'rw', isa => 'Maybe[Int]', required => 0, default => -1);
44 2 has 'smalt_n' => ( is => 'rw', isa => 'Maybe[Int]', required => 0, default => 1);
45 2 has 'samtools_exec' => ( is => 'rw', isa => 'Str', default => 'samtools' );
46  
47 2 has '_temp_directory' => (
48 is => 'rw',
49 isa => 'Str',
50 required => 0,
51 lazy => 1,
52 builder => '_build__temp_directory'
53 );
54 2 has 'output_directory' => (
55 is => 'rw',
56 isa => 'Str',
57 required => 0,
58 lazy => 1,
59 builder => '_build_output_directory'
60 );
61 2 has '_stats_handle' => ( is => 'ro', isa => 'FileHandle', required => 1 );
62 2 has '_sequence_info' => (
63 is => 'rw',
64 isa => 'HashRef',
65 required => 0,
66 lazy => 1,
67 builder => '_build__sequence_info'
68 );
69 2 has '_current_directory' => (
70 is => 'rw',
71 isa => 'Str',
72 required => 0,
73 lazy => 1,
74 builder => '_build__current_directory'
75 );
76  
77 sub _is_gz {
78 2 ▶ my ($self) = @_;
Subroutine _is_gz: called CC=2 SCAR=7.4
79 2 my $fq = $self->fastqfile;
80  
81 2 ▶ if ( $fq =~ /\.gz/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fq =~ /\.gz/) { } 0 2 2
82 0 return 1;
83 }
84 else {
85 2 return 0;
86 }
87 }
88  
89 sub _build__unzipped_fastq {
90 2 ▶ my ($self) = @_;
Subroutine _build__unzipped_fastq: called CC=3 SCAR=16.0
91 2 my $fq = $self->fastqfile;
92 2 my $temporary_directory = $self->_temp_directory;
93  
94 2 ▶ if ( $self->_is_gz ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_gz) { } 0 2 2
95 0 $fq =~ /([^\/]+)$/;
96 0 my $newfq = $1;
97 0 $newfq =~ s/\.gz//;
98 0 ▶ if ( !-e "$temporary_directory/$newfq" ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e "$temporary_directory/$newfq") 0 0 0
99 0 `gunzip -c $fq > $temporary_directory/$newfq`;
100 }
101 0 return "$temporary_directory/$newfq";
102 }
103 else {
104 2 return $fq;
105 }
106 }
107  
108 sub _build__stats_handle {
109 0 ▶ my ($self) = @_;
Subroutine _build__stats_handle: not called CC=1 SCAR=6.9
110 0 my $outfile = $self->outfile;
111  
112 0 open( my $stats, ">", "$outfile.stats" );
113 0 return $stats;
114 }
115  
116 sub _build__sequence_info {
117 0 ▶ my ($self) = @_;
Subroutine _build__sequence_info: not called CC=2 SCAR=17.9
118 0 my $temporary_directory = $self->_temp_directory;
119 0 open( GREP,
120 "grep \@SQ $temporary_directory/mapped.sam | awk '{print \$2, \$3}' |"
121 );
122 0 my %sns = ();
123 0 ▶ while ( my $sn = <GREP> ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $sn = readline GREP)) 0 0 0
124 0 chomp($sn);
125 0 $sn =~ /SN:(\S+)\s+LN:(\d+)/;
126 0 $sns{$1} = $2;
127 }
128 0 return \%sns;
129 }
130  
131 sub _build__temp_directory {
132 1 ▶ my ($self) = @_;
Subroutine _build__temp_directory: called CC=1 SCAR=0.0
133 1 my $tmp_dir = File::Temp->newdir( 'tmp_run_tradis_XXXXX',
134 CLEANUP => 0,
135 DIR => $self->output_directory );
136 1 return $tmp_dir->dirname;
137 }
138  
139 sub _build_output_directory {
140 0 ▶ return cwd();
Subroutine _build_output_directory: not called CC=1 SCAR=6.9
141 }
142  
143 sub _build__current_directory {
144 0 ▶ my ($self) = @_;
Subroutine _build__current_directory: not called CC=1 SCAR=6.9
145 0 my $fq = $self->fastqfile;
146  
147 0 my @dirs = split( '/', $fq );
148 0 pop(@dirs);
149 0 return join( '/', @dirs );
150 }
151  
152 sub run_tradis {
153 1 ▶ my ($self) = @_;
Subroutine run_tradis: called CC=12 SCAR=36.0
Pod undocumented
154 1 my $temporary_directory = $self->_temp_directory;
155 1 my $fq = $self->fastqfile;
156
157 1 my $ref = $self->reference;
158 1 ▶ Bio::Tradis::Exception::RefNotFound->throw( error => "$ref not found\n" ) unless( -e $ref );
Branch: 1 branch
BranchTrueFalseTotal
unless -e $ref 0 1 1
159  
160 1 ▶ print STDERR "::::::::::::::::::\n$fq\n::::::::::::::::::\n\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 1 1
161  
162 # Step 1: Filter tags that match user input tag
163 1 ▶ print STDERR "..........Step 1: Filter tags that match user input tag\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 1 1
164 1 $self->_filter;
165  
166 1 ▶ print STDERR "..........Step 1.1: Check that at least one read started with the tag\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 1 1
167 1 $self->_check_filter;
168  
169 # Step 2: Remove the tag from the sequence and quality strings
170 1 ▶ print STDERR
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 1 1
171 "..........Step 2: Remove the tag from the sequence and quality strings\n" if($self->verbose);
172 1 $self->_remove;
173  
174 # Step 3: Map file to reference
175 1 ▶ print STDERR "..........Step 3: Map file to reference\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 1 1
176 1 $self->_map;
177  
178 # Step 4: Convert output from SAM to BAM, sort and index
179 1 ▶ print STDERR
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 1 1
180 "..........Step 3.5: Convert output from SAM to BAM and sort\n" if($self->verbose);
181 1 $self->_sam2bam;
182 1 $self->_sort_bam;
183 0 $self->_bamcheck;
184  
185 # Step 5: Generate plot
186 0 ▶ print STDERR "..........Step 4: Generate plot\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 0 0
187 0 $self->_make_plot;
188  
189 # Step 6: Generate statistics
190 0 ▶ print STDERR "..........Step 5: Generate statistics\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 0 0
191 0 $self->_stats;
192  
193 # Step 7: Move files to current directory
194 0 ▶ print STDERR "..........Step 6: Move files to current directory\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 0 0
195 0 my $outfile = $self->outfile;
196 0 my $output_directory = $self->output_directory;
197 0 system("mv $temporary_directory/$outfile* $output_directory");
198 0 system("mv $temporary_directory/mapped.sort.bam $output_directory/$outfile.mapped.bam");
199 0 system("mv $temporary_directory/mapped.sort.bam.bai $output_directory/$outfile.mapped.bam.bai");
200 0 system("mv $temporary_directory/mapped.bamcheck $output_directory/$outfile.mapped.bamcheck");
201  
202 # Clean up
203 0 ▶ print STDERR "..........Clean up\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 0 0
204  
205 0 rmtree($temporary_directory);
206  
207 0 return 1;
208 }
209  
210 sub _filter {
211 2 ▶ my ($self) = @_;
Subroutine _filter: called CC=1 SCAR=0.0
212 2 my $temporary_directory = $self->_temp_directory;
213 2 my $fqfile = $self->_unzipped_fastq;
214 2 my $tag = $self->tag;
215 2 my $mm = $self->mismatch;
216  
217 2 my $filter = Bio::Tradis::FilterTags->new(
218 fastqfile => $fqfile,
219 tag => $tag,
220 mismatch => $mm,
221 outfile => "$temporary_directory/filter.fastq"
222 )->filter_tags;
223 }
224  
225 sub _check_filter {
226 8 ▶ my ($self) = @_;
Subroutine _check_filter: called CC=6 SCAR=17.9
227 8 my $temporary_directory = $self->_temp_directory;
228 8 my $filtered_file_filename = "$temporary_directory/filter.fastq";
229 8 ▶ open my $filtered_file, '<', $filtered_file_filename or
Branch: 1 branch
BranchTrueFalseTotal
open my $filtered_file, "<", $filtered_file_filename or "Bio::Tradis::Exception::TagFilterError"->throw("error", "There was a problem filtering reads by the specified tag. Please check all input files are Fastq formatted and that at least one read in each starts with the specified tag\n") 1 7 8
230 Bio::Tradis::Exception::TagFilterError->throw( error => "There was a problem filtering reads by the specified tag. Please check all input files are Fastq formatted and that at least one read in each starts with the specified tag\n" );
231 7 my @first_read_data;
232 7 ▶ while( my $line = <$filtered_file> ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $filtered_file)) 22 5 27
233 22 ▶ last if $. > 4;
Branch: 1 branch
BranchTrueFalseTotal
if $. > 4 2 20 22
234 20 chomp($line);
235 20 push @first_read_data, $line;
236 }
237 7 my $number_of_read_lines = scalar @first_read_data;
238 7 ▶ if ( $number_of_read_lines ne 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($number_of_read_lines ne 4) 3 4 7
239 # There wasn't enough data for a complete read
240 3 Bio::Tradis::Exception::TagFilterError->throw( error => "There was a problem filtering reads by the specified tag. Please check all input files are Fastq formatted and that at least one read in each starts with the specified tag\n" );
241 }
242 4 my $read_plus_sign = $first_read_data[2];
243 4 ▶ if ( $read_plus_sign ne '+' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($read_plus_sign ne "+") 1 3 4
244 # The first 'read' didn't have a '+' on the third line, suspicious
245 1 Bio::Tradis::Exception::TagFilterError->throw( error => "There was a problem filtering reads by the specified tag. Please check all input files are Fastq formatted and that at least one read in each starts with the specified tag\n" );
246 }
247 # I'm not proposing further (more detailed) validation here
248 3 close $filtered_file;
249 }
250  
251 sub _remove {
252 2 ▶ my ($self) = @_;
Subroutine _remove: called CC=1 SCAR=0.0
253 2 my $temporary_directory = $self->_temp_directory;
254 2 my $tag = $self->tag;
255 2 my $mm = $self->mismatch;
256  
257 2 my $rm_tags = Bio::Tradis::RemoveTags->new(
258 fastqfile => "$temporary_directory/filter.fastq",
259 tag => $tag,
260 mismatch => $mm,
261 outfile => "$temporary_directory/tags_removed.fastq"
262 )->remove_tags;
263 }
264  
265 sub _map {
266 2 ▶ my ($self) = @_;
Subroutine _map: called CC=1 SCAR=0.0
267 2 my $temporary_directory = $self->_temp_directory;
268  
269 2 my $ref = $self->reference;
270  
271 2 my $mapping = Bio::Tradis::Map->new(
272 fastqfile => "$temporary_directory/tags_removed.fastq",
273 reference => "$ref",
274 refname => "$temporary_directory/ref.index",
275 outfile => "$temporary_directory/mapped.sam",
276 smalt_k => $self->smalt_k,
277 smalt_s => $self->smalt_s,
278 smalt_y => $self->smalt_y,
279 smalt_r => $self->smalt_r,
280 smalt_n => $self->smalt_n
281 );
282 2 $mapping->index_ref;
283 2 $mapping->do_mapping;
284 }
285  
286 sub _sam2bam {
287 2 ▶ my ($self) = @_;
Subroutine _sam2bam: called CC=1 SCAR=0.0
288 2 my $temporary_directory = $self->_temp_directory;
289  
290 2 system(
291 $self->samtools_exec." view -b -o $temporary_directory/mapped.bam -S $temporary_directory/mapped.sam"
292 );
293 2 return 1;
294 }
295  
296 sub _sort_bam {
297 2 ▶ my ($self) = @_;
Subroutine _sort_bam: called CC=1 SCAR=0.4
298 2 my $temporary_directory = $self->_temp_directory;
299  
300 2 my $samtools_obj = Bio::Tradis::Samtools->new(exec => $self->samtools_exec, threads => $self->smalt_n);
301 2 $samtools_obj->run_sort("$temporary_directory/mapped.bam","$temporary_directory/mapped.sort.bam");
302 0 $samtools_obj->run_index("$temporary_directory/mapped.sort.bam");
303 0 return 1;
304 }
305  
306 sub _bamcheck {
307 0 ▶ my ($self) = @_;
Subroutine _bamcheck: not called CC=1 SCAR=6.9
308 0 my $temporary_directory = $self->_temp_directory;
309  
310 0 system(
311 $self->samtools_exec." stats $temporary_directory/mapped.sort.bam > $temporary_directory/mapped.bamcheck"
312 );
313 0 return 1;
314 }
315  
316 sub _make_plot {
317 0 ▶ my ($self) = @_;
Subroutine _make_plot: not called CC=3 SCAR=24.8
318 0 my $temporary_directory = $self->_temp_directory;
319 0 my $ref = $self->reference;
320 0 my $outfile = $self->outfile;
321 0 my $tr_d = $self->tagdirection;
322  
323 0 my $plot = Bio::Tradis::TradisPlot->new(
324 mappedfile => "$temporary_directory/mapped.sort.bam",
325 mapping_score => $self->mapping_score,
326 outfile => "$temporary_directory/$outfile"
327 )->plot;
328  
329 # if tag direction is 5, reverse plot columns
330 0 ▶ if ( $self->tagdirection eq '5' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->tagdirection eq 5) 0 0 0
331 0 ▶ print STDERR "Tag direction = 5. Reversing plot..\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 0 0
332 0 $self->_reverse_plots;
333 }
334 0 return 1;
335 }
336  
337 sub _reverse_plots {
338 0 ▶ my ($self) = @_;
Subroutine _reverse_plots: not called CC=3 SCAR=24.8
339 0 my $temporary_directory = $self->_temp_directory;
340 0 my $outfile = $self->outfile;
341 0 my @seqnames = keys %{ $self->_sequence_info };
342  
343 0 my @current_plots =
344 glob("$temporary_directory/$outfile.*.insert_site_plot.gz");
345  
346 0 foreach my $plotname (@current_plots) {
347 0 ▶ print STDERR "Reversing $plotname\n" if($self->verbose);
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 0 0
348  
349 #my $plotname = $self->_plotname($sn);
350 0 system("gunzip -c $plotname > $temporary_directory/tmp.plot");
351 0 system(
352 "awk '{ t = \$1; \$1 = \$2; \$2 = t; print; }' $temporary_directory/tmp.plot > rv_plot"
353 );
354 0 system("gzip -c rv_plot > $plotname");
355 }
356 0 unlink("$temporary_directory/tmp.plot");
357 0 unlink("rv_plot");
358 }
359  
360 sub _stats {
361 0 ▶ my ($self) = @_;
Subroutine _stats: not called CC=4 SCAR=30.0
362 0 my $outfile = $self->outfile;
363 0 my $temporary_directory = $self->_temp_directory;
364 0 my $fq = $self->_unzipped_fastq;
365 0 my $seq_info = $self->_sequence_info;
366  
367 #write header to stats file
368 0 $self->_write_stats_header;
369  
370 # Add file name and number of reads in it
371 0 my @fql = split( "/", $fq );
372 0 my $stats = "$fql[-1],";
373 0 my $total_reads = `wc $fq | awk '{print \$1/4}'`;
374 0 chomp($total_reads);
375 0 $stats .= "$total_reads,";
376  
377 # Matching reads
378 0 my $matching =
379 `wc $temporary_directory/filter.fastq | awk '{print \$1/4}'`;
380 0 chomp($matching);
381 0 $stats .= "$matching,";
382 0 $stats .= ( $matching / $total_reads ) * 100 . ",";
383  
384 # Mapped reads
385 0 my $mapped = $self->_number_of_mapped_reads;
386 0 $stats .= "$mapped,";
387 0 $stats .= ( $mapped / $matching ) * 100 . ",";
388  
389 # Unique insertion sites
390 0 my ( $total_uis, $total_seq_len );
391 0 foreach my $si ( keys %{$seq_info} ) {
392 0 my $plotname = $self->_plotname($si);
393 0 system(
394 "gunzip -c $temporary_directory/$plotname > $temporary_directory/tmp.plot"
395 );
396 0 my $uis = `grep -c -v "0 0" $temporary_directory/tmp.plot`;
397 0 chomp($uis);
398 0 $total_uis += $uis;
399 0 $stats .= "$uis,";
400 0 my $seqlen = ${$seq_info}{$si};
401 0 $total_seq_len += $seqlen;
402 0 my $uis_per_seqlen = "NaN";
403 0 ▶ $uis_per_seqlen = $seqlen / $uis if ( $uis > 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $uis > 0 0 0 0
404 0 chomp($uis_per_seqlen);
405 0 $stats .= "$uis_per_seqlen,";
406 }
407 0 $stats .= "$total_uis,";
408 0 my $t_uis_p_l = "NaN";
409 0 ▶ $t_uis_p_l = $total_seq_len / $total_uis if ( $total_uis > 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $total_uis > 0 0 0 0
410 0 $stats .= "$t_uis_p_l\n";
411 0 print { $self->_stats_handle } $stats;
412 }
413  
414 sub _write_stats_header {
415 0 ▶ my ($self) = @_;
Subroutine _write_stats_header: not called CC=2 SCAR=17.9
416 0 my @seqnames = keys %{ $self->_sequence_info };
417 0 my @fields = (
418 "File",
419 "Total Reads",
420 "Reads Matched",
421 "\% Matched",
422 "Reads Mapped",
423 "\% Mapped"
424 );
425 0 print { $self->_stats_handle } join( ",", @fields ) . ",";
426 0 foreach my $sn (@seqnames) {
427 0 print { $self->_stats_handle } "Unique Insertion Sites : $sn,";
428 0 print { $self->_stats_handle } "Seq Len/UIS : $sn,";
429 }
430 0 print { $self->_stats_handle } "Total Unique Insertion Sites,";
431 0 print { $self->_stats_handle } "Total Seq Len/Total UIS\n";
432 }
433  
434 sub _plotname {
435 0 ▶ my ( $self, $seq_name ) = @_;
Subroutine _plotname: not called CC=1 SCAR=6.9
436 0 my $outfile = $self->outfile;
437  
438 0 $seq_name =~ s/[^\w\d\.]/_/g;
439 0 my $plotfile_name = "$outfile.$seq_name.insert_site_plot.gz";
440 0 return $plotfile_name;
441 }
442  
443 sub _number_of_mapped_reads {
444 0 ▶ my ($self) = @_;
Subroutine _number_of_mapped_reads: not called CC=3 SCAR=24.8
445 0 my $temporary_directory = $self->_temp_directory;
446  
447 0 my $pars =
448 Bio::Tradis::Parser::Bam->new(
449 file => "$temporary_directory/mapped.bam" );
450 0 my $c = 0;
451 0 ▶ while ( $pars->next_read ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pars->next_read) 0 0 0
452 0 ▶ if ( $pars->is_mapped ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pars->is_mapped) 0 0 0
453 0 $c++;
454 }
455 }
456 0 return $c;
457 }
458  
459 2 __PACKAGE__->meta->make_immutable;
460 2 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
461 2 1;
462  
463 __END__
464  
465 =pod
466  
467 =encoding UTF-8
468  
469 =head1 NAME
470  
471 Bio::Tradis::RunTradis - Perform all steps required for a tradis analysis
472  
473 =head1 VERSION
474  
475 version 1.4.1
476  
477 =head1 SYNOPSIS
478  
479 Takes a fastq file with tags already attached, filters the tags matching user input,
480 removes the tags, maps to a reference (.fa) and generates insertion site plots for use in
481 Artemis (or other genome browsers), mapped BAM files for each lane and a statistical summary of the analysis.
482  
483 use Bio::Tradis::RunTradis;
484
485 my $pipeline = Bio::Tradis::RunTradis->new(
486 fastqfile => 'abc',
487 reference => 'abc',
488 tag => 'abc',
489 tagdirection => '5'|'3'
490 );
491 $pipeline->run_tradis();
492  
493 =head1 PARAMETERS
494  
495 =head2 Required
496  
497 =over
498  
499 =item * C<fastqfile> - file containing a list of fastqs (gzipped or raw) to run the
500 complete analysis on. This includes all (including
501 intermediary format conversion and sorting) steps starting from
502 filtering.
503  
504 =item * C<tag> - TraDIS tag to filter and then remove
505  
506 =item * C<reference> - path to/name of reference genome in fasta format (.fa)
507  
508 =back
509  
510 =head2 Optional
511  
512 =over
513  
514 =item * C<mismatch> - number of mismatches to allow when filtering/removing the tag. Default = 0
515  
516 =item * C<tagdirection> - direction of the tag, 5' or 3'. Default = 3
517  
518 =item * C<mapping_score> - cutoff value for mapping score when creating insertion site plots. Default = 30
519  
520 =back
521  
522 =head1 METHODS
523  
524 C<run_tradis> - run complete analysis with given parameters
525  
526 =head1 AUTHOR
527  
528 Carla Cummins <path-help@sanger.ac.uk>
529  
530 =head1 COPYRIGHT AND LICENSE
531  
532 This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
533  
534 This is free software, licensed under:
535  
536 The GNU General Public License, Version 3, June 2007
537  
538 =cut
« blib/lib/Bio/Tradis/CommandLine/PlotTradis.pm ↑ Summary lib/Bio/Tradis/Parser/Cigar.pm »