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