| 1 | =head1 LICENSE | ||
| 2 | |||
| 3 | See the NOTICE file distributed with this work for additional information | ||
| 4 | regarding copyright ownership. | ||
| 5 | |||
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 7 | you may not use this file except in compliance with the License. | ||
| 8 | You may obtain a copy of the License at | ||
| 9 | |||
| 10 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | |||
| 12 | Unless required by applicable law or agreed to in writing, software | ||
| 13 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 15 | See the License for the specific language governing permissions and | ||
| 16 | limitations under the License. | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | =head1 CONTACT | ||
| 23 | |||
| 24 | Please email comments or questions to the public Ensembl | ||
| 25 | developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. | ||
| 26 | |||
| 27 | Questions may also be sent to the Ensembl help desk at | ||
| 28 | <http://www.ensembl.org/Help/Contact>. | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | Bio::EnsEMBL::FeaturePair - Stores sequence Features which are | ||
| 35 | themselves hits to other sequence features. | ||
| 36 | |||
| 37 | =head1 SYNOPSIS | ||
| 38 | |||
| 39 | my $feat = Bio::EnsEMBL::FeaturePair->new( | ||
| 40 | -start => 132_231, | ||
| 41 | -end => 132_321, | ||
| 42 | -strand => -1, | ||
| 43 | -slice => $slice, | ||
| 44 | -hstart => 10, | ||
| 45 | -hend => 100, | ||
| 46 | -hstrand => 1, | ||
| 47 | -score => 100, | ||
| 48 | -percent_id => 92.0, | ||
| 49 | -hseqname => 'ALUSX10.1', | ||
| 50 | -analysis => $analysis | ||
| 51 | ); | ||
| 52 | |||
| 53 | my $hit_start = $feat->hstart(); | ||
| 54 | my $hit_end = $feat->hend(); | ||
| 55 | my $hit_strand = $feat->hstrand(); | ||
| 56 | my $analysis = $feat->analysis(); | ||
| 57 | |||
| 58 | =head1 DESCRIPTION | ||
| 59 | |||
| 60 | A sequence feature object where the feature is itself a feature on | ||
| 61 | another sequence - e.g. a blast hit where residues 1-40 of a protein | ||
| 62 | sequence SW:HBA_HUMAN has hit to bases 100 - 220 on a genomic sequence | ||
| 63 | HS120G22. The genomic sequence coordinates are represented by the | ||
| 64 | start, end, strand attributes while the protein (hit) coordinates are | ||
| 65 | represented by the hstart, hend, hstrand attributes. | ||
| 66 | |||
| 67 | $clone = $slice_adpator->fetch_by_region( 'clone', 'HS120G22' ); | ||
| 68 | |||
| 69 | $fp = Bio::EnsEMBL::FeaturePair( | ||
| 70 | -start => 100, | ||
| 71 | -end => 220, | ||
| 72 | -strand => 1, | ||
| 73 | -slice => $clone, | ||
| 74 | -hstart => 1, | ||
| 75 | -hend => 40, | ||
| 76 | -hstrand => 1, | ||
| 77 | -percent_id => 92.0, | ||
| 78 | -score => 100, | ||
| 79 | -hseqname => 'SW:HBA_HUMAN', | ||
| 80 | -species => 'Homo sapiens', | ||
| 81 | -hspecies => 'Homo sapiens' | ||
| 82 | ); | ||
| 83 | |||
| 84 | =head1 METHODS | ||
| 85 | |||
| 86 | =cut | ||
| 87 | |||
| 88 | package Bio::EnsEMBL::FeaturePair; | ||
| 89 | $Bio::EnsEMBL::FeaturePair::VERSION = '114.0.0_50'; # TRIAL | ||
| 90 | $Bio::EnsEMBL::FeaturePair::VERSION = '114.0.050'; | ||
| 91 | use vars qw(@ISA); | ||
| 92 | use strict; | ||
| 93 | |||
| 94 | use Bio::EnsEMBL::Feature; | ||
| 95 | use Bio::EnsEMBL::Utils::Argument qw(rearrange); | ||
| 96 | use Bio::EnsEMBL::Utils::Exception qw(throw warning); | ||
| 97 | |||
| 98 | @ISA = qw(Bio::EnsEMBL::Feature); | ||
| 99 | |||
| 100 | =head2 new | ||
| 101 | |||
| 102 | Arg [HSTART] : int - The start of the hit region (optional) | ||
| 103 | Arg [HEND] : int - The end of the hit region (optional) | ||
| 104 | Arg [HSTRAND] : (0,1,-1) - The strand of the hit region (optional) | ||
| 105 | Arg [PERCENT_ID]: float - The precentage identity of the hit (optional) | ||
| 106 | Arg [SCORE] : float - The score of the hit (optional) | ||
| 107 | Arg [HSEQNAME] : string - The name of the hit sequence (optional) | ||
| 108 | Arg [P_VALUE] : float - The pvalue or evalue (optional) | ||
| 109 | Arg [SPECIES] : string - The species the query sequence is from (optional) | ||
| 110 | Arg [HSPECIES] : string - The species the hit sequence is from (optional) | ||
| 111 | Arg [COVERAGE] : string - The % of the query that this feature pair covers | ||
| 112 | Arg [HCOVERAGE] : string - The % of the target this this feature pair covers | ||
| 113 | Arg [EXTRA_DATA]: HashRef - Additional data, specified as name, value attribute pairs (optional) | ||
| 114 | Arg [...] : Named superclass constructor args (Bio::EnsEMBL::Feature) | ||
| 115 | Example : $feat = Bio::EnsEMBL::FeaturePair->new(-start => 132_231, | ||
| 116 | -end => 132_321, | ||
| 117 | -strand => -1, | ||
| 118 | -slice => $slice, | ||
| 119 | -hstart => 10, | ||
| 120 | -hend => 100, | ||
| 121 | -hstrand => 1, | ||
| 122 | -score => 100, | ||
| 123 | -percent_id => 92.0, | ||
| 124 | -hseqname => 'ALUSX10.1', | ||
| 125 | -analysis => $analysis); | ||
| 126 | Description: Creates a new Bio::EnsEMBL::FeaturePair object | ||
| 127 | Returntype : Bio::EnsEMBL::FeaturePair | ||
| 128 | Exceptions : throw if start > end | ||
| 129 | throw if invalid strand is provided | ||
| 130 | Caller : general | ||
| 131 | Status : Stable | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | sub new { | ||
| 136 | my $caller = shift; | ||
| 137 | |||
| 138 | my $class = ref($caller) || $caller; | ||
| 139 | |||
| 140 | my $self = $class->SUPER::new(@_); | ||
| 141 | |||
| 142 | my ($hstart, $hend, $hstrand, $percent_id, $score, $species, $hspecies, $p_value, $hseqname, $f1, $f2, $coverage, $hcoverage, $group_id, $level_id, $external_db_id, $extra_data, $external_db_name, $external_display_db_name, $hdescription) = rearrange(['HSTART', 'HEND', 'HSTRAND', 'PERCENT_ID', 'SCORE', 'SPECIES', 'HSPECIES', 'P_VALUE', 'HSEQNAME', 'FEATURE1', 'FEATURE2', 'COVERAGE', 'HCOVERAGE', 'GROUP_ID', 'LEVEL_ID', 'EXTERNAL_DB_ID', 'EXTRA_DATA', 'DBNAME', 'DB_DISPLAY_NAME', 'HDESCRIPTION'], @_); | ||
| 143 | |||
| 144 | if (defined($hstart) && defined($hend) && ($hend < $hstart)) { | ||
| 145 | throw('HSTART must be less than or equal to HEND'); | ||
| 146 | } | ||
| 147 | |||
| 148 | if (defined($hstrand) && $hstrand != 1 && $hstrand != -1 && $hstrand != 0) { | ||
| 149 | throw('HSTRAND must be one of (0,1,-1)'); | ||
| 150 | } | ||
| 151 | |||
| 152 | $self->{'hstart'} = $hstart; | ||
| 153 | $self->{'hend'} = $hend; | ||
| 154 | $self->{'hstrand'} = $hstrand; | ||
| 155 | $self->{'score'} = $score; | ||
| 156 | $self->{'percent_id'} = $percent_id; | ||
| 157 | $self->{'species'} = $species; | ||
| 158 | $self->{'hspecies'} = $hspecies; | ||
| 159 | $self->{'hseqname'} = $hseqname; | ||
| 160 | $self->{'coverage'} = $coverage; | ||
| 161 | $self->{'hcoverage'} = $hcoverage; | ||
| 162 | $self->{'p_value'} = $p_value; | ||
| 163 | $self->{'group_id'} = $group_id; | ||
| 164 | $self->{'level_id'} = $level_id; | ||
| 165 | $self->{'external_db_id'} = $external_db_id; | ||
| 166 | $self->{'extra_data'} = $extra_data; | ||
| 167 | $self->{'dbname'} = $external_db_name; | ||
| 168 | $self->{'db_display_name'} = $external_display_db_name; | ||
| 169 | $self->{'hdescription'} = $hdescription; | ||
| 170 | |||
| 171 | |||
| 172 | return $self; | ||
| 173 | } ## end sub new | ||
| 174 | |||
| 175 | =head2 hseqname | ||
| 176 | |||
| 177 | Arg [1] : string $hseqname (optional) | ||
| 178 | Example : $hseqname = $fp->hseqname(); | ||
| 179 | Description: Getter/Setter for the name of the hit sequence | ||
| 180 | Returntype : string | ||
| 181 | Exceptions : none | ||
| 182 | Caller : general | ||
| 183 | Status : Stable | ||
| 184 | |||
| 185 | =cut | ||
| 186 | |||
| 187 | sub hseqname { | ||
| 188 | my $self = shift; | ||
| 189 | $self->{'hseqname'} = shift if (@_); | ||
| 190 | return $self->{hseqname}; | ||
| 191 | } | ||
| 192 | |||
| 193 | =head2 hstart | ||
| 194 | |||
| 195 | Arg [1] : string $hstart (optional) | ||
| 196 | Example : $hstart = $fp->hstart(); | ||
| 197 | Description: Getter/Setter for the start coordinate on the hit sequence | ||
| 198 | Returntype : int | ||
| 199 | Exceptions : none | ||
| 200 | Caller : general | ||
| 201 | Status : Stable | ||
| 202 | |||
| 203 | =cut | ||
| 204 | |||
| 205 | sub hstart { | ||
| 206 | my $self = shift; | ||
| 207 | $self->{'hstart'} = shift if (@_); | ||
| 208 | return $self->{'hstart'}; | ||
| 209 | } | ||
| 210 | |||
| 211 | =head2 hend | ||
| 212 | |||
| 213 | Arg [1] : string $hend (optional) | ||
| 214 | Example : $hend = $fp->hend(); | ||
| 215 | Description: Getter/Setter for the end coordinate on the hit sequence | ||
| 216 | Returntype : int | ||
| 217 | Exceptions : none | ||
| 218 | Caller : general | ||
| 219 | Status : Stable | ||
| 220 | |||
| 221 | =cut | ||
| 222 | |||
| 223 | sub hend { | ||
| 224 | my $self = shift; | ||
| 225 | $self->{'hend'} = shift if (@_); | ||
| 226 | return $self->{'hend'}; | ||
| 227 | } | ||
| 228 | |||
| 229 | =head2 hstrand | ||
| 230 | |||
| 231 | Arg [1] : int $hstrand (optional) | ||
| 232 | Example : $hstrand = $fp->hstrand | ||
| 233 | Description: Getter/Setter for the orientation of the hit on the hit sequence | ||
| 234 | Returntype : 0,1,-1 | ||
| 235 | Exceptions : thrown | ||
| 236 | Caller : general | ||
| 237 | Status : Stable | ||
| 238 | |||
| 239 | =cut | ||
| 240 | |||
| 241 | sub hstrand { | ||
| 242 | my $self = shift; | ||
| 243 | |||
| 244 | if (@_) { | ||
| 245 | my $hstrand = shift; | ||
| 246 | if (defined($hstrand) && $hstrand != 1 && $hstrand != 0 && $hstrand != -1) { | ||
| 247 | throw('hstrand must be one of (-1,0,1)'); | ||
| 248 | } | ||
| 249 | $self->{'hstrand'} = $hstrand; | ||
| 250 | } | ||
| 251 | |||
| 252 | return $self->{'hstrand'}; | ||
| 253 | } | ||
| 254 | |||
| 255 | =head2 hslice | ||
| 256 | |||
| 257 | Arg [1] : (optional) Bio::EnsEMBL::Slice $slice | ||
| 258 | Example : $hseqname = $featurepair->hslice()->seq_region_name(); | ||
| 259 | Description: Getter/Setter for the Slice that is associated with this | ||
| 260 | hit feature. The slice represents the underlying sequence that this | ||
| 261 | feature is on. Note that this method call is analagous to the | ||
| 262 | old SeqFeature methods contig(), entire_seq(), attach_seq(), | ||
| 263 | etc. | ||
| 264 | Returntype : Bio::EnsEMBL::Slice | ||
| 265 | Exceptions : thrown if an invalid argument is passed | ||
| 266 | Caller : general | ||
| 267 | Status : Stable | ||
| 268 | |||
| 269 | =cut | ||
| 270 | |||
| 271 | sub hslice { | ||
| 272 | my $self = shift; | ||
| 273 | |||
| 274 | if (@_) { | ||
| 275 | my $sl = shift; | ||
| 276 | if (defined($sl) && (!ref($sl) || !($sl->isa('Bio::EnsEMBL::Slice')))) { | ||
| 277 | throw('slice argument must be a Bio::EnsEMBL::Slice'); | ||
| 278 | } | ||
| 279 | |||
| 280 | $self->{'hslice'} = $sl; | ||
| 281 | } | ||
| 282 | |||
| 283 | return $self->{'hslice'}; | ||
| 284 | } | ||
| 285 | |||
| 286 | =head2 hseq_region_name | ||
| 287 | |||
| 288 | Arg [1] : none | ||
| 289 | Example : print $feature->hseq_region_name(); | ||
| 290 | Description: Gets the name of the hseq_region which this feature is on. | ||
| 291 | Returns undef if this Feature is not on a hslice. | ||
| 292 | Returntype : string or undef | ||
| 293 | Exceptions : none | ||
| 294 | Caller : general | ||
| 295 | Status : Stable | ||
| 296 | |||
| 297 | =cut | ||
| 298 | |||
| 299 | sub hseq_region_name { | ||
| 300 | my $self = shift; | ||
| 301 | my $slice = $self->{'hslice'}; | ||
| 302 | |||
| 303 | return ($slice) ? $slice->seq_region_name() : undef; | ||
| 304 | } | ||
| 305 | |||
| 306 | =head2 hseq_region_strand | ||
| 307 | |||
| 308 | Arg [1] : none | ||
| 309 | Example : print $feature->hseq_region_strand(); | ||
| 310 | Description: Returns the strand of the hseq_region which this feature is on | ||
| 311 | (i.e. feature_strand * slice_strand) | ||
| 312 | Returns undef if this Feature is not on a hslice. | ||
| 313 | Returntype : 1,0,-1 or undef | ||
| 314 | Exceptions : none | ||
| 315 | Caller : general | ||
| 316 | Status : Stable | ||
| 317 | |||
| 318 | =cut | ||
| 319 | |||
| 320 | sub hseq_region_strand { | ||
| 321 | my $self = shift; | ||
| 322 | my $slice = $self->{'hslice'}; | ||
| 323 | |||
| 324 | return ($slice) ? $slice->strand()*$self->{'hstrand'} : undef; | ||
| 325 | } | ||
| 326 | |||
| 327 | =head2 hseq_region_start | ||
| 328 | |||
| 329 | Arg [1] : none | ||
| 330 | Example : print $feature->hseq_region_start(); | ||
| 331 | Description: Convenience method which returns the absolute start of this | ||
| 332 | feature on the hseq_region, as opposed to the relative (hslice) | ||
| 333 | position. | ||
| 334 | |||
| 335 | Returns undef if this feature is not on a hslice. | ||
| 336 | Returntype : int or undef | ||
| 337 | Exceptions : none | ||
| 338 | Caller : general | ||
| 339 | Status : Stable | ||
| 340 | |||
| 341 | =cut | ||
| 342 | |||
| 343 | sub hseq_region_start { | ||
| 344 | my $self = shift; | ||
| 345 | my $slice = $self->{'hslice'}; | ||
| 346 | |||
| 347 | return undef if (!$slice); | ||
| 348 | |||
| 349 | if ($slice->strand == 1) { | ||
| 350 | return undef if (!defined($self->{'hstart'})); | ||
| 351 | return $slice->start() + $self->{'hstart'} - 1; | ||
| 352 | } else { | ||
| 353 | return undef if (!defined($self->{'hend'})); | ||
| 354 | return $slice->end() - $self->{'hend'} + 1; | ||
| 355 | } | ||
| 356 | } | ||
| 357 | |||
| 358 | =head2 hseq_region_end | ||
| 359 | |||
| 360 | Arg [1] : none | ||
| 361 | Example : print $feature->hseq_region_end(); | ||
| 362 | Description: Convenience method which returns the absolute end 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_end { | ||
| 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->{'hend'})); | ||
| 382 | return $slice->start() + $self->{'hend'} - 1; | ||
| 383 | } else { | ||
| 384 | return undef if (!defined($self->{'hstart'})); | ||
| 385 | return $slice->end() - $self->{'hstart'} + 1; | ||
| 386 | } | ||
| 387 | } | ||
| 388 | |||
| 389 | =head2 score | ||
| 390 | |||
| 391 | Arg [1] : float $score (optional) | ||
| 392 | Example : $score = $fp->score(); | ||
| 393 | Description: Getter/Setter for the score of this feature pair | ||
| 394 | Returntype : float | ||
| 395 | Exceptions : none | ||
| 396 | Caller : general | ||
| 397 | Status : Stable | ||
| 398 | |||
| 399 | =cut | ||
| 400 | |||
| 401 | sub score { | ||
| 402 | my $self = shift; | ||
| 403 | $self->{'score'} = shift if (@_); | ||
| 404 | return $self->{'score'}; | ||
| 405 | } | ||
| 406 | |||
| 407 | =head2 percent_id | ||
| 408 | |||
| 409 | Arg [1] : float $percent_id (optional) | ||
| 410 | Example : $percent_id = $fp->percent_id(); | ||
| 411 | Description: Getter/Setter for the percentage identity of this feature pair | ||
| 412 | Returntype : float | ||
| 413 | Exceptions : none | ||
| 414 | Caller : general | ||
| 415 | Status : Stable | ||
| 416 | |||
| 417 | =cut | ||
| 418 | |||
| 419 | sub percent_id { | ||
| 420 | my $self = shift; | ||
| 421 | $self->{'percent_id'} = shift if (@_); | ||
| 422 | return $self->{'percent_id'}; | ||
| 423 | } | ||
| 424 | |||
| 425 | =head2 species | ||
| 426 | |||
| 427 | Arg [1] : string $genus_species_name (optional) | ||
| 428 | e.g. Homo_sapiens or Mus_musculus | ||
| 429 | Example : $species = $fp->species(); | ||
| 430 | Description: get/set on the species of feature1 | ||
| 431 | Returntype : string | ||
| 432 | Execeptions: none | ||
| 433 | Caller : general | ||
| 434 | Status : Stable | ||
| 435 | |||
| 436 | =cut | ||
| 437 | |||
| 438 | sub species { | ||
| 439 | my $self = shift; | ||
| 440 | $self->{'species'} = shift if (@_); | ||
| 441 | return $self->{'species'}; | ||
| 442 | } | ||
| 443 | |||
| 444 | =head2 hspecies | ||
| 445 | |||
| 446 | Arg [1] : string $genus_species_name (optional) | ||
| 447 | e.g. Homo_sapiens or Mus_musculus | ||
| 448 | Example : $hspecies = $fp->hspecies | ||
| 449 | Description: get/set on the species of feature2 | ||
| 450 | Returntype : string | ||
| 451 | Execeptions: none | ||
| 452 | Caller : general | ||
| 453 | Status : Stable | ||
| 454 | |||
| 455 | =cut | ||
| 456 | |||
| 457 | sub hspecies { | ||
| 458 | my $self = shift; | ||
| 459 | $self->{'hspecies'} = shift if (@_); | ||
| 460 | return $self->{'hspecies'}; | ||
| 461 | } | ||
| 462 | |||
| 463 | =head2 coverage | ||
| 464 | |||
| 465 | Arg [1] : number (percentage) $coverage (optional) | ||
| 466 | Example : $cov = $fp->coverage(); | ||
| 467 | Description: Getter/Setter for the % of the query covered by the feature | ||
| 468 | Returntype : string | ||
| 469 | Exceptions : none | ||
| 470 | Caller : general | ||
| 471 | Status : Stable | ||
| 472 | |||
| 473 | =cut | ||
| 474 | |||
| 475 | sub coverage { | ||
| 476 | my $self = shift; | ||
| 477 | $self->{'coverage'} = shift if (@_); | ||
| 478 | return $self->{'coverage'}; | ||
| 479 | } | ||
| 480 | |||
| 481 | =head2 hcoverage | ||
| 482 | |||
| 483 | Arg [1] : number (percentage) $hcoverage (optional) | ||
| 484 | Example : $hcov = $fp->hcoverage(); | ||
| 485 | Description: Getter/Setter for the % of the target covered by the feature | ||
| 486 | Returntype : string | ||
| 487 | Exceptions : none | ||
| 488 | Caller : general | ||
| 489 | Status : Stable | ||
| 490 | |||
| 491 | =cut | ||
| 492 | |||
| 493 | sub hcoverage { | ||
| 494 | my $self = shift; | ||
| 495 | $self->{'hcoverage'} = shift if (@_); | ||
| 496 | return $self->{'hcoverage'}; | ||
| 497 | } | ||
| 498 | |||
| 499 | =head2 external_db_id | ||
| 500 | |||
| 501 | Arg [1] : int $external_db_id (optional) | ||
| 502 | Example : $ex_db = $fp->external_db_id(); | ||
| 503 | Description: Getter/Setter for the external_db_id taregt source database feature | ||
| 504 | Returntype : string | ||
| 505 | Exceptions : none | ||
| 506 | Caller : general | ||
| 507 | Status : At Risk | ||
| 508 | |||
| 509 | =cut | ||
| 510 | |||
| 511 | sub external_db_id { | ||
| 512 | my $self = shift; | ||
| 513 | $self->{'external_db_id'} = shift if (@_); | ||
| 514 | return $self->{'external_db_id'}; | ||
| 515 | } | ||
| 516 | |||
| 517 | =head2 db_name | ||
| 518 | |||
| 519 | Arg [1] : string $external_db_name (optional) | ||
| 520 | Example : $ex_db_name = $fp->dbname(); | ||
| 521 | Description: Getter/Setter for the external_db_name attribute, name of external database | ||
| 522 | Returntype : string | ||
| 523 | Exceptions : none | ||
| 524 | Caller : general | ||
| 525 | Status : At Risk | ||
| 526 | |||
| 527 | =cut | ||
| 528 | |||
| 529 | sub db_name { | ||
| 530 | my $self = shift; | ||
| 531 | $self->{'dbname'} = shift if (@_); | ||
| 532 | return $self->{'dbname'}; | ||
| 533 | } | ||
| 534 | |||
| 535 | =head2 db_display_name | ||
| 536 | |||
| 537 | Arg [1] : string $db_display_name (optional) | ||
| 538 | Example : $ex_db_display_name = $fp->db_display_name(); | ||
| 539 | Description: Getter/Setter for the db_display_name attribute | ||
| 540 | The preferred display name for the external database. | ||
| 541 | Returntype : string | ||
| 542 | Exceptions : none | ||
| 543 | Caller : general | ||
| 544 | Status : At Risk | ||
| 545 | |||
| 546 | =cut | ||
| 547 | |||
| 548 | sub db_display_name { | ||
| 549 | my $self = shift; | ||
| 550 | $self->{'db_display_name'} = shift if (@_); | ||
| 551 | return $self->{'db_display_name'}; | ||
| 552 | } | ||
| 553 | |||
| 554 | =head2 p_value | ||
| 555 | |||
| 556 | Arg [1] : float $p_value (optional) | ||
| 557 | Example : $eval = $fp->p_value | ||
| 558 | Description: Getter Setter for the evalue / pvalue of this feature | ||
| 559 | Returntype : float | ||
| 560 | Exceptions : none | ||
| 561 | Caller : general | ||
| 562 | Status : Stable | ||
| 563 | |||
| 564 | =cut | ||
| 565 | |||
| 566 | sub p_value { | ||
| 567 | my $self = shift; | ||
| 568 | $self->{'p_value'} = shift if (@_); | ||
| 569 | return $self->{'p_value'}; | ||
| 570 | } | ||
| 571 | |||
| 572 | =head2 hdescription | ||
| 573 | |||
| 574 | Arg [1] : String (optional) | ||
| 575 | Example : $des = $fp->hdescription() | ||
| 576 | Description: Getter Setter for optional description of this feature | ||
| 577 | Returntype : String | ||
| 578 | Exceptions : none | ||
| 579 | Caller : general | ||
| 580 | Status : Stable | ||
| 581 | |||
| 582 | =cut | ||
| 583 | |||
| 584 | sub hdescription { | ||
| 585 | my $self = shift; | ||
| 586 | $self->{'hdescription'} = shift if (@_); | ||
| 587 | return $self->{'hdescription'}; | ||
| 588 | } | ||
| 589 | |||
| 590 | =head2 display_id | ||
| 591 | |||
| 592 | Arg [1] : none | ||
| 593 | Example : print $fp->display_id(); | ||
| 594 | Description: This method returns a string that is considered to be | ||
| 595 | the 'display' identifier. For feature pairs this is the | ||
| 596 | hseqname if it is available otherwise it is an empty string. | ||
| 597 | Returntype : string | ||
| 598 | Exceptions : none | ||
| 599 | Caller : web drawing code | ||
| 600 | Status : Stable | ||
| 601 | |||
| 602 | =cut | ||
| 603 | |||
| 604 | sub display_id { | ||
| 605 | my $self = shift; | ||
| 606 | return $self->{'hseqname'} || ''; | ||
| 607 | } | ||
| 608 | |||
| 609 | =head2 identical_matches | ||
| 610 | |||
| 611 | Arg [1] : int $identical_matches (optional) | ||
| 612 | Example : | ||
| 613 | Description: get/set on the number of identical matches | ||
| 614 | Returntype : int | ||
| 615 | Execeptions: none | ||
| 616 | Caller : general | ||
| 617 | Status : Stable | ||
| 618 | |||
| 619 | =cut | ||
| 620 | |||
| 621 | sub identical_matches { | ||
| 622 | my ($self, $arg) = @_; | ||
| 623 | |||
| 624 | if (defined($arg)) { | ||
| 625 | return $self->{'_identical_matches'} = $arg; | ||
| 626 | } | ||
| 627 | return $self->{'_identical_matches'}; | ||
| 628 | } | ||
| 629 | |||
| 630 | =head2 positive_matches | ||
| 631 | |||
| 632 | Arg [1] : int $positive_matches (optional) | ||
| 633 | Example : | ||
| 634 | Description: get/set on the number of positive matches | ||
| 635 | Returntype : int | ||
| 636 | Execeptions: none | ||
| 637 | Caller : general | ||
| 638 | Status : Stable | ||
| 639 | |||
| 640 | =cut | ||
| 641 | |||
| 642 | sub positive_matches { | ||
| 643 | my ($self, $arg) = @_; | ||
| 644 | |||
| 645 | if (defined($arg)) { | ||
| 646 | return $self->{'_positive_matches'} = $arg; | ||
| 647 | } | ||
| 648 | return $self->{'_positive_matches'}; | ||
| 649 | } | ||
| 650 | |||
| 651 | =head2 group_id | ||
| 652 | |||
| 653 | Arg [1] : int $group_id | ||
| 654 | Example : none | ||
| 655 | Description: get/set for attribute group_id | ||
| 656 | Returntype : int | ||
| 657 | Exceptions : none | ||
| 658 | Caller : general | ||
| 659 | Status : Stable | ||
| 660 | |||
| 661 | =cut | ||
| 662 | |||
| 663 | sub group_id { | ||
| 664 | my ($self, $arg) = @_; | ||
| 665 | |||
| 666 | if (defined $arg) { | ||
| 667 | $self->{'group_id'} = $arg; | ||
| 668 | } | ||
| 669 | return $self->{'group_id'}; | ||
| 670 | } | ||
| 671 | |||
| 672 | =head2 level_id | ||
| 673 | |||
| 674 | Arg [1] : int $level_id | ||
| 675 | Example : none | ||
| 676 | Description: get/set for attribute level_id | ||
| 677 | Returntype : int | ||
| 678 | Exceptions : none | ||
| 679 | Caller : general | ||
| 680 | Status : Stable | ||
| 681 | |||
| 682 | =cut | ||
| 683 | |||
| 684 | sub level_id { | ||
| 685 | my ($self, $arg) = @_; | ||
| 686 | |||
| 687 | if (defined $arg) { | ||
| 688 | $self->{'level_id'} = $arg; | ||
| 689 | } | ||
| 690 | return $self->{'level_id'}; | ||
| 691 | } | ||
| 692 | |||
| 693 | |||
| 694 | =head2 invert | ||
| 695 | |||
| 696 | Arg [1] : (optional) Bio::EnsEMBL::Slice $newslice | ||
| 697 | Example : $feature->invert(); | ||
| 698 | Description: This method is used to swap the hit and query sides of this | ||
| 699 | feature in place. A new slice may optionally provided which | ||
| 700 | this feature will be placed on. If no slice is provided the | ||
| 701 | feature slice will be set to undef. | ||
| 702 | Returntype : none | ||
| 703 | Exceptions : none | ||
| 704 | Caller : pipeline (BlastMiniGenewise) | ||
| 705 | |||
| 706 | =cut | ||
| 707 | |||
| 708 | sub invert { | ||
| 709 | my ($self, $slice) = @_; | ||
| 710 | |||
| 711 | if (!defined $slice && defined $self->hslice) { | ||
| 712 | $slice = $self->hslice; | ||
| 713 | } | ||
| 714 | |||
| 715 | my $hstart = $self->{'hstart'}; | ||
| 716 | my $hend = $self->{'hend'}; | ||
| 717 | my $hstrand = $self->{'hstrand'}; | ||
| 718 | my $hspecies = $self->{'hspecies'}; | ||
| 719 | my $hseqname = $self->{'hseqname'}; | ||
| 720 | my $hdescription = $self->{'hdescription'}; | ||
| 721 | |||
| 722 | my $start = $self->{'start'}; | ||
| 723 | my $end = $self->{'end'}; | ||
| 724 | my $strand = $self->{'strand'}; | ||
| 725 | my $species = $self->{'species'}; | ||
| 726 | my $seqname = $self->seqname(); | ||
| 727 | |||
| 728 | $self->{'start'} = $hstart; | ||
| 729 | $self->{'end'} = $hend; | ||
| 730 | $self->{'strand'} = $hstrand; | ||
| 731 | $self->{'species'} = $hspecies; | ||
| 732 | $self->{'seqname'} = $hseqname if (defined($hseqname)); | ||
| 733 | |||
| 734 | $self->{'hstart'} = $start; | ||
| 735 | $self->{'hend'} = $end; | ||
| 736 | $self->{'hstrand'} = $strand; | ||
| 737 | $self->{'hseqname'} = $seqname; | ||
| 738 | $self->{'hspecies'} = $species; | ||
| 739 | |||
| 740 | $self->{'hdescription'} = $hdescription; | ||
| 741 | |||
| 742 | $self->{'hslice'} = $self->slice; | ||
| 743 | $self->{'slice'} = $slice; | ||
| 744 | } ## end sub invert | ||
| 745 | |||
| 746 | |||
| 747 | sub extra_data { | ||
| 748 | my $self = shift; | ||
| 749 | $self->{'extra_data'} = shift if (@_); | ||
| 750 | return $self->{'extra_data'}; | ||
| 751 | } | ||
| 752 | |||
| 753 | sub type { | ||
| 754 | my $self = shift; | ||
| 755 | $self->{'extra_data'}->{'type'} = shift if (@_); | ||
| 756 | if (exists $self->{'extra_data'}) { | ||
| 757 | return $self->{'extra_data'}->{'type'}; | ||
| 758 | } | ||
| 759 | return; | ||
| 760 | } | ||
| 761 | |||
| 762 | 1; |