0
|
1 NAME
|
|
2 MoleculeFileIO
|
|
3
|
|
4 SYNOPSIS
|
|
5 use MoleculeFileIO;
|
|
6
|
|
7 use MoleculeFileIO qw(:all);
|
|
8
|
|
9 DESCRIPTION
|
|
10 MoleculeFileIO class provides the following methods:
|
|
11
|
|
12 new, Close, IsSupportedMoleculeFileFormat, Open, ReadMolecule,
|
|
13 ReadMoleculeString, WriteMolecule
|
|
14
|
|
15 The following methods can also be used as functions:
|
|
16
|
|
17 IsSupportedMoleculeFileFormat
|
|
18
|
|
19 METHODS
|
|
20 new
|
|
21 $NewMoleculeFileIO = new MoleculeFileIO([%PropertyNameAndValues]);
|
|
22
|
|
23 Using specified *MoleculeFileIO* property names and values hash, new
|
|
24 method creates a new object and returns a reference to newly created
|
|
25 MoleculeFileIO object. By default, following properties are
|
|
26 initialized:
|
|
27
|
|
28 Name = ""
|
|
29 Mode = ""
|
|
30 FileIORef = ""
|
|
31
|
|
32 Based on extension of specified file *Name*, an input class is
|
|
33 automatically associated to provide molecule read and write methods.
|
|
34
|
|
35 Examples:
|
|
36
|
|
37 $Name = "Water.mol";
|
|
38 $Mode = "Read";
|
|
39 $MoleculeFileIO = new MoleculeFileIO('Name' => $Name,
|
|
40 'Mode' => $Mode);
|
|
41 $MoleculeFileIO->Open();
|
|
42 $Molecule = $MoleculeFileIO->ReadMolecule();
|
|
43 $Molecule->DetectRings();
|
|
44 print "$Molecule\n";
|
|
45 $MoleculeFileIO->Close();
|
|
46
|
|
47 $MoleculeFileIO = new MoleculeFileIO('Name' => 'Sample1.sdf',
|
|
48 'Mode' => 'Read');
|
|
49 $MoleculeFileIO->Open();
|
|
50 while ($Molecule = $MoleculeFileIO1->ReadMolecule()) {
|
|
51 $Molecule->DetectRings();
|
|
52 print "$Molecule\n";
|
|
53
|
|
54 $DataLabelsAndValuesRef =
|
|
55 $Molecule->GetDataFieldLabelAndValues();
|
|
56 for $DataLabel (sort keys %{$DataLabelsAndValuesRef} ) {
|
|
57 $DataValue = $DataLabelsAndValuesRef->{$DataLabel};
|
|
58 print "<DataLabel: $DataLabel; DataValue: $DataValue>; ";
|
|
59 }
|
|
60 print "\n";
|
|
61 }
|
|
62 $MoleculeFileIO->Close();
|
|
63
|
|
64 Close
|
|
65 $MoleculeFileIO->Close();
|
|
66
|
|
67 Closes an open file
|
|
68
|
|
69 IsSupportedMoleculeFileFormat
|
|
70 $Status = $MoleculeFileIO->IsSupportedMoleculeFileFormat($Name);
|
|
71 $Status = MoleculeFileIO::IsSupportedMoleculeFileFormat($Name);
|
|
72 ($Status, $FormatType, $IOClassName) =
|
|
73 $MoleculeFileIO::IsSupportedMoleculeFileFormat($Name);
|
|
74
|
|
75 Returns 1 or 0 based on whether input file *Name* format is
|
|
76 supported. In list context, value of supported format type and name
|
|
77 of associated IO class is also returned.
|
|
78
|
|
79 File extension is used to determine file format. Currently,
|
|
80 following file extensions are supported:
|
|
81
|
|
82 FileExts - FormatType - AssociatedIOClassName
|
|
83
|
|
84 .mol - MDLMOL - MDLMolFileIO
|
|
85 .sdf, .sd - SDF - SDFileIO
|
|
86
|
|
87 Open
|
|
88 $MoleculeFileIO->Open([$Mode]);
|
|
89
|
|
90 Opens a file in a specified *Mode*. Default mode value: *Read*.
|
|
91 Supported mode values:
|
|
92
|
|
93 Read, Write, Append, <, >, >>, r, w, or a
|
|
94
|
|
95 ReadMolecule
|
|
96 $Molecule = $MoleculeFileIO->ReadMolecule();
|
|
97
|
|
98 Reads molecule data from the file and returns a *Molecule* object.
|
|
99
|
|
100 ReadMoleculeString
|
|
101 $MoleculeString = $MoleculeFileIO->ReadMoleculeString();
|
|
102
|
|
103 Reads molecule data from a file and returns a *Molecule* string.
|
|
104
|
|
105 WriteMolecule
|
|
106 $MoleculeFileIO->WriteMolecule();
|
|
107
|
|
108 Write molecule data to a file for a *Molecule*.
|
|
109
|
|
110 AUTHOR
|
|
111 Manish Sud <msud@san.rr.com>
|
|
112
|
|
113 SEE ALSO
|
|
114 FileIO.pm, MDLMolFileIO.pm, SDFileIO.pm
|
|
115
|
|
116 COPYRIGHT
|
|
117 Copyright (C) 2015 Manish Sud. All rights reserved.
|
|
118
|
|
119 This file is part of MayaChemTools.
|
|
120
|
|
121 MayaChemTools is free software; you can redistribute it and/or modify it
|
|
122 under the terms of the GNU Lesser General Public License as published by
|
|
123 the Free Software Foundation; either version 3 of the License, or (at
|
|
124 your option) any later version.
|
|
125
|