Class CifReader

All Implemented Interfaces:
javajs.api.GenericLineReader
Direct Known Subclasses:
Cif2Reader, MMCifReader

public class CifReader extends AtomSetCollectionReader
A true line-free CIF file reader for CIF files. Subclasses of CIF -- mmCIF/PDBx (pre-initialized) and msCIF (initialized here) Note that a file can be a PDB file without being Added nonstandard mCIF (magnetic_ tags) 5/2/2014 note that PRELIM keys can be removed at some later time

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 Details

  • Constructor Details

    • CifReader

      public CifReader()
  • Method Details

    • initializeReader

      public void initializeReader() throws Exception
      Overrides:
      initializeReader in class AtomSetCollectionReader
      Throws:
      Exception
    • initSubclass

      protected void initSubclass()
    • readCifData

      private void readCifData() throws Exception
      Throws:
      Exception
    • continueWith

      private boolean continueWith(String key)
    • getCifDataParser

      protected javajs.api.GenericCifDataParser getCifDataParser()
    • readAllData

      private boolean readAllData() throws Exception
      Throws:
      Exception
    • skipKey

      private boolean skipKey(String key)
    • addModelTitle

      private void addModelTitle(String key)
    • processSubclassEntry

      protected void processSubclassEntry() throws Exception
      Throws:
      Exception
    • processUnitCellTransform

      private void processUnitCellTransform()
      (magnetic CIF only) Process the unit cell transformation as indicated by _parent_space_group or _space_group_magn (or older _magentic_space_group)
    • addCellType

      private void addCellType(String type, String data, boolean isFrom)
      (magnetic CIF or LOAD ... SUPERCELL) Add a cell type such as "conventional"
      Parameters:
      type -
      data - if starting with "!" then "opposite of"
      isFrom - TRUE for SUPERCELL or "_from_parent" or "child_transform"
    • getModulationReader

      private MSCifParser getModulationReader() throws Exception
      Throws:
      Exception
    • initializeMSCIF

      private MSCifParser initializeMSCIF() throws Exception
      Throws:
      Exception
    • newModel

      protected void newModel(int modelNo) throws Exception
      Throws:
      Exception
    • finalizeSubclassReader

      protected void finalizeSubclassReader() throws Exception
      Description copied from class: AtomSetCollectionReader
      optional reader-specific method run first.
      Overrides:
      finalizeSubclassReader in class AtomSetCollectionReader
      Throws:
      Exception
    • setOxidationStates

      private void setOxidationStates()
    • addHeader

      protected void addHeader()
    • finalizeSubclass

      protected boolean finalizeSubclass() throws Exception
      Throws:
      Exception
    • doPreSymmetry

      public void doPreSymmetry() throws Exception
      Overrides:
      doPreSymmetry in class AtomSetCollectionReader
      Throws:
      Exception
    • applySymmetryAndSetTrajectory

      public void applySymmetryAndSetTrajectory() throws Exception
      Overrides:
      applySymmetryAndSetTrajectory in class AtomSetCollectionReader
      Throws:
      Exception
    • finalizeSubclassSymmetry

      protected void finalizeSubclassSymmetry(boolean haveSymmetry) throws Exception
      Overrides:
      finalizeSubclassSymmetry in class AtomSetCollectionReader
      Parameters:
      haveSymmetry -
      Throws:
      Exception
    • processDataParameter

      private void processDataParameter()
      initialize a new atom set
    • nextAtomSet

      protected void nextAtomSet()
    • processChemicalInfo

      private String processChemicalInfo(String type) throws Exception
      reads some of the more interesting info into specific atomSetAuxiliaryInfo elements
      Parameters:
      type - "name" "formula" etc.
      Returns:
      data
      Throws:
      Exception
    • processSymmetrySpaceGroupName

      private void processSymmetrySpaceGroupName() throws Exception
      done by AtomSetCollectionReader
      Throws:
      Exception
    • addLatticeVectors

      private void addLatticeVectors()
    • processCellParameter

      private void processCellParameter() throws Exception
      unit cell parameters -- two options, so we use MOD 6
      Throws:
      Exception
    • processUnitCellTransformMatrix

      private void processUnitCellTransformMatrix() throws Exception
      the PDB transformation matrix cartesian --> fractional
      Throws:
      Exception
    • getData

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

      protected void processLoopBlock() throws Exception
      processes loop_ blocks of interest or skips the data
      Throws:
      Exception
    • processSubclassLoopBlock

      protected boolean processSubclassLoopBlock() throws Exception
      Throws:
      Exception
    • getTopologyParser

      private CifReader.Parser getTopologyParser()
    • addMore

      private void addMore()
    • fieldProperty

      protected int fieldProperty(int i)
    • parseLoopParameters

      void parseLoopParameters(String[] fields) throws Exception
      sets up arrays and variables for tokenizer.getData()
      Parameters:
      fields -
      Throws:
      Exception
    • parseLoopParametersFor

      void parseLoopParametersFor(String key, String[] fields) throws Exception
      Throws:
      Exception
    • disableField

      private void disableField(int fieldIndex)
      used for turning off fractional or nonfractional coord.
      Parameters:
      fieldIndex -
    • processAtomTypeLoopBlock

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

      boolean processAtomSiteLoopBlock(boolean isLigand) throws Exception
      reads atom data in any order
      Parameters:
      isLigand -
      Returns:
      TRUE if successful; FALS if EOF encountered
      Throws:
      Exception
    • addCifAtom

      protected boolean addCifAtom(Atom atom, String id, String componentId, String strChain)
    • checkPDBModelField

      protected int checkPDBModelField(int modelField, int currentModelNo) throws Exception
      Parameters:
      modelField -
      currentModelNo -
      Returns:
      new currentModelNo
      Throws:
      Exception
    • processSubclassAtom

      protected boolean processSubclassAtom(Atom atom, String assemblyId, String strChain)
      Parameters:
      atom -
      assemblyId -
      strChain -
      Returns:
      true if valid atom
    • filterCIFAtom

      protected boolean filterCIFAtom(Atom atom, String componentId)
    • processCitationListBlock

      private void processCitationListBlock() throws Exception
      Throws:
      Exception
    • processSymmetryOperationsLoopBlock

      private void processSymmetryOperationsLoopBlock() throws Exception
      retrieves symmetry operations
      Throws:
      Exception
    • getBondOrder

      public int getBondOrder(String field)
    • processGeomBondLoopBlock

      private void processGeomBondLoopBlock() throws 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, but see below.
      Throws:
      Exception
    • getAtomFromNameCheckCase

      private Atom getAtomFromNameCheckCase(String name)
      From GEOM_BOND, check first for an exact match. If that is not found, add all-caps keys and try again with all upper case. This should solve the problem of GEOM_BOND_* using the wrong case while still preserving functionality when H15a and H15A are both present (COD 7700953 https://www.crystallography.net/cod/7700953.html)
      Parameters:
      name -
      Returns:
      atom
    • setBondingAndMolecules

      private void setBondingAndMolecules()
      (1) If GEOM_BOND records are present, we (a) use them to generate bonds (b) add H atoms to bonds if necessary (c) turn off autoBonding ("hasBonds") (2) If MOLECULAR, then we (a) use {1 1 1} if lattice is not defined (b) use asc.bonds[] to construct a preliminary molecule and connect as we go (c) check symmetry for connections to molecule in any one of the 27 3x3 adjacent cells (d) move those atoms and their connected branch set (e) iterate as necessary to get all atoms desired (f) delete unselected atoms (g) set all coordinates as Cartesians (h) remove all unit cell information
    • fixAtomForBonding

      private void fixAtomForBonding(javajs.util.P3 pt, int i)
    • createBonds

      private boolean createBonds(boolean doInit)
      Use the site bitset to check for atoms that are within +/-dx Angstroms of the specified distances in GEOM_BOND where dx is determined by the uncertainty (dx) in the record. Note that this also "connects" the atoms that might have been moved in a previous iteration. Also connect H atoms based on a distance invalid input: '<'= 1.1 Angstrom from a nearby atom. Then create molecules.
      Parameters:
      doInit -
      Returns:
      TRUE if need to continue
    • checkBondDistance

      private boolean checkBondDistance(Atom a, Atom b, float distance, float dx)
    • addNewBond

      private void addNewBond(int i, int j, int order)
      add the bond and mark it for molecular processing
      Parameters:
      i -
      j -
      order -
    • setBs

      private void setBs(Atom[] atoms, int iatom, javajs.util.BS[] bsBonds, javajs.util.BS bs)
      iteratively run through connected atoms, adding them to the set
      Parameters:
      atoms -
      iatom -
      bsBonds -
      bs -
    • checkSubclassSymmetry

      protected boolean checkSubclassSymmetry()
    • checkAllFieldsPresent

      protected boolean checkAllFieldsPresent(String[] keys, int lastKey, boolean critical)
    • getField

      protected String getField(byte type)
    • isNull

      protected boolean isNull(String key)
    • skipLoop

      protected void skipLoop(boolean doReport) throws Exception
      Throws:
      Exception