Oct 26 2021

T97-2021 Pipeline Pilot Chemistry SDK: Changes in Exception Handling

BIOVIA Pipeline Pilot Chemistry SDK

Program

BIOVIA Pipeline Pilot Chemistry SDK 2022 and greater

Operating System

All supported operating systems

Description

Exception handling has been added to many more PPChem SDK (Java, Python, DotNet) methods in the 2022 release. PPChem SDK API headers and signatures are backwards compatible, and there is no need to change existing code that calls these methods. However, the updated Java PPChem SDK methods now throw exceptions, and as a result, applications that call these Java methods need to handle or re-throw exceptions if this was not already in place. For example, the getChirality() method of the Atom class now throws exceptions:

  public Chirality getChirality() throws Exception;

And the following code snippet shows how to handle exceptions thrown by this method:

import com.accelrys.chem.*;

import java.io.FileOutputStream;

import java.io.PrintWriter;

 

public class Example_GetChirality {

  static void runExample() {

    MolIO molIO = null;

    Molecule mol = null;

    try {

      molIO = PPChemSDKFactory.createMolIO();

      mol = PPChemSDKFactory.createMolecule();

      String inputSmiles = “[C@@H](Cl)c1ccccc1";

      molIO.readMolecule(inputSmiles, MolIO.FormatType.SMILES_String, mol);

      for (int i = 0; i < mol.getNumAtoms(); ++i) {

        mol.getAtom(i).getChirality();

      }

    } catch (Exception e) {

      System.out.println("Caught Exception: " + e.getMessage());

      e.printStackTrace();

    } finally {

      if (mol != null)

        mol.close();

      if (molIO != null)

        molIO.close();

    }

  }

}


If getChirality() is not inside a try-catch block and runExample() does not re-throw exceptions, there will be an error “unreported exception Exception; must be caught or declared to be thrown”.

Here is a list of Java methods that didn’t use to but now throw exceptions:

Atom class

appendLabel

setType

setNonStandardType

getSumBondOrder

getChirality

getHybridization

setHybridization

setCharge

setRadical

setWeight

setStereo

getValence

isLegalValence

getNumHydrogens

getNumExplicitHydrogens

getNumExplicitHydrogens

setNumImplicitHydrogens

estimateNumImplicitHydrogens

getNumLonePairs

getNumLonePairsForDraw

getNumPiElectrons

invertStereo

clearStereo

getStereoFromCoordinates

canHaveStereo

hasStereo

hasPseudoStereo

hasUnknownPseudoStereo

hasMesoStereo

is

getSymmetryClass

getCanonicalIndex

getProperties

 

Bond class

setType

setStereo

invertStereo

getStereoFromCoordinates

hasStereo

is

getProperties

 

CalcPicture class

setCaptionProperty

setChiralityLabels

setChiralityLabelMode

setRAndSLabels

 

CustomData class

getOwnerType

getOwnerSgroupType

getOwnerIndex

setName

setValue

setVariable

setQueryType

setQueryOp

SetFieldType

setUnits

setDisplay

setPlacement

setDisplayUnits

setNumDisplayChars

 

GenGroup class

getInternalAtoms

getInternalBonds

getLinkBonds

getInternalAtom

getInternalBond

getLinkBond

getBracketX1

getBracketX2

getBracketY1

getBracketY2

addAutoBrackets

 

MarkushBond class

getBasisAtom

 

Mixture class

getAtom

getBond

addAutoBrackets

setBracketCoordinates

 

MixtureComponent class

getAtom

getBond

addAutoBrackets

setBracketCoordinates

 

Molecule class

setHydrogenFill

getNumFragments

getNumComplexedFragments

getNumRings

getNumChains

getNumBridges

getRingSize

getSmallestRingOnAtom

getSmallestRingOnBond

isBridgeRing

isAromaticRing

getRingBonds

getRingAtoms

getChainBonds

getChainAtoms

getBridgeAtoms

getBridgeBonds

getRingBonds

getRingAtoms

getChainBonds

getChainAtoms

getComplexedFragmentBonds

getComplexedFragmentAtoms

getFragmentBonds

getFragmentAtoms

getFragmentRings

getFragmentChains

getFragmentBridges

getRingsOnAtom

getRingsOnBond

getNumRingAssemblies

getRingAssemblyBonds

getRingAssemblyAtoms

getRingAssemblyRings

getFragmentRingAssemblies

getNumRingsOnlyCovalentBonds

getNumRingsWithCoordinationBonds

getNumRingsWithHydrogenBonds

getNumRingAssembliesOnlyCovalentBonds

getNumRingAssembliesWithCoordinationBonds

getNumRingAssembliesWithHydrogenBonds

getNumFragmentsOnlyCovalentBonds

getNumFragmentsWithCoordinationBonds

getNumFragmentsWithHydrogenBonds

ringHasCoordinationBonds

ringHasHydrogenBonds

ringAssemblyHasOnlyCovalentBonds

ringAssemblyHasCoordinationBonds

ringAssemblyHasHydrogenBonds

fragmentHasOnlyCovalentBonds

fragmentHasCoordinationBonds

fragmentHasHydrogenBonds

getNumAtomSymmetryClasses

getNumAlleneCenters

getAlleneEndpoint1

getAlleneEndpoint2

getAlleneDistance

getAlleneAtoms

getAlleneBonds

getAlleneStereoParity

setAlleneStereoParity

getNumAtropisomerCenters

getAtropisomerBond

getAtropisomerStereoParity

setAtropisomerStereoParity

getNumSquarePlanarCenters

getNumTrigonalBipyramidalCenters

getNumOctahedralCenters

getSquarePlanarCenterAtom

getTrigonalBipyramidalCenterAtom

getOctahedralCenterAtom

getCustomDataContainingAtom

 

MolIO class

addPDBReferenceFile

clearPDBReferenceFiles

verifyMolecularFormat

 

Monomer class

getAtom

getBond

getBracketX1

getBracketX2

getBracketY1

getBracketY2

addAutoBrackets

setBracketCoordinates

 

MulGroup class

getInternalAtom

getUniqueAtom

getInternalBond

getLinkBond

getBracketX1

getBracketX2

getBracketY1

getBracketY2

addAutoBrackets

setBracketCoordinates

 

PiSystem class

getAtom

getBond

getCentroidX

getCentroidY

getCentroidZ

 

Polymer class

getLinkBond

getInternalAtom

getBracketX1

getBracketX2

getBracketY1

getBracketY2

addAutoBrackets

setBracketCoordinates

 

PropertyCollection class

hasProperty

 

Reaction class

getReactant

getProduct

getReagent

getPropertyNameByIndex

getPropertyStringValueByIndex

getPropertySizeByIndex

getPropertyIthValueByIndex

removePropertyByIndex

getReactantAtomStatusFlags

getReactantBondStatusFlags

getProductAtomStatusFlags

getProductBondStatusFlags

getProductAtomMappedFromReactantAtom

getReactantAtomMappedFromProductAtom

 

RepeatUnit class

getInternalAtom

getInternalBond

getLinkBond

getBracketX1

getBracketX2

getBracketY1

getBracketY2

addAutoBrackets

setBracketCoordinates

 

SCSRSeqAtom class

getAttachmentAtom

getAtomLabel

getTemplateClass

getAttachmentLabel

addAttachment

setAttachmentAtom

setAttachmentLabel

deleteAttachment

 

SCSRTemplate class

getTemplateClass

getName

getAltName

 

SGMappingEngine class

getSearchOptions

setDefaultOptions

getQueryMolecule

 

SuperAtom class

getAtom

getLinkBond

getAttachmentPointApoAtom

getAttachmentPointLeavingAtom

getAttachmentPointLabel

getCrossingBondCStateBond

getCrossingBondCStateX

getCrossingBondCStateY

getBondVectorBond

getBondVectorX

getBondVectorY

setClassName

setLabel

How to contact BIOVIA Support

If you have any questions, please contact BIOVIA Support.