astex
Class MoleculeIO

java.lang.Object
  extended by astex.MoleculeIO

public class MoleculeIO
extends java.lang.Object

22-05-01 mjh add .sdf as a file type for mol files. 25-05-00 mjh make file types default to pdb files. A class for reading and writing molecules from various file formats.


Field Summary
static java.lang.String MDLMol
          MDL mol file.
static java.lang.String PDBFile
          PDB file.
static java.lang.String SimpleMol
          simple mol file.
static java.lang.String SybylMol2
          SYBYL mol file.
static java.lang.String TmeshMol
          simple tmesh file.
static java.lang.String XyzrMol
          simple xyzr file.
 
Constructor Summary
MoleculeIO()
           
 
Method Summary
static java.lang.String getAtomName(char a, char b, char c, char d)
          Look up the atom name.
static int getElementFromPDBAtomLabel(char c0, char c1)
          Assign element type from pdb atom label.
static java.lang.String getResidueName(char a, char b, char c)
          Look up the residue name.
static java.lang.String getTypeFromExtension(java.lang.String filename)
          Static mapping of file extensions to AstexViewer molecule types.
static boolean isSolventAtom()
          Is the atom label a solvent label.
static boolean needNewResidue(int currentResidueNumber, char currentInsertionCode, char currentResidueA, char currentResidueB, char currentResidueC)
          Do we need a new residue?
static Molecule read(java.lang.String filename)
          Convenience method that will try and determine a file type from its extension (not foolproof).
static Molecule read(java.lang.String type, FILE file)
          Main entry point for reading a molecule file.
static boolean readAtomBlock(FILE file, int atomCount, Molecule molecule)
          Read the Sybyl atom block.
static void readBondBlock(FILE file, int bondCount, Molecule molecule, boolean atomsInOrder)
          Read the Sybyl atom block.
static Molecule readMDLMol(FILE file)
          Read an an MDL mol file.
static Molecule readMol2(FILE file)
          Read a SYBYL mol file.
static Molecule readPDB(FILE file)
          Read a PDB file from the input.
static Atom readPDBAtom(FILE file, Molecule molecule)
          Read a pdb atom from the current record.
static void readScaleRecord(Molecule molecule, FILE file)
          Read a scale record from the input file.
static Molecule readSimple(FILE file)
          Read an an MDL mol file.
static Molecule readTmesh(FILE file)
           
static void readUnitCell(Molecule molecule, FILE file)
          Read the unit cell info from the current line.
static Molecule readXyzr(FILE file)
           
static void summariseMolecule(Molecule molecule)
          Summarise the contents of a molecule.
static void write(Molecule molecule, FILE output)
          Write a Molecule.
static void write(Molecule molecule, FILE output, java.lang.String type)
           
static void writeMDLMol(Molecule molecule, FILE output)
          Write an MDL mol file to the output stream.
static void writeMDLMol(Molecule molecule, FILE output, boolean dollars)
           
static void writeMDLMolSeparator(FILE output)
          Write a molecule separator to the output stream.
static void writeMol2(Molecule molecule, FILE output)
          Write an Sybyl mol2 file to the output stream.
static void writePDB(Molecule molecule, FILE output)
          Write a molecule out as a PDB file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SybylMol2

public static final java.lang.String SybylMol2
SYBYL mol file.

See Also:
Constant Field Values

MDLMol

public static final java.lang.String MDLMol
MDL mol file.

See Also:
Constant Field Values

SimpleMol

public static final java.lang.String SimpleMol
simple mol file.

See Also:
Constant Field Values

XyzrMol

public static final java.lang.String XyzrMol
simple xyzr file.

See Also:
Constant Field Values

TmeshMol

public static final java.lang.String TmeshMol
simple tmesh file.

See Also:
Constant Field Values

PDBFile

public static final java.lang.String PDBFile
PDB file.

See Also:
Constant Field Values
Constructor Detail

MoleculeIO

public MoleculeIO()
Method Detail

getTypeFromExtension

public static java.lang.String getTypeFromExtension(java.lang.String filename)
Static mapping of file extensions to AstexViewer molecule types.


read

public static Molecule read(java.lang.String filename)
Convenience method that will try and determine a file type from its extension (not foolproof).


read

public static Molecule read(java.lang.String type,
                            FILE file)
Main entry point for reading a molecule file.


readBondBlock

public static void readBondBlock(FILE file,
                                 int bondCount,
                                 Molecule molecule,
                                 boolean atomsInOrder)
Read the Sybyl atom block.


readAtomBlock

public static boolean readAtomBlock(FILE file,
                                    int atomCount,
                                    Molecule molecule)
Read the Sybyl atom block.


readMol2

public static Molecule readMol2(FILE file)
Read a SYBYL mol file.


summariseMolecule

public static void summariseMolecule(Molecule molecule)
Summarise the contents of a molecule.


readTmesh

public static Molecule readTmesh(FILE file)

readXyzr

public static Molecule readXyzr(FILE file)

readSimple

public static Molecule readSimple(FILE file)
Read an an MDL mol file.


readMDLMol

public static Molecule readMDLMol(FILE file)
Read an an MDL mol file.


needNewResidue

public static boolean needNewResidue(int currentResidueNumber,
                                     char currentInsertionCode,
                                     char currentResidueA,
                                     char currentResidueB,
                                     char currentResidueC)
Do we need a new residue?


readPDB

public static Molecule readPDB(FILE file)
Read a PDB file from the input.


readScaleRecord

public static void readScaleRecord(Molecule molecule,
                                   FILE file)
Read a scale record from the input file.


readUnitCell

public static void readUnitCell(Molecule molecule,
                                FILE file)
Read the unit cell info from the current line.


readPDBAtom

public static Atom readPDBAtom(FILE file,
                               Molecule molecule)
Read a pdb atom from the current record.


isSolventAtom

public static boolean isSolventAtom()
Is the atom label a solvent label.


getElementFromPDBAtomLabel

public static int getElementFromPDBAtomLabel(char c0,
                                             char c1)
Assign element type from pdb atom label.


getResidueName

public static java.lang.String getResidueName(char a,
                                              char b,
                                              char c)
Look up the residue name.


getAtomName

public static java.lang.String getAtomName(char a,
                                           char b,
                                           char c,
                                           char d)
Look up the atom name. If it is a standard PDB one we will use it.


write

public static void write(Molecule molecule,
                         FILE output)
Write a Molecule.


write

public static void write(Molecule molecule,
                         FILE output,
                         java.lang.String type)

writePDB

public static void writePDB(Molecule molecule,
                            FILE output)
Write a molecule out as a PDB file.


writeMol2

public static void writeMol2(Molecule molecule,
                             FILE output)
Write an Sybyl mol2 file to the output stream.


writeMDLMol

public static void writeMDLMol(Molecule molecule,
                               FILE output)
Write an MDL mol file to the output stream.


writeMDLMol

public static void writeMDLMol(Molecule molecule,
                               FILE output,
                               boolean dollars)

writeMDLMolSeparator

public static void writeMDLMolSeparator(FILE output)
Write a molecule separator to the output stream.