Mercurial > repos > mahtabm > ensemb_rep_gvl
comparison variant_effect_predictor/Bio/EnsEMBL/Analysis.pm @ 0:2bc9b66ada89 draft default tip
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 06:29:17 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:2bc9b66ada89 |
---|---|
1 =head1 LICENSE | |
2 | |
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and | |
4 Genome Research Limited. All rights reserved. | |
5 | |
6 This software is distributed under a modified Apache license. | |
7 For license details, please see | |
8 | |
9 http://www.ensembl.org/info/about/code_licence.html | |
10 | |
11 =head1 CONTACT | |
12 | |
13 Please email comments or questions to the public Ensembl | |
14 developers list at <dev@ensembl.org>. | |
15 | |
16 Questions may also be sent to the Ensembl help desk at | |
17 <helpdesk@ensembl.org>. | |
18 | |
19 =cut | |
20 | |
21 =head1 NAME | |
22 | |
23 Bio::EnsEMBL::Analysis.pm - Stores details of an analysis run | |
24 | |
25 =head1 SYNOPSIS | |
26 | |
27 my $obj = new Bio::EnsEMBL::Analysis( | |
28 -id => $id, | |
29 -logic_name => 'SWIRBlast', | |
30 -db => $db, | |
31 -db_version => $db_version, | |
32 -db_file => $db_file, | |
33 -program => $program, | |
34 -program_version => $program_version, | |
35 -program_file => $program_file, | |
36 -gff_source => $gff_source, | |
37 -gff_feature => $gff_feature, | |
38 -module => $module, | |
39 -module_version => $module_version, | |
40 -parameters => $parameters, | |
41 -created => $created, | |
42 -description => 'some warm words about this analysis', | |
43 -display_label => 'UNIprot alignment', | |
44 -displayable => '1', | |
45 -web_data => 'web metadata info' | |
46 ); | |
47 | |
48 =head1 DESCRIPTION | |
49 | |
50 Object to store details of an analysis run. | |
51 | |
52 =head1 METHODS | |
53 | |
54 =cut | |
55 | |
56 package Bio::EnsEMBL::Analysis; | |
57 | |
58 use vars qw(@ISA); | |
59 use strict; | |
60 | |
61 use Bio::EnsEMBL::Storable; | |
62 | |
63 use Bio::EnsEMBL::Utils::Exception qw(throw); | |
64 use Bio::EnsEMBL::Utils::Argument qw(rearrange); | |
65 use Scalar::Util qw/isweak weaken/; | |
66 | |
67 @ISA = qw(Bio::EnsEMBL::Storable); | |
68 | |
69 | |
70 =head2 new | |
71 | |
72 Arg [..] : Takes a set of named arguments | |
73 Example : $analysis = new Bio::EnsEMBL::Analysis::Analysis( | |
74 -id => $id, | |
75 -logic_name => 'SWIRBlast', | |
76 -db => $db, | |
77 -db_version => $db_version, | |
78 -db_file => $db_file, | |
79 -program => $program, | |
80 -program_version => $program_version, | |
81 -program_file => $program_file, | |
82 -gff_source => $gff_source, | |
83 -gff_feature => $gff_feature, | |
84 -module => $module, | |
85 -module_version => $module_version, | |
86 -parameters => $parameters, | |
87 -created => $created ); | |
88 Description: Creates a new Analysis object | |
89 Returntype : Bio::EnsEMBL::Analysis | |
90 Exceptions : none | |
91 Caller : general | |
92 Status : Stable | |
93 | |
94 =cut | |
95 | |
96 sub new { | |
97 my($class,@args) = @_; | |
98 | |
99 my $self = bless {},$class; | |
100 | |
101 my ($id, $adaptor, $db, $db_version, $db_file, $program, $program_version, | |
102 $program_file, $gff_source, $gff_feature, $module, $module_version, | |
103 $parameters, $created, $logic_name, $description, $display_label, | |
104 $displayable, $web_data) = | |
105 | |
106 rearrange([qw(ID | |
107 ADAPTOR | |
108 DB | |
109 DB_VERSION | |
110 DB_FILE | |
111 PROGRAM | |
112 PROGRAM_VERSION | |
113 PROGRAM_FILE | |
114 GFF_SOURCE | |
115 GFF_FEATURE | |
116 MODULE | |
117 MODULE_VERSION | |
118 PARAMETERS | |
119 CREATED | |
120 LOGIC_NAME | |
121 DESCRIPTION | |
122 DISPLAY_LABEL | |
123 DISPLAYABLE | |
124 WEB_DATA | |
125 )],@args); | |
126 | |
127 $displayable ||= 0; | |
128 | |
129 $self->dbID ($id); | |
130 $self->adaptor ($adaptor); | |
131 $self->db ($db); | |
132 $self->db_version ($db_version); | |
133 $self->db_file ($db_file); | |
134 $self->program ($program); | |
135 $self->program_version($program_version); | |
136 $self->program_file ($program_file); | |
137 $self->module ($module); | |
138 $self->module_version ($module_version); | |
139 $self->gff_source ($gff_source); | |
140 $self->gff_feature ($gff_feature); | |
141 $self->parameters ($parameters); | |
142 $self->created ($created); | |
143 $self->logic_name ( $logic_name ); | |
144 $self->description( $description ); | |
145 $self->display_label( $display_label ); | |
146 $self->displayable( $displayable ); | |
147 $self->web_data ( $web_data ); | |
148 return $self; # success - we hope! | |
149 } | |
150 | |
151 =head2 new_fast | |
152 | |
153 Arg [1] : HashRef $hashref | |
154 Value to bless | |
155 Description: Bless a hash into this object type | |
156 Exceptions : none | |
157 Returntype : Bio::EnsEMBL::Analysis | |
158 Caller : general, subclass constructors | |
159 | |
160 =cut | |
161 | |
162 sub new_fast { | |
163 my ($class, $hashref) = @_; | |
164 my $self = bless $hashref, ref($class) || $class; | |
165 weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) ); | |
166 return $self; | |
167 } | |
168 | |
169 =head2 db | |
170 | |
171 Arg [1] : string $db | |
172 Description: get/set for the attribute db | |
173 Returntype : string | |
174 Exceptions : none | |
175 Caller : general | |
176 Status : Stable | |
177 | |
178 =cut | |
179 | |
180 sub db { | |
181 my ($self,$arg) = @_; | |
182 | |
183 if (defined($arg)) { | |
184 $self->{_db} = $arg; | |
185 } | |
186 | |
187 return $self->{_db}; | |
188 } | |
189 | |
190 | |
191 =head2 db_version | |
192 | |
193 Arg [1] : string $db_version | |
194 Description: get/set for attribute db_version | |
195 Returntype : string | |
196 Exceptions : none | |
197 Caller : general | |
198 Status : Stable | |
199 | |
200 =cut | |
201 | |
202 sub db_version { | |
203 my ($self,$arg) = @_; | |
204 | |
205 if (defined($arg)) { | |
206 $self->{_db_version} = $arg; | |
207 } | |
208 | |
209 return $self->{_db_version}; | |
210 } | |
211 | |
212 | |
213 =head2 db_file | |
214 | |
215 Arg [1] : string $db_file | |
216 Description: get/set for attribute db_file | |
217 Returntype : string | |
218 Exceptions : none | |
219 Caller : general | |
220 Status : Stable | |
221 | |
222 =cut | |
223 | |
224 sub db_file { | |
225 my ($self,$arg) = @_; | |
226 | |
227 if (defined($arg)) { | |
228 $self->{_db_file} = $arg; | |
229 } | |
230 | |
231 return $self->{_db_file}; | |
232 } | |
233 | |
234 | |
235 | |
236 =head2 program | |
237 | |
238 Arg [1] : string $program | |
239 Description: get/set for attribute program | |
240 Returntype : string | |
241 Exceptions : none | |
242 Caller : general | |
243 Status : Stable | |
244 | |
245 =cut | |
246 | |
247 sub program { | |
248 my ($self,$arg) = @_; | |
249 | |
250 if (defined($arg)) { | |
251 $self->{_program} = $arg; | |
252 } | |
253 | |
254 return $self->{_program}; | |
255 } | |
256 | |
257 | |
258 =head2 program_version | |
259 | |
260 Arg [1] : string $program_version | |
261 Description: get/set for attribute program_version | |
262 Returntype : string | |
263 Exceptions : none | |
264 Caller : general | |
265 Status : Stable | |
266 | |
267 =cut | |
268 | |
269 sub program_version { | |
270 my ($self,$arg) = @_; | |
271 | |
272 if (defined($arg)) { | |
273 $self->{_program_version} = $arg; | |
274 } | |
275 | |
276 return $self->{_program_version}; | |
277 } | |
278 | |
279 | |
280 =head2 program_file | |
281 | |
282 Arg [1] : string $program_file | |
283 Description: get/set for attribute program_file | |
284 Returntype : string | |
285 Exceptions : none | |
286 Caller : general | |
287 Status : Stable | |
288 | |
289 =cut | |
290 | |
291 sub program_file { | |
292 my ($self,$arg) = @_; | |
293 | |
294 if (defined($arg)) { | |
295 $self->{_program_file} = $arg; | |
296 } | |
297 | |
298 return $self->{_program_file}; | |
299 } | |
300 | |
301 | |
302 =head2 module | |
303 | |
304 Arg [1] : string $module | |
305 Description: get/set for attribute module. Usually a RunnableDB perl | |
306 module that executes this analysis job. | |
307 Returntype : string | |
308 Exceptions : none | |
309 Caller : general | |
310 Status : Stable | |
311 | |
312 =cut | |
313 | |
314 sub module { | |
315 my ($self,$arg) = @_; | |
316 | |
317 if (defined($arg)) { | |
318 $self->{_module} = $arg; | |
319 } | |
320 | |
321 return $self->{_module}; | |
322 } | |
323 | |
324 | |
325 =head2 module_version | |
326 | |
327 Arg [1] : string $module_version | |
328 Description: get/set for attribute module_version | |
329 Returntype : string | |
330 Exceptions : none | |
331 Caller : general | |
332 Status : Stable | |
333 | |
334 =cut | |
335 | |
336 sub module_version { | |
337 my ($self,$arg) = @_; | |
338 | |
339 if (defined($arg)) { | |
340 $self->{_module_version} = $arg; | |
341 } | |
342 | |
343 return $self->{_module_version}; | |
344 } | |
345 | |
346 | |
347 =head2 gff_source | |
348 | |
349 Arg [1] : string $gff_source | |
350 Description: get/set for attribute gff_source | |
351 Returntype : string | |
352 Exceptions : none | |
353 Caller : general | |
354 Status : Stable | |
355 | |
356 =cut | |
357 | |
358 sub gff_source { | |
359 my ($self,$arg) = @_; | |
360 | |
361 if (defined($arg)) { | |
362 $self->{_gff_source} = $arg; | |
363 } | |
364 | |
365 return $self->{_gff_source}; | |
366 } | |
367 | |
368 | |
369 =head2 gff_feature | |
370 | |
371 Arg [1] : string $gff_feature | |
372 Description: get/set for attribute gff_feature | |
373 Returntype : string | |
374 Exceptions : none | |
375 Caller : general | |
376 Status : Stable | |
377 | |
378 =cut | |
379 | |
380 sub gff_feature { | |
381 my ($self,$arg) = @_; | |
382 | |
383 if (defined($arg)) { | |
384 $self->{_gff_feature} = $arg; | |
385 } | |
386 | |
387 return $self->{_gff_feature}; | |
388 } | |
389 | |
390 | |
391 =head2 parameters | |
392 | |
393 Arg [1] : string $parameters | |
394 Description: get/set for attribute parameters. This should be evaluated | |
395 by the module if given or the program that is specified. | |
396 Returntype : string | |
397 Exceptions : none | |
398 Caller : general | |
399 Status : Stable | |
400 | |
401 =cut | |
402 | |
403 sub parameters { | |
404 my ($self,$arg) = @_; | |
405 | |
406 if (defined($arg)) { | |
407 $self->{_parameters} = $arg; | |
408 } | |
409 | |
410 return $self->{_parameters}; | |
411 } | |
412 | |
413 | |
414 =head2 created | |
415 | |
416 Arg [1] : string $created | |
417 Description: get/set for attribute created time. | |
418 Returntype : string | |
419 Exceptions : none | |
420 Caller : general | |
421 Status : Stable | |
422 | |
423 =cut | |
424 | |
425 sub created { | |
426 my ($self,$arg) = @_; | |
427 | |
428 if (defined($arg)) { | |
429 $self->{_created} = $arg; | |
430 } | |
431 | |
432 return $self->{_created}; | |
433 } | |
434 | |
435 | |
436 =head2 logic_name | |
437 | |
438 Arg [1] : string $logic_name | |
439 Description: Get/set method for the logic_name, the name under | |
440 which this typical analysis is known. | |
441 Returntype : string | |
442 Exceptions : none | |
443 Caller : general | |
444 Status : Stable | |
445 | |
446 =cut | |
447 | |
448 sub logic_name { | |
449 my ($self, $arg ) = @_; | |
450 ( defined $arg ) && | |
451 ($self->{_logic_name} = $arg); | |
452 $self->{_logic_name}; | |
453 } | |
454 | |
455 | |
456 =head2 has_database | |
457 | |
458 Args : none | |
459 Description: tests if the db attribute is set, returns 1 if so, | |
460 0 if not. | |
461 Returntype : int 0,1 | |
462 Exceptions : none | |
463 Caller : general | |
464 Status : Stable | |
465 | |
466 =cut | |
467 | |
468 sub has_database{ | |
469 my ($self,@args) = @_; | |
470 | |
471 if( defined $self->db ){ return 1; } | |
472 return 0; | |
473 } | |
474 | |
475 | |
476 =head2 description | |
477 | |
478 Arg [1] : string $description | |
479 Example : none | |
480 Description: get/set for attribute description | |
481 Returntype : string | |
482 Exceptions : none | |
483 Caller : general | |
484 Status : Stable | |
485 | |
486 =cut | |
487 | |
488 sub description { | |
489 my ($self,$arg) = @_; | |
490 | |
491 if (defined($arg)) { | |
492 $self->{_description} = $arg; | |
493 } | |
494 | |
495 return $self->{_description}; | |
496 } | |
497 | |
498 | |
499 =head2 display_label | |
500 | |
501 Arg [1] : string $display_label | |
502 Description: get/set for attribute display_label | |
503 Returntype : string | |
504 Exceptions : none | |
505 Caller : general | |
506 Status : Stable | |
507 | |
508 =cut | |
509 | |
510 sub display_label { | |
511 my ($self,$arg) = @_; | |
512 | |
513 if (defined($arg)) { | |
514 $self->{_display_label} = $arg; | |
515 } | |
516 | |
517 return $self->{_display_label}; | |
518 } | |
519 | |
520 =head2 displayable | |
521 | |
522 Arg [1] : string $displayable | |
523 Description: get/set for attribute displayable | |
524 Returntype : string | |
525 Exceptions : none | |
526 Caller : general | |
527 Status : Stable | |
528 | |
529 =cut | |
530 | |
531 sub displayable { | |
532 my ($self,$arg) = @_; | |
533 | |
534 if (defined($arg)) { | |
535 $self->{_displayable} = $arg; | |
536 } | |
537 | |
538 return $self->{_displayable}; | |
539 } | |
540 | |
541 | |
542 =head2 web_data | |
543 | |
544 Arg [1] : string $web_data | |
545 Description: get/set for attribute web_data | |
546 Returntype : string | |
547 Exceptions : none | |
548 Caller : general | |
549 Status : Stable | |
550 | |
551 =cut | |
552 | |
553 sub web_data { | |
554 my ($self,$arg) = @_; | |
555 | |
556 if (defined($arg)) { | |
557 $self->{_web_data} = $arg; | |
558 } | |
559 | |
560 return $self->{_web_data}; | |
561 } | |
562 | |
563 =head2 compare | |
564 | |
565 Arg 1 : Bio::EnsEMBL::Analysis $ana | |
566 The analysis to compare to | |
567 Description: returns 1 if this analysis is special case of given analysis | |
568 returns 0 if they are equal | |
569 returns -1 if they are completely different | |
570 Returntype : int -1,0,1 | |
571 Exceptions : none | |
572 Caller : unknown | |
573 Status : Stable | |
574 | |
575 =cut | |
576 | |
577 sub compare { | |
578 my ($self, $ana ) = @_; | |
579 | |
580 throw("Object is not a Bio::EnsEMBL::Analysis") | |
581 unless $ana->isa("Bio::EnsEMBL::Analysis"); | |
582 | |
583 my $detail = 0; | |
584 | |
585 foreach my $methodName ( 'program', 'program_version', 'program_file', | |
586 'db','db_version','db_file','gff_source','gff_feature', 'module', | |
587 'module_version', 'parameters','logic_name' ) { | |
588 if( defined $self->$methodName() && ! $ana->can($methodName )) { | |
589 $detail = 1; | |
590 } | |
591 if( defined $self->$methodName() && ! defined $ana->$methodName() ) { | |
592 $detail = 1; | |
593 } | |
594 # if given anal is different from this, defined or not, then its different | |
595 if( defined($ana->$methodName()) && defined($self->$methodName()) && | |
596 ( $self->$methodName() ne $ana->$methodName() )) { | |
597 return -1; | |
598 } | |
599 } | |
600 if( $detail == 1 ) { return 1 }; | |
601 return 0; | |
602 } | |
603 | |
604 | |
605 1; | |
606 | |
607 | |
608 | |
609 | |
610 | |
611 | |
612 | |
613 | |
614 | |
615 | |
616 | |
617 | |
618 | |
619 | |
620 | |
621 |