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 Detail

      • CELL_TYPE_MAGNETIC_PARENT

        protected static final java.lang.String CELL_TYPE_MAGNETIC_PARENT
        See Also:
        Constant Field Values
      • CELL_TYPE_MAGNETIC_STANDARD

        protected static final java.lang.String CELL_TYPE_MAGNETIC_STANDARD
        See Also:
        Constant Field Values
      • cifParser

        javajs.api.GenericCifDataParser cifParser
      • isAFLOW

        private boolean isAFLOW
      • filterAssembly

        private boolean filterAssembly
      • allowRotations

        private boolean allowRotations
      • readIdeal

        private boolean readIdeal
      • configurationPtr

        private int configurationPtr
      • useAuthorChainID

        protected boolean useAuthorChainID
      • thisDataSetName

        protected java.lang.String thisDataSetName
      • lastDataSetName

        protected java.lang.String lastDataSetName
      • chemicalName

        private java.lang.String chemicalName
      • thisStructuralFormula

        private java.lang.String thisStructuralFormula
      • thisFormula

        private java.lang.String thisFormula
      • iHaveDesiredModel

        protected boolean iHaveDesiredModel
      • isMMCIF

        protected boolean isMMCIF
      • isLigand

        protected boolean isLigand
      • isMagCIF

        protected boolean isMagCIF
      • haveHAtoms

        boolean haveHAtoms
      • molecularType

        private java.lang.String molecularType
      • lastAltLoc

        private char lastAltLoc
      • haveAromatic

        private boolean haveAromatic
      • conformationIndex

        private int conformationIndex
      • nMolecular

        private int nMolecular
      • appendedData

        private java.lang.String appendedData
      • skipping

        protected boolean skipping
      • nAtoms

        protected int nAtoms
      • ac

        protected int ac
      • auditBlockCode

        private java.lang.String auditBlockCode
      • lastSpaceGroupName

        private java.lang.String lastSpaceGroupName
      • modulated

        private boolean modulated
      • isCourseGrained

        protected boolean isCourseGrained
      • haveCellWaveVector

        boolean haveCellWaveVector
      • htGroup1

        protected java.util.Map<java.lang.String,​java.lang.String> htGroup1
      • nAtoms0

        protected int nAtoms0
      • titleAtomSet

        private int titleAtomSet
      • htCellTypes

        private java.util.Map<java.lang.String,​java.lang.String> htCellTypes
      • modelMap

        public java.util.Map<java.lang.String,​java.lang.Integer> modelMap
      • haveGlobalDummy

        private boolean haveGlobalDummy
      • htAudit

        private java.util.Hashtable<java.lang.String,​java.lang.Object> htAudit
      • symops

        public javajs.util.Lst<java.lang.String> symops
      • pdbID

        protected java.lang.String pdbID
      • TransformFields

        private static final java.lang.String[] TransformFields
      • key

        java.lang.String key
      • key0

        java.lang.String key0
      • data

        java.lang.String data
      • isLoop

        private boolean isLoop
      • col2key

        int[] col2key
      • key2col

        int[] key2col
      • field

        java.lang.String field
      • firstChar

        protected char firstChar
      • htOxStates

        private java.util.Map<java.lang.String,​float[]> htOxStates
      • bondTypes

        private javajs.util.Lst<java.lang.Object[]> bondTypes
      • disorderAssembly

        private java.lang.String disorderAssembly
      • lastDisorderAssembly

        private java.lang.String lastDisorderAssembly
      • lattvecs

        private javajs.util.Lst<float[]> lattvecs
      • magCenterings

        private javajs.util.Lst<java.lang.String> magCenterings
      • maxSerial

        protected int maxSerial
      • 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
      • atomFields

        private static final java.lang.String[] atomFields
      • citationFields

        private static final java.lang.String[] citationFields
      • SYM_MAGN_SSG_CENTERING

        private static final byte SYM_MAGN_SSG_CENTERING
        See Also:
        Constant Field Values
      • symmetryOperationsFields

        private static final java.lang.String[] symmetryOperationsFields
      • 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
      • geomBondFields

        private static final java.lang.String[] geomBondFields
      • atomRadius

        private float[] atomRadius
      • bsConnected

        private javajs.util.BS[] bsConnected
      • bsSets

        private javajs.util.BS[] bsSets
      • ptOffset

        private final javajs.util.P3 ptOffset
      • bsMolecule

        private javajs.util.BS bsMolecule
      • bsExclude

        private javajs.util.BS bsExclude
      • firstAtom

        private int firstAtom
      • atoms

        private Atom[] atoms
      • bsBondDuplicates

        private javajs.util.BS bsBondDuplicates
    • Constructor Detail

      • CifReader

        public CifReader()
    • Method Detail

      • initSubclass

        protected void initSubclass()
      • readCifData

        private void readCifData()
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • continueWith

        private boolean continueWith​(java.lang.String key)
      • getCifDataParser

        protected javajs.api.GenericCifDataParser getCifDataParser()
      • readAllData

        private boolean readAllData()
                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addModelTitle

        private void addModelTitle​(java.lang.String key)
      • processSubclassEntry

        protected void processSubclassEntry()
                                     throws java.lang.Exception
        Throws:
        java.lang.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​(java.lang.String type,
                                 java.lang.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 java.lang.Exception
        Throws:
        java.lang.Exception
      • initializeMSCIF

        private MSCifParser initializeMSCIF()
                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • newModel

        protected void newModel​(int modelNo)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setOxidationStates

        private void setOxidationStates()
      • addHeader

        protected void addHeader()
      • finalizeSubclass

        protected boolean finalizeSubclass()
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • processDataParameter

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

        protected void nextAtomSet()
      • processChemicalInfo

        private java.lang.String 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.
        Returns:
        data
        Throws:
        java.lang.Exception
      • processSymmetrySpaceGroupName

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

        private void addLatticeVectors()
      • 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

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

        protected boolean processSubclassLoopBlock()
                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addMore

        private void addMore()
      • fieldProperty

        protected int fieldProperty​(int i)
      • parseLoopParameters

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

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

        private void disableField​(int fieldIndex)
        used for turning off fractional or nonfractional coord.
        Parameters:
        fieldIndex -
      • 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​(boolean isLigand)
                                  throws java.lang.Exception
        reads atom data in any order
        Parameters:
        isLigand -
        Returns:
        TRUE if successful; FALS if EOF encountered
        Throws:
        java.lang.Exception
      • getAtomNameRef

        private int getAtomNameRef()
      • addCifAtom

        protected boolean addCifAtom​(Atom atom,
                                     java.lang.String id,
                                     java.lang.String componentId,
                                     java.lang.String strChain)
      • checkPDBModelField

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

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

        protected boolean filterCIFAtom​(Atom atom,
                                        java.lang.String componentId)
      • processCitationListBlock

        private void processCitationListBlock()
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • processSymmetryOperationsLoopBlock

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

        public int getBondOrder​(java.lang.String field)
      • 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, but see below.
        Throws:
        java.lang.Exception
      • getAtomFromNameCheckCase

        private Atom getAtomFromNameCheckCase​(java.lang.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 <= 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​(java.lang.String[] keys,
                                                int lastKey,
                                                boolean critical)
      • getField

        protected java.lang.String getField​(byte type)
      • isNull

        protected boolean isNull​(java.lang.String key)