blib/lib/Bio/Tools/Run/Genscan.pm

filter: Statementstmt 39.5% 32 / 81 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 52.6% 10 / 19 Podpod 100% 5 / 5 totaltotal 38.8% 47 / 121 CC 10 SCAR 21.8
CC
10
Cov
33%
_run
30.0
AUTOLOAD
12.0
new
12.0
CRAP 8.8
« blib/lib/Bio/Tools/Run/Seg.pm ↑ Summary blib/lib/Bio/DB/SoapEUtilities/GQueryAdaptor.pm »
1 # BioPerl module for Bio::Tools::Run::Genscan
2 #
3 # Please direct questions and support issues to <bioperl-l@bioperl.org>
4 #
5 # Cared for by
6 #
7 # Copyright Balamurugan Kumarasamy
8 #
9 # You may distribute this module under the same terms as perl itself
10 # POD documentation - main docs before the code
11  
12 =head1 NAME
13  
14 Bio::Tools::Run::Genscan - Object for identifying genes in a
15 given sequence given a matrix(for appropriate organisms).
16  
17 =head1 SYNOPSIS
18  
19 # Build a Genscan factory
20 my $param = ('MATRIX'=>HumanIso.smat);
21 my $factory = Bio::Tools::Run::Genscan->new($param);
22  
23 # Pass the factory a Bio::Seq object
24 #@genes is an array of Bio::Tools::Predictions::Gene objects
25 my @genes = $factory->run($seq);
26  
27 =head1 DESCRIPTION
28  
29 Genscan is a gene identifying program developed by Christopher Burge
30 http://genes.mit.edu/burgelab/
31  
32 By default it looks for an executable called I<genscan> and data/parameter files
33 in the directory specified by the I<GENSCANDIR> environmental variable.
34  
35 =head1 FEEDBACK
36  
37 =head2 Mailing Lists
38  
39 User feedback is an integral part of the evolution of this and other
40 Bioperl modules. Send your comments and suggestions preferably to one
41 of the Bioperl mailing lists. Your participation is much appreciated.
42  
43 bioperl-l@bioperl.org - General discussion
44 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
45  
46 =head2 Support
47  
48 Please direct usage questions or support issues to the mailing list:
49  
50 I<bioperl-l@bioperl.org>
51  
52 rather than to the module maintainer directly. Many experienced and
53 reponsive experts will be able look at the problem and quickly
54 address it. Please include a thorough description of the problem
55 with code and data examples if at all possible.
56  
57 =head2 Reporting Bugs
58  
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 the bugs and their resolution. Bug reports can be submitted via the
61 web:
62  
63 http://redmine.open-bio.org/projects/bioperl/
64  
65 =head1 AUTHOR - Bala
66  
67 Email savikalpa@fugu-sg.org
68  
69 =head1 APPENDIX
70  
71 The rest of the documentation details each of the object
72 methods. Internal methods are usually preceded with a _
73  
74 =cut
75  
76 package Bio::Tools::Run::Genscan;
77
78 1 use vars qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR
79 1 ▶ $PROGRAMNAME @GENSCAN_PARAMS %OK_FIELD);
Subroutine BEGIN: called CC=1 SCAR=0.0
80 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
81 1 ▶use Bio::Seq;
Subroutine BEGIN: called CC=1 SCAR=0.0
82 1 ▶use Bio::SeqIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
83 1 ▶use Bio::Root::Root;
Subroutine BEGIN: called CC=1 SCAR=0.0
84 1 ▶use Bio::Root::IO;
Subroutine BEGIN: called CC=1 SCAR=0.0
85 1 ▶use Bio::Factory::ApplicationFactoryI;
Subroutine BEGIN: called CC=1 SCAR=0.0
86 1 ▶use Bio::Tools::Genscan;
Subroutine BEGIN: called CC=1 SCAR=0.0
87 1 ▶use Bio::Tools::Run::WrapperBase;
Subroutine BEGIN: called CC=1 SCAR=0.0
88  
89 1 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
90  
91 BEGIN {
92 1 ▶ @GENSCAN_PARAMS=qw(MATRIX VERBOSE QUIET);
Subroutine BEGIN: called CC=2 SCAR=6.9
93 1 foreach my $attr ( @GENSCAN_PARAMS)
94 3 { $OK_FIELD{$attr}++; }
95 }
96  
97 =head2 program_name
98  
99 Title : program_name
100 Usage : $factory>program_name()
101 Function: holds the program name
102 Returns: string
103 Args : None
104  
105 =cut
106  
107 sub program_name {
108 0 ▶ return 'genscan';
Subroutine program_name: not called CC=1 SCAR=6.9
Pod documented
109 }
110  
111 =head2 program_dir
112  
113 Title : program_dir
114 Usage : $factory->program_dir(@params)
115 Function: returns the program directory, obtained from ENV variable.
116 Returns: string
117 Args :
118  
119 =cut
120  
121 sub program_dir {
122 0 ▶ return Bio::Root::IO->catfile($ENV{GENSCANDIR});
Subroutine program_dir: not called CC=1 SCAR=6.9
Pod documented
123 }
124  
125  
126 sub AUTOLOAD {
127 0 ▶ my $self = shift;
Subroutine AUTOLOAD: not called CC=3 SCAR=24.8
128 0 my $attr = $AUTOLOAD;
129 0 $attr =~ s/.*:://;
130 0 $attr = uc $attr;
131 0 ▶ $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $Bio::Tools::Run::Genscan::OK_FIELD{$attr} 0 0 0
132 0 ▶ $self->{$attr} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
133 0 return $self->{$attr};
134 }
135  
136 sub new {
137 0 ▶ my ($class,@args) = @_;
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
138 0 my $self = $class->SUPER::new(@args);
139 0 my ($attr, $value);
140 0 ▶ while (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
141 0 $attr = shift @args;
142 0 $value = shift @args;
143 0 ▶ next if( $attr =~ /^-/ ); # don't want named parameters
Branch: 1 branch
BranchTrueFalseTotal
if $attr =~ /^-/ 0 0 0
144 0 $self->$attr($value);
145 }
146 0 return $self;
147 }
148  
149 =head2 predict_genes()
150  
151 Title : predict_genes()
152 Usage : DEPRECATED: use $obj->run($seq) instead
153 Function: Runs genscan and creates an array of Genes
154 Returns : An array of Bio::Tools::Prediction::Gene objects
155 Args : A Bio::PrimarySeqI
156  
157 =cut
158  
159 sub predict_genes{
160 0 ▶ return shift->run(@_);
Subroutine predict_genes: not called CC=1 SCAR=6.9
Pod documented
161 }
162  
163 =head2 run
164  
165 Title : run
166 Usage : $obj->run($seq)
167 Function: Runs genscan and creates an array of Genes
168 Returns : An array of Bio::Tools::Prediction::Gene objects
169 Args : A Bio::PrimarySeqI
170  
171 =cut
172  
173 sub run {
174 0 ▶ my ($self,$seq) = @_;
Subroutine run: not called CC=1 SCAR=6.9
Pod documented
175 0 my $infile1 = $self->_writeSeqFile($seq);
176 0 $self->_set_input($infile1);
177 0 my @feat = $self->_run();
178 0 return @feat;
179 }
180  
181 =head2 _run
182  
183 Title : _run
184 Usage : $obj->_run()
185 Function: Internal(not to be used directly)
186 Returns : An array of Bio::Tools::Prediction::Gene objects
187 Args :
188  
189 =cut
190  
191 sub _run {
192  
193 0 ▶ my ($self) = @_;
Subroutine _run: not called CC=5 SCAR=34.0
194 0 my @genes;
195 my $gene;
196  
197 0 my $str = $self->executable.' '.$self->MATRIX.' '.$self->{'input'};
198 0 ▶ if($self->verbose){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->verbose) 0 0 0
199 0 $str.=" -v ";
200 }
201 0 ▶ if($self->quiet){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->quiet) 0 0 0
202 0 open(STDERR,">/dev/null");
203 }
204 0 ▶ unless (open(GENSCAN, "$str |")){
Branch: 1 branch
BranchTrueFalseTotal
unless (open GENSCAN, "$str |") 0 0 0
205 0 $self->warn("Cannot run $str");
206 }
207 0 close(STDERR);
208 0 my $genScanParser = Bio::Tools::Genscan->new(-fh=> \*GENSCAN);
209  
210
211 0 ▶ while( $gene = $genScanParser->next_prediction()){
Branch: 1 branch
BranchTrueFalseTotal
if ($gene = $genScanParser->next_prediction) 0 0 0
212 0 push(@genes, $gene);
213 }
214 0 $self->cleanup();
215 0 return @genes;
216 }
217  
218 =head2 _set_input()
219  
220 Title : _set_input
221 Usage : obj->_set_input($matrixFile,$seqFile)
222 Function: Internal(not to be used directly)
223 Returns :
224 Args :
225  
226 =cut
227  
228 sub _set_input() {
229 0 ▶ my ($self,$infile1) = @_;
Subroutine _set_input: not called CC=1 SCAR=6.9
230 0 $self->{'input'}=$infile1;
231 }
232  
233 =head2 _writeSeqFile()
234  
235 Title : _writeSeqFile
236 Usage : obj->_writeSeqFile($seq)
237 Function: Internal(not to be used directly)
238 Returns :
239 Args :
240  
241 =cut
242  
243  
244 sub _writeSeqFile(){
245 0 ▶ my ($self,$seq) = @_;
Subroutine _writeSeqFile: not called CC=1 SCAR=6.9
246 0 my ($tfh,$inputfile) = $self->io->tempfile(-dir=>$self->tempdir);
247 0 my $in = Bio::SeqIO->new(-fh => $tfh , '-format' => 'fasta');
248 0 $in->write_seq($seq);
249 0 $in->close();
250 0 close($tfh);
251 0 undef $tfh;
252 0 return $inputfile;
253 }
254  
255 1 1;
« blib/lib/Bio/Tools/Run/Seg.pm ↑ Summary blib/lib/Bio/DB/SoapEUtilities/GQueryAdaptor.pm »