Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/Structure/Atom.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 # $Id: Atom.pm,v 1.8 2002/10/22 07:38:44 lapp Exp $ | |
| 2 # | |
| 3 # bioperl module for Bio::Structure::Atom | |
| 4 # | |
| 5 # Cared for by Kris Boulez <kris.boulez@algonomics.com> | |
| 6 # | |
| 7 # Copyright Kris Boulez | |
| 8 # | |
| 9 # You may distribute this module under the same terms as perl itself | |
| 10 | |
| 11 # POD documentation - main docs before the code | |
| 12 | |
| 13 =head1 NAME | |
| 14 | |
| 15 Bio::Structure::Atom - Bioperl structure Object, describes an Atom | |
| 16 | |
| 17 =head1 SYNOPSIS | |
| 18 | |
| 19 #add synopsis here | |
| 20 | |
| 21 =head1 DESCRIPTION | |
| 22 | |
| 23 This object stores a Bio::Structure::Atom | |
| 24 | |
| 25 =head1 FEEDBACK | |
| 26 | |
| 27 =head2 Mailing Lists | |
| 28 | |
| 29 User feedback is an integral part of the evolution of this and other | |
| 30 Bioperl modules. Send your comments and suggestions preferably to one | |
| 31 of the Bioperl mailing lists. Your participation is much appreciated. | |
| 32 | |
| 33 bioperl-l@bioperl.org - General discussion | |
| 34 http://bio.perl.org/MailList.html - About the mailing lists | |
| 35 | |
| 36 =head2 Reporting Bugs | |
| 37 | |
| 38 Report bugs to the Bioperl bug tracking system to help us keep track | |
| 39 the bugs and their resolution. Bug reports can be submitted via email | |
| 40 or the web: | |
| 41 | |
| 42 bioperl-bugs@bio.perl.org | |
| 43 http://bugzilla.bioperl.org/ | |
| 44 | |
| 45 =head1 AUTHOR - Kris Boulez | |
| 46 | |
| 47 Email kris.boulez@algonomics.com | |
| 48 | |
| 49 =head1 APPENDIX | |
| 50 | |
| 51 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ | |
| 52 | |
| 53 =cut | |
| 54 | |
| 55 | |
| 56 # Let the code begin... | |
| 57 | |
| 58 package Bio::Structure::Atom; | |
| 59 use vars qw(@ISA); | |
| 60 use strict; | |
| 61 | |
| 62 use Bio::Root::Root; | |
| 63 use Bio::Structure::Residue; | |
| 64 @ISA = qw(Bio::Root::Root); | |
| 65 | |
| 66 | |
| 67 =head2 new() | |
| 68 | |
| 69 Title : new() | |
| 70 Usage : $struc = Bio::Structure::Atom->new( | |
| 71 -id => 'human_id', | |
| 72 ); | |
| 73 | |
| 74 Function: Returns a new Bio::Structure::Atom object from basic | |
| 75 constructors. Probably most called from Bio::Structure::IO. | |
| 76 Returns : a new Bio::Structure::Atom object | |
| 77 | |
| 78 =cut | |
| 79 | |
| 80 | |
| 81 sub new { | |
| 82 my ($class, @args) = @_; | |
| 83 my $self = $class->SUPER::new(@args); | |
| 84 | |
| 85 my($id, $x, $y, $z) = | |
| 86 $self->_rearrange([qw( | |
| 87 ID | |
| 88 X | |
| 89 Y | |
| 90 Z | |
| 91 )], | |
| 92 @args); | |
| 93 | |
| 94 $id && $self->id($id); | |
| 95 $x && $self->x($x); | |
| 96 $y && $self->y($y); | |
| 97 $z && $self->z($z); | |
| 98 | |
| 99 return $self; | |
| 100 } | |
| 101 | |
| 102 | |
| 103 | |
| 104 =head2 x() | |
| 105 | |
| 106 Title : x | |
| 107 Usage : $x = $atom->x($x); | |
| 108 Function: Set/gets the X coordinate for an Atom | |
| 109 Returns : The value for the X coordinate of the Atom (This is just a number, | |
| 110 it is expected to be in Angstrom, but no garantees) | |
| 111 Args : The X coordinate as a number | |
| 112 | |
| 113 =cut | |
| 114 | |
| 115 sub x { | |
| 116 my ($self,$value) = @_; | |
| 117 if( defined $value) { | |
| 118 # do we want to check if $value contains really a number ? | |
| 119 $self->{'x'} = $value; | |
| 120 } | |
| 121 return $self->{'x'}; | |
| 122 } | |
| 123 | |
| 124 | |
| 125 =head2 y() | |
| 126 | |
| 127 Title : y | |
| 128 Usage : $y = $atom->y($y); | |
| 129 Function: Set/gets the Y coordinate for an Atom | |
| 130 Returns : The value for the Y coordinate of the Atom (This is just a number, | |
| 131 it is eypected to be in Angstrom, but no garantees) | |
| 132 Args : The Y coordinate as a number | |
| 133 | |
| 134 =cut | |
| 135 | |
| 136 sub y { | |
| 137 my ($self,$value) = @_; | |
| 138 if( defined $value) { | |
| 139 # do we want to check if $value contains really a number ? | |
| 140 $self->{'y'} = $value; | |
| 141 } | |
| 142 return $self->{'y'}; | |
| 143 } | |
| 144 | |
| 145 | |
| 146 =head2 z() | |
| 147 | |
| 148 Title : z | |
| 149 Usage : $z = $atom->z($z); | |
| 150 Function: Set/gets the Z coordinate for an Atom | |
| 151 Returns : The value for the Z coordinate of the Atom (This is just a number, | |
| 152 it is ezpected to be in Angstrom, but no garantees) | |
| 153 Args : The Z coordinate as a number | |
| 154 | |
| 155 =cut | |
| 156 | |
| 157 sub z { | |
| 158 my ($self,$value) = @_; | |
| 159 if( defined $value) { | |
| 160 # do we want to check if $value contains really a number ? | |
| 161 $self->{'z'} = $value; | |
| 162 } | |
| 163 return $self->{'z'}; | |
| 164 } | |
| 165 | |
| 166 | |
| 167 =head2 xyz() | |
| 168 | |
| 169 Title : xyz | |
| 170 Usage : ($x,$y,$z) = $atom->xyz; | |
| 171 Function: Gets the XYZ coordinates for an Atom | |
| 172 Returns : A list with the value for the XYZ coordinate of the Atom | |
| 173 Args : | |
| 174 | |
| 175 =cut | |
| 176 | |
| 177 sub xyz { | |
| 178 my ($self) = @_; | |
| 179 | |
| 180 return ($self->x, $self->y, $self->z); | |
| 181 } | |
| 182 | |
| 183 | |
| 184 =head2 residue() | |
| 185 | |
| 186 Title : residue | |
| 187 Usage : | |
| 188 Function: No code here, all parent/child stuff via Entry | |
| 189 Returns : | |
| 190 Args : | |
| 191 | |
| 192 =cut | |
| 193 | |
| 194 sub residue { | |
| 195 my($self, $value) = @_; | |
| 196 | |
| 197 $self->throw("all parent/child stuff via Entry\n"); | |
| 198 } | |
| 199 | |
| 200 | |
| 201 =head2 icode() | |
| 202 | |
| 203 Title : icode | |
| 204 Usage : $icode = $atom->icode($icode) | |
| 205 Function: Sets/gets the icode | |
| 206 Returns : Returns the icode for this atom | |
| 207 Args : reference to an Atom | |
| 208 | |
| 209 =cut | |
| 210 | |
| 211 sub icode { | |
| 212 my($self, $value) = @_; | |
| 213 | |
| 214 if (defined $value) { | |
| 215 $self->{'icode'} = $value; | |
| 216 } | |
| 217 return $self->{'icode'}; | |
| 218 } | |
| 219 | |
| 220 | |
| 221 =head2 serial() | |
| 222 | |
| 223 Title : serial | |
| 224 Usage : $serial = $atom->serial($serial) | |
| 225 Function: Sets/gets the serial number | |
| 226 Returns : Returns the serial number for this atom | |
| 227 Args : reference to an Atom | |
| 228 | |
| 229 =cut | |
| 230 | |
| 231 sub serial { | |
| 232 my($self, $value) = @_; | |
| 233 | |
| 234 if (defined $value) { | |
| 235 $self->{'serial'} = $value; | |
| 236 } | |
| 237 return $self->{'serial'}; | |
| 238 } | |
| 239 | |
| 240 | |
| 241 =head2 occupancy() | |
| 242 | |
| 243 Title : occupancy | |
| 244 Usage : $occupancy = $atom->occupancy($occupancy) | |
| 245 Function: Sets/gets the occupancy | |
| 246 Returns : Returns the occupancy for this atom | |
| 247 Args : reference to an Atom | |
| 248 | |
| 249 =cut | |
| 250 | |
| 251 sub occupancy { | |
| 252 my($self, $value) = @_; | |
| 253 | |
| 254 if (defined $value) { | |
| 255 $self->{'occupancy'} = $value; | |
| 256 } | |
| 257 return $self->{'occupancy'}; | |
| 258 } | |
| 259 | |
| 260 | |
| 261 =head2 tempfactor() | |
| 262 | |
| 263 Title : tempfactor | |
| 264 Usage : $tempfactor = $atom->tempfactor($tempfactor) | |
| 265 Function: Sets/gets the tempfactor | |
| 266 Returns : Returns the tempfactor for this atom | |
| 267 Args : reference to an Atom | |
| 268 | |
| 269 =cut | |
| 270 | |
| 271 sub tempfactor { | |
| 272 my($self, $value) = @_; | |
| 273 | |
| 274 if (defined $value) { | |
| 275 $self->{'tempfactor'} = $value; | |
| 276 } | |
| 277 return $self->{'tempfactor'}; | |
| 278 } | |
| 279 | |
| 280 | |
| 281 =head2 segID() | |
| 282 | |
| 283 Title : segID | |
| 284 Usage : $segID = $atom->segID($segID) | |
| 285 Function: Sets/gets the segID | |
| 286 Returns : Returns the segID for this atom | |
| 287 Args : reference to an Atom | |
| 288 | |
| 289 =cut | |
| 290 | |
| 291 sub segID { | |
| 292 my($self, $value) = @_; | |
| 293 | |
| 294 if (defined $value) { | |
| 295 $self->{'segID'} = $value; | |
| 296 } | |
| 297 return $self->{'segID'}; | |
| 298 } | |
| 299 | |
| 300 | |
| 301 =head2 pdb_atomname() | |
| 302 | |
| 303 Title : pdb_atomname | |
| 304 Usage : $pdb_atomname = $atom->pdb_atomname($pdb_atomname) | |
| 305 Function: Sets/gets the pdb_atomname (atomname used in the PDB file) | |
| 306 Returns : Returns the pdb_atomname for this atom | |
| 307 Args : reference to an Atom | |
| 308 | |
| 309 =cut | |
| 310 | |
| 311 sub pdb_atomname { | |
| 312 my($self, $value) = @_; | |
| 313 | |
| 314 if (defined $value) { | |
| 315 $self->{'pdb_atomname'} = $value; | |
| 316 } | |
| 317 return $self->{'pdb_atomname'}; | |
| 318 } | |
| 319 | |
| 320 | |
| 321 =head2 element() | |
| 322 | |
| 323 Title : element | |
| 324 Usage : $element = $atom->element($element) | |
| 325 Function: Sets/gets the element | |
| 326 Returns : Returns the element for this atom | |
| 327 Args : reference to an Atom | |
| 328 | |
| 329 =cut | |
| 330 | |
| 331 sub element { | |
| 332 my($self, $value) = @_; | |
| 333 | |
| 334 if (defined $value) { | |
| 335 $self->{'element'} = $value; | |
| 336 } | |
| 337 return $self->{'element'}; | |
| 338 } | |
| 339 | |
| 340 | |
| 341 =head2 charge() | |
| 342 | |
| 343 Title : charge | |
| 344 Usage : $charge = $atom->charge($charge) | |
| 345 Function: Sets/gets the charge | |
| 346 Returns : Returns the charge for this atom | |
| 347 Args : reference to an Atom | |
| 348 | |
| 349 =cut | |
| 350 | |
| 351 sub charge { | |
| 352 my($self, $value) = @_; | |
| 353 | |
| 354 if (defined $value) { | |
| 355 $self->{'charge'} = $value; | |
| 356 } | |
| 357 return $self->{'charge'}; | |
| 358 } | |
| 359 | |
| 360 | |
| 361 =head2 sigx() | |
| 362 | |
| 363 Title : sigx | |
| 364 Usage : $sigx = $atom->sigx($sigx) | |
| 365 Function: Sets/gets the sigx | |
| 366 Returns : Returns the sigx for this atom | |
| 367 Args : reference to an Atom | |
| 368 | |
| 369 =cut | |
| 370 | |
| 371 sub sigx { | |
| 372 my($self, $value) = @_; | |
| 373 | |
| 374 if (defined $value) { | |
| 375 $self->{'sigx'} = $value; | |
| 376 } | |
| 377 return $self->{'sigx'}; | |
| 378 } | |
| 379 | |
| 380 | |
| 381 =head2 sigy() | |
| 382 | |
| 383 Title : sigy | |
| 384 Usage : $sigy = $atom->sigy($sigy) | |
| 385 Function: Sets/gets the sigy | |
| 386 Returns : Returns the sigy for this atom | |
| 387 Args : reference to an Atom | |
| 388 | |
| 389 =cut | |
| 390 | |
| 391 sub sigy { | |
| 392 my($self, $value) = @_; | |
| 393 | |
| 394 if (defined $value) { | |
| 395 $self->{'sigy'} = $value; | |
| 396 } | |
| 397 return $self->{'sigy'}; | |
| 398 } | |
| 399 | |
| 400 | |
| 401 =head2 sigz() | |
| 402 | |
| 403 Title : sigz | |
| 404 Usage : $sigz = $atom->sigz($sigz) | |
| 405 Function: Sets/gets the sigz | |
| 406 Returns : Returns the sigz for this atom | |
| 407 Args : reference to an Atom | |
| 408 | |
| 409 =cut | |
| 410 | |
| 411 sub sigz { | |
| 412 my($self, $value) = @_; | |
| 413 | |
| 414 if (defined $value) { | |
| 415 $self->{'sigz'} = $value; | |
| 416 } | |
| 417 return $self->{'sigz'}; | |
| 418 } | |
| 419 | |
| 420 | |
| 421 =head2 sigocc() | |
| 422 | |
| 423 Title : sigocc | |
| 424 Usage : $sigocc = $atom->sigocc($sigocc) | |
| 425 Function: Sets/gets the sigocc | |
| 426 Returns : Returns the sigocc for this atom | |
| 427 Args : reference to an Atom | |
| 428 | |
| 429 =cut | |
| 430 | |
| 431 sub sigocc { | |
| 432 my($self, $value) = @_; | |
| 433 | |
| 434 if (defined $value) { | |
| 435 $self->{'sigocc'} = $value; | |
| 436 } | |
| 437 return $self->{'sigocc'}; | |
| 438 } | |
| 439 | |
| 440 | |
| 441 =head2 sigtemp() | |
| 442 | |
| 443 Title : sigtemp | |
| 444 Usage : $sigtemp = $atom->sigtemp($sigtemp) | |
| 445 Function: Sets/gets the sigtemp | |
| 446 Returns : Returns the sigtemp for this atom | |
| 447 Args : reference to an Atom | |
| 448 | |
| 449 =cut | |
| 450 | |
| 451 sub sigtemp { | |
| 452 my($self, $value) = @_; | |
| 453 | |
| 454 if (defined $value) { | |
| 455 $self->{'sigtemp'} = $value; | |
| 456 } | |
| 457 return $self->{'sigtemp'}; | |
| 458 } | |
| 459 | |
| 460 | |
| 461 =head2 aniso() | |
| 462 | |
| 463 Title : aniso | |
| 464 Usage : $u12 = $atom->aniso("u12", $u12) | |
| 465 Function: Sets/gets the anisotropic temperature factors | |
| 466 Returns : Returns the requested factor for this atom | |
| 467 Args : reference to an Atom, name of the factor, value for the factor | |
| 468 | |
| 469 =cut | |
| 470 | |
| 471 sub aniso { | |
| 472 my($self, $name, $value) = @_; | |
| 473 | |
| 474 if ( !defined $name) { | |
| 475 $self->throw("You need to supply a name of the anisotropic temp factor you want to get"); | |
| 476 } | |
| 477 if (defined $value) { | |
| 478 $self->{$name} = $value; | |
| 479 } | |
| 480 return $self->{$name}; | |
| 481 } | |
| 482 | |
| 483 # placeholders | |
| 484 sub u11 { | |
| 485 my ($self, $name, $value) = @_; | |
| 486 $self->aniso($name,$value); | |
| 487 } | |
| 488 sub u22 { | |
| 489 my ($self, $name, $value) = @_; | |
| 490 $self->aniso($name,$value); | |
| 491 } | |
| 492 sub u33 { | |
| 493 my ($self, $name, $value) = @_; | |
| 494 $self->aniso($name,$value); | |
| 495 } | |
| 496 sub u12 { | |
| 497 my ($self, $name, $value) = @_; | |
| 498 $self->aniso($name,$value); | |
| 499 } | |
| 500 sub u13 { | |
| 501 my ($self, $name, $value) = @_; | |
| 502 $self->aniso($name,$value); | |
| 503 } | |
| 504 sub u23 { | |
| 505 my ($self, $name, $value) = @_; | |
| 506 $self->aniso($name,$value); | |
| 507 } | |
| 508 sub sigu11 { | |
| 509 my ($self, $name, $value) = @_; | |
| 510 $self->aniso($name,$value); | |
| 511 } | |
| 512 sub sigu22 { | |
| 513 my ($self, $name, $value) = @_; | |
| 514 $self->aniso($name,$value); | |
| 515 } | |
| 516 sub sigu33 { | |
| 517 my ($self, $name, $value) = @_; | |
| 518 $self->aniso($name,$value); | |
| 519 } | |
| 520 sub sigu12 { | |
| 521 my ($self, $name, $value) = @_; | |
| 522 $self->aniso($name,$value); | |
| 523 } | |
| 524 sub sigu13 { | |
| 525 my ($self, $name, $value) = @_; | |
| 526 $self->aniso($name,$value); | |
| 527 } | |
| 528 sub sigu23 { | |
| 529 my ($self, $name, $value) = @_; | |
| 530 $self->aniso($name,$value); | |
| 531 } | |
| 532 | |
| 533 | |
| 534 | |
| 535 | |
| 536 | |
| 537 | |
| 538 | |
| 539 | |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 =head2 id() | |
| 546 | |
| 547 Title : id | |
| 548 Usage : $atom->id("CZ2") | |
| 549 Function: Gets/sets the ID for this atom | |
| 550 Returns : the ID | |
| 551 Args : the ID | |
| 552 | |
| 553 =cut | |
| 554 | |
| 555 sub id { | |
| 556 my ($self, $value) = @_;; | |
| 557 if (defined $value) { | |
| 558 $self->{'id'} = $value; | |
| 559 } | |
| 560 return $self->{'id'}; | |
| 561 } | |
| 562 | |
| 563 sub DESTROY { | |
| 564 my $self = shift; | |
| 565 | |
| 566 # dummy, nothing needs to be done here | |
| 567 } | |
| 568 | |
| 569 # | |
| 570 # from here on only private methods | |
| 571 # | |
| 572 | |
| 573 =head2 _remove_residue() | |
| 574 | |
| 575 Title : _remove_residue | |
| 576 Usage : | |
| 577 Function: Removes the Residue this Atom is atttached to. | |
| 578 Returns : | |
| 579 Args : | |
| 580 | |
| 581 =cut | |
| 582 | |
| 583 sub _remove_residue { | |
| 584 my ($self) = shift; | |
| 585 | |
| 586 $self->throw("no code here at the moment\n"); | |
| 587 } | |
| 588 | |
| 589 | |
| 590 =head2 _grandparent() | |
| 591 | |
| 592 Title : _grandparent | |
| 593 Usage : | |
| 594 Function: get/set a symbolic reference to our grandparent | |
| 595 Returns : | |
| 596 Args : | |
| 597 | |
| 598 =cut | |
| 599 | |
| 600 sub _grandparent { | |
| 601 my($self,$symref) = @_; | |
| 602 | |
| 603 if (ref($symref)) { | |
| 604 $self->throw("Thou shall only pass strings in here, no references $symref\n"); | |
| 605 } | |
| 606 if (defined $symref) { | |
| 607 $self->{'grandparent'} = $symref; | |
| 608 } | |
| 609 return $self->{'grandparent'}; | |
| 610 } | |
| 611 | |
| 612 | |
| 613 1; |
