HackaMol

 view release on metacpan or  search on metacpan

examples/MolAdjust/readpdb_select_write.pl  view on Meta::CPAN

#!/usr/bin/env perl
# DMR April 9, 2014
#   
#   perl readpdb_select_write.pl some.pdb   
#
# reads pdb (via shift of @ARGV) 
# prints a selection to STDOUT
#
# useful for overlaying visualizations with general selections in VMD
# or whatever. All accomplished without creating any variables to show
# some object method chaining. 
#

use Modern::Perl;
use HackaMol;

HackaMol::Molecule -> new (
    atoms=>[
            grep {

t/HackaMol.t  view on Meta::CPAN

        bonds => [@ss]
    );

    $bc += $_->bond_count foreach @ss_atoms;
    is( $bc, 18, "18 bonds for 9  disulfides (1/atom) in molecule" );


    my @ss_2 = $hack->mol_disulfide_bonds($mol,0.15);
    is_deeply([@ss],[@ss_2],'mol_disulfide gives same as find_disulfide');

    # checks out by viz xyz and pdb overlay
    # $mol2->print_xyz;
}

{    # guess element from name make them dirty if don't exist in lookup
    my @atoms;
    warning_is { @atoms = $hack->read_file_atoms("t/lib/1L2Y_noelem.pdb") }
    "MolReadRole> found 2 dirty atoms. Check symbols and lookup names PeriodicTable.pm: DIRTY: index 34 name HXYY element H     -5.592      8.445     -1.281; DIRTY: index 35 name HXXX element H      0.000      0.000      0.000;",
      "warning for dirty atoms";

    # no warning...



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