Tools/Run/Genscan.pm

filter: Statementstmt 39.0% 32 / 82 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 52.6% 10 / 19 Podpod 100% 5 / 5 totaltotal 37.9% 47 / 124 CC 11 SCAR 24.9
CC
11
Cov
32%
_run
42.0
AUTOLOAD
12.0
new
12.0
CRAP 12.0
« Tools/Run/Alignment/Gmap.pm ↑ Summary Run/ConfigData.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
Subroutine BEGIN: called CC=1 SCAR=0.0
79 1 $PROGRAMNAME @GENSCAN_PARAMS %OK_FIELD);
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 1 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=6.9
92 1 @GENSCAN_PARAMS=qw(MATRIX VERBOSE QUIET);
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 0 ▶sub program_name {
Subroutine program_name: not called CC=1 SCAR=6.9
Pod documented
108 0 return 'genscan';
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 0 ▶sub program_dir {
Subroutine program_dir: not called CC=1 SCAR=6.9
Pod documented
122 0 return Bio::Root::IO->catfile($ENV{GENSCANDIR});
123 }
124  
125  
126 0 ▶ sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=3 SCAR=24.8
127 0 my $self = shift;
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 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
137 0 my ($class,@args) = @_;
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 0 ▶sub predict_genes{
Subroutine predict_genes: not called CC=1 SCAR=6.9
Pod documented
160 0 return shift->run(@_);
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 0 ▶sub run {
Subroutine run: not called CC=1 SCAR=6.9
Pod documented
174 0 my ($self,$seq) = @_;
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 0 ▶sub _run {
Subroutine _run: not called CC=6 SCAR=37.4
192  
193 0 my ($self) = @_;
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 ▶ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /mswin/i ? : 0 0 0
203 0 open(STDERR,">$null");
204 }
205 0 ▶ unless (open(GENSCAN, "$str |")){
Branch: 1 branch
BranchTrueFalseTotal
unless (open GENSCAN, "$str |") 0 0 0
206 0 $self->warn("Cannot run $str");
207 }
208 0 close(STDERR);
209 0 my $genScanParser = Bio::Tools::Genscan->new(-fh=> \*GENSCAN);
210  
211
212 0 ▶ while( $gene = $genScanParser->next_prediction()){
Branch: 1 branch
BranchTrueFalseTotal
if ($gene = $genScanParser->next_prediction) 0 0 0
213 0 push(@genes, $gene);
214 }
215 0 $self->cleanup();
216 0 return @genes;
217 }
218  
219 =head2 _set_input()
220  
221 Title : _set_input
222 Usage : obj->_set_input($matrixFile,$seqFile)
223 Function: Internal(not to be used directly)
224 Returns :
225 Args :
226  
227 =cut
228  
229 0 ▶sub _set_input() {
Subroutine _set_input: not called CC=1 SCAR=6.9
230 0 my ($self,$infile1) = @_;
231 0 $self->{'input'}=$infile1;
232 }
233  
234 =head2 _writeSeqFile()
235  
236 Title : _writeSeqFile
237 Usage : obj->_writeSeqFile($seq)
238 Function: Internal(not to be used directly)
239 Returns :
240 Args :
241  
242 =cut
243  
244  
245 0 ▶sub _writeSeqFile(){
Subroutine _writeSeqFile: not called CC=1 SCAR=6.9
246 0 my ($self,$seq) = @_;
247 0 my ($tfh,$inputfile) = $self->io->tempfile(-dir=>$self->tempdir);
248 0 my $in = Bio::SeqIO->new(-fh => $tfh , '-format' => 'fasta');
249 0 $in->write_seq($seq);
250 0 $in->close();
251 0 close($tfh);
252 0 undef $tfh;
253 0 return $inputfile;
254 }
255  
256 1 1;
« Tools/Run/Alignment/Gmap.pm ↑ Summary Run/ConfigData.pm »