blib/lib/Chemistry/File/MidasPattern.pm

filter: Statementstmt 78.9% 15 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 80.0% 20 / 25 CC 1 SCAR 1.8
CC
1
Cov
79%
parse_string
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Chemistry-Mol-0.35/t/geom.t ↑ Summary blib/lib/Chemistry/File/FormulaPattern.pm »
1 package Chemistry::File::MidasPattern;
2  
3 9 $VERSION = '0.11';
4  
5 =head1 NAME
6  
7 Chemistry::File::MidasPattern - Wrapper Chemistry::File class for Midas patterns
8  
9 =head1 SYNOPSIS
10  
11 use Chemistry::File::MidasPattern;
12 use Chemistry::File::PDB;
13  
14 # read a molecule
15 my $mol = Chemistry::MacroMol->read("test.pdb");
16  
17 # define a pattern matching carbons alpha and beta
18 # in all valine residues
19 my $str = ':VAL@CA,CB';
20 my $patt = Chemistry::MidasPattern->parse($str, format => 'midas');
21 # Chemistry::Mol->parse($str, format => 'midas') also works
22  
23 # apply the pattern to the molecule
24 $patt->match($mol);
25  
26 # extract the results
27 for my $atom ($patt->atom_map) {
28 printf "%s\t%s\n", $atom->attr("pdb/residue_name"), $atom->name;
29 }
30 printf "FOUND %d atoms\n", scalar($patt->atom_map);
31  
32 =head1 DESCRIPTION
33  
34 This is a wrapper class for reading Midas Patterns using the standard
35 Chemistry::Mol I/O interface. This allows Midas patterns to be used
36 interchangeably with other pattern languages such as SMARTS in the context of
37 programs such as L<mok>. All of the real work is done by
38 L<Chemistry::MidasPattern>.
39  
40 This module register the 'midas' format with Chemistry::Mol.
41  
42 =cut
43  
44 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 9 ▶use base "Chemistry::File";
Subroutine BEGIN: called CC=1 SCAR=0.0
47 9 ▶use Chemistry::MidasPattern;
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49 9 Chemistry::Mol->register_format(midas => __PACKAGE__);
50  
51 0 ▶sub parse_string {
Subroutine parse_string: not called CC=1 SCAR=6.9
Pod documented
52 0 my ($self, $s, %opts) = @_;
53 0 my $patt = Chemistry::MidasPattern->new($s);
54 0 $patt->options(%opts);
55 0 $patt;
56 }
57  
58 9 1;
59  
60 =head1 VERSION
61  
62 0.11
63  
64 =head1 SEE ALSO
65  
66 L<Chemistry::MidasPattern>, L<Chemistry::File>, L<Chemistry::Mol>,
67 L<Chemistry::MacroMol>, L<mok>.
68  
69 The PerlMol website L<http://www.perlmol.org/>
70  
71 =head1 AUTHOR
72  
73 Ivan Tubert E<lt>itub@cpan.orgE<gt>
74  
75 =head1 COPYRIGHT
76  
77 Copyright (c) 2005 Ivan Tubert. All rights reserved. This program is free
78 software; you can redistribute it and/or modify it under the same terms as
79 Perl itself.
80  
81 =cut
82  
« Chemistry-Mol-0.35/t/geom.t ↑ Summary blib/lib/Chemistry/File/FormulaPattern.pm »