view mayachemtools/docs/modules/html/MoleculeFileIO.html @ 9:ab29fa5c8c1f draft default tip

Uploaded
author deepakjadmin
date Thu, 15 Dec 2016 14:18:03 -0500
parents 73ae111cf86f
children
line wrap: on
line source

<html>
<head>
<title>MayaChemTools:Documentation:MoleculeFileIO.pm</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../css/MayaChemTools.css">
</head>
<body leftmargin="20" rightmargin="20" topmargin="10" bottommargin="10">
<br/>
<center>
<a href="http://www.mayachemtools.org" title="MayaChemTools Home"><img src="../../images/MayaChemToolsLogo.gif" border="0" alt="MayaChemTools"></a>
</center>
<br/>
<div class="DocNav">
<table width="100%" border=0 cellpadding=0 cellspacing=2>
<tr align="left" valign="top"><td width="33%" align="left"><a href="./Molecule.html" title="Molecule.html">Previous</a>&nbsp;&nbsp;<a href="./index.html" title="Table of Contents">TOC</a>&nbsp;&nbsp;<a href="./NucleicAcids.html" title="NucleicAcids.html">Next</a></td><td width="34%" align="middle"><strong>MoleculeFileIO.pm</strong></td><td width="33%" align="right"><a href="././code/MoleculeFileIO.html" title="View source code">Code</a>&nbsp;|&nbsp;<a href="./../pdf/MoleculeFileIO.pdf" title="PDF US Letter Size">PDF</a>&nbsp;|&nbsp;<a href="./../pdfgreen/MoleculeFileIO.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a>&nbsp;|&nbsp;<a href="./../pdfa4/MoleculeFileIO.pdf" title="PDF A4 Size">PDFA4</a>&nbsp;|&nbsp;<a href="./../pdfa4green/MoleculeFileIO.pdf" title="PDF A4 Size with narrow margins: www.changethemargins.com">PDFA4Green</a></td></tr>
</table>
</div>
<p>
</p>
<h2>NAME</h2>
<p>MoleculeFileIO</p>
<p>
</p>
<h2>SYNOPSIS</h2>
<p>use MoleculeFileIO;</p>
<p>use MoleculeFileIO qw(:all);</p>
<p>
</p>
<h2>DESCRIPTION</h2>
<p><strong>MoleculeFileIO</strong> class provides the following methods:</p>
<p> <a href="#new">new</a>, <a href="#close">Close</a>, <a href="#issupportedmoleculefileformat">IsSupportedMoleculeFileFormat</a>, <a href="#open">Open</a>, <a href="#readmolecule">ReadMolecule</a>
, <a href="#readmoleculestring">ReadMoleculeString</a>, <a href="#writemolecule">WriteMolecule</a>
</p><p>The following methods can also be used as functions:</p>
<p>IsSupportedMoleculeFileFormat</p>
<p>
</p>
<h2>METHODS</h2>
<dl>
<dt><strong><a name="new" class="item"><strong>new</strong></a></strong></dt>
<dd>
<div class="OptionsBox">
    $NewMoleculeFileIO = new MoleculeFileIO([%PropertyNameAndValues]);</div>
<p>Using specified <em>MoleculeFileIO</em> property names and values hash, <strong>new</strong> method
creates a new object and returns a reference to newly created <strong>MoleculeFileIO</strong> object.
By default, following properties are initialized:</p>
<div class="OptionsBox">
    Name = &quot;&quot;
<br/>    Mode = &quot;&quot;
<br/>    FileIORef = &quot;&quot;</div>
<p>Based on extension of specified file <em>Name</em>, an input class is automatically associated to
provide molecule read and write methods.</p>
<p>Examples:</p>
<div class="OptionsBox">
    $Name = &quot;Water.mol&quot;;
<br/>    $Mode = &quot;Read&quot;;
<br/>    $MoleculeFileIO = new MoleculeFileIO('Name' =&gt; $Name,
                                         'Mode' =&gt; $Mode);
<br/>    $MoleculeFileIO-&gt;Open();
<br/>    $Molecule = $MoleculeFileIO-&gt;ReadMolecule();
<br/>    $Molecule-&gt;DetectRings();
<br/>    print &quot;$Molecule\n&quot;;
<br/>    $MoleculeFileIO-&gt;Close();</div>
<div class="OptionsBox">
    $MoleculeFileIO = new MoleculeFileIO('Name' =&gt; 'Sample1.sdf',
                                         'Mode' =&gt; 'Read');
<br/>    $MoleculeFileIO-&gt;Open();
<br/>    while ($Molecule = $MoleculeFileIO1-&gt;ReadMolecule()) {
<br/>&nbsp;&nbsp;&nbsp;&nbsp;        $Molecule-&gt;DetectRings();
<br/>&nbsp;&nbsp;&nbsp;&nbsp;        print &quot;$Molecule\n&quot;;</div>
<div class="OptionsBox">
&nbsp;&nbsp;&nbsp;&nbsp;        $DataLabelsAndValuesRef =
          $Molecule-&gt;GetDataFieldLabelAndValues();
<br/>&nbsp;&nbsp;&nbsp;&nbsp;        for $DataLabel (sort keys %{$DataLabelsAndValuesRef} ) {
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            $DataValue = $DataLabelsAndValuesRef-&gt;{$DataLabel};
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            print &quot;&lt;DataLabel: $DataLabel; DataValue: $DataValue&gt;; &quot;;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;        }
<br/>&nbsp;&nbsp;&nbsp;&nbsp;        print &quot;\n&quot;;
<br/>    }
<br/>    $MoleculeFileIO-&gt;Close();</div>
</dd>
<dt><strong><a name="close" class="item"><strong>Close</strong></a></strong></dt>
<dd>
<div class="OptionsBox">
    $MoleculeFileIO-&gt;Close();</div>
<p>Closes an open file</p>
</dd>
<dt><strong><a name="issupportedmoleculefileformat" class="item"><strong>IsSupportedMoleculeFileFormat</strong></a></strong></dt>
<dd>
<div class="OptionsBox">
    $Status = $MoleculeFileIO-&gt;IsSupportedMoleculeFileFormat($Name);
<br/>    $Status = MoleculeFileIO::IsSupportedMoleculeFileFormat($Name);
<br/>    ($Status, $FormatType, $IOClassName) =
       $MoleculeFileIO::IsSupportedMoleculeFileFormat($Name);</div>
<p>Returns 1 or 0 based on whether input file <em>Name</em> format is supported. In list context,
value of supported format type and name of associated IO class is also returned.</p>
<p>File extension is used to determine file format. Currently, following file extensions are
supported:</p>
<div class="OptionsBox">
    FileExts - FormatType - AssociatedIOClassName</div>
<div class="OptionsBox">
    .mol - MDLMOL - MDLMolFileIO
<br/>    .sdf, .sd - SDF - SDFileIO</div>
</dd>
<dt><strong><a name="open" class="item"><strong>Open</strong></a></strong></dt>
<dd>
<div class="OptionsBox">
    $MoleculeFileIO-&gt;Open([$Mode]);</div>
<p>Opens a file in a specified <em>Mode</em>. Default mode value: <em>Read</em>. Supported mode
values:</p>
<div class="OptionsBox">
    Read, Write, Append, &lt;, &gt;, &gt;&gt;, r, w, or a</div>
</dd>
<dt><strong><a name="readmolecule" class="item"><strong>ReadMolecule</strong></a></strong></dt>
<dd>
<div class="OptionsBox">
    $Molecule = $MoleculeFileIO-&gt;ReadMolecule();</div>
<p>Reads molecule data from the file and returns a <em>Molecule</em> object.</p>
</dd>
<dt><strong><a name="readmoleculestring" class="item"><strong>ReadMoleculeString</strong></a></strong></dt>
<dd>
<div class="OptionsBox">
    $MoleculeString = $MoleculeFileIO-&gt;ReadMoleculeString();</div>
<p>Reads molecule data from a file and returns a <em>Molecule</em> string.</p>
</dd>
<dt><strong><a name="writemolecule" class="item"><strong>WriteMolecule</strong></a></strong></dt>
<dd>
<div class="OptionsBox">
    $MoleculeFileIO-&gt;WriteMolecule();</div>
<p>Write molecule data to a file for a <em>Molecule</em>.</p>
</dd>
</dl>
<p>
</p>
<h2>AUTHOR</h2>
<p><a href="mailto:msud@san.rr.com">Manish Sud</a></p>
<p>
</p>
<h2>SEE ALSO</h2>
<p><a href="./FileIO.html">FileIO.pm</a>,&nbsp<a href="./MDLMolFileIO.html">MDLMolFileIO.pm</a>,&nbsp<a href="./SDFileIO.html">SDFileIO.pm</a>
</p>
<p>
</p>
<h2>COPYRIGHT</h2>
<p>Copyright (C) 2015 Manish Sud. All rights reserved.</p>
<p>This file is part of MayaChemTools.</p>
<p>MayaChemTools is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.</p>
<p>&nbsp</p><p>&nbsp</p><div class="DocNav">
<table width="100%" border=0 cellpadding=0 cellspacing=2>
<tr align="left" valign="top"><td width="33%" align="left"><a href="./Molecule.html" title="Molecule.html">Previous</a>&nbsp;&nbsp;<a href="./index.html" title="Table of Contents">TOC</a>&nbsp;&nbsp;<a href="./NucleicAcids.html" title="NucleicAcids.html">Next</a></td><td width="34%" align="middle"><strong>March 29, 2015</strong></td><td width="33%" align="right"><strong>MoleculeFileIO.pm</strong></td></tr>
</table>
</div>
<br />
<center>
<img src="../../images/h2o2.png">
</center>
</body>
</html>