Chemistry-MacroMol

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension Chemistry::MacroMol.

0.06  Jul 03 2004
        - Fixed a memory leak.

0.05  Sep 25 2003
	- First release

Domain.pm  view on Meta::CPAN

1;

=back

=head1 VERSION

0.06

=head1 SEE ALSO

L<Chemistry::MacroMol>, L<Chemistry::Mol>, L<Chemistry::Atom>, 
L<Chemistry::Bond>

=head1 AUTHOR

Ivan Tubert, E<lt>itub@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2004 by Ivan Tubert

MANIFEST  view on Meta::CPAN

Changes
MacroMol.pm
Domain.pm
Makefile.PL
MANIFEST
README
t/1.t

MacroMol.pm  view on Meta::CPAN

package Chemistry::MacroMol;

$VERSION = '0.06';
# $Id: MacroMol.pm,v 1.6 2004/07/03 19:19:44 itubert Exp $

use 5.006;
use strict;
use warnings;
use base qw(Chemistry::Mol);

=head1 NAME

Chemistry::MacroMol - Perl module for macromolecules

=head1 SYNOPSIS

    use Chemistry::MacroMol;

    my $mol = Chemistry::MacroMol->new(name => 'my big molecule');
    $mol->new_domain(name => "ASP"); # see Chemistry::Domain for details
    my @domains = $mol->domains;

=head1 DESCRIPTION

For the purposes of this module, a macromolecule is just a molecule that 
consists of several "domains". For example, a protein consists of aminoacid
residues, or a nucleic acid consists of bases. Therefore Chemistry::MacroMol 
is derived from Chemistry::Mol, with additional methods to handle the domains.

The way things are currently structured, an atom in a macromolecule "belong"
both to the MacroMol object and to a Domain object. This way you can get all the
atoms in $protein via $protein->atoms, or to the atoms in residue 123 via
$protein->domain(123)->atoms.

=head1 METHODS

Remember that this class inherits all the methods from Chemistry::Mol. They
won't be repeated here.

=over 4

=item Chemistry::MacroMol->new(name => value, ...)

Create a new MacroMol object with the specified attributes. You can use the
same attributes as for Chemistry::Mol->new.

=cut

sub new {
    my $class = shift;
    my %args = @_;
    my $self = bless $class->SUPER::new(), $class;
    $self->{domains} = [];
    $self->$_($args{$_}) for (keys %args);

MacroMol.pm  view on Meta::CPAN

    for my $b (@_){
        push @{$self->{domains}}, $b;
	$self->{byId}{$b->{id}} = $b;
    }
    $_[-1];
}

=item $mol->domain_class

Returns the domain class that a macromolecule class expects to use by default.
Chemistry::MacroMol objects return "Chemistry::Domain", but subclasses will
likely override this method.

=cut

sub domain_class { "Chemistry::Domain" }

=item $mol->new_domain(name => value, ...)

Shorthand for $mol->add_domain($mol->domain_class->new(parent => $mol, name => value, ...));

Makefile.PL  view on Meta::CPAN

use 5.006;
use ExtUtils::MakeMaker;

WriteMakefile(
    'NAME'		=> 'Chemistry::MacroMol',
    'VERSION_FROM'	=> 'MacroMol.pm', 
    'PREREQ_PM'		=> {qw(
        Chemistry::Mol      0.24 
        Scalar::Util        0
    )},
);

README  view on Meta::CPAN

Chemistry/MacroMol version 0.06
===============================

For the purposes of this module, a macromolecule is just a molecule that 
consists of several "domains". For example, a protein consists of aminoacid
residues, or a nucleic acid consists of bases. Therefore Chemistry::MacroMol 
is derived from Chemistry::Mol, with additional methods to handle the domains.

The way things are currently structured, an atom in a macromolecule "belong"
both to the MacroMol object and to a Domain object. This way you can get all the
atoms in $protein via $protein->atoms, or to the atoms in residue 123 via
$protein->domain(123)->atoms.

CHANGES SINCE VERSION 0.06
        - Fixed a memory leak.

INSTALLATION

To install this module type the following:

t/1.t  view on Meta::CPAN

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 1.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use Test;
BEGIN { plan tests => 1 };
use Chemistry::MacroMol;
ok(1); # If we made it this far, we're ok.

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.



( run in 0.744 second using v1.01-cache-2.11-cpan-49f99fa48dc )