[Bioperl-l] A new Perl module for Chemistry

Maksim Khrapov mkhrapov@cobaltgroup.com
Wed, 13 Sep 2000 15:10:17 -0500


Hello,

I have written a new Perl Chemistry module that might be of interest to
you guys as well. I would like to request comments before I put it out
on CPAN.

**** Special interest for biochemists -- adding a macro like "Gly" =>
"NHCH2CO" allows you to calculate masses of proteins and nucleic asids.
****

NAME
    Chemistry::MolecularMass - Perl extension for calculating molecular
mass
    of a chemical compound given its chemical formula.

VERSION
    0.1 beta

AUTHOR AND COPYRIGHT
    Copyright (C) 2000, Maksim A. Khrapov maksim@recursivemind.com
    http://www.recursivemind.com

    This program is distributed under Perl Artistic Lisence. No
warranty.
    Use at your own risk.

SYNOPSIS
       use Chemistry::MolecularMass;
       my $mm = new Chemistry::MolecularMass;
       my $mass = $mm->calc_mass("C2H5OH");
       print $mass if defined($mass);

       my %default_macros = $mm->all_macros;
       $mm->add_macros("Ts" => "CH3C6H4SO2", "Bs" => "BrC6H4SO2");
       $mass = $mm->calc_mass("TsOEt");

       ### if you are an organic chemist, you might want to do this:
       $mm->add_macros("Pr" => "C3H7", "Ac" => "CH3COO");

       my %elements = $mm->all_elements;
       $mm->replace_elements("Na" => 24.00, "Cl" => 37.00);
       $mass = $mm->calc_mass("NaCl");

DESCRIPTION
       Chemistry::MolecularMass is an Object Oriented Perl module for
calculating
       molcular mass of chemical compounds implemented with Perl and C.
       Molecular masses of elements stored in the module follow
recommendations
       of IUPAC (1995). The module includes elements from H(1) through
       Uuu(113) and isotopes of hydrogen: deuterium and tritium. The
module
       also allows a programmer to change the default masses of elements
       for work with isotopes. It also includes some of the more common
       chemical abbreviations as macros and allows to add new macros and
       change the values of old macros. A hash of all macros and a hash
       of all elements can be returned.

       Each MolecularMass object has its own hashes of macros and
element 
       masses, so modifications made to one MolecularMass object do NOT
       affect another. The whole thing was programmed with reentrancy
       in mind, so it should be thread safe as well.


-- 
Maksim Khrapov <mkhrapov@cobaltgroup.com> +1-512-328-5959 ext. 3015
http://www.dealernet.com/ -- Where will you buy your next car?