org.jmol.adapter.readers.cifpdb
Class CifReader

java.lang.Object
  extended by org.jmol.adapter.smarter.AtomSetCollectionReader
      extended by org.jmol.adapter.readers.cifpdb.CifReader
All Implemented Interfaces:
JmolLineReader

public class CifReader
extends AtomSetCollectionReader
implements JmolLineReader

A true line-free CIF file reader for CIF and mmCIF files.

http://www.iucr.org/iucr-top/cif/ http://www.iucr.org/iucr-top/cif/standard/cifstd5.html

Author:
Miguel, Egon, and Bob (hansonr@stolaf.edu) symmetry added by Bob Hanson: setSpaceGroupName() setSymmetryOperator() setUnitCellItem() setFractionalCoordinates() setAtomCoord() applySymmetryAndSetTrajectory()

Field Summary
private static byte ADP_TYPE
           
private static byte ALT_ID
           
private static byte ANISO_B11
           
private static byte ANISO_B12
           
private static byte ANISO_B13
           
private static byte ANISO_B22
           
private static byte ANISO_B23
           
private static byte ANISO_B33
           
private static byte ANISO_Beta_11
           
private static byte ANISO_Beta_12
           
private static byte ANISO_Beta_13
           
private static byte ANISO_Beta_22
           
private static byte ANISO_Beta_23
           
private static byte ANISO_Beta_33
           
private static byte ANISO_LABEL
           
private static byte ANISO_MMCIF_U11
           
private static byte ANISO_MMCIF_U12
           
private static byte ANISO_MMCIF_U13
           
private static byte ANISO_MMCIF_U22
           
private static byte ANISO_MMCIF_U23
           
private static byte ANISO_MMCIF_U33
           
private static byte ANISO_U11
           
private static byte ANISO_U12
           
private static byte ANISO_U13
           
private static byte ANISO_U22
           
private static byte ANISO_U23
           
private static byte ANISO_U33
           
private static byte ASYM_ID
           
private static byte ATOM_TYPE_OXIDATION_NUMBER
           
private static byte ATOM_TYPE_SYMBOL
           
private static java.lang.String[] atomFields
           
private static java.lang.String[] atomTypeFields
           
private  java.util.Hashtable atomTypes
           
private static byte AUTH_ATOM
           
private static byte B_ISO
           
private static byte BEG_ASYM_ID
           
private static byte BEG_INS_CODE
           
private static byte BEG_SEQ_ID
           
private static byte CARTN_X
           
private static byte CARTN_Y
           
private static byte CARTN_Z
           
static java.lang.String[] cellParamNames
           
private static byte CHEM_COMP_ID
           
private static byte CHEM_COMP_NAME
           
private static java.lang.String[] chemCompFields
           
private  java.lang.String chemicalName
           
private static byte COMP_ID
           
private static byte CONF_TYPE_ID
           
private  java.lang.String data
           
private static byte DISORDER_GROUP
           
private static byte DUMMY_ATOM
           
private static byte END_ASYM_ID
           
private static byte END_INS_CODE
           
private static byte END_SEQ_ID
           
(package private)  java.lang.String field
           
private  byte[] fieldOf
           
private  char firstChar
           
private static byte FRACT_X
           
private static byte FRACT_Y
           
private static byte FRACT_Z
           
private static byte GEOM_BOND_ATOM_SITE_LABEL_1
           
private static byte GEOM_BOND_ATOM_SITE_LABEL_2
           
private static byte GEOM_BOND_SITE_SYMMETRY_2
           
private static java.lang.String[] geomBondFields
           
private static byte GROUP_PDB
           
private  java.lang.String[] hetatmData
          optional nonloop format -- see 1jsa.cif
private  java.util.Hashtable htHetero
           
private  java.util.Hashtable htSites
           
private  boolean iHaveDesiredModel
           
private static byte INS_CODE
           
private  java.lang.String key
           
private static byte LABEL
           
private static byte MODEL_NO
           
private static byte NONE
           
private static byte NONPOLY_COMP_ID
           
private static byte NONPOLY_ENTITY_ID
           
private static byte NONPOLY_NAME
           
private static java.lang.String[] nonpolyFields
           
private static byte OCCUPANCY
           
private  int propertyCount
           
private  int[] propertyOf
           
private static byte SEQ_ID
           
private static byte SERIAL_NO
           
private static byte SHEET_ID
           
private static byte SITE_ASYM_ID
           
private static byte SITE_COMP_ID
           
private static byte SITE_ID
           
private static byte SITE_INS_CODE
           
private static byte SITE_SEQ_ID
           
private  int siteNum
           
private static byte STRAND_ID
           
private static byte STRUCT_ID
           
private static java.lang.String[] structConfFields
           
private static java.lang.String[] structSheetRangeFields
           
private static java.lang.String[] structSiteRangeFields
           
private static byte SYM_EQUIV_XYZ
           
private static java.lang.String[] symmetryOperationsFields
           
private static byte SYMOP_XYZ
           
private  java.lang.String thisDataSetName
           
private  java.lang.String thisFormula
           
private  java.lang.String thisStructuralFormula
           
private  CifDataReader tokenizer
           
private static java.lang.String[] TransformFields
           
private static byte TYPE_SYMBOL
           
private static byte U_ISO_OR_EQUIV
           
 
Fields inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader
ANGSTROMS_PER_BOHR, applySymmetryToBonds, atomSetCollection, bsFilter, bsModels, calculationType, doApplySymmetry, filter, getHeader, haveAtomFilter, havePartialChargeFilter, htParams, ignoreFileSymmetryOperators, ignoreFileUnitCell, iHaveSymmetryOperators, iHaveUnitCell, isTrajectory, latticeCells, line, modelNumber, needToApplySymmetry, next, prevline, reader, readerName, spaceGroup, templateAtomCount
 
Constructor Summary
CifReader()
           
 
Method Summary
private  void addHetero(java.lang.String groupName, java.lang.String hetName)
           
private  void disableField(int fieldIndex)
          used for turning off fractional or nonfractional coord.
private  int fieldProperty(int i)
           
private  boolean getData()
           
private static boolean isMatch(java.lang.String str1, java.lang.String str2)
           
private  void parseLoopParameters(java.lang.String[] fields)
          sets up arrays and variables for tokenizer.getData()
(package private)  boolean processAtomSiteLoopBlock()
          reads atom data in any order
private  void processAtomTypeLoopBlock()
          reads the oxidation number and associates it with an atom name, which can then later be associated with the right atom indirectly.
private  void processCellParameter()
          unit cell parameters -- two options, so we use MOD 6
private  void processChemCompLoopBlock()
          a general name definition field.
private  void processChemicalInfo(java.lang.String type)
          reads some of the more interesting info into specific atomSetAuxiliaryInfo elements
private  void processDataParameter()
          initialize a new atom set
private  void processGeomBondLoopBlock()
          reads bond data -- N_ijk symmetry business is ignored, so we only indicate bonds within the unit cell to just the original set of atoms.
private  void processLoopBlock()
          processes loop_ blocks of interest or skips the data
private  void processNonpolyData()
           
private  void processNonpolyLoopBlock()
          a HETERO name definition field.
private  void processStructConfLoopBlock()
          identifies ranges for HELIX and TURN
private  void processStructSheetRangeLoopBlock()
          identifies sheet ranges
private  void processStructSiteBlock()
          identifies structure sites
private  void processSymmetryOperationsLoopBlock()
          retrieves symmetry operations
private  void processSymmetrySpaceGroupName()
          done by AtomSetCollectionReader
private  void processUnitCellTransformMatrix()
          the PDB transformation matrix cartesian --> fractional
 void readAtomSetCollection(java.io.BufferedReader reader)
           
 java.lang.String readLine()
           
private  void skipLoop()
          skips all associated loop data
 
Methods inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader
addJmolScript, addPrimitiveLatticeVector, addSites, applySymmetryAndSetTrajectory, checkLineForScript, checkLineForScript, clearLatticeParameters, deducePdbElementSymbol, discardLines, discardLinesUntilBlank, discardLinesUntilContains, discardLinesUntilNonBlank, discardLinesUntilStartsWith, doGetModel, fillDataBlock, filterAtom, filterAtom, getElementSymbol, getStrings, getTokens, getTokens, getTokens, getTokensFloat, isLastModel, newAtomSet, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseToken, parseToken, parseToken, parseTokenNext, parseTrimmed, parseTrimmed, readAtomSetCollectionFromDOM, readData, readData, readLineTrimmed, setAtomCoord, setAtomCoord, setError, setFractionalCoordinates, setMOData, setSpaceGroupName, setSymmetryOperator, setTransform, setUnitCell, setUnitCellItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokenizer

private CifDataReader tokenizer

thisDataSetName

private java.lang.String thisDataSetName

chemicalName

private java.lang.String chemicalName

thisStructuralFormula

private java.lang.String thisStructuralFormula

thisFormula

private java.lang.String thisFormula

iHaveDesiredModel

private boolean iHaveDesiredModel

htHetero

private java.util.Hashtable htHetero

cellParamNames

public static final java.lang.String[] cellParamNames

TransformFields

private static final java.lang.String[] TransformFields

key

private java.lang.String key

data

private java.lang.String data

atomTypes

private java.util.Hashtable atomTypes

ATOM_TYPE_SYMBOL

private static final byte ATOM_TYPE_SYMBOL
See Also:
Constant Field Values

ATOM_TYPE_OXIDATION_NUMBER

private static final byte ATOM_TYPE_OXIDATION_NUMBER
See Also:
Constant Field Values

atomTypeFields

private static final java.lang.String[] atomTypeFields

NONE

private static final byte NONE
See Also:
Constant Field Values

TYPE_SYMBOL

private static final byte TYPE_SYMBOL
See Also:
Constant Field Values

LABEL

private static final byte LABEL
See Also:
Constant Field Values

AUTH_ATOM

private static final byte AUTH_ATOM
See Also:
Constant Field Values

FRACT_X

private static final byte FRACT_X
See Also:
Constant Field Values

FRACT_Y

private static final byte FRACT_Y
See Also:
Constant Field Values

FRACT_Z

private static final byte FRACT_Z
See Also:
Constant Field Values

CARTN_X

private static final byte CARTN_X
See Also:
Constant Field Values

CARTN_Y

private static final byte CARTN_Y
See Also:
Constant Field Values

CARTN_Z

private static final byte CARTN_Z
See Also:
Constant Field Values

OCCUPANCY

private static final byte OCCUPANCY
See Also:
Constant Field Values

B_ISO

private static final byte B_ISO
See Also:
Constant Field Values

COMP_ID

private static final byte COMP_ID
See Also:
Constant Field Values

ASYM_ID

private static final byte ASYM_ID
See Also:
Constant Field Values

SEQ_ID

private static final byte SEQ_ID
See Also:
Constant Field Values

INS_CODE

private static final byte INS_CODE
See Also:
Constant Field Values

ALT_ID

private static final byte ALT_ID
See Also:
Constant Field Values

GROUP_PDB

private static final byte GROUP_PDB
See Also:
Constant Field Values

MODEL_NO

private static final byte MODEL_NO
See Also:
Constant Field Values

DUMMY_ATOM

private static final byte DUMMY_ATOM
See Also:
Constant Field Values

DISORDER_GROUP

private static final byte DISORDER_GROUP
See Also:
Constant Field Values

ANISO_LABEL

private static final byte ANISO_LABEL
See Also:
Constant Field Values

ANISO_U11

private static final byte ANISO_U11
See Also:
Constant Field Values

ANISO_U22

private static final byte ANISO_U22
See Also:
Constant Field Values

ANISO_U33

private static final byte ANISO_U33
See Also:
Constant Field Values

ANISO_U12

private static final byte ANISO_U12
See Also:
Constant Field Values

ANISO_U13

private static final byte ANISO_U13
See Also:
Constant Field Values

ANISO_U23

private static final byte ANISO_U23
See Also:
Constant Field Values

ANISO_MMCIF_U11

private static final byte ANISO_MMCIF_U11
See Also:
Constant Field Values

ANISO_MMCIF_U22

private static final byte ANISO_MMCIF_U22
See Also:
Constant Field Values

ANISO_MMCIF_U33

private static final byte ANISO_MMCIF_U33
See Also:
Constant Field Values

ANISO_MMCIF_U12

private static final byte ANISO_MMCIF_U12
See Also:
Constant Field Values

ANISO_MMCIF_U13

private static final byte ANISO_MMCIF_U13
See Also:
Constant Field Values

ANISO_MMCIF_U23

private static final byte ANISO_MMCIF_U23
See Also:
Constant Field Values

U_ISO_OR_EQUIV

private static final byte U_ISO_OR_EQUIV
See Also:
Constant Field Values

ANISO_B11

private static final byte ANISO_B11
See Also:
Constant Field Values

ANISO_B22

private static final byte ANISO_B22
See Also:
Constant Field Values

ANISO_B33

private static final byte ANISO_B33
See Also:
Constant Field Values

ANISO_B12

private static final byte ANISO_B12
See Also:
Constant Field Values

ANISO_B13

private static final byte ANISO_B13
See Also:
Constant Field Values

ANISO_B23

private static final byte ANISO_B23
See Also:
Constant Field Values

ANISO_Beta_11

private static final byte ANISO_Beta_11
See Also:
Constant Field Values

ANISO_Beta_22

private static final byte ANISO_Beta_22
See Also:
Constant Field Values

ANISO_Beta_33

private static final byte ANISO_Beta_33
See Also:
Constant Field Values

ANISO_Beta_12

private static final byte ANISO_Beta_12
See Also:
Constant Field Values

ANISO_Beta_13

private static final byte ANISO_Beta_13
See Also:
Constant Field Values

ANISO_Beta_23

private static final byte ANISO_Beta_23
See Also:
Constant Field Values

ADP_TYPE

private static final byte ADP_TYPE
See Also:
Constant Field Values

atomFields

private static final java.lang.String[] atomFields

GEOM_BOND_ATOM_SITE_LABEL_1

private static final byte GEOM_BOND_ATOM_SITE_LABEL_1
See Also:
Constant Field Values

GEOM_BOND_ATOM_SITE_LABEL_2

private static final byte GEOM_BOND_ATOM_SITE_LABEL_2
See Also:
Constant Field Values

GEOM_BOND_SITE_SYMMETRY_2

private static final byte GEOM_BOND_SITE_SYMMETRY_2
See Also:
Constant Field Values

geomBondFields

private static final java.lang.String[] geomBondFields

NONPOLY_ENTITY_ID

private static final byte NONPOLY_ENTITY_ID
See Also:
Constant Field Values

NONPOLY_NAME

private static final byte NONPOLY_NAME
See Also:
Constant Field Values

NONPOLY_COMP_ID

private static final byte NONPOLY_COMP_ID
See Also:
Constant Field Values

nonpolyFields

private static final java.lang.String[] nonpolyFields

hetatmData

private java.lang.String[] hetatmData
optional nonloop format -- see 1jsa.cif


CHEM_COMP_ID

private static final byte CHEM_COMP_ID
See Also:
Constant Field Values

CHEM_COMP_NAME

private static final byte CHEM_COMP_NAME
See Also:
Constant Field Values

chemCompFields

private static final java.lang.String[] chemCompFields

CONF_TYPE_ID

private static final byte CONF_TYPE_ID
See Also:
Constant Field Values

BEG_ASYM_ID

private static final byte BEG_ASYM_ID
See Also:
Constant Field Values

BEG_SEQ_ID

private static final byte BEG_SEQ_ID
See Also:
Constant Field Values

BEG_INS_CODE

private static final byte BEG_INS_CODE
See Also:
Constant Field Values

END_ASYM_ID

private static final byte END_ASYM_ID
See Also:
Constant Field Values

END_SEQ_ID

private static final byte END_SEQ_ID
See Also:
Constant Field Values

END_INS_CODE

private static final byte END_INS_CODE
See Also:
Constant Field Values

STRUCT_ID

private static final byte STRUCT_ID
See Also:
Constant Field Values

SERIAL_NO

private static final byte SERIAL_NO
See Also:
Constant Field Values

structConfFields

private static final java.lang.String[] structConfFields

SHEET_ID

private static final byte SHEET_ID
See Also:
Constant Field Values

STRAND_ID

private static final byte STRAND_ID
See Also:
Constant Field Values

structSheetRangeFields

private static final java.lang.String[] structSheetRangeFields

SITE_ID

private static final byte SITE_ID
See Also:
Constant Field Values

SITE_COMP_ID

private static final byte SITE_COMP_ID
See Also:
Constant Field Values

SITE_ASYM_ID

private static final byte SITE_ASYM_ID
See Also:
Constant Field Values

SITE_SEQ_ID

private static final byte SITE_SEQ_ID
See Also:
Constant Field Values

SITE_INS_CODE

private static final byte SITE_INS_CODE
See Also:
Constant Field Values

structSiteRangeFields

private static final java.lang.String[] structSiteRangeFields

siteNum

private int siteNum

htSites

private java.util.Hashtable htSites

SYMOP_XYZ

private static final byte SYMOP_XYZ
See Also:
Constant Field Values

SYM_EQUIV_XYZ

private static final byte SYM_EQUIV_XYZ
See Also:
Constant Field Values

symmetryOperationsFields

private static final java.lang.String[] symmetryOperationsFields

field

java.lang.String field

firstChar

private char firstChar

propertyOf

private int[] propertyOf

fieldOf

private byte[] fieldOf

propertyCount

private int propertyCount
Constructor Detail

CifReader

public CifReader()
Method Detail

readAtomSetCollection

public void readAtomSetCollection(java.io.BufferedReader reader)
Specified by:
readAtomSetCollection in class AtomSetCollectionReader

processDataParameter

private void processDataParameter()
initialize a new atom set


processChemicalInfo

private void processChemicalInfo(java.lang.String type)
                          throws java.lang.Exception
reads some of the more interesting info into specific atomSetAuxiliaryInfo elements

Parameters:
type - "name" "formula" etc.
Throws:
java.lang.Exception

processSymmetrySpaceGroupName

private void processSymmetrySpaceGroupName()
                                    throws java.lang.Exception
done by AtomSetCollectionReader

Throws:
java.lang.Exception

processCellParameter

private void processCellParameter()
                           throws java.lang.Exception
unit cell parameters -- two options, so we use MOD 6

Throws:
java.lang.Exception

processUnitCellTransformMatrix

private void processUnitCellTransformMatrix()
                                     throws java.lang.Exception
the PDB transformation matrix cartesian --> fractional

Throws:
java.lang.Exception

getData

private boolean getData()
                 throws java.lang.Exception
Returns:
TRUE if data, even if ''; FALSE if '.' or '?' or eof.
Throws:
java.lang.Exception

processLoopBlock

private void processLoopBlock()
                       throws java.lang.Exception
processes loop_ blocks of interest or skips the data

Throws:
java.lang.Exception

processAtomTypeLoopBlock

private void processAtomTypeLoopBlock()
                               throws java.lang.Exception
reads the oxidation number and associates it with an atom name, which can then later be associated with the right atom indirectly.

Throws:
java.lang.Exception

processAtomSiteLoopBlock

boolean processAtomSiteLoopBlock()
                           throws java.lang.Exception
reads atom data in any order

Returns:
TRUE if successful; FALS if EOF encountered
Throws:
java.lang.Exception

processGeomBondLoopBlock

private void processGeomBondLoopBlock()
                               throws java.lang.Exception
reads bond data -- N_ijk symmetry business is ignored, so we only indicate bonds within the unit cell to just the original set of atoms. "connect" script or "set forceAutoBond" will override these values.

Throws:
java.lang.Exception

processNonpolyData

private void processNonpolyData()

processChemCompLoopBlock

private void processChemCompLoopBlock()
                               throws java.lang.Exception
a general name definition field. Not all hetero

Throws:
java.lang.Exception

processNonpolyLoopBlock

private void processNonpolyLoopBlock()
                              throws java.lang.Exception
a HETERO name definition field. Maybe not all hetero? nonpoly?

Throws:
java.lang.Exception

addHetero

private void addHetero(java.lang.String groupName,
                       java.lang.String hetName)

processStructConfLoopBlock

private void processStructConfLoopBlock()
                                 throws java.lang.Exception
identifies ranges for HELIX and TURN

Throws:
java.lang.Exception

processStructSheetRangeLoopBlock

private void processStructSheetRangeLoopBlock()
                                       throws java.lang.Exception
identifies sheet ranges

Throws:
java.lang.Exception

processStructSiteBlock

private void processStructSiteBlock()
                             throws java.lang.Exception
identifies structure sites

Throws:
java.lang.Exception

processSymmetryOperationsLoopBlock

private void processSymmetryOperationsLoopBlock()
                                         throws java.lang.Exception
retrieves symmetry operations

Throws:
java.lang.Exception

fieldProperty

private int fieldProperty(int i)

parseLoopParameters

private void parseLoopParameters(java.lang.String[] fields)
                          throws java.lang.Exception
sets up arrays and variables for tokenizer.getData()

Parameters:
fields -
Throws:
java.lang.Exception

readLine

public java.lang.String readLine()
                          throws java.lang.Exception
Specified by:
readLine in interface JmolLineReader
Overrides:
readLine in class AtomSetCollectionReader
Throws:
java.lang.Exception

disableField

private void disableField(int fieldIndex)
used for turning off fractional or nonfractional coord.

Parameters:
fieldIndex -

skipLoop

private void skipLoop()
               throws java.lang.Exception
skips all associated loop data

Throws:
java.lang.Exception

isMatch

private static boolean isMatch(java.lang.String str1,
                               java.lang.String str2)
Parameters:
str1 -
str2 -
Returns:
TRUE if a match