| 0 | 1 <html> | 
|  | 2 <head> | 
|  | 3 <title>MayaChemTools:Documentation:MoleculeFileIO.pm</title> | 
|  | 4 <meta http-equiv="content-type" content="text/html;charset=utf-8"> | 
|  | 5 <link rel="stylesheet" type="text/css" href="../../css/MayaChemTools.css"> | 
|  | 6 </head> | 
|  | 7 <body leftmargin="20" rightmargin="20" topmargin="10" bottommargin="10"> | 
|  | 8 <br/> | 
|  | 9 <center> | 
|  | 10 <a href="http://www.mayachemtools.org" title="MayaChemTools Home"><img src="../../images/MayaChemToolsLogo.gif" border="0" alt="MayaChemTools"></a> | 
|  | 11 </center> | 
|  | 12 <br/> | 
|  | 13 <div class="DocNav"> | 
|  | 14 <table width="100%" border=0 cellpadding=0 cellspacing=2> | 
|  | 15 <tr align="left" valign="top"><td width="33%" align="left"><a href="./Molecule.html" title="Molecule.html">Previous</a>  <a href="./index.html" title="Table of Contents">TOC</a>  <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> | <a href="./../pdf/MoleculeFileIO.pdf" title="PDF US Letter Size">PDF</a> | <a href="./../pdfgreen/MoleculeFileIO.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a> | <a href="./../pdfa4/MoleculeFileIO.pdf" title="PDF A4 Size">PDFA4</a> | <a href="./../pdfa4green/MoleculeFileIO.pdf" title="PDF A4 Size with narrow margins: www.changethemargins.com">PDFA4Green</a></td></tr> | 
|  | 16 </table> | 
|  | 17 </div> | 
|  | 18 <p> | 
|  | 19 </p> | 
|  | 20 <h2>NAME</h2> | 
|  | 21 <p>MoleculeFileIO</p> | 
|  | 22 <p> | 
|  | 23 </p> | 
|  | 24 <h2>SYNOPSIS</h2> | 
|  | 25 <p>use MoleculeFileIO;</p> | 
|  | 26 <p>use MoleculeFileIO qw(:all);</p> | 
|  | 27 <p> | 
|  | 28 </p> | 
|  | 29 <h2>DESCRIPTION</h2> | 
|  | 30 <p><strong>MoleculeFileIO</strong> class provides the following methods:</p> | 
|  | 31 <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> | 
|  | 32 , <a href="#readmoleculestring">ReadMoleculeString</a>, <a href="#writemolecule">WriteMolecule</a> | 
|  | 33 </p><p>The following methods can also be used as functions:</p> | 
|  | 34 <p>IsSupportedMoleculeFileFormat</p> | 
|  | 35 <p> | 
|  | 36 </p> | 
|  | 37 <h2>METHODS</h2> | 
|  | 38 <dl> | 
|  | 39 <dt><strong><a name="new" class="item"><strong>new</strong></a></strong></dt> | 
|  | 40 <dd> | 
|  | 41 <div class="OptionsBox"> | 
|  | 42     $NewMoleculeFileIO = new MoleculeFileIO([%PropertyNameAndValues]);</div> | 
|  | 43 <p>Using specified <em>MoleculeFileIO</em> property names and values hash, <strong>new</strong> method | 
|  | 44 creates a new object and returns a reference to newly created <strong>MoleculeFileIO</strong> object. | 
|  | 45 By default, following properties are initialized:</p> | 
|  | 46 <div class="OptionsBox"> | 
|  | 47     Name = "" | 
|  | 48 <br/>    Mode = "" | 
|  | 49 <br/>    FileIORef = ""</div> | 
|  | 50 <p>Based on extension of specified file <em>Name</em>, an input class is automatically associated to | 
|  | 51 provide molecule read and write methods.</p> | 
|  | 52 <p>Examples:</p> | 
|  | 53 <div class="OptionsBox"> | 
|  | 54     $Name = "Water.mol"; | 
|  | 55 <br/>    $Mode = "Read"; | 
|  | 56 <br/>    $MoleculeFileIO = new MoleculeFileIO('Name' => $Name, | 
|  | 57                                          'Mode' => $Mode); | 
|  | 58 <br/>    $MoleculeFileIO->Open(); | 
|  | 59 <br/>    $Molecule = $MoleculeFileIO->ReadMolecule(); | 
|  | 60 <br/>    $Molecule->DetectRings(); | 
|  | 61 <br/>    print "$Molecule\n"; | 
|  | 62 <br/>    $MoleculeFileIO->Close();</div> | 
|  | 63 <div class="OptionsBox"> | 
|  | 64     $MoleculeFileIO = new MoleculeFileIO('Name' => 'Sample1.sdf', | 
|  | 65                                          'Mode' => 'Read'); | 
|  | 66 <br/>    $MoleculeFileIO->Open(); | 
|  | 67 <br/>    while ($Molecule = $MoleculeFileIO1->ReadMolecule()) { | 
|  | 68 <br/>            $Molecule->DetectRings(); | 
|  | 69 <br/>            print "$Molecule\n";</div> | 
|  | 70 <div class="OptionsBox"> | 
|  | 71             $DataLabelsAndValuesRef = | 
|  | 72           $Molecule->GetDataFieldLabelAndValues(); | 
|  | 73 <br/>            for $DataLabel (sort keys %{$DataLabelsAndValuesRef} ) { | 
|  | 74 <br/>                    $DataValue = $DataLabelsAndValuesRef->{$DataLabel}; | 
|  | 75 <br/>                    print "<DataLabel: $DataLabel; DataValue: $DataValue>; "; | 
|  | 76 <br/>            } | 
|  | 77 <br/>            print "\n"; | 
|  | 78 <br/>    } | 
|  | 79 <br/>    $MoleculeFileIO->Close();</div> | 
|  | 80 </dd> | 
|  | 81 <dt><strong><a name="close" class="item"><strong>Close</strong></a></strong></dt> | 
|  | 82 <dd> | 
|  | 83 <div class="OptionsBox"> | 
|  | 84     $MoleculeFileIO->Close();</div> | 
|  | 85 <p>Closes an open file</p> | 
|  | 86 </dd> | 
|  | 87 <dt><strong><a name="issupportedmoleculefileformat" class="item"><strong>IsSupportedMoleculeFileFormat</strong></a></strong></dt> | 
|  | 88 <dd> | 
|  | 89 <div class="OptionsBox"> | 
|  | 90     $Status = $MoleculeFileIO->IsSupportedMoleculeFileFormat($Name); | 
|  | 91 <br/>    $Status = MoleculeFileIO::IsSupportedMoleculeFileFormat($Name); | 
|  | 92 <br/>    ($Status, $FormatType, $IOClassName) = | 
|  | 93        $MoleculeFileIO::IsSupportedMoleculeFileFormat($Name);</div> | 
|  | 94 <p>Returns 1 or 0 based on whether input file <em>Name</em> format is supported. In list context, | 
|  | 95 value of supported format type and name of associated IO class is also returned.</p> | 
|  | 96 <p>File extension is used to determine file format. Currently, following file extensions are | 
|  | 97 supported:</p> | 
|  | 98 <div class="OptionsBox"> | 
|  | 99     FileExts - FormatType - AssociatedIOClassName</div> | 
|  | 100 <div class="OptionsBox"> | 
|  | 101     .mol - MDLMOL - MDLMolFileIO | 
|  | 102 <br/>    .sdf, .sd - SDF - SDFileIO</div> | 
|  | 103 </dd> | 
|  | 104 <dt><strong><a name="open" class="item"><strong>Open</strong></a></strong></dt> | 
|  | 105 <dd> | 
|  | 106 <div class="OptionsBox"> | 
|  | 107     $MoleculeFileIO->Open([$Mode]);</div> | 
|  | 108 <p>Opens a file in a specified <em>Mode</em>. Default mode value: <em>Read</em>. Supported mode | 
|  | 109 values:</p> | 
|  | 110 <div class="OptionsBox"> | 
|  | 111     Read, Write, Append, <, >, >>, r, w, or a</div> | 
|  | 112 </dd> | 
|  | 113 <dt><strong><a name="readmolecule" class="item"><strong>ReadMolecule</strong></a></strong></dt> | 
|  | 114 <dd> | 
|  | 115 <div class="OptionsBox"> | 
|  | 116     $Molecule = $MoleculeFileIO->ReadMolecule();</div> | 
|  | 117 <p>Reads molecule data from the file and returns a <em>Molecule</em> object.</p> | 
|  | 118 </dd> | 
|  | 119 <dt><strong><a name="readmoleculestring" class="item"><strong>ReadMoleculeString</strong></a></strong></dt> | 
|  | 120 <dd> | 
|  | 121 <div class="OptionsBox"> | 
|  | 122     $MoleculeString = $MoleculeFileIO->ReadMoleculeString();</div> | 
|  | 123 <p>Reads molecule data from a file and returns a <em>Molecule</em> string.</p> | 
|  | 124 </dd> | 
|  | 125 <dt><strong><a name="writemolecule" class="item"><strong>WriteMolecule</strong></a></strong></dt> | 
|  | 126 <dd> | 
|  | 127 <div class="OptionsBox"> | 
|  | 128     $MoleculeFileIO->WriteMolecule();</div> | 
|  | 129 <p>Write molecule data to a file for a <em>Molecule</em>.</p> | 
|  | 130 </dd> | 
|  | 131 </dl> | 
|  | 132 <p> | 
|  | 133 </p> | 
|  | 134 <h2>AUTHOR</h2> | 
|  | 135 <p><a href="mailto:msud@san.rr.com">Manish Sud</a></p> | 
|  | 136 <p> | 
|  | 137 </p> | 
|  | 138 <h2>SEE ALSO</h2> | 
|  | 139 <p><a href="./FileIO.html">FileIO.pm</a>, <a href="./MDLMolFileIO.html">MDLMolFileIO.pm</a>, <a href="./SDFileIO.html">SDFileIO.pm</a> | 
|  | 140 </p> | 
|  | 141 <p> | 
|  | 142 </p> | 
|  | 143 <h2>COPYRIGHT</h2> | 
|  | 144 <p>Copyright (C) 2015 Manish Sud. All rights reserved.</p> | 
|  | 145 <p>This file is part of MayaChemTools.</p> | 
|  | 146 <p>MayaChemTools is free software; you can redistribute it and/or modify it under | 
|  | 147 the terms of the GNU Lesser General Public License as published by the Free | 
|  | 148 Software Foundation; either version 3 of the License, or (at your option) | 
|  | 149 any later version.</p> | 
|  | 150 <p> </p><p> </p><div class="DocNav"> | 
|  | 151 <table width="100%" border=0 cellpadding=0 cellspacing=2> | 
|  | 152 <tr align="left" valign="top"><td width="33%" align="left"><a href="./Molecule.html" title="Molecule.html">Previous</a>  <a href="./index.html" title="Table of Contents">TOC</a>  <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> | 
|  | 153 </table> | 
|  | 154 </div> | 
|  | 155 <br /> | 
|  | 156 <center> | 
|  | 157 <img src="../../images/h2o2.png"> | 
|  | 158 </center> | 
|  | 159 </body> | 
|  | 160 </html> |