Tools/Run/Vista.pm

filter: Statementstmt 12.7% 31 / 244 Branchbran 1.9% 2 / 102 Conditioncond 2.3% 1 / 43 MC/DCmcdc 0.0% 0 / 27 Subroutinesub 38.1% 8 / 21 Podpod 100% 4 / 4 totaltotal 10.4% 46 / 441 CC 79 SCAR 58.6
CC
79
Cov
9%
_make_plotfile
992.0
_mf2bin
182.0
java
90.0
CRAP 351.8
« Tools/Run/StandAloneBlastPlus.pm ↑ Summary Tools/Run/TribeMCL.pm »
1 # Please direct questions and support issues to <bioperl-l@bioperl.org>
2 #
3 # Cared for by Shawn Hoon
4 #
5 # Copyright Shawn Hoon
6 #
7 # You may distribute this module under the same terms as perl itself
8  
9 # POD documentation - main docs before the code
10  
11 =head1 NAME
12  
13 Bio::Tools::Run::Vista
14  
15 Wrapper for Vista
16  
17 =head1 SYNOPSIS
18  
19 use Bio::Tools::Run::Vista;
20 use Bio::Tools::Run::Alignment::Lagan;
21 use Bio::AlignIO;
22  
23 my $sio = Bio::SeqIO->new(-file=>$ARGV[0],-format=>'genbank');
24 my @seq;
25 my $reference = $sio->next_seq;
26 push @seq, $reference;
27 while(my $seq = $sio->next_seq){
28 push @seq,$seq;
29 }
30 my @features = grep{$_->primary_tag eq 'CDS'} $reference->get_SeqFeatures;
31  
32 my $lagan = Bio::Tools::Run::Alignment::Lagan->new;
33  
34 my $aln = $lagan->mlagan(\@seq,'(fugu (mouse human))');
35  
36  
37 my $vis = Bio::Tools::Run::Vista->new('outfile'=>"outfile.pdf",
38 'title' => "My Vista Plot",
39 'annotation'=>\@features,
40 'annotation_format'=>'GFF',
41 'min_perc_id'=>75,
42 'min_length'=>100,
43 'plotmin' => 50,
44 'tickdist' => 2000,
45 'window'=>40,
46 'numwindows'=>4,
47 'start'=>50,
48 'end'=>1500,
49 'tickdist'=>100,
50 'bases'=>1000,
51 'java_param'=>"-Xmx128m",
52 'num_pages'=>1,
53 'color'=> {'EXON'=>'100 0 0',
54 'CNS'=>'0 0 100'},
55 'quiet'=>1);
56  
57 my $referenceid= 'human';
58 $vis->run($aln,$referenceid);
59  
60 #alternative one can choose pairwise alignments to plot
61 #where the second id in each pair is the reference sequence
62 $vis->run($aln,([mouse,human],[fugu,human],[mouse,fugu]));
63  
64 =head1 DESCRIPTION
65  
66 Pls see Vista documentation for plotfile options
67  
68 Wrapper for Vista :
69  
70 C. Mayor, M. Brudno, J. R. Schwartz, A. Poliakov, E. M. Rubin, K. A. Frazer,
71 L. S. Pachter, I. Dubchak.
72 VISTA: Visualizing global DNA sequence alignments of arbitrary length.
73 Bioinformatics, 2000 Nov;16(11):1046-1047.
74 Get it here:
75 http://www-gsd.lbl.gov/vista/VISTAdownload2.html
76  
77 On the command line, it is assumed that this can be executed:
78  
79 java Vista plotfile
80  
81 Some of the code was adapted from MLAGAN toolkit
82  
83 M. Brudno, C.B. Do, G. Cooper, M.F. Kim, E. Davydov, NISC Sequencing Consortium,
84 E.D. Green, A. Sidow and S. Batzoglou
85 LAGAN and Multi-LAGAN: Efficient Tools for Large-Scale Multiple Alignment of Genomic
86 DNA, Genome Research, in press
87  
88 get lagan here:
89  
90 http://lagan.stanford.edu/
91  
92 =head1 FEEDBACK
93  
94 =head2 Mailing Lists
95  
96 User feedback is an integral part of the evolution of this and other
97 Bioperl modules. Send your comments and suggestions preferably to one
98 of the Bioperl mailing lists. Your participation is much appreciated.
99  
100 bioperl-l@bioperl.org - General discussion
101 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
102  
103 =head2 Support
104  
105 Please direct usage questions or support issues to the mailing list:
106  
107 I<bioperl-l@bioperl.org>
108  
109 rather than to the module maintainer directly. Many experienced and
110 reponsive experts will be able look at the problem and quickly
111 address it. Please include a thorough description of the problem
112 with code and data examples if at all possible.
113  
114 =head2 Reporting Bugs
115  
116 Report bugs to the Bioperl bug tracking system to help us keep track
117 the bugs and their resolution. Bug reports can be submitted via the
118 web:
119  
120 http://redmine.open-bio.org/projects/bioperl/
121  
122 =head1 AUTHOR
123  
124 Shawn Hoon
125 Email shawnh@fugu-sg.org
126  
127 =head1 APPENDIX
128  
129 The rest of the documentation details each of the object
130 methods. Internal methods are usually preceded with a _
131  
132 =cut
133  
134 package Bio::Tools::Run::Vista;
135  
136 1 ▶use vars qw($AUTOLOAD @ISA %DEFAULT_VALUES %EPONINE_PARAMS
Subroutine BEGIN: called CC=1 SCAR=0.0
137 @VISTA_PARAMS $EPOJAR $JAVA $PROGRAMDIR $PROGRAMNAME $PROGRAM
138 1 %OK_FIELD);
139 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
140  
141 1 ▶use Bio::Root::Root;
Subroutine BEGIN: called CC=1 SCAR=0.0
142 1 ▶use Bio::Seq;
Subroutine BEGIN: called CC=1 SCAR=0.0
143 1 ▶use Bio::Root::IO;
Subroutine BEGIN: called CC=1 SCAR=0.0
144 1 ▶use Bio::Tools::Run::WrapperBase;
Subroutine BEGIN: called CC=1 SCAR=0.0
145 1 ▶use File::Copy;
Subroutine BEGIN: called CC=1 SCAR=0.0
146 1 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
147  
148 1 ▶BEGIN {
Subroutine BEGIN: called CC=8 SCAR=29.6
149 1 $PROGRAMNAME = 'java';
150  
151 1 ▶ if( ! defined $PROGRAMDIR ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $Bio::Tools::Run::Vista::PROGRAMDIR) 1 0 1
152 1 ▶ $PROGRAMDIR = $ENV{'JAVA_HOME'} || $ENV{'JAVA_DIR'};
Condition33%1/3
$ENV{'JAVA_HOME'} || $ENV{'JAVA_DIR'}
l!l&&r!l&&!r
001
MC/DC0%0/2
$ENV{'JAVA_HOME'} || $ENV{'JAVA_DIR'}
$ENV{'JAVA_HOME'} $ENV{'JAVA_DIR'}
Truth table33%1/3
A || B
A= $ENV{'JAVA_HOME'}B= $ENV{'JAVA_DIR'}
ABresult
1X1
011
000
153 }
154 1 ▶ if (defined $PROGRAMDIR) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Bio::Tools::Run::Vista::PROGRAMDIR) 0 1 1
155 0 foreach my $progname ( [qw(java)],[qw(bin java)] ) {
156 0 my $f = Bio::Root::IO->catfile($PROGRAMDIR, @$progname);
157 0 ▶ if( -e $f && -x $f ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $f and -x $f) 0 0 0
Condition0%0/3
-e $f and -x $f
!ll&&!rl&&r
000
MC/DC0%0/2
-e $f and -x $f
-e $f -x $f
Truth table0%0/3
A and B
A= -e $fB= -x $f
ABresult
0X0
100
111
158 0 $PROGRAM = $f;
159 0 last;
160 }
161 }
162 }
163  
164 1 %DEFAULT_VALUES= ('java' => 'java',
165 'min_perc_id' => 75,
166 'min_length' => 100,
167 'plotmin' => 50,
168 'bases' => 10000,
169 'tickdist' => 2000,
170 'resolution'=> 25,
171 'window' => 40,
172 'title' => 'VISTA PLOT',
173 'numwindows'=>4);
174  
175 1 @VISTA_PARAMS=qw(JAVA JAVA_PARAM OUTFILE MIN_PERC_ID QUIET VERBOSE ANNOTATION_FORMAT
176 REGION_FILE REGION_FILE_DIR SCORE_FILE SCORE_FILE_DIR ALIGNMENT_FILE_DIR
177 ALIGNMENT_FILE CONTIGS_FILE DIFFS PLOTFILE
178 MIN_LENGTH PLOTMIN ANNOTATION BASES TICKDIST RESOLUTION TITLE PAPER
179 WINDOW NUMWINDOWS START END NUM_PLOT_LINES LEGEND FILENAME NUM_PAGES
180 AXIS_LABEL TICKS_FILE COLOR USE_ORDER GAPS SNPS_FILE REPEATS_FILE
181 FILTER_REPEATS);
182  
183 1 foreach my $attr ( @VISTA_PARAMS)
184 40 { $OK_FIELD{$attr}++; }
185 }
186  
187 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=3 SCAR=24.8
188 0 my $self = shift;
189 0 my $attr = $AUTOLOAD;
190 0 $self->debug( "************ attr: $attr\n");
191 0 $attr =~ s/.*:://;
192 0 $attr = uc $attr;
193 0 ▶ $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $Bio::Tools::Run::Vista::OK_FIELD{$attr} 0 0 0
194 0 ▶ $self->{$attr} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
195 0 return $self->{$attr};
196 }
197  
198 =head2 new
199  
200 Title : new
201 Usage : my $vis = Bio::Tools::Run::Vista->new('outfile'=>$out,
202 'title' => "My Vista Plot",
203 'annotation'=>\@features,
204 'annotation_format'=>'GFF',
205 'min_perc_id'=>75,
206 'min_length'=>100,
207 'plotmin' => 50,
208 'tickdist' => 2000,
209 'window'=>40,
210 'numwindows'=>4,
211 'start'=>50,
212 'end'=>1500,
213 'tickdist'=>100,
214 'bases'=>1000,
215 'color'=> {'EXON'=>'100 0 0',
216 'CNS'=>'0 0 100'},
217 'quiet'=>1);
218 Function: Construtor for Vista wrapper
219 Args : outfile - location of the pdf generated
220 annotation - either a file or and array ref of Bio::SeqFeatureI
221 indicating the exons
222 regmin -region min
223  
224 =cut
225  
226 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
227 0 my ($caller, @args) = @_;
228 # chained new
229 0 my $self = $caller->SUPER::new(@args);
230 # so that tempfiles are cleaned up
231 0 foreach my $key(keys %DEFAULT_VALUES){
232 0 $self->$key($DEFAULT_VALUES{$key});
233 }
234 0 ▶ while (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
235 0 my $attr = shift @args;
236 0 my $value = shift @args;
237 0 ▶ next if( $attr =~ /^-/ ); # don't want named parameters
Branch: 1 branch
BranchTrueFalseTotal
if $attr =~ /^-/ 0 0 0
238 0 $self->$attr($value);
239 }
240  
241 0 return $self;
242 }
243  
244 =head2 java
245  
246 Title : java
247 Usage : $obj->java('/usr/opt/java130/bin/java');
248 Function: Get/set method for the location of java VM
249 Args : File path (optional)
250  
251 =cut
252  
253 0 ▶sub executable { shift->java(@_); }
Subroutine executable: not called CC=1 SCAR=6.9
Pod documented
254  
255 0 ▶sub java {
Subroutine java: not called CC=9 SCAR=45.0
Pod documented
256 0 my ($self, $exe,$warn) = @_;
257  
258 0 ▶ if( defined $exe ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $exe) 0 0 0
259 0 $self->{'_pathtojava'} = $exe;
260 }
261  
262 0 ▶ unless( defined $self->{'_pathtojava'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_pathtojava"}) 0 0 0
263 0 ▶ if( $PROGRAM && -e $PROGRAM && -x $PROGRAM ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Bio::Tools::Run::Vista::PROGRAM and -e $Bio::Tools::Run::Vista::PROGRAM and -x $Bio::Tools::Run::Vista::PROGRAM) { } 0 0 0
Condition0%0/6
$Bio::Tools::Run::Vista::PROGRAM and -e $Bio::Tools::Run::Vista::PROGRAM and -x $Bio::Tools::Run::Vista::PROGRAM
!ll&&!rl&&r
000
$Bio::Tools::Run::Vista::PROGRAM and -e $Bio::Tools::Run::Vista::PROGRAM
!ll&&!rl&&r
000
MC/DC0%0/3
$Bio::Tools::Run::Vista::PROGRAM and -e $Bio::Tools::Run::Vista::PROGRAM and -x $Bio::Tools::Run::Vista::PROGRAM
$Bio::Tools::Run::Vista::PROGRAM -e $Bio::Tools::Run::Vista::PROGRAM -x $Bio::Tools::Run::Vista::PROGRAM
Truth table0%0/4
A and B and C
A= $Bio::Tools::Run::Vista::PROGRAMB= -e $Bio::Tools::Run::Vista::PROGRAMC= -x $Bio::Tools::Run::Vista::PROGRAM
ABCresult
0XX0
10X0
1100
1111
264 0 $self->{'_pathtojava'} = $PROGRAM;
265 } else {
266 0 my $exe;
267 0 ▶ if( ( $exe = $self->io->exists_exe($PROGRAMNAME) ) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($exe = $self->io->exists_exe($Bio::Tools::Run::Vista::PROGRAMNAME) and -x $exe) { } 0 0 0
Condition0%0/3
$exe = $self->io->exists_exe($Bio::Tools::Run::Vista::PROGRAMNAME) and -x $exe
!ll&&!rl&&r
000
MC/DC0%0/2
$exe = $self->io->exists_exe($Bio::Tools::Run::Vista::PROGRAMNAME) and -x $exe
$exe = $self->io->exists_exe($Bio::Tools::Run::Vista::PROGRAMNAME) -x $exe
Truth table0%0/3
A and B
A= $exe = $self->io->exists_exe($Bio::Tools::Run::Vista::PROGRAMNAME)B= -x $exe
ABresult
0X0
100
111
268 -x $exe ) {
269 0 $self->{'_pathtojava'} = $exe;
270 } else {
271 0 ▶ $self->warn("Cannot find executable for $PROGRAMNAME") if $warn;
Branch: 1 branch
BranchTrueFalseTotal
if $warn 0 0 0
272 0 $self->{'_pathtojava'} = undef;
273 }
274 }
275 }
276 0 $self->{'_pathtojava'};
277 }
278  
279  
280 =head2 run
281  
282 Title : run
283 Usage : my @genes = $self->run($seq)
284 Function: runs Vista
285 Returns : A boolean 1 if no errors
286 Args : Argument 1: Bio::Align::Align required
287 Argument 2: a string or number, which is the sequence id of the
288 reference sequence or the rank of the sequence
289 in the alignment
290  
291 =cut
292  
293 0 ▶sub run{
Subroutine run: not called CC=2 SCAR=17.9
Pod documented
294 0 my ($self,$align,$ref) = @_;
295 0 ▶ $ref ||=1;
Condition0%0/2
$ref ||= 1
l!l
00
MC/DC0%0/1
$ref ||= 1
$ref
Truth table0%0/2
A
A= $ref
Aresult
11
00
296 0 my $infile = $self->_setinput($align,$ref);
297 0 return $self->_run_Vista($infile);
298  
299 }
300  
301 =head2 _setinput
302  
303 Title : _setinput
304 Usage : Internal function, not to be called directly
305 Function: writes input sequence to file and return the file name
306 Example :
307 Returns : string
308 Args :
309  
310 =cut
311  
312 0 ▶sub _setinput {
Subroutine _setinput: not called CC=1 SCAR=6.9
313 0 my ($self,$sim_aln,$ref) = @_;
314 0 my($pairs,$files) = $self->_mf2bin($sim_aln,$ref);
315 0 my $plotfile = $self->_make_plotfile($sim_aln,$pairs,$files);
316 0 return $plotfile;
317 }
318  
319 0 ▶sub _parse_multi_fasta {
Subroutine _parse_multi_fasta: not called CC=6 SCAR=37.4
320 0 my ($self,$file) = @_;
321 0 my %seq;
322 0 ▶ open(FASTA, $file) || $self->throw("Couldn't open $file");
Branch: 1 branch
BranchTrueFalseTotal
open FASTA, $file or $self->throw("Couldn't open $file") 0 0 0
323 0 my $last;
324 0 my $count = 0;
325 0 ▶ while (my $line = <FASTA>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline FASTA)) 0 0 0
326 0 chomp $line;
327 0 ▶ next if $line=~/^$/;
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^$/ 0 0 0
328 0 ▶ if (substr($line, 0, 1) eq ">") {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($line, 0, 1) eq '>') { } 0 0 0
329 0 $_ = substr($line, 1);
330 0 /\w+/g;
331 0 $seq{$&} = "";
332 0 $last = $&;
333 } else {
334 0 $seq{$last}.=$line;
335 }
336 0 print STDERR $count."\n";
337 0 $count++;
338 }
339 0 my @seq;
340  
341 0 foreach my $key(keys %seq){
342 0 my $seq = Bio::Seq->new(-id=>$key,-seq=>$seq{$key});
343 0 push @seq,$seq;
344 }
345 0 return @seq;
346 }
347  
348 #adapted from mlagan utils mf2bin.pl
349 0 ▶sub _mf2bin {
Subroutine _mf2bin: not called CC=13 SCAR=52.0
350 0 my ($self,$sim,$ref)= @_;
351 0 my @seq;
352 0 ▶ if(!ref $sim){
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $sim) { } 0 0 0
353 0 @seq = $self->_parse_multi_fasta($sim);
354 }
355 else {
356 0 ▶ ($sim && $sim->isa("Bio::Align::AlignI")) || $self->throw("Expecting a Bio::Align::AlignI");
Branch: 1 branch
BranchTrueFalseTotal
$sim and $sim->isa("Bio::Align::AlignI") or $self->throw("Expecting a Bio::Align::AlignI") 0 0 0
Condition0%0/3
$sim and $sim->isa("Bio::Align::AlignI")
!ll&&!rl&&r
000
MC/DC0%0/2
$sim and $sim->isa("Bio::Align::AlignI")
$sim $sim->isa("Bio::Align::AlignI")
Truth table0%0/3
A and B
A= $simB= $sim->isa("Bio::Align::AlignI")
ABresult
0X0
100
111
357 0 @seq = $sim->each_seq;
358 }
359 0 my $reference;
360 my @files;
361 0 my @pairs;
362 0 ▶ if(ref($ref) eq 'ARRAY'){
Branch: 2 branches
BranchTrueFalseTotal
if (ref $ref eq 'ARRAY') { } 0 0 0
elsif ($ref =~ /^\d+$/) { } 0 0 0
363 0 my @ref;
364 0 foreach my $set(@$ref){
365 0 my ($reference) = grep{$_->id eq $set->[1]}@seq;
366 0 my ($other) = grep{$_->id eq $set->[0]}@seq;
367 0 my ($pair,$file) = $self->_pack_bin($reference,$other);
368 0 push @pairs, @$pair;
369 0 push @files, @$file;
370 0 push @ref,$set->[1];
371 }
372 0 $self->_coordinate(\@ref);
373 0 return \@pairs,\@files;
374  
375 }
376 #figure out the reference sequence
377 elsif($ref =~/^\d+$/){ #its a rank index
378 0 $reference = $seq[$ref-1];
379 0 my $tmp = $ref;
380 0 $ref = $reference->id;
381 0 splice @seq,($tmp-1),1;
382 }
383 else { #its an id
384 0 foreach my $i(0..$#seq){
385 0 ▶ if($seq[$i]->id =~/$ref/){
Branch: 1 branch
BranchTrueFalseTotal
if ($seq[$i]->id =~ /$ref/) 0 0 0
386 0 $reference = $seq[$i];
387 0 splice @seq,($i),1;
388 0 last;
389 }
390 }
391 }
392 0 $self->_coordinate([$ref]);
393  
394 # pack bin
395 # format from Alex Poliakov's glass2bin.pl script
396 0 my %base_code = ('-' => 0, 'A' => 1, 'C' => 2, 'T' => 3, 'G' => 4, 'N' => 5,
397 'a' => 1, 'c' => 2, 't' => 3, 'g' => 4, 'n' => 5);
398  
399  
400 0 my @ref= (split ('',$reference->seq));
401  
402 0 foreach my $seq2(@seq){
403 0 my ($tfh1,$outfile) = $self->io->tempfile(-dir=>$self->tempdir);
404 0 my @seq2= (split('', $seq2->seq));
405 0 foreach my $index(0..$#ref){
406 0 ▶ unless($ref[$index] eq '-' && $seq2[$index] eq '-'){
Branch: 1 branch
BranchTrueFalseTotal
unless ($ref[$index] eq "-" and $seq2[$index] eq "-") 0 0 0
Condition0%0/3
$ref[$index] eq "-" and $seq2[$index] eq "-"
!ll&&!rl&&r
000
MC/DC0%0/2
$ref[$index] eq "-" and $seq2[$index] eq "-"
$ref[$index] eq "-" $seq2[$index] eq "-"
Truth table0%0/3
A and B
A= $ref[$index] eq "-"B= $seq2[$index] eq "-"
ABresult
0X0
100
111
407 0 print $tfh1 pack("H2",$base_code{$ref[$index]}.$base_code{$seq2[$index]});
408 }
409 }
410 0 close ($tfh1);
411 0 undef ($tfh1);
412 0 push @files, $outfile;
413 0 push @pairs,[$reference->id,$seq2->id];
414 }
415 0 return \@pairs,\@files;
416 }
417  
418 0 ▶sub _pack_bin {
Subroutine _pack_bin: not called CC=4 SCAR=30.0
419 0 my ($self,$first,$sec) = @_;
420 0 my @first = (split('',$first->seq));
421 0 my @sec = (split('',$sec->seq));
422 # pack bin
423 # format from Alex Poliakov's glass2bin.pl script
424 0 my %base_code = ('-' => 0, 'A' => 1, 'C' => 2, 'T' => 3, 'G' => 4, 'N' => 5,
425 'a' => 1, 'c' => 2, 't' => 3, 'g' => 4, 'n' => 5);
426 0 my @files;
427 my @pairs;
428 0 my ($tfh1,$outfile) = $self->io->tempfile(-dir=>$self->tempdir);
429 0 foreach my $index(0..$#first){
430 0 ▶ unless($first[$index] eq '-' && $sec[$index] eq '-'){
Branch: 1 branch
BranchTrueFalseTotal
unless ($first[$index] eq "-" and $sec[$index] eq "-") 0 0 0
Condition0%0/3
$first[$index] eq "-" and $sec[$index] eq "-"
!ll&&!rl&&r
000
MC/DC0%0/2
$first[$index] eq "-" and $sec[$index] eq "-"
$first[$index] eq "-" $sec[$index] eq "-"
Truth table0%0/3
A and B
A= $first[$index] eq "-"B= $sec[$index] eq "-"
ABresult
0X0
100
111
431 0 print $tfh1 pack("H2",$base_code{$first[$index]}.$base_code{$sec[$index]});
432 }
433 }
434 0 close ($tfh1);
435 0 undef ($tfh1);
436 0 push @files, $outfile;
437 0 push @pairs,[$first->id,$sec->id];
438 0 return \@pairs,\@files;
439 }
440  
441 0 ▶sub _make_plotfile {
Subroutine _make_plotfile: not called CC=31 SCAR=69.0
442 0 my ($self,$sim_aln,$pairs,$files) = @_;
443 0 my ($tfh1,$plotfile) = $self->io->tempfile(-dir=>$self->tempdir);
444 0 my @ids = map{$_->id}$sim_aln->each_seq;
445
446 0 print $tfh1 "TITLE ".$self->title."\n\n";
447 0 print $tfh1 "OUTPUT ".$self->outfile."\n\n" ;
448 0 print $tfh1 "SEQUENCES ";
449 0 print $tfh1 join(" ",@ids)."\n\n";
450  
451 0 foreach my $index(0..$#$pairs){
452 0 print $tfh1 "ALIGN ".$files->[$index]." BINARY\n";
453 0 print $tfh1 " SEQUENCES ".$pairs->[$index]->[0]." ".$pairs->[$index]->[1]."\n";
454 0 print $tfh1 " REGIONS ".$self->min_perc_id." ".$self->min_length."\n";
455 0 print $tfh1 " MIN ".$self->plotmin."\n";
456 0 ▶ print $tfh1 " DIFFS ". $self->diffs ."\n\n" if $self->diffs;
Branch: 1 branch
BranchTrueFalseTotal
if $self->diffs 0 0 0
457 0 ▶ if($self->region_file||$self->region_file_dir){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->region_file or $self->region_file_dir) 0 0 0
Condition0%0/3
$self->region_file or $self->region_file_dir
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->region_file or $self->region_file_dir
$self->region_file $self->region_file_dir
Truth table0%0/3
A or B
A= $self->region_fileB= $self->region_file_dir
ABresult
1X1
011
000
458 0 my $file = " REGION_FILE ";
459 0 ▶ $file.=$self->region_file_dir."/" if $self->region_file_dir;
Branch: 1 branch
BranchTrueFalseTotal
if $self->region_file_dir 0 0 0
460 0 $file.=$pairs->[$index]->[0]."_".$pairs->[$index]->[1].".region\n\n";
461 0 print $tfh1 $file;
462 }
463 0 ▶ if($self->score_file || $self->score_file_dir){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->score_file or $self->score_file_dir) 0 0 0
Condition0%0/3
$self->score_file or $self->score_file_dir
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->score_file or $self->score_file_dir
$self->score_file $self->score_file_dir
Truth table0%0/3
A or B
A= $self->score_fileB= $self->score_file_dir
ABresult
1X1
011
000
464 0 my $file = " SCORE_FILE ";
465 0 ▶ $file.=$self->score_file_dir."/" if $self->score_file_dir;
Branch: 1 branch
BranchTrueFalseTotal
if $self->score_file_dir 0 0 0
466 0 $file.=$pairs->[$index]->[0]."_".$pairs->[$index]->[1].".score\n\n";
467 0 print $tfh1 $file;
468 }
469 0 ▶ if($self->alignment_file || $self->alignment_file_dir){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->alignment_file or $self->alignment_file_dir) 0 0 0
Condition0%0/3
$self->alignment_file or $self->alignment_file_dir
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->alignment_file or $self->alignment_file_dir
$self->alignment_file $self->alignment_file_dir
Truth table0%0/3
A or B
A= $self->alignment_fileB= $self->alignment_file_dir
ABresult
1X1
011
000
470 0 my $file = " ALIGNMENT_FILE ";
471 0 ▶ $file.=$self->alignment_file_dir."/" if $self->alignment_file_dir;
Branch: 1 branch
BranchTrueFalseTotal
if $self->alignment_file_dir 0 0 0
472 0 $file.=$pairs->[$index]->[0]."_".$pairs->[$index]->[1].".alignment\n\n";
473 0 print $tfh1 $file;
474 }
475
476 0 ▶ print $tfh1 " CONTIGS_FILE ". $self->contigs_file ."\n\n" if $self->contigs_file;
Branch: 1 branch
BranchTrueFalseTotal
if $self->contigs_file 0 0 0
477 0 ▶ print $tfh1 " USE_ORDER ". $self->use_order."\n\n" if $self->use_order;
Branch: 1 branch
BranchTrueFalseTotal
if $self->use_order 0 0 0
478 0 print $tfh1 "END \n\n";
479 }
480 0 my $annotation_file;
481 0 ▶ if((ref $self->annotation eq 'ARRAY')&& $self->annotation->[0]->isa("Bio::SeqFeatureI")){
Branch: 2 branches
BranchTrueFalseTotal
if (ref $self->annotation eq 'ARRAY' and $self->annotation->[0]->isa('Bio::SeqFeatureI')) { } 0 0 0
elsif ($self->annotation) { } 0 0 0
Condition0%0/3
ref $self->annotation eq "ARRAY" and $self->annotation->[0]->isa("Bio::SeqFeatureI")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $self->annotation eq "ARRAY" and $self->annotation->[0]->isa("Bio::SeqFeatureI")
ref $self->annotation eq "ARRAY" $self->annotation->[0]->isa("Bio::SeqFeatureI")
Truth table0%0/3
A and B
A= ref $self->annotation eq "ARRAY"B= $self->annotation->[0]->isa("Bio::SeqFeatureI")
ABresult
0X0
100
111
482 0 $annotation_file = $self->_dump2gff($self->annotation);
483 0 $self->annotation_format('GFF');
484 }
485 elsif($self->annotation){
486 0 $annotation_file = $self->annotation;
487 }
488 0 ▶ $annotation_file .= " GFF" if $self->annotation_format=~/GFF/i;
Branch: 1 branch
BranchTrueFalseTotal
if $self->annotation_format =~ /GFF/i 0 0 0
489 0 ▶ print $tfh1 "GENES ".$annotation_file." \n\n" if $annotation_file;
Branch: 1 branch
BranchTrueFalseTotal
if $annotation_file 0 0 0
490 0 print $tfh1 "LEGEND on\n\n";
491 0 print $tfh1 "COORDINATE ".join(" ",@{$self->_coordinate})."\n\n";
492 0 print $tfh1 "PAPER letter\n\n";
493 0 print $tfh1 "BASES ".$self->bases."\n\n";
494 0 print $tfh1 "TICK_DIST ".$self->tickdist."\n\n";
495 0 print $tfh1 "RESOLUTION ".$self->resolution."\n\n";
496 0 print $tfh1 "WINDOW ".$self->window."\n\n";
497 0 print $tfh1 "NUM_WINDOWS ".$self->numwindows."\n\n";
498 0 ▶ print $tfh1 "AXIS_LABEL ".$self->axis_label ."\n\n" if $self->axis_label;
Branch: 1 branch
BranchTrueFalseTotal
if $self->axis_label 0 0 0
499 0 ▶ print $tfh1 "TICKS_FILE ".$self->ticks_file ."\n\n" if $self->ticks_file;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ticks_file 0 0 0
500 0 ▶ print $tfh1 "SNPS_FILE"." ".$self->snps_file."\n\n" if $self->snps_file;
Branch: 1 branch
BranchTrueFalseTotal
if $self->snps_file 0 0 0
501 0 ▶ print $tfh1 "GAPS ".$self->gaps ."\n\n"if $self->gaps;
Branch: 1 branch
BranchTrueFalseTotal
if $self->gaps 0 0 0
502 0 ▶ print $tfh1 "REPEATS_FILE ".$self->repeats_file ."\n\n" if $self->repeats_file;
Branch: 1 branch
BranchTrueFalseTotal
if $self->repeats_file 0 0 0
503 0 ▶ print $tfh1 "FILTER_REPEATS ".$self->filter_repeats ."\n\n" if $self->filter_repeats;
Branch: 1 branch
BranchTrueFalseTotal
if $self->filter_repeats 0 0 0
504 0 ▶ print $tfh1 "NUM_PAGES ".$self->num_pages ."\n\n" if $self->num_pages;
Branch: 1 branch
BranchTrueFalseTotal
if $self->num_pages 0 0 0
505 0 ▶ print $tfh1 "START ".$self->start ."\n\n" if $self->start;
Branch: 1 branch
BranchTrueFalseTotal
if $self->start 0 0 0
506 0 ▶ print $tfh1 "END ".$self->end ."\n\n" if $self->end;
Branch: 1 branch
BranchTrueFalseTotal
if $self->end 0 0 0
507 0 my $color = $self->color;
508 0 ▶ if(ref $color eq 'HASH'){
Branch: 1 branch
BranchTrueFalseTotal
if (ref $color eq "HASH") 0 0 0
509 0 foreach my $region_type (keys %$color){
510 0 print $tfh1 "COLOR ".$region_type." ".$color->{$region_type}."\n\n";
511 }
512 }
513  
514 0 close ($tfh1);
515 0 undef $tfh1;
516 0 ▶ if($self->plotfile) {#saving plotfile
Branch: 1 branch
BranchTrueFalseTotal
if ($self->plotfile) { } 0 0 0
517 0 copy($plotfile,$self->plotfile);
518 }
519 else {
520 0 $self->plotfile($plotfile);
521 }
522 0 return $self->plotfile;
523 }
524  
525 0 ▶sub _dump2gff {
Subroutine _dump2gff: not called CC=2 SCAR=17.9
526 0 my ($self,$feat) = @_;
527 0 my ($tfh1,$file) = $self->io->tempfile(-dir=>$self->tempdir);
528 0 foreach my $f(@$feat){
529 0 print $tfh1 $f->gff_string."\n";
530 }
531 0 close ($tfh1);
532 0 undef $tfh1;
533 0 return $file;
534 }
535  
536 0 ▶sub _run_Vista {
Subroutine _run_Vista: not called CC=6 SCAR=37.4
537 0 my ($self,$infile) = @_;
538  
539 #run Vista
540 0 $self->debug( "Running Vista\n");
541 0 my $java = $self->java;
542 0 ▶ my $param = $self->java_param || '';
Condition0%0/2
$self->java_param || ''
l!l
00
MC/DC0%0/1
$self->java_param || ''
$self->java_param
Truth table0%0/2
A
A= $self->java_param
Aresult
11
00
543 0 my $cmd = $java." ".$param.' Vista ';
544 0 ▶ $cmd .= " -q " if $self->quiet || $self->verbose < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->quiet or $self->verbose < 0 0 0 0
Condition0%0/3
$self->quiet or $self->verbose < 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->quiet or $self->verbose < 0
$self->quiet $self->verbose < 0
Truth table0%0/3
A or B
A= $self->quietB= $self->verbose < 0
ABresult
1X1
011
000
545 0 ▶ $cmd .= " -d " if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
546 0 $cmd .= $infile;
547 0 $self->debug($cmd);
548 0 my $status = system ($cmd);
549  
550 0 ▶ $self->throw("Problem running Vista: $? \n") if $status != 0;
Branch: 1 branch
BranchTrueFalseTotal
if $status != 0 0 0 0
551
552 0 return 1;
553  
554 }
555 0 ▶sub _coordinate {
Subroutine _coordinate: not called CC=2 SCAR=17.9
556 0 my ($self,$val) = @_;
557 0 ▶ if($val){
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 0 0 0
558 0 $self->{'_coordinate'} = $val;
559 }
560 0 return $self->{'_coordinate'};
561 }
562  
563 =head2 outfile
564  
565 Title : outfile
566 Usage : $obj->outfile
567 Function : Get/Set method outfile
568 Args :
569  
570 =cut
571  
572 =head2 min_perc_id
573  
574 Title : min_perc_id
575 Usage : $obj->min_perc_id
576 Function : Get/Set method min_perc_id
577 Args :
578  
579 =cut
580  
581 =head2 quiet
582  
583 Title : quiet
584 Usage : $obj->quiet
585 Function : Get/Set method quiet
586 Args :
587  
588 =cut
589  
590 =head2 verbose
591  
592 Title : verbose
593 Usage : $obj->verbose
594 Function : Get/Set method verbose
595 Args :
596  
597 =cut
598  
599 =head2 annotation_format
600  
601 Title : annotation_format
602 Usage : $obj->annotation_format
603 Function : Get/Set method annotation_format
604 Args :
605  
606 =cut
607  
608 =head2 region_file
609  
610 Title : region_file
611 Usage : $obj->region_file
612 Function : Get/Set method region_file
613 Args :
614  
615 =cut
616  
617 =head2 score_file
618  
619 Title : score_file
620 Usage : $obj->score_file
621 Function : Get/Set method score_file
622 Args :
623  
624 =cut
625  
626 =head2 alignment_file
627  
628 Title : alignment_file
629 Usage : $obj->alignment_file
630 Function : Get/Set method alignment_file
631 Args :
632  
633 =cut
634  
635 =head2 contigs_file
636  
637 Title : contigs_file
638 Usage : $obj->contigs_file
639 Function : Get/Set method contigs_file
640 Args :
641  
642 =cut
643  
644 =head2 diffs
645  
646 Title : diffs
647 Usage : $obj->diffs
648 Function : Get/Set method diffs
649 Args :
650  
651 =cut
652  
653 =head2 plotfile
654  
655 Title : plotfile
656 Usage : $obj->plotfile
657 Function : Get/Set method plotfile
658 Args :
659  
660 =cut
661  
662 =head2 min_length
663  
664 Title : min_length
665 Usage : $obj->min_length
666 Function : Get/Set method min_length
667 Args :
668  
669 =cut
670  
671 =head2 plotmin
672  
673 Title : plotmin
674 Usage : $obj->plotmin
675 Function : Get/Set method plotmin
676 Args :
677  
678 =cut
679  
680 =head2 annotation
681  
682 Title : annotation
683 Usage : $obj->annotation
684 Function : Get/Set method annotation
685 Args :
686  
687 =cut
688  
689  
690 =head2 bases
691  
692 Title : bases
693 Usage : $obj->bases
694 Function : Get/Set method bases
695 Args :
696  
697 =cut
698  
699 =head2 tickdist
700  
701 Title : tickdist
702 Usage : $obj->tickdist
703 Function : Get/Set method tickdist
704 Args :
705  
706 =cut
707  
708 =head2 resolution
709  
710 Title : resolution
711 Usage : $obj->resolution
712 Function : Get/Set method resolution
713 Args :
714  
715 =cut
716  
717 =head2 title
718  
719 Title : title
720 Usage : $obj->title
721 Function : Get/Set method title
722 Args :
723  
724 =cut
725  
726 =head2 window
727  
728 Title : window
729 Usage : $obj->window
730 Function : Get/Set method window
731 Args :
732  
733 =cut
734  
735 =head2 numwindows
736  
737 Title : numwindows
738 Usage : $obj->numwindows
739 Function : Get/Set method numwindows
740 Args :
741  
742 =cut
743  
744 =head2 start
745  
746 Title : start
747 Usage : $obj->start
748 Function : Get/Set method start
749 Args :
750  
751 =cut
752  
753 =head2 end
754  
755 Title : end
756 Usage : $obj->end
757 Function : Get/Set method end
758 Args :
759  
760 =cut
761  
762 =head2 num_plot_lines
763  
764 Title : num_plot_lines
765 Usage : $obj->num_plot_lines
766 Function : Get/Set method num_plot_lines
767 Args :
768  
769 =cut
770  
771 =head2 legend
772  
773 Title : legend
774 Usage : $obj->legend
775 Function : Get/Set method legend
776 Args :
777  
778 =cut
779  
780 =head2 filename
781  
782 Title : filename
783 Usage : $obj->filename
784 Function : Get/Set method filename
785 Args :
786  
787 =cut
788  
789 =head2 axis_label
790  
791 Title : axis_label
792 Usage : $obj->axis_label
793 Function : Get/Set method axis_label
794 Args :
795  
796 =cut
797  
798 =head2 ticks_file
799  
800 Title : ticks_file
801 Usage : $obj->ticks_file
802 Function : Get/Set method ticks_file
803 Args :
804  
805 =cut
806  
807 =head2 color
808  
809 Title : color
810 Usage : $obj->color
811 Function : Get/Set method color
812 Args :
813  
814 =cut
815  
816 =head2 use_order
817  
818 Title : use_order
819 Usage : $obj->use_order
820 Function : Get/Set method use_order
821 Args :
822  
823 =cut
824  
825 =head2 gaps
826  
827 Title : gaps
828 Usage : $obj->gaps
829 Function : Get/Set method gaps
830 Args :
831  
832 =cut
833  
834 =head2 snps_file
835  
836 Title : snps_file
837 Usage : $obj->snps_file
838 Function : Get/Set method snps_file
839 Args :
840  
841 =cut
842  
843 =head2 repeats_file
844  
845 Title : repeats_file
846 Usage : $obj->repeats_file
847 Function : Get/Set method repeats_file
848 Args :
849  
850 =cut
851  
852 =head2 filter_repeats
853  
854 Title : filter_repeats
855 Usage : $obj->filter_repeats
856 Function : Get/Set method filter_repeats
857 Args :
858  
859 =cut
860  
861 1 1;
862 __END__
« Tools/Run/StandAloneBlastPlus.pm ↑ Summary Tools/Run/TribeMCL.pm »