Chemistry-MidasPattern

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
name:         Chemistry-MidasPattern
version:      0.11
version_from: lib/Chemistry/MidasPattern.pm
installdirs:  site
requires:
    Chemistry::File::PDB:          0.21
    Chemistry::MacroMol:           0.05
    Chemistry::Mol:                0.24
    Chemistry::Pattern:            0.20
    Test::Simple:                  0

distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17

Makefile.PL  view on Meta::CPAN

use 5.006;
use ExtUtils::MakeMaker;

WriteMakefile(
    'NAME'		=> 'Chemistry::MidasPattern',
    'VERSION_FROM'	=> 'lib/Chemistry/MidasPattern.pm', 
    'PREREQ_PM'		=> {qw(
        Chemistry::Mol         0.24
        Chemistry::MacroMol    0.05
        Chemistry::Pattern     0.20
        Chemistry::File::PDB   0.21
        Test::Simple           0
    )},
);

README  view on Meta::CPAN


   perl Makefile.PL
   make
   make test
   make install

DEPENDENCIES

This module requires these other modules and libraries:
        Chemistry::Mol         0.24
        Chemistry::MacroMol    0.05
        Chemistry::Pattern     0.20
        Chemistry::File::PDB   0.21
        Test::Simple           0

COPYRIGHT AND LICENSE

Copyright (C) 2005 Ivan Tubert <itub@cpan.org>

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 

lib/Chemistry/File/MidasPattern.pm  view on Meta::CPAN

=head1 NAME

Chemistry::File::MidasPattern - Wrapper Chemistry::File class for Midas patterns

=head1 SYNOPSIS

    use Chemistry::File::MidasPattern;
    use Chemistry::File::PDB;

    # read a molecule
    my $mol = Chemistry::MacroMol->read("test.pdb");

    # define a pattern matching carbons alpha and beta
    # in all valine residues
    my $str  = ':VAL@CA,CB';
    my $patt = Chemistry::MidasPattern->parse($str, format => 'midas');
    # Chemistry::Mol->parse($str, format => 'midas') also works

    # apply the pattern to the molecule
    $patt->match($mol);

lib/Chemistry/File/MidasPattern.pm  view on Meta::CPAN


1;

=head1 VERSION

0.11

=head1 SEE ALSO

L<Chemistry::MidasPattern>, L<Chemistry::File>, L<Chemistry::Mol>,
L<Chemistry::MacroMol>, L<mok>.

The PerlMol website L<http://www.perlmol.org/>

=head1 AUTHOR

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

=head1 COPYRIGHT

Copyright (c) 2005 Ivan Tubert. All rights reserved. This program is free

lib/Chemistry/MidasPattern.pm  view on Meta::CPAN

=head1 NAME

Chemistry::MidasPattern - Select atoms in macromolecules

=head1 SYNOPSIS

    use Chemistry::MidasPattern;
    use Chemistry::File::PDB;

    # read a molecule
    my $mol = Chemistry::MacroMol->read("test.pdb");

    # define a pattern matching carbons alpha and beta
    # in all valine residues
    my $str  = ':VAL@CA,CB';
    my $patt = Chemistry::MidasPattern->new($str);

    # apply the pattern to the molecule
    $patt->match($mol);

    # extract the results

lib/Chemistry/MidasPattern.pm  view on Meta::CPAN

    @123                Atom 123
    @123 za<5.0         Atoms within 5.0 Angstroms of atom 123
    @123 za>30.0        Atoms not within 30.0 Angstroms of atom 123
    @CA & @123 za<5.0   Alpha carbons within 5.0 Angstroms of atom 123

=cut


use strict;
use warnings;
use Chemistry::MacroMol;
use Carp;
use base "Chemistry::Pattern";

our $DEBUG = 0;

sub new {
    my ($class, $str) = @_;
    my $self = bless { 
        atom_map => [],
        options  => {},

t/midas.t  view on Meta::CPAN

my @files = glob("t/pats/*.pat");
my $n = @files;

eval "use Chemistry::File::PDB";
if ($@) {
    plan skip_all => "You don't have Chemistry::File::PDB installed";
} else {
    plan tests => $n;
}

my $mol = Chemistry::MacroMol->read(shift || "test.pdb");

for my $fname (@files) {
    open F, "<$fname" or die "couldn't open $fname: $!\n";
    my ($str, @expected) = map { /: (.*)/g } <F>;

    my $patt = Chemistry::MidasPattern->parse($str, format => 'midas');
    $patt->match($mol);
    my @got = map { 
        sprintf "%s\t%s",  $_->attr("pdb/residue_name"), $_->name
    } $patt->atom_map;



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