Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/FeaturePair.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
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::FeaturePair - Stores sequence Features which are | |
24 themselves hits to other sequence features. | |
25 | |
26 =head1 SYNOPSIS | |
27 | |
28 my $feat = Bio::EnsEMBL::FeaturePair->new( | |
29 -start => 132_231, | |
30 -end => 132_321, | |
31 -strand => -1, | |
32 -slice => $slice, | |
33 -hstart => 10, | |
34 -hend => 100, | |
35 -hstrand => 1, | |
36 -score => 100, | |
37 -percent_id => 92.0, | |
38 -hseqname => 'ALUSX10.1', | |
39 -analysis => $analysis | |
40 ); | |
41 | |
42 my $hit_start = $feat->hstart(); | |
43 my $hit_end = $feat->hend(); | |
44 my $hit_strand = $feat->hstrand(); | |
45 my $analysis = $feat->analysis(); | |
46 | |
47 =head1 DESCRIPTION | |
48 | |
49 A sequence feature object where the feature is itself a feature on | |
50 another sequence - e.g. a blast hit where residues 1-40 of a protein | |
51 sequence SW:HBA_HUMAN has hit to bases 100 - 220 on a genomic sequence | |
52 HS120G22. The genomic sequence coordinates are represented by the | |
53 start, end, strand attributes while the protein (hit) coordinates are | |
54 represented by the hstart, hend, hstrand attributes. | |
55 | |
56 $clone = $slice_adpator->fetch_by_region( 'clone', 'HS120G22' ); | |
57 | |
58 $fp = Bio::EnsEMBL::FeaturePair( | |
59 -start => 100, | |
60 -end => 220, | |
61 -strand => 1, | |
62 -slice => $clone, | |
63 -hstart => 1, | |
64 -hend => 40, | |
65 -hstrand => 1, | |
66 -percent_id => 92.0, | |
67 -score => 100, | |
68 -hseqname => 'SW:HBA_HUMAN', | |
69 -species => 'Homo sapiens', | |
70 -hspecies => 'Homo sapiens' | |
71 ); | |
72 | |
73 =head1 METHODS | |
74 | |
75 =cut | |
76 | |
77 package Bio::EnsEMBL::FeaturePair; | |
78 | |
79 use vars qw(@ISA); | |
80 use strict; | |
81 | |
82 use Bio::EnsEMBL::Feature; | |
83 use Bio::EnsEMBL::Utils::Argument qw(rearrange); | |
84 use Bio::EnsEMBL::Utils::Exception qw(throw deprecate warning); | |
85 | |
86 @ISA = qw(Bio::EnsEMBL::Feature); | |
87 | |
88 | |
89 | |
90 =head2 new | |
91 | |
92 Arg [HSTART] : int - The start of the hit region (optional) | |
93 Arg [HEND] : int - The end of the hit region (optional) | |
94 Arg [HSTRAND] : (0,1,-1) - The strand of the hit region (optional) | |
95 Arg [PERCENT_ID]: float - The precentage identity of the hit (optional) | |
96 Arg [SCORE] : float - The score of the hit (optional) | |
97 Arg [HSEQNAME] : string - The name of the hit sequence (optional) | |
98 Arg [P_VALUE] : float - The pvalue or evalue (optional) | |
99 Arg [SPECIES] : string - The species the query sequence is from (optional) | |
100 Arg [HSPECIES] : string - The species the hit sequence is from (optional) | |
101 Arg [COVERAGE] : string - The % of the query that this feature pair covers | |
102 Arg [HCOVERAGE] : string - The % of the target this this feature pair covers | |
103 Arg [...] : Named superclass constructor args (Bio::EnsEMBL::Feature) | |
104 Example : $feat = Bio::EnsEMBL::FeaturePair->new(-start => 132_231, | |
105 -end => 132_321, | |
106 -strand => -1, | |
107 -slice => $slice, | |
108 -hstart => 10, | |
109 -hend => 100, | |
110 -hstrand => 1, | |
111 -score => 100, | |
112 -percent_id => 92.0, | |
113 -hseqname => 'ALUSX10.1', | |
114 -analysis => $analysis); | |
115 Description: Creates a new Bio::EnsEMBL::FeaturePair object | |
116 Returntype : Bio::EnsEMBL::FeaturePair | |
117 Exceptions : throw if start > end | |
118 throw if invalid strand is provided | |
119 Caller : general | |
120 Status : Stable | |
121 | |
122 =cut | |
123 | |
124 sub new { | |
125 my $caller = shift; | |
126 | |
127 my $class = ref($caller) || $caller; | |
128 | |
129 my $self = $class->SUPER::new(@_); | |
130 | |
131 my ($hstart,$hend,$hstrand,$percent_id,$score, $species, $hspecies, | |
132 $p_value, $hseqname, $f1,$f2, $coverage, $hcoverage, $group_id,$level_id, $external_db_id, $extra_data, $external_db_name, $external_display_db_name) = | |
133 rearrange(['HSTART','HEND','HSTRAND','PERCENT_ID','SCORE','SPECIES', | |
134 'HSPECIES', 'P_VALUE', 'HSEQNAME', 'FEATURE1','FEATURE2', | |
135 'COVERAGE', 'HCOVERAGE', 'GROUP_ID','LEVEL_ID', 'EXTERNAL_DB_ID', 'EXTRA_DATA', 'DBNAME', 'DB_DISPLAY_NAME'], @_); | |
136 | |
137 if(defined($hstart) && defined($hend) && ($hend < $hstart)) { | |
138 throw('HSTART must be less than or equal to HEND'); | |
139 } | |
140 | |
141 if(defined($hstrand) && $hstrand != 1 && $hstrand != -1 && $hstrand != 0) { | |
142 throw('HSTRAND must be one of (0,1,-1)'); | |
143 } | |
144 | |
145 $self->{'hstart'} = $hstart; | |
146 $self->{'hend'} = $hend; | |
147 $self->{'hstrand'} = $hstrand; | |
148 $self->{'score'} = $score; | |
149 $self->{'percent_id'} = $percent_id; | |
150 $self->{'species'} = $species; | |
151 $self->{'hspecies'} = $hspecies; | |
152 $self->{'hseqname'} = $hseqname; | |
153 $self->{'coverage'} = $coverage; | |
154 $self->{'hcoverage'} = $hcoverage; | |
155 $self->{'p_value'} = $p_value; | |
156 $self->{'group_id'} = $group_id; | |
157 $self->{'level_id'} = $level_id; | |
158 $self->{'external_db_id'} = $external_db_id; | |
159 $self->{'extra_data'} = $extra_data; | |
160 $self->{'dbname'} = $external_db_name; | |
161 $self->{'db_display_name'} = $external_display_db_name; | |
162 | |
163 # | |
164 # Feature1 and Feature2 arg handling for backwards compatibility | |
165 # | |
166 if($f1) { | |
167 deprecate("Using FEATURE1 arg to construct FeaturePairs" . | |
168 " is deprecated.\nUse the args START,END,STRAND,SLICE instead"); | |
169 | |
170 #eval because we are not exactly sure what f1 arg will look like | |
171 eval { | |
172 $self->{'start'} = $f1->start(); | |
173 $self->{'end'} = $f1->end(); | |
174 $self->{'strand'} = $f1->strand(); | |
175 $self->{'slice'} = $f1->contig(); | |
176 $self->{'analysis'} = $f1->analysis() if($f1->analysis()); | |
177 }; | |
178 } | |
179 | |
180 if($f2) { | |
181 deprecate("Using FEATURE2 arg to construct FeaturePairs is deprecated" . | |
182 "\nUse the args HSTART,HEND,HSTRAND,HSEQNAME instead"); | |
183 | |
184 #eval because we are not exactly sure what f2 arg will look like | |
185 eval { | |
186 $self->{'hseqname'} = $f2->seqname(); | |
187 $self->{'hstart'} = $f2->start(); | |
188 $self->{'hend'} = $f2->end(); | |
189 $self->{'hstrand'} = $f2->strand(); | |
190 $self->{'analysis'} = $f2->analysis() if($f2->analysis()); | |
191 }; | |
192 } | |
193 | |
194 return $self; | |
195 } | |
196 | |
197 | |
198 | |
199 =head2 hseqname | |
200 | |
201 Arg [1] : string $hseqname (optional) | |
202 Example : $hseqname = $fp->hseqname(); | |
203 Description: Getter/Setter for the name of the hit sequence | |
204 Returntype : string | |
205 Exceptions : none | |
206 Caller : general | |
207 Status : Stable | |
208 | |
209 =cut | |
210 | |
211 sub hseqname { | |
212 my $self = shift; | |
213 $self->{'hseqname'} = shift if(@_); | |
214 return $self->{hseqname}; | |
215 } | |
216 | |
217 | |
218 | |
219 =head2 hstart | |
220 | |
221 Arg [1] : string $hstart (optional) | |
222 Example : $hstart = $fp->hstart(); | |
223 Description: Getter/Setter for the start coordinate on the hit sequence | |
224 Returntype : int | |
225 Exceptions : none | |
226 Caller : general | |
227 Status : Stable | |
228 | |
229 =cut | |
230 | |
231 sub hstart{ | |
232 my $self = shift; | |
233 $self->{'hstart'} = shift if(@_); | |
234 return $self->{'hstart'}; | |
235 } | |
236 | |
237 | |
238 =head2 hend | |
239 | |
240 Arg [1] : string $hend (optional) | |
241 Example : $hend = $fp->hend(); | |
242 Description: Getter/Setter for the end coordinate on the hit sequence | |
243 Returntype : int | |
244 Exceptions : none | |
245 Caller : general | |
246 Status : Stable | |
247 | |
248 =cut | |
249 | |
250 sub hend{ | |
251 my $self = shift; | |
252 $self->{'hend'} = shift if(@_); | |
253 return $self->{'hend'}; | |
254 } | |
255 | |
256 | |
257 | |
258 =head2 hstrand | |
259 | |
260 Arg [1] : int $hstrand (optional) | |
261 Example : $hstrand = $fp->hstrand | |
262 Description: Getter/Setter for the orientation of the hit on the hit sequence | |
263 Returntype : 0,1,-1 | |
264 Exceptions : thrown | |
265 Caller : general | |
266 Status : Stable | |
267 | |
268 =cut | |
269 | |
270 sub hstrand{ | |
271 my $self = shift; | |
272 | |
273 if(@_) { | |
274 my $hstrand = shift; | |
275 if(defined($hstrand) && $hstrand != 1 && $hstrand != 0 && $hstrand != -1) { | |
276 throw('hstrand must be one of (-1,0,1)'); | |
277 } | |
278 $self->{'hstrand'} = $hstrand; | |
279 } | |
280 | |
281 return $self->{'hstrand'}; | |
282 } | |
283 | |
284 =head2 hslice | |
285 | |
286 Arg [1] : (optional) Bio::EnsEMBL::Slice $slice | |
287 Example : $hseqname = $featurepair->hslice()->seq_region_name(); | |
288 Description: Getter/Setter for the Slice that is associated with this | |
289 hit feature. The slice represents the underlying sequence that this | |
290 feature is on. Note that this method call is analagous to the | |
291 old SeqFeature methods contig(), entire_seq(), attach_seq(), | |
292 etc. | |
293 Returntype : Bio::EnsEMBL::Slice | |
294 Exceptions : thrown if an invalid argument is passed | |
295 Caller : general | |
296 Status : Stable | |
297 | |
298 =cut | |
299 | |
300 sub hslice { | |
301 my $self = shift; | |
302 | |
303 if(@_) { | |
304 my $sl = shift; | |
305 if(defined($sl) && (!ref($sl) || !($sl->isa('Bio::EnsEMBL::Slice') ) )) { | |
306 throw('slice argument must be a Bio::EnsEMBL::Slice'); | |
307 } | |
308 | |
309 $self->{'hslice'} = $sl; | |
310 } | |
311 | |
312 return $self->{'hslice'}; | |
313 } | |
314 | |
315 =head2 hseq_region_name | |
316 | |
317 Arg [1] : none | |
318 Example : print $feature->hseq_region_name(); | |
319 Description: Gets the name of the hseq_region which this feature is on. | |
320 Returns undef if this Feature is not on a hslice. | |
321 Returntype : string or undef | |
322 Exceptions : none | |
323 Caller : general | |
324 Status : Stable | |
325 | |
326 =cut | |
327 | |
328 sub hseq_region_name { | |
329 my $self = shift; | |
330 my $slice = $self->{'hslice'}; | |
331 | |
332 return ($slice) ? $slice->seq_region_name() : undef; | |
333 } | |
334 | |
335 | |
336 =head2 hseq_region_strand | |
337 | |
338 Arg [1] : none | |
339 Example : print $feature->hseq_region_strand(); | |
340 Description: Returns the strand of the hseq_region which this feature is on | |
341 (i.e. feature_strand * slice_strand) | |
342 Returns undef if this Feature is not on a hslice. | |
343 Returntype : 1,0,-1 or undef | |
344 Exceptions : none | |
345 Caller : general | |
346 Status : Stable | |
347 | |
348 =cut | |
349 | |
350 | |
351 sub hseq_region_strand { | |
352 my $self = shift; | |
353 my $slice = $self->{'hslice'}; | |
354 | |
355 return ($slice) ? $slice->strand() * $self->{'hstrand'} : undef; | |
356 } | |
357 | |
358 =head2 hseq_region_start | |
359 | |
360 Arg [1] : none | |
361 Example : print $feature->hseq_region_start(); | |
362 Description: Convenience method which returns the absolute start of this | |
363 feature on the hseq_region, as opposed to the relative (hslice) | |
364 position. | |
365 | |
366 Returns undef if this feature is not on a hslice. | |
367 Returntype : int or undef | |
368 Exceptions : none | |
369 Caller : general | |
370 Status : Stable | |
371 | |
372 =cut | |
373 | |
374 sub hseq_region_start { | |
375 my $self = shift; | |
376 my $slice = $self->{'hslice'}; | |
377 | |
378 return undef if(!$slice); | |
379 | |
380 if($slice->strand == 1) { | |
381 return undef if(!defined($self->{'hstart'})); | |
382 return $slice->start() + $self->{'hstart'} - 1; | |
383 } else { | |
384 return undef if(!defined($self->{'hend'})); | |
385 return $slice->end() - $self->{'hend'} + 1; | |
386 } | |
387 } | |
388 | |
389 | |
390 =head2 hseq_region_end | |
391 | |
392 Arg [1] : none | |
393 Example : print $feature->hseq_region_end(); | |
394 Description: Convenience method which returns the absolute end of this | |
395 feature on the hseq_region, as opposed to the relative (hslice) | |
396 position. | |
397 | |
398 Returns undef if this feature is not on a hslice. | |
399 Returntype : int or undef | |
400 Exceptions : none | |
401 Caller : general | |
402 Status : Stable | |
403 | |
404 =cut | |
405 | |
406 sub hseq_region_end { | |
407 my $self = shift; | |
408 my $slice = $self->{'hslice'}; | |
409 | |
410 return undef if(!$slice); | |
411 | |
412 if($slice->strand == 1) { | |
413 return undef if(!defined($self->{'hend'})); | |
414 return $slice->start() + $self->{'hend'} - 1; | |
415 } else { | |
416 return undef if(!defined($self->{'hstart'})); | |
417 return $slice->end() - $self->{'hstart'} + 1; | |
418 } | |
419 } | |
420 | |
421 =head2 score | |
422 | |
423 Arg [1] : float $score (optional) | |
424 Example : $score = $fp->score(); | |
425 Description: Getter/Setter for the score of this feature pair | |
426 Returntype : float | |
427 Exceptions : none | |
428 Caller : general | |
429 Status : Stable | |
430 | |
431 =cut | |
432 | |
433 sub score{ | |
434 my $self = shift; | |
435 $self->{'score'} = shift if(@_); | |
436 return $self->{'score'}; | |
437 } | |
438 | |
439 | |
440 | |
441 =head2 percent_id | |
442 | |
443 Arg [1] : float $percent_id (optional) | |
444 Example : $percent_id = $fp->percent_id(); | |
445 Description: Getter/Setter for the percentage identity of this feature pair | |
446 Returntype : float | |
447 Exceptions : none | |
448 Caller : general | |
449 Status : Stable | |
450 | |
451 =cut | |
452 | |
453 sub percent_id { | |
454 my $self = shift; | |
455 $self->{'percent_id'} = shift if(@_); | |
456 return $self->{'percent_id'}; | |
457 } | |
458 | |
459 | |
460 | |
461 =head2 species | |
462 | |
463 Arg [1] : string $genus_species_name (optional) | |
464 e.g. Homo_sapiens or Mus_musculus | |
465 Example : $species = $fp->species(); | |
466 Description: get/set on the species of feature1 | |
467 Returntype : string | |
468 Execeptions: none | |
469 Caller : general | |
470 Status : Stable | |
471 | |
472 =cut | |
473 | |
474 sub species{ | |
475 my $self = shift; | |
476 $self->{'species'} = shift if(@_); | |
477 return $self->{'species'}; | |
478 } | |
479 | |
480 | |
481 =head2 hspecies | |
482 | |
483 Arg [1] : string $genus_species_name (optional) | |
484 e.g. Homo_sapiens or Mus_musculus | |
485 Example : $hspecies = $fp->hspecies | |
486 Description: get/set on the species of feature2 | |
487 Returntype : string | |
488 Execeptions: none | |
489 Caller : general | |
490 Status : Stable | |
491 | |
492 =cut | |
493 | |
494 sub hspecies{ | |
495 my $self = shift; | |
496 $self->{'hspecies'} = shift if(@_); | |
497 return $self->{'hspecies'}; | |
498 } | |
499 | |
500 | |
501 =head2 coverage | |
502 | |
503 Arg [1] : number (percentage) $coverage (optional) | |
504 Example : $cov = $fp->coverage(); | |
505 Description: Getter/Setter for the % of the query covered by the feature | |
506 Returntype : string | |
507 Exceptions : none | |
508 Caller : general | |
509 Status : Stable | |
510 | |
511 =cut | |
512 | |
513 sub coverage { | |
514 my $self = shift; | |
515 $self->{'coverage'} = shift if(@_); | |
516 return $self->{'coverage'}; | |
517 } | |
518 | |
519 | |
520 =head2 hcoverage | |
521 | |
522 Arg [1] : number (percentage) $hcoverage (optional) | |
523 Example : $hcov = $fp->hcoverage(); | |
524 Description: Getter/Setter for the % of the target covered by the feature | |
525 Returntype : string | |
526 Exceptions : none | |
527 Caller : general | |
528 Status : Stable | |
529 | |
530 =cut | |
531 | |
532 sub hcoverage { | |
533 my $self = shift; | |
534 $self->{'hcoverage'} = shift if(@_); | |
535 return $self->{'hcoverage'}; | |
536 } | |
537 | |
538 =head2 external_db_id | |
539 | |
540 Arg [1] : int $external_db_id (optional) | |
541 Example : $ex_db = $fp->external_db_id(); | |
542 Description: Getter/Setter for the external_db_id taregt source database feature | |
543 Returntype : string | |
544 Exceptions : none | |
545 Caller : general | |
546 Status : At Risk | |
547 | |
548 =cut | |
549 | |
550 sub external_db_id { | |
551 my $self = shift; | |
552 $self->{'external_db_id'} = shift if(@_); | |
553 return $self->{'external_db_id'}; | |
554 } | |
555 | |
556 | |
557 =head2 db_name | |
558 | |
559 Arg [1] : string $external_db_name (optional) | |
560 Example : $ex_db_name = $fp->dbname(); | |
561 Description: Getter/Setter for the external_db_name attribute, name of external database | |
562 Returntype : string | |
563 Exceptions : none | |
564 Caller : general | |
565 Status : At Risk | |
566 | |
567 =cut | |
568 | |
569 sub db_name { | |
570 my $self = shift; | |
571 $self->{'dbname'} = shift if(@_); | |
572 return $self->{'dbname'}; | |
573 } | |
574 | |
575 =head2 db_display_name | |
576 | |
577 Arg [1] : string $db_display_name (optional) | |
578 Example : $ex_db_display_name = $fp->db_display_name(); | |
579 Description: Getter/Setter for the db_display_name attribute | |
580 The preferred display name for the external database. | |
581 Returntype : string | |
582 Exceptions : none | |
583 Caller : general | |
584 Status : At Risk | |
585 | |
586 =cut | |
587 | |
588 sub db_display_name { | |
589 my $self = shift; | |
590 $self->{'db_display_name'} = shift if(@_); | |
591 return $self->{'db_display_name'}; | |
592 } | |
593 | |
594 | |
595 | |
596 =head2 p_value | |
597 | |
598 Arg [1] : float $p_value (optional) | |
599 Example : $eval = $fp->p_value | |
600 Description: Getter Setter for the evalue / pvalue of this feature | |
601 Returntype : float | |
602 Exceptions : none | |
603 Caller : general | |
604 Status : Stable | |
605 | |
606 =cut | |
607 | |
608 sub p_value{ | |
609 my $self = shift; | |
610 $self->{'p_value'} = shift if(@_); | |
611 return $self->{'p_value'}; | |
612 } | |
613 | |
614 | |
615 | |
616 =head2 display_id | |
617 | |
618 Arg [1] : none | |
619 Example : print $fp->display_id(); | |
620 Description: This method returns a string that is considered to be | |
621 the 'display' identifier. For feature pairs this is the | |
622 hseqname if it is available otherwise it is an empty string. | |
623 Returntype : string | |
624 Exceptions : none | |
625 Caller : web drawing code | |
626 Status : Stable | |
627 | |
628 =cut | |
629 | |
630 sub display_id { | |
631 my $self = shift; | |
632 return $self->{'hseqname'} || ''; | |
633 } | |
634 | |
635 | |
636 =head2 identical_matches | |
637 | |
638 Arg [1] : int $identical_matches (optional) | |
639 Example : | |
640 Description: get/set on the number of identical matches | |
641 Returntype : int | |
642 Execeptions: none | |
643 Caller : general | |
644 Status : Stable | |
645 | |
646 =cut | |
647 | |
648 sub identical_matches{ | |
649 my ($self,$arg) = @_; | |
650 | |
651 if (defined($arg)) { | |
652 return $self->{'_identical_matches'} = $arg; | |
653 } | |
654 return $self->{'_identical_matches'}; | |
655 } | |
656 | |
657 =head2 positive_matches | |
658 | |
659 Arg [1] : int $positive_matches (optional) | |
660 Example : | |
661 Description: get/set on the number of positive matches | |
662 Returntype : int | |
663 Execeptions: none | |
664 Caller : general | |
665 Status : Stable | |
666 | |
667 =cut | |
668 | |
669 sub positive_matches{ | |
670 my ($self,$arg) = @_; | |
671 | |
672 if (defined($arg)) { | |
673 return $self->{'_positive_matches'} = $arg; | |
674 } | |
675 return $self->{'_positive_matches'}; | |
676 } | |
677 | |
678 =head2 group_id | |
679 | |
680 Arg [1] : int $group_id | |
681 Example : none | |
682 Description: get/set for attribute group_id | |
683 Returntype : int | |
684 Exceptions : none | |
685 Caller : general | |
686 Status : Stable | |
687 | |
688 =cut | |
689 | |
690 sub group_id { | |
691 my ($self, $arg) = @_; | |
692 | |
693 if ( defined $arg ) { | |
694 $self->{'group_id'} = $arg ; | |
695 } | |
696 return $self->{'group_id'}; | |
697 } | |
698 | |
699 =head2 level_id | |
700 | |
701 Arg [1] : int $level_id | |
702 Example : none | |
703 Description: get/set for attribute level_id | |
704 Returntype : int | |
705 Exceptions : none | |
706 Caller : general | |
707 Status : Stable | |
708 | |
709 =cut | |
710 | |
711 sub level_id { | |
712 my ($self, $arg) = @_; | |
713 | |
714 if ( defined $arg ) { | |
715 $self->{'level_id'} = $arg ; | |
716 } | |
717 return $self->{'level_id'}; | |
718 } | |
719 | |
720 | |
721 | |
722 | |
723 | |
724 | |
725 =head1 DEPRECATED METHODS | |
726 | |
727 =cut | |
728 | |
729 | |
730 =head2 feature1 | |
731 | |
732 Description: DEPRECATED use start(), end(), strand(), slice(), etc. | |
733 methods instead | |
734 | |
735 =cut | |
736 | |
737 sub feature1 { | |
738 my ($self,$arg) = @_; | |
739 | |
740 deprecate('Use start(), end(), strand(), slice(), etc. methods instead.'); | |
741 | |
742 if($arg) { | |
743 $self->start($arg->start()); | |
744 $self->end($arg->end()); | |
745 $self->strand($arg->strand()); | |
746 $self->score($arg->score()); | |
747 $self->percent_id($arg->percent_id()); | |
748 $self->analysis($arg->analysis); | |
749 if($arg->contig){ | |
750 $self->slice($arg->contig); | |
751 } | |
752 } | |
753 | |
754 return $self; | |
755 } | |
756 | |
757 =head2 feature2 | |
758 | |
759 Description: DEPRECATED use hstart(), hend(), hstrand() etc. | |
760 methods instead | |
761 | |
762 =cut | |
763 | |
764 sub feature2 { | |
765 my ($self,$arg) = @_; | |
766 | |
767 deprecate('Use hstart(),hend(),hstrand(),hseqname() methods instead.'); | |
768 | |
769 if (defined($arg)) { | |
770 $self->hstart($arg->start()); | |
771 $self->hend($arg->end()); | |
772 $self->hstrand($arg->strand()); | |
773 $self->hseqname($arg->seqname()); | |
774 return $arg; | |
775 } | |
776 | |
777 return new Bio::EnsEMBL::Feature( | |
778 -START => $self->hstart(), | |
779 -END => $self->hend(), | |
780 -STRAND => $self->hstrand(), | |
781 -SCORE => $self->score(), | |
782 -PERCENT_ID => $self->percent_id(), | |
783 -ANALYSIS => $self->analysis, | |
784 -SEQNAME => $self->hseqname()); | |
785 } | |
786 | |
787 | |
788 | |
789 | |
790 =head2 invert | |
791 | |
792 Arg [1] : (optional) Bio::EnsEMBL::Slice $newslice | |
793 Example : $feature->invert(); | |
794 Description: This method is used to swap the hit and query sides of this | |
795 feature in place. A new slice may optionally provided which | |
796 this feature will be placed on. If no slice is provided the | |
797 feature slice will be set to undef. | |
798 Returntype : none | |
799 Exceptions : none | |
800 Caller : pipeline (BlastMiniGenewise) | |
801 | |
802 =cut | |
803 | |
804 sub invert { | |
805 my ($self,$slice) = @_; | |
806 | |
807 if (! defined $slice && defined $self->hslice) { | |
808 $slice = $self->hslice; | |
809 } | |
810 | |
811 my $hstart = $self->{'hstart'}; | |
812 my $hend = $self->{'hend'}; | |
813 my $hstrand = $self->{'hstrand'}; | |
814 my $hspecies = $self->{'hspecies'}; | |
815 my $hseqname = $self->{'hseqname'}; | |
816 | |
817 my $start = $self->{'start'}; | |
818 my $end = $self->{'end'}; | |
819 my $strand = $self->{'strand'}; | |
820 my $species = $self->{'species'}; | |
821 my $seqname = $self->seqname(); | |
822 | |
823 $self->{'start'} = $hstart; | |
824 $self->{'end'} = $hend; | |
825 $self->{'strand'} = $hstrand; | |
826 $self->{'species'} = $hspecies; | |
827 $self->{'seqname'} = $hseqname if(defined($hseqname)); | |
828 | |
829 $self->{'hstart'} = $start; | |
830 $self->{'hend'} = $end; | |
831 $self->{'hstrand'} = $strand; | |
832 $self->{'hseqname'} = $seqname; | |
833 $self->{'hspecies'} = $species; | |
834 | |
835 $self->{'hslice'} = $self->slice; | |
836 $self->{'slice'} = $slice; | |
837 } | |
838 | |
839 | |
840 | |
841 =head2 validate | |
842 | |
843 Description: DEPRECATED do not use | |
844 | |
845 =cut | |
846 | |
847 sub validate { | |
848 my ($self) = @_; | |
849 | |
850 deprecate('This method does nothing and should not be used.'); | |
851 } | |
852 | |
853 =head2 validate_prot_feature | |
854 | |
855 Description: DEPRECATED do not use | |
856 | |
857 =cut | |
858 | |
859 sub validate_prot_feature{ | |
860 my ($self) = @_; | |
861 | |
862 deprecate('This method does nothing and should not be used.'); | |
863 } | |
864 | |
865 | |
866 =head2 set_featurepair_fields | |
867 | |
868 Description: DEPRECATED do not use | |
869 | |
870 =cut | |
871 | |
872 sub set_featurepair_fields { | |
873 my ($self, $start, $end, $strand, $score, $seqname, $hstart, $hend, | |
874 $hstrand, $hseqname, $analysis, $e_value, $perc_id, | |
875 $phase, $end_phase) = @_; | |
876 | |
877 deprecate("Use individual Getter/Setters or Constructor arguments " . | |
878 " instead.\nThere is no advantage to using this method."); | |
879 | |
880 throw('interface fault') if (@_ < 12 or @_ > 15); | |
881 | |
882 $self->start($start); | |
883 $self->end($end); | |
884 $self->strand($strand); | |
885 $self->score($score); | |
886 $self->seqname($seqname); | |
887 $self->hstart($hstart); | |
888 $self->hend($hend); | |
889 $self->hstrand($hstrand); | |
890 $self->hseqname($hseqname); | |
891 $self->analysis($analysis); | |
892 $self->p_value ($e_value) if (defined $e_value); | |
893 $self->percent_id ($perc_id) if (defined $perc_id); | |
894 $self->phase ($phase) if (defined $phase); | |
895 $self->end_phase ($end_phase) if (defined $end_phase); | |
896 } | |
897 | |
898 | |
899 =head2 gffstring | |
900 | |
901 Description: DEPRECATED do not use | |
902 | |
903 =cut | |
904 | |
905 sub gffstring { | |
906 my ($self) = @_; | |
907 | |
908 deprecate('Do not use'); | |
909 | |
910 my $str .= (defined $self->slice) ? $self->slice->name()."\t": "\t"; | |
911 $str .= "\t"; #source tag | |
912 $str .= "\t"; #primary tag | |
913 $str .= (defined $self->start) ? $self->start."\t" : "\t"; | |
914 $str .= (defined $self->end) ? $self->end."\t" : "\t"; | |
915 $str .= (defined $self->score) ? $self->score."\t" : "\t"; | |
916 $str .= (defined $self->strand) ? $self->strand."\t" : ".\t"; | |
917 $str .= ".\t"; #phase | |
918 $str .= ".\t"; #end phase | |
919 | |
920 my $hstrand = "+"; | |
921 | |
922 if (($self->hstrand)&&($self->hstrand == -1)) { | |
923 $hstrand = "-"; | |
924 } | |
925 | |
926 #Append a few FeaturePair specific things | |
927 $str .= (defined $self->hseqname) ? $self->hseqname."\t" : "\t"; | |
928 $str .= (defined $self->hstart) ? $self->hstart."\t" : "\t"; | |
929 $str .= (defined $self->hend) ? $self->hend."\t" : "\t"; | |
930 $str .= (defined $self->hstrand) ? $hstrand."\t" : "\t"; | |
931 $str .= (defined $self->hphase) ? $self->hphase."\t" : ".\t"; | |
932 | |
933 return $str; | |
934 } | |
935 | |
936 | |
937 | |
938 | |
939 =head2 hphase | |
940 | |
941 Description: DEPRECATED do not use | |
942 | |
943 =cut | |
944 | |
945 sub hphase { | |
946 my ($self, $value) = @_; | |
947 | |
948 deprecate('This method does nothing useful.'); | |
949 | |
950 if (defined($value)) { | |
951 $self->{_hphase} = $value; | |
952 } | |
953 | |
954 return $self->{_hphase}; | |
955 } | |
956 | |
957 | |
958 =head2 hend_phase | |
959 | |
960 Description: DEPRECATED do not use | |
961 | |
962 =cut | |
963 | |
964 sub hend_phase { | |
965 my ($self, $value) = @_; | |
966 | |
967 deprecate('This method does nothing useful.'); | |
968 | |
969 if (defined($value)) { | |
970 $self->{_hend_phase} = $value; | |
971 } | |
972 return $self->{_hend_phase}; | |
973 } | |
974 | |
975 sub extra_data { | |
976 my $self = shift; | |
977 $self->{'extra_data'} = shift if(@_); | |
978 return $self->{'extra_data'}; | |
979 } | |
980 | |
981 sub type { | |
982 my $self = shift; | |
983 $self->{'extra_data'}->{'type'} = shift if(@_); | |
984 if (exists $self->{'extra_data'}) { | |
985 return $self->{'extra_data'}->{'type'}; | |
986 } | |
987 return; | |
988 } | |
989 | |
990 1; |