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()
    • Constructor Detail

      • CifReader

        public CifReader()
    • Method Detail

      • initSubclass

        protected void initSubclass()
      • continueWith

        private boolean continueWith​(String key)
      • getCifDataParser

        protected javajs.api.GenericCifDataParser getCifDataParser()
      • addModelTitle

        private void addModelTitle​(String key)
      • processSubclassEntry

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

        private void processUnitCellTransform()
      • addCellType

        private void addCellType​(String type,
                                 String data,
                                 boolean isFrom)
      • readSingleAtom

        private void readSingleAtom()
        No need for anything other than the atom name and symbol; coordinates will be (0 0 0), and no other information is needed.
      • addHeader

        protected void addHeader()
      • finalizeSubclass

        protected boolean finalizeSubclass()
                                    throws Exception
        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
      • 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
      • 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
      • 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
      • 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 ≤ 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)