BioResolver
Date: 2019-10-22

org.jmol.modelsetbio

## Class BioResolver

- java.lang.Object
- - org.jmol.modelsetbio.BioResolver

- All Implemented Interfaces:
    java.util.Comparator<java.lang.String[]>

      public final class BioResolver
      extends java.lang.Object
      implements java.util.Comparator<java.lang.String[]>

  a class used by ModelLoader to handle all loading of operations specific to PDB/mmCIF files. By loading only by class name, only loaded if PDB file is called. In addition, constants relating only to PDB files are here -- for coloring by chain, selecting by protein, etc.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static java.lang.String` | `allCarbohydrates` this form is used for counting groups in ModelSet GLX added for 13.1.16
    `private static int[]` | `argbsAmino`
    `private static int[]` | `argbsChainAtom` some pastel colors C0D0FF - pastel blue B0FFB0 - pastel green B0FFFF - pastel cyan FFC0C8 - pink FFC0FF - pastel magenta FFFF80 - pastel yellow FFDEAD - navajowhite FFD070 - pastel gold FF9898 - light coral B4E444 - light yellow-green C0C000 - light olive FF8060 - light tomato 00FF7F - springgreen cpk on; select atomno>100; label %i; color chain; select selected & hetero; cpk off
    `private static int[]` | `argbsChainHetero`
    `private static int[]` | `argbsNucleic`
    `private static int[]` | `argbsShapely`
    `static int` | `ATOMID_MAX`
    `private int` | `baseBondIndex`
    `private javajs.util.BS` | `bsAddedHydrogens`
    `private javajs.util.BS` | `bsAddedMask`
    `private javajs.util.BS` | `bsAssigned`
    `private javajs.util.BS` | `bsAtomsForHs`
    `private static int` | `group3Count`
    `static short` | `group3NameCount`
    `private boolean` | `haveHsAlready`
    `private java.lang.String[]` | `hNames`
    `private java.util.Map<java.lang.String,java.lang.String>` | `htBondMap`
    `static java.util.Map<java.lang.String,java.lang.Short>` | `htGroup`
    `private java.util.Map<java.lang.String,java.lang.Boolean>` | `htGroupBonds`
    `private static java.util.Map<java.lang.String,java.lang.String[][]>` | `htPdbBondInfo`
    `private static java.util.Map<java.lang.String,java.lang.Byte>` | `htSpecialAtoms`
    `private int` | `lastSetH`
    `private int` | `maxSerial`
    `private ModelLoader` | `ml`
    `private ModelSet` | `ms`
    `private static int[]` | `mytypes`
    `static java.lang.String[]` | `pdbBondInfo` pdbBondInfo describes in a compact way what the hydrogen atom names are for each standard amino acid.
    `private static int[]` | `pdbHydrogenCount`
    `private javajs.util.P4` | `plane`
    `(package private) static char[]` | `predefinedGroup1Names`
    `private static java.lang.String[]` | `predefinedGroup3Names`
    `private static java.lang.String[]` | `specialAtomNames`
    `private static STR[]` | `types`
    `private javajs.util.V3` | `vAB`
    `private javajs.util.V3` | `vNorm`
    `private Viewer` | `vwr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BioResolver()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private static short` | `addGroup3Name(java.lang.String group3)` These can overrun 3 characters; that is not significant.
    `private void` | `addHydrogens()`
    `void` | `addImplicitHydrogenAtoms(JmolAdapter adapter, int iGroup, int nH)`
    `(package private) static BioPolymer` | `allocateBioPolymer(Group[] groups, int firstGroupIndex, boolean checkConnections, int pt0)`
    `private static boolean` | `checkCarbohydrate(java.lang.String group3)`
    `int` | `compare(java.lang.String[] a, java.lang.String[] b)`
    `private void` | `deleteAtoms(javajs.util.BS bsDeletedAtoms)` called from org.jmol.modelsetbio.resolver when adding hydrogens.
    `private void` | `deleteUnneededAtoms()` Delete hydrogen atoms that are still in bsAddedHydrogens, because they were not actually added.
    `Group` | `distinguishAndPropagateGroup(Chain chain, java.lang.String group3, int seqcode, int firstAtomIndex, int lastAtomIndex, int[] specialAtomIndexes, Atom[] atoms)`
    `void` | `finalizeHydrogens()`
    `private void` | `finalizePdbCharges()`
    `private void` | `finalizePdbMultipleBonds()`
    `private void` | `fixAnnotations(int i, java.lang.String name, int type)`
    `java.lang.Object` | `fixPropertyValue(javajs.util.BS bsAtoms, java.lang.Object data, boolean toHydrogens)`
    `int[]` | `getArgbs(int tok)`
    `Model` | `getBioModel(int modelIndex, int trajectoryBaseIndex, java.lang.String jmolData, java.util.Properties modelProperties, java.util.Map<java.lang.String,java.lang.Object> modelAuxiliaryInfo)`
    `private void` | `getBondInfo(JmolAdapter adapter, java.lang.String group3, java.lang.Object model)`
    `short` | `getGroupID(java.lang.String g3)`
    `(package private) static short` | `getGroupIdFor(java.lang.String group3)`
    `private java.lang.String[][]` | `getLigandBondInfo(JmolAdapter adapter, java.lang.Object model, java.lang.String group3)` reads PDB ligand CIF info and creates a bondInfo object.
    `private java.lang.String[][]` | `getPdbBondInfo(java.lang.String group3, boolean isLegacy)`
    `(package private) static java.lang.String` | `getSpecialAtomName(int atomID)`
    `private static int` | `getStandardPdbHydrogenCount(java.lang.String group3)`
    `void` | `initializeHydrogenAddition()`
    `boolean` | `isHetero(java.lang.String group3)` MMCif, Gromacs, MdTop, Mol2 readers only
    `boolean` | `isKnownPDBGroup(java.lang.String g3, int max)`
    `void` | `iterateOverAllNewStructures(JmolAdapter adapter, java.lang.Object atomSetCollection)` Pull in all spans of helix, etc.
    `static short` | `knownGroupID(java.lang.String group3)`
    `byte` | `lookupSpecialAtomID(java.lang.String name)`
    `void` | `setGroupLists(int ipt)`
    `void` | `setHaveHsAlready(boolean b)`
    `private void` | `setHydrogen(int iTo, int iAtom, java.lang.String name, javajs.util.P3 pt)`
    `BioResolver` | `setLoader(ModelLoader modelLoader)`
    `private void` | `setStructure(JmolAdapterStructureIterator iterStructure)` note that istart and iend will be adjusted.
    `BioResolver` | `setViewer(Viewer vwr)`
    `java.lang.String` | `toStdAmino3(java.lang.String g1)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Field Detail

    - #### htGroup

          public static final java.util.Map<java.lang.String,java.lang.Short> htGroup

    - #### vwr

          private Viewer vwr

    - #### vAB

          private javajs.util.V3 vAB

    - #### vNorm

          private javajs.util.V3 vNorm

    - #### plane

          private javajs.util.P4 plane

    - #### ml

          private ModelLoader ml

    - #### ms

          private ModelSet ms

    - #### bsAddedMask

          private javajs.util.BS bsAddedMask

    - #### lastSetH

          private int lastSetH

    - #### maxSerial

          private int maxSerial

    - #### haveHsAlready

          private boolean haveHsAlready

    - #### bsAddedHydrogens

          private javajs.util.BS bsAddedHydrogens

    - #### bsAtomsForHs

          private javajs.util.BS bsAtomsForHs

    - #### htBondMap

          private java.util.Map<java.lang.String,java.lang.String> htBondMap

    - #### htGroupBonds

          private java.util.Map<java.lang.String,java.lang.Boolean> htGroupBonds

    - #### hNames

          private java.lang.String[] hNames

    - #### baseBondIndex

          private int baseBondIndex

    - #### bsAssigned

          private javajs.util.BS bsAssigned

    - #### types

          private static STR[] types

    - #### mytypes

          private static int[] mytypes

    - #### htPdbBondInfo

          private static java.util.Map<java.lang.String,java.lang.String[][]> htPdbBondInfo

    - #### pdbBondInfo

          public static final java.lang.String[] pdbBondInfo

      pdbBondInfo describes in a compact way what the hydrogen atom names are for each standard amino acid. This list consists of pairs of attached atom/hydrogen atom names, with abbreviations N, C, O, B, D, G, 1, and 2 (for N, C, O, CB, CD, CG, C1', and C2', respectively) given in pdbHAttachments, above. Note that we never add HXT or NH3 "?" here is for methyl groups with H1, H2, H3. "@" indicates a prochiral center, with the assignment order given here

    - #### pdbHydrogenCount

          private static final int[] pdbHydrogenCount

    - #### allCarbohydrates

          private static final java.lang.String allCarbohydrates

      this form is used for counting groups in ModelSet GLX added for 13.1.16
      See Also:
        Constant Field Values

    - #### group3Count

          private static int group3Count

    - #### predefinedGroup1Names

          static final char[] predefinedGroup1Names

    - #### group3NameCount

          public static short group3NameCount

    - #### predefinedGroup3Names

          private static final java.lang.String[] predefinedGroup3Names

    - #### specialAtomNames

          private static final java.lang.String[] specialAtomNames

    - #### ATOMID_MAX

          public static final int ATOMID_MAX

    - #### htSpecialAtoms

          private static java.util.Map<java.lang.String,java.lang.Byte> htSpecialAtoms

    - #### argbsAmino

          private static final int[] argbsAmino

    - #### argbsNucleic

          private static final int[] argbsNucleic

    - #### argbsChainAtom

          private static final int[] argbsChainAtom

      some pastel colors C0D0FF - pastel blue B0FFB0 - pastel green B0FFFF - pastel cyan FFC0C8 - pink FFC0FF - pastel magenta FFFF80 - pastel yellow FFDEAD - navajowhite FFD070 - pastel gold FF9898 - light coral B4E444 - light yellow-green C0C000 - light olive FF8060 - light tomato 00FF7F - springgreen cpk on; select atomno>100; label %i; color chain; select selected & hetero; cpk off

    - #### argbsChainHetero

          private static final int[] argbsChainHetero

    - #### argbsShapely

          private static final int[] argbsShapely

  - ### Constructor Detail

    - #### BioResolver

          public BioResolver()

  - ### Method Detail

    - #### setLoader

          public BioResolver setLoader(ModelLoader modelLoader)

    - #### setViewer

          public BioResolver setViewer(Viewer vwr)

    - #### getBioModel

          public Model getBioModel(int modelIndex,
                                   int trajectoryBaseIndex,
                                   java.lang.String jmolData,
                                   java.util.Properties modelProperties,
                                   java.util.Map<java.lang.String,java.lang.Object> modelAuxiliaryInfo)

    - #### distinguishAndPropagateGroup

          public Group distinguishAndPropagateGroup(Chain chain,
                                                    java.lang.String group3,
                                                    int seqcode,
                                                    int firstAtomIndex,
                                                    int lastAtomIndex,
                                                    int[] specialAtomIndexes,
                                                    Atom[] atoms)

    - #### setHaveHsAlready

          public void setHaveHsAlready(boolean b)

    - #### initializeHydrogenAddition

          public void initializeHydrogenAddition()

    - #### addImplicitHydrogenAtoms

          public void addImplicitHydrogenAtoms(JmolAdapter adapter,
                                               int iGroup,
                                               int nH)

    - #### getBondInfo

          private void getBondInfo(JmolAdapter adapter,
                                   java.lang.String group3,
                                   java.lang.Object model)

    - #### getLigandBondInfo

          private java.lang.String[][] getLigandBondInfo(JmolAdapter adapter,
                                                         java.lang.Object model,
                                                         java.lang.String group3)

      reads PDB ligand CIF info and creates a bondInfo object.
      Parameters:
        `adapter` -
        `model` -
        `group3` -
      Returns:
        [[atom1, atom2, order]...]

    - #### compare

          public int compare(java.lang.String[] a,
                             java.lang.String[] b)

      Specified by:
        `compare` in interface `java.util.Comparator<java.lang.String[]>`

    - #### finalizeHydrogens

          public void finalizeHydrogens()

    - #### addHydrogens

          private void addHydrogens()

    - #### deleteUnneededAtoms

          private void deleteUnneededAtoms()

      Delete hydrogen atoms that are still in bsAddedHydrogens, because they were not actually added. Also delete ligand hydrogen atoms from CO2- and PO3(2-) Note that we do this AFTER all atoms have been added. That means that this operation will not mess up atom indexing

    - #### deleteAtoms

          private void deleteAtoms(javajs.util.BS bsDeletedAtoms)

      called from org.jmol.modelsetbio.resolver when adding hydrogens.
      Parameters:
        `bsDeletedAtoms` -

    - #### fixAnnotations

          private void fixAnnotations(int i,
                                      java.lang.String name,
                                      int type)

    - #### finalizePdbCharges

          private void finalizePdbCharges()

    - #### finalizePdbMultipleBonds

          private void finalizePdbMultipleBonds()

    - #### setHydrogen

          private void setHydrogen(int iTo,
                                   int iAtom,
                                   java.lang.String name,
                                   javajs.util.P3 pt)

    - #### fixPropertyValue

          public java.lang.Object fixPropertyValue(javajs.util.BS bsAtoms,
                                                   java.lang.Object data,
                                                   boolean toHydrogens)

    - #### allocateBioPolymer

          static BioPolymer allocateBioPolymer(Group[] groups,
                                               int firstGroupIndex,
                                               boolean checkConnections,
                                               int pt0)

    - #### iterateOverAllNewStructures

          public void iterateOverAllNewStructures(JmolAdapter adapter,
                                                  java.lang.Object atomSetCollection)

      Pull in all spans of helix, etc. in the file(s) We do turn first, because sometimes a group is defined twice, and this way it gets marked as helix or sheet if it is both one of those and turn. Jmol 14.3 - adds sequence ANNOTATION
      Parameters:
        `adapter` -
        `atomSetCollection` -

    - #### setStructure

          private void setStructure(JmolAdapterStructureIterator iterStructure)

      note that istart and iend will be adjusted.
      Parameters:
        `iterStructure` -

    - #### setGroupLists

          public void setGroupLists(int ipt)

    - #### isKnownPDBGroup

          public boolean isKnownPDBGroup(java.lang.String g3,
                                         int max)

      Parameters:
        `g3` -
        `max` - max ID (e.g. 20); can be Integer.MAX_VALUE to allow carbohydrate
      Returns:
        true if found

    - #### lookupSpecialAtomID

          public byte lookupSpecialAtomID(java.lang.String name)

    - #### getPdbBondInfo

          private java.lang.String[][] getPdbBondInfo(java.lang.String group3,
                                                      boolean isLegacy)

    - #### knownGroupID

          public static short knownGroupID(java.lang.String group3)

    - #### checkCarbohydrate

          private static final boolean checkCarbohydrate(java.lang.String group3)

      Parameters:
        `group3` - a potential group3 name
      Returns:
        whether this is a carbohydrate from the list

    - #### isHetero

          public boolean isHetero(java.lang.String group3)

      MMCif, Gromacs, MdTop, Mol2 readers only
      Parameters:
        `group3` -
      Returns:
        true if an identified hetero group

    - #### toStdAmino3

          public java.lang.String toStdAmino3(java.lang.String g1)

    - #### getGroupID

          public short getGroupID(java.lang.String g3)

    - #### getGroupIdFor

          static short getGroupIdFor(java.lang.String group3)

    - #### addGroup3Name

          private static short addGroup3Name(java.lang.String group3)

      These can overrun 3 characters; that is not significant.
      Parameters:
        `group3` -
      Returns:
        a short group ID

    - #### getStandardPdbHydrogenCount

          private static int getStandardPdbHydrogenCount(java.lang.String group3)

    - #### getSpecialAtomName

          static final java.lang.String getSpecialAtomName(int atomID)

    - #### getArgbs

          public int[] getArgbs(int tok)