idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
28,300
private int getNumberOfHydrogen ( IAtomContainer atomContainer , IAtom atom ) { java . util . List < IBond > bonds = atomContainer . getConnectedBondsList ( atom ) ; IAtom connectedAtom ; int hCounter = 0 ; for ( IBond bond : bonds ) { connectedAtom = bond . getOther ( atom ) ; if ( connectedAtom . getSymbol ( ) . equa...
Gets the numberOfHydrogen attribute of the Polarizability object .
28,301
private static boolean checkAbbreviationHighlight ( IAtomContainer container , Sgroup sgroup ) { assert sgroup . getType ( ) == SgroupType . CtabAbbreviation ; Set < IAtom > sgroupAtoms = sgroup . getAtoms ( ) ; int atomHighlight = 0 ; int bondHighlight = 0 ; int numSgroupAtoms = sgroupAtoms . size ( ) ; int numSgroupB...
Checks whether the given abbreviation Sgroup either has no highlight or is fully highlighted . If an abbreviation is partially highlighted we don t want to contract it as this would hide the part being highlighted .
28,302
private static void hideMultipleParts ( IAtomContainer container , Sgroup sgroup ) { final Set < IBond > crossing = sgroup . getBonds ( ) ; final Set < IAtom > atoms = sgroup . getAtoms ( ) ; final Set < IAtom > parentAtoms = sgroup . getValue ( SgroupKey . CtabParentAtomList ) ; for ( IBond bond : container . bonds ( ...
Hide the repeated atoms and bonds of a multiple group . We hide al atoms that belong to the group unless they are defined in the parent atom list . Any bond to those atoms that is not a crossing bond or one connecting atoms in the parent list is hidden .
28,303
IRenderingElement generateSgroups ( IAtomContainer container , AtomSymbol [ ] symbols ) { ElementGroup result = new ElementGroup ( ) ; List < Sgroup > sgroups = container . getProperty ( CDKConstants . CTAB_SGROUPS ) ; if ( sgroups == null || sgroups . isEmpty ( ) ) return result ; Map < IAtom , AtomSymbol > symbolMap ...
Generate the Sgroup elements for the provided atom contains .
28,304
private IRenderingElement generatePolymerSgroup ( Sgroup sgroup , Map < IAtom , AtomSymbol > symbolMap ) { List < SgroupBracket > brackets = sgroup . getValue ( SgroupKey . CtabBracket ) ; if ( brackets != null ) { SgroupType type = sgroup . getType ( ) ; String subscript = sgroup . getValue ( SgroupKey . CtabSubScript...
Generates polymer Sgroup elements .
28,305
public static Partition unit ( int size ) { Partition unit = new Partition ( ) ; unit . cells . add ( new TreeSet < Integer > ( ) ) ; for ( int i = 0 ; i < size ; i ++ ) { unit . cells . get ( 0 ) . add ( i ) ; } return unit ; }
Create a unit partition - in other words the coarsest possible partition where all the elements are in one cell .
28,306
public int numberOfElements ( ) { int n = 0 ; for ( SortedSet < Integer > cell : cells ) { n += cell . size ( ) ; } return n ; }
Calculate the size of the partition as the sum of the sizes of the cells .
28,307
public Permutation toPermutation ( ) { Permutation p = new Permutation ( this . size ( ) ) ; for ( int i = 0 ; i < this . size ( ) ; i ++ ) { p . set ( i , this . cells . get ( i ) . first ( ) ) ; } return p ; }
Converts the whole partition into a permutation .
28,308
public Partition splitBefore ( int cellIndex , int splitElement ) { Partition r = new Partition ( ) ; for ( int j = 0 ; j < cellIndex ; j ++ ) { r . addCell ( this . copyBlock ( j ) ) ; } r . addSingletonCell ( splitElement ) ; SortedSet < Integer > splitBlock = this . copyBlock ( cellIndex ) ; splitBlock . remove ( sp...
Splits this partition by taking the cell at cellIndex and making two new cells - the first with the singleton splitElement and the second with the rest of the elements from that cell .
28,309
public void addSingletonCell ( int element ) { SortedSet < Integer > cell = new TreeSet < Integer > ( ) ; cell . add ( element ) ; this . cells . add ( cell ) ; }
Add a new singleton cell to the end of the partition containing only this element .
28,310
public void addCell ( int ... elements ) { SortedSet < Integer > cell = new TreeSet < Integer > ( ) ; for ( int element : elements ) { cell . add ( element ) ; } this . cells . add ( cell ) ; }
Adds a new cell to the end of the partition containing these elements .
28,311
public void addToCell ( int index , int element ) { if ( cells . size ( ) < index + 1 ) { addSingletonCell ( element ) ; } else { cells . get ( index ) . add ( element ) ; } }
Add an element to a particular cell .
28,312
public void order ( ) { Collections . sort ( cells , new Comparator < SortedSet < Integer > > ( ) { public int compare ( SortedSet < Integer > cellA , SortedSet < Integer > cellB ) { return cellA . first ( ) . compareTo ( cellB . first ( ) ) ; } } ) ; }
Sort the cells in increasing order .
28,313
public boolean inSameCell ( int elementI , int elementJ ) { for ( int cellIndex = 0 ; cellIndex < size ( ) ; cellIndex ++ ) { SortedSet < Integer > cell = getCell ( cellIndex ) ; if ( cell . contains ( elementI ) && cell . contains ( elementJ ) ) { return true ; } } return false ; }
Check that two elements are in the same cell of the partition .
28,314
public < T > Iterable < T > map ( final Function < int [ ] , T > f ) { return Iterables . transform ( iterable , f ) ; }
Map the mappings to another type . Each mapping is transformed using the provided function .
28,315
public Mappings limit ( int limit ) { return new Mappings ( query , target , Iterables . limit ( iterable , limit ) ) ; }
Limit the number of mappings - only this number of mappings will be generate .
28,316
public Mappings uniqueAtoms ( ) { return new Mappings ( query , target , new Iterable < int [ ] > ( ) { public Iterator < int [ ] > iterator ( ) { return Iterators . filter ( iterable . iterator ( ) , new UniqueAtomMatches ( ) ) ; } } ) ; }
Filter the mappings for those which cover a unique set of atoms in the target . The unique atom mappings are a subset of the unique bond matches .
28,317
public Mappings uniqueBonds ( ) { final int [ ] [ ] g = GraphUtil . toAdjList ( query ) ; return new Mappings ( query , target , new Iterable < int [ ] > ( ) { public Iterator < int [ ] > iterator ( ) { return Iterators . filter ( iterable . iterator ( ) , new UniqueBondMatches ( g ) ) ; } } ) ; }
Filter the mappings for those which cover a unique set of bonds in the target .
28,318
public int [ ] [ ] toArray ( ) { int [ ] [ ] res = new int [ 14 ] [ ] ; int size = 0 ; for ( int [ ] map : this ) { if ( size == res . length ) res = Arrays . copyOf ( res , size + ( size >> 1 ) ) ; res [ size ++ ] = map . clone ( ) ; } return Arrays . copyOf ( res , size ) ; }
Mappings are lazily generated and best used in a loop . However if all mappings are required this method can provide a fixed size array of mappings .
28,319
public static float calculate ( IAtomContainer query , IAtomContainer target ) throws CDKException { float [ ] mom1 = generateMoments ( query ) ; float [ ] mom2 = generateMoments ( target ) ; float sum = 0 ; for ( int i = 0 ; i < mom1 . length ; i ++ ) { sum += Math . abs ( mom1 [ i ] - mom2 [ i ] ) ; } return ( float ...
Evaluate the 3D similarity between two molecules .
28,320
public boolean isCachedAtomContainer ( IAtomContainer container ) { if ( cachedDescriptorValues == null ) return false ; return ( cachedDescriptorValues . get ( PREVIOUS_ATOMCONTAINER ) == container ) ; }
Returns true if the cached IDescriptorResult s are for the given IAtomContainer .
28,321
public IDescriptorResult getCachedDescriptorValue ( IAtom atom ) { if ( cachedDescriptorValues == null ) return null ; return ( IDescriptorResult ) cachedDescriptorValues . get ( atom ) ; }
Returns the cached DescriptorValue for the given IAtom .
28,322
synchronized public void addLabel ( String label ) { if ( ! labelMap . contains ( label ) ) { labelMap . add ( labelCounter ++ , label ) ; } }
Add label if its not present
28,323
public DescriptorValue calculate ( IAtomContainer atomContainer ) { int hBondAcceptors = 0 ; IAtomContainer ac ; try { ac = ( IAtomContainer ) atomContainer . clone ( ) ; } catch ( CloneNotSupportedException e ) { return getDummyDescriptorValue ( e ) ; } if ( checkAromaticity ) { try { AtomContainerManipulator . percie...
Calculates the number of H bond acceptors .
28,324
private ILigand [ ] order ( ILigand [ ] ligands ) { ILigand [ ] newLigands = new ILigand [ ligands . length ] ; System . arraycopy ( ligands , 0 , newLigands , 0 , ligands . length ) ; Arrays . sort ( newLigands , numberRule ) ; ILigand [ ] reverseLigands = new ILigand [ newLigands . length ] ; for ( int i = 0 ; i < ne...
Order the ligands from high to low precedence according to atomic and mass numbers .
28,325
public DescriptorValue calculate ( IAtom atom , IAtomContainer ac ) { Double originalCharge = atom . getCharge ( ) ; String originalAtomtypeName = atom . getAtomTypeName ( ) ; Integer originalNeighborCount = atom . getFormalNeighbourCount ( ) ; Integer originalValency = atom . getValency ( ) ; IAtomType . Hybridization...
The method returns partial total charges assigned to an heavy atom through PEOE method . It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .
28,326
public static boolean isValid ( String casNumber ) { boolean overall = true ; String format = "^(\\d+)-(\\d\\d)-(\\d)$" ; Pattern pattern = Pattern . compile ( format ) ; Matcher matcher = pattern . matcher ( casNumber ) ; overall = overall && matcher . matches ( ) ; if ( matcher . matches ( ) ) { String part1 = matche...
Checks whether the registry number is valid .
28,327
public static String getVersion ( ) { if ( version != null ) return version ; try ( InputStream stream = CDK . class . getResourceAsStream ( RESOURCE_LOCATION ) ) { if ( stream == null ) { version = CDK . class . getPackage ( ) . getImplementationVersion ( ) ; } Properties props = new Properties ( ) ; props . load ( st...
Returns the version of this CDK library .
28,328
private static BitSet available ( int [ ] [ ] graph , IAtom [ ] atoms , EdgeToBondMap bonds ) { final BitSet available = new BitSet ( ) ; ATOMS : for ( int i = 0 ; i < atoms . length ; i ++ ) { final IAtom atom = atoms [ i ] ; if ( atom . getAtomicNumber ( ) == null ) throw new IllegalArgumentException ( "atom " + ( i ...
Determine the set of atoms that are available to have a double - bond .
28,329
private static boolean available ( final int element , final int charge , final int valence ) { switch ( Elements . ofNumber ( element ) ) { case Boron : if ( charge == 0 && valence <= 2 ) return true ; if ( charge == - 1 && valence <= 3 ) return true ; break ; case Carbon : case Silicon : case Germanium : case Tin : i...
Determine if the specified element with the provided charge and valance requires a pi bond?
28,330
public void addReaction ( IReaction reaction , int position ) { hashMapChain . put ( reaction , position ) ; this . addReaction ( reaction ) ; }
Added a IReaction for this chain in position .
28,331
public IReaction getReaction ( int position ) { if ( ! hashMapChain . containsValue ( position ) ) return null ; Set < Entry < IReaction , Integer > > entries = hashMapChain . entrySet ( ) ; for ( Iterator < Entry < IReaction , Integer > > it = entries . iterator ( ) ; it . hasNext ( ) ; ) { Entry < IReaction , Integer...
Get the reaction of this chain reaction object at the position .
28,332
public static IAtomContainerSet getAllAtomContainers ( IReactionScheme scheme ) { return getAllAtomContainers ( scheme , scheme . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ) ; }
get all AtomContainers object from a set of Reactions .
28,333
public static List < String > getAllIDs ( IReactionScheme scheme ) { List < String > IDlist = new ArrayList < String > ( ) ; if ( scheme . getID ( ) != null ) IDlist . add ( scheme . getID ( ) ) ; for ( IReaction reaction : scheme . reactions ( ) ) { IDlist . addAll ( ReactionManipulator . getAllIDs ( reaction ) ) ; } ...
Get all ID of this IReactionSet .
28,334
public static IReactionSet getAllReactions ( IReactionScheme scheme ) { IReactionSet reactionSet = scheme . getBuilder ( ) . newInstance ( IReactionSet . class ) ; if ( scheme . getReactionSchemeCount ( ) != 0 ) for ( IReactionScheme schemeInt : scheme . reactionSchemes ( ) ) { for ( IReaction reaction : getAllReaction...
Get all IReaction s object from a given IReactionScheme .
28,335
public static IReactionScheme createReactionScheme ( IReactionSet reactionSet ) { IReactionScheme reactionScheme = reactionSet . getBuilder ( ) . newInstance ( IReactionScheme . class ) ; ArrayList < IReaction > listTopR = new ArrayList < IReaction > ( ) ; for ( IReaction reaction : reactionSet . reactions ( ) ) { if (...
Create a IReactionScheme give a IReactionSet object .
28,336
public static IReactionSet extractTopReactions ( IReactionScheme reactionScheme ) { IReactionSet reactionSet = reactionScheme . getBuilder ( ) . newInstance ( IReactionSet . class ) ; IReactionSet allSet = getAllReactions ( reactionScheme ) ; for ( IReaction reaction : allSet . reactions ( ) ) { IReactionSet precuSet =...
Extract a set of Reactions which are in top of a IReactionScheme . The top reactions are those which any of their reactants are participating in other reactions as a products .
28,337
private static IReactionScheme setScheme ( IReaction reaction , IReactionSet reactionSet ) { IReactionScheme reactionScheme = reaction . getBuilder ( ) . newInstance ( IReactionScheme . class ) ; IReactionSet reactConSet = extractSubsequentReaction ( reaction , reactionSet ) ; if ( reactConSet . getReactionCount ( ) !=...
Create a IReactionScheme given as a top a IReaction . If it doesn t exist any subsequent reaction return null ;
28,338
private static IReactionSet extractPrecursorReaction ( IReaction reaction , IReactionSet reactionSet ) { IReactionSet reactConSet = reaction . getBuilder ( ) . newInstance ( IReactionSet . class ) ; for ( IAtomContainer reactant : reaction . getReactants ( ) . atomContainers ( ) ) { for ( IReaction reactionInt : reacti...
Extract reactions from a IReactionSet which at least one product is existing as reactant given a IReaction
28,339
public static ArrayList < IAtomContainerSet > getAtomContainerSet ( IAtomContainer origenMol , IAtomContainer finalMol , IReactionScheme reactionScheme ) { ArrayList < IAtomContainerSet > listPath = new ArrayList < IAtomContainerSet > ( ) ; IReactionSet reactionSet = getAllReactions ( reactionScheme ) ; boolean found =...
Extract the list of AtomContainers taking part in the IReactionScheme to originate a product given a reactant .
28,340
public double compare ( IsotopePattern isoto1 , IsotopePattern isoto2 ) { IsotopePattern iso1 = IsotopePatternManipulator . sortAndNormalizedByIntensity ( isoto1 ) ; IsotopePattern iso2 = IsotopePatternManipulator . sortAndNormalizedByIntensity ( isoto2 ) ; if ( isoto1 . getCharge ( ) == 1 ) chargeToAdd = massE ; else ...
Compare the IMolecularFormula with a isotope abundance pattern .
28,341
private int getClosestDataDiff ( IsotopeContainer isoContainer , IsotopePattern pattern ) { double diff = 100 ; int posi = - 1 ; for ( int i = 0 ; i < pattern . getNumberOfIsotopes ( ) ; i ++ ) { double tempDiff = Math . abs ( ( isoContainer . getMass ( ) ) - pattern . getIsotopes ( ) . get ( i ) . getMass ( ) ) ; if (...
Search and find the closest difference in an array in terms of mass and intensity . Always return the position in this List .
28,342
private void setSmarts ( String [ ] smarts ) { keys . clear ( ) ; for ( String key : smarts ) { QueryAtomContainer qmol = new QueryAtomContainer ( null ) ; SmartsPattern ptrn = null ; ptrn = SmartsPattern . create ( key ) ; ptrn . setPrepare ( false ) ; keys . add ( new Key ( key , ptrn ) ) ; } }
Set the SMARTS patterns .
28,343
public void addAtom ( IAtom oAtom , IMonomer oMonomer ) { if ( ! contains ( oAtom ) ) { super . addAtom ( oAtom ) ; if ( oMonomer != null ) { oMonomer . addAtom ( oAtom ) ; if ( ! monomers . containsKey ( oMonomer . getMonomerName ( ) ) ) { monomers . put ( oMonomer . getMonomerName ( ) , oMonomer ) ; } } } }
Adds the atom oAtom to a specified Monomer .
28,344
private void adjust ( ExtendedCisTrans elem ) { IBond middle = elem . getFocus ( ) ; IAtom [ ] ends = ExtendedCisTrans . findTerminalAtoms ( container , middle ) ; IBond [ ] bonds = elem . getCarriers ( ) . toArray ( new IBond [ 2 ] ) ; IAtom left = ends [ 0 ] ; IAtom right = ends [ 1 ] ; int p = parity ( elem ) ; int ...
Adjust the configuration of the cumulated double bonds to be either Cis or Trans .
28,345
private IAtom [ ] getAtoms ( IAtom focus , IAtom substituent , IAtom otherFocus ) { IAtom otherSubstituent = focus ; for ( int w : graph [ atomToIndex . get ( focus ) ] ) { IAtom atom = container . getAtom ( w ) ; if ( ! atom . equals ( substituent ) && ! atom . equals ( otherFocus ) ) otherSubstituent = atom ; } retur...
Create an array of three atoms for a side of the double bond . This is used to determine the winding of one side of the double bond .
28,346
private static int parity ( Point2d a , Point2d b , Point2d c ) { double det = ( a . x - c . x ) * ( b . y - c . y ) - ( a . y - c . y ) * ( b . x - c . x ) ; return ( int ) Math . signum ( det ) ; }
Determine the parity of the triangle formed by the 3 coordinates a b and c .
28,347
public List < Orbit > calculateOrbits ( ) { List < Orbit > orbits = new ArrayList < Orbit > ( ) ; List < SymmetryClass > symmetryClasses = super . getSymmetryClasses ( ) ; for ( SymmetryClass symmetryClass : symmetryClasses ) { Orbit orbit = new Orbit ( symmetryClass . getSignatureString ( ) , - 1 ) ; for ( int atomInd...
Calculates the orbits of the atoms of the molecule .
28,348
public String toCanonicalSignatureString ( int height ) { String canonicalSignature = null ; for ( int i = 0 ; i < getVertexCount ( ) ; i ++ ) { String signatureForI = signatureStringForVertex ( i , height ) ; if ( canonicalSignature == null || canonicalSignature . compareTo ( signatureForI ) < 0 ) { canonicalSignature...
Make a canonical signature string of a given height .
28,349
public IAtom [ ] getAtoms ( ) { IAtom [ ] returnAtoms = new Atom [ atomCount ] ; System . arraycopy ( this . atoms , 0 , returnAtoms , 0 , returnAtoms . length ) ; return returnAtoms ; }
Returns the array of atoms making up this Association .
28,350
public boolean contains ( IAtom atom ) { for ( int i = 0 ; i < atomCount ; i ++ ) { if ( atoms [ i ] . equals ( atom ) ) { return true ; } } return false ; }
Returns true if the given atom participates in this Association .
28,351
public void addChild ( String text , Position position ) { this . children . add ( new Child ( text , position ) ) ; }
Add a child text element .
28,352
public Object [ ] getParameters ( ) { Object [ ] params = new Object [ 1 ] ; params [ 0 ] = ( Integer ) maxIterations ; return params ; }
Gets the parameters attribute of the BondPartialSigmaChargeDescriptor object .
28,353
public DescriptorValue calculate ( IBond bond , IAtomContainer ac ) { Double originalCharge1 = bond . getBegin ( ) . getCharge ( ) ; Double originalCharge2 = bond . getEnd ( ) . getCharge ( ) ; if ( ! isCachedAtomContainer ( ac ) ) { IAtomContainer mol = ac . getBuilder ( ) . newInstance ( IAtomContainer . class , ac )...
The method calculates the bond - sigma Partial charge of a given bond It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .
28,354
public Object getParameterType ( String name ) { if ( "maxIterations" . equals ( name ) ) return Integer . MAX_VALUE ; return null ; }
Gets the parameterType attribute of the BondPartialSigmaChargeDescriptor object .
28,355
private List < IBond > heavyBonds ( final List < IBond > bonds ) { final List < IBond > heavy = new ArrayList < IBond > ( bonds . size ( ) ) ; for ( final IBond bond : bonds ) { if ( ! ( bond . getBegin ( ) . getSymbol ( ) . equals ( "H" ) && bond . getEnd ( ) . getSymbol ( ) . equals ( "H" ) ) ) { heavy . add ( bond )...
Filter a bond list keeping only bonds between heavy atoms .
28,356
private int countAttachedBonds ( List < IBond > connectedBonds , IAtom atom , IBond . Order order , String symbol ) { int neighborcount = connectedBonds . size ( ) ; int doubleBondedAtoms = 0 ; for ( int i = neighborcount - 1 ; i >= 0 ; i -- ) { IBond bond = connectedBonds . get ( i ) ; if ( bond . getOrder ( ) == orde...
Count the number of doubly bonded atoms .
28,357
public InputSource resolveEntity ( String publicId , String systemId ) { logger . debug ( "CMLResolver: resolving " , publicId , ", " , systemId ) ; systemId = systemId . toLowerCase ( ) ; if ( ( systemId . indexOf ( "cml-1999-05-15.dtd" ) != - 1 ) || ( systemId . indexOf ( "cml.dtd" ) != - 1 ) || ( systemId . indexOf ...
Resolves SYSTEM and PUBLIC identifiers for CML DTDs .
28,358
protected void checkInputParameters ( final IChemObjectBuilder builder , final double minMass , final double maxMass , final MolecularFormulaRange mfRange ) { if ( ( minMass < 0.0 ) || ( maxMass < 0.0 ) ) { throw ( new IllegalArgumentException ( "The minimum and maximum mass values must be >=0" ) ) ; } if ( ( minMass >...
Checks if input parameters are valid and throws an IllegalArgumentException otherwise .
28,359
public int [ ] [ ] paths ( ) { final int [ ] [ ] paths = new int [ size ( ) ] [ 0 ] ; int i = 0 ; for ( final Cycle c : basis . members ( ) ) paths [ i ++ ] = c . path ( ) ; return paths ; }
The paths of all cycles in the minimum cycle basis .
28,360
public boolean compare ( Object object ) { if ( ! ( object instanceof IAtom ) ) { return false ; } if ( ! super . compare ( object ) ) { return false ; } Atom atom = ( Atom ) object ; if ( ( ( point2d == atom . point2d ) || ( ( point2d != null ) && ( point2d . equals ( atom . point2d ) ) ) ) && ( ( point3d == atom . po...
Compares a atom with this atom .
28,361
public ISimpleChemObjectReader createReader ( InputStream input ) throws IOException { IChemFormat format = null ; ISimpleChemObjectReader reader = null ; if ( input instanceof GZIPInputStream ) { format = formatFactory . guessFormat ( input ) ; reader = createReader ( format ) ; if ( reader != null ) { try { reader . ...
Detects the format of the Reader input and if known it will return a CDK Reader to read the format or null when the reader is not implemented .
28,362
public ISimpleChemObjectReader createReader ( IChemFormat format ) { if ( format != null ) { String readerClassName = format . getReaderClassName ( ) ; if ( readerClassName != null ) { try { return ( ISimpleChemObjectReader ) this . getClass ( ) . getClassLoader ( ) . loadClass ( readerClassName ) . newInstance ( ) ; }...
Creates a new IChemObjectReader based on the given IChemFormat .
28,363
public List < IAtomContainer > getTautomers ( IAtomContainer mol ) throws CDKException , CloneNotSupportedException { String opt = "" ; if ( ( flags & KETO_ENOL ) != 0 ) opt += " -KET" ; if ( ( flags & ONE_FIVE_SHIFT ) != 0 ) opt += " -15T" ; InChIGenerator gen = InChIGeneratorFactory . getInstance ( ) . getInChIGenera...
Public method to get tautomers for an input molecule based on the InChI which will be calculated by JNI - InChI .
28,364
private IAtomContainer connectAtoms ( String inputInchi , IAtomContainer inputMolecule , Map < Integer , IAtom > inchiAtomsByPosition ) throws CDKException { String inchi = inputInchi ; inchi = inchi . substring ( inchi . indexOf ( '/' ) + 1 ) ; inchi = inchi . substring ( inchi . indexOf ( '/' ) + 1 ) ; String connect...
Pops and pushes its ways through the InChI connection table to build up a simple molecule .
28,365
private void mapInputMoleculeToInchiMolgraph ( IAtomContainer inchiMolGraph , IAtomContainer mol ) throws CDKException { Iterator < Map < IAtom , IAtom > > iter = org . openscience . cdk . isomorphism . VentoFoggia . findIdentical ( inchiMolGraph , AtomMatcher . forElement ( ) , BondMatcher . forAny ( ) ) . matchAll ( ...
Atom - atom mapping of the input molecule to the bare container constructed from the InChI connection table . This makes it possible to map the positions of the mobile hydrogens in the InChI back to the input molecule .
28,366
private void combineHydrogenPositions ( List < Integer > taken , List < List < Integer > > combinations , IAtomContainer skeleton , int totalMobHydrCount , List < Integer > mobHydrAttachPositions ) { if ( taken . size ( ) != totalMobHydrCount ) { for ( int i = 0 ; i < mobHydrAttachPositions . size ( ) ; i ++ ) { int po...
Makes combinations recursively of all possible mobile Hydrogen positions .
28,367
private IAtom findAtomByPosition ( IAtomContainer container , int position ) { String pos = String . valueOf ( position ) ; for ( IAtom atom : container . atoms ( ) ) { if ( atom . getID ( ) . equals ( pos ) ) return atom ; } return null ; }
Helper method that locates an atom based on its InChI atom table position which has been set as ID .
28,368
private List < Integer > tryDoubleBondCombinations ( IAtomContainer container , int dblBondsAdded , int bondOffSet , int doubleBondMax , List < IAtom > atomsInNeedOfFix ) { int offSet = bondOffSet ; List < Integer > dblBondPositions = null ; while ( offSet < container . getBondCount ( ) && dblBondPositions == null ) { ...
Tries double bond combinations for a certain input container of which the double bonds have been stripped around the mobile hydrogen positions . Recursively .
28,369
static double max ( double [ ] values ) { double max = values [ 0 ] ; for ( double value : values ) if ( value > max ) max = value ; return max ; }
Analog of Math . max that returns the largest double value in an array of doubles .
28,370
static double min ( double [ ] values ) { double min = values [ 0 ] ; for ( double value : values ) if ( value < min ) min = value ; return min ; }
Analog of Math . min that returns the largest double value in an array of double .
28,371
public void addChemModel ( IChemModel chemModel ) { if ( chemModelCount + 1 >= chemModels . length ) { growChemModelArray ( ) ; } chemModels [ chemModelCount ] = chemModel ; chemModelCount ++ ; }
Adds an chemModel to this container .
28,372
public StereoEncoder create ( IAtomContainer container , int [ ] [ ] graph ) { List < StereoEncoder > encoders = new ArrayList < StereoEncoder > ( 5 ) ; for ( IBond bond : container . bonds ( ) ) { if ( DOUBLE . equals ( bond . getOrder ( ) ) && ! E_OR_Z . equals ( bond . getStereo ( ) ) ) { IAtom left = bond . getBegi...
Create a stereo encoder for all potential 2D and 3D double bond stereo configurations .
28,373
static StereoEncoder newEncoder ( IAtomContainer container , IAtom left , IAtom leftParent , IAtom right , IAtom rightParent , int [ ] [ ] graph ) { List < IBond > leftBonds = container . getConnectedBondsList ( left ) ; List < IBond > rightBonds = container . getConnectedBondsList ( right ) ; if ( accept ( left , left...
Create a new encoder for the specified left and right atoms . The parent is the atom which is connected by a double bond to the left and right atom . For simple double bonds the parent of each is the other atom in cumulenes the parents are not the same .
28,374
static PermutationParity permutation ( int [ ] neighbors ) { return neighbors . length == 2 ? PermutationParity . IDENTITY : new BasicPermutationParity ( Arrays . copyOf ( neighbors , neighbors . length - 1 ) ) ; }
Create a permutation parity for the given neighbors . The neighbor list should include the other double bonded atom but in the last index .
28,375
public DescriptorValue calculate ( IAtom atom , IAtomContainer org ) { if ( atom . getProperty ( CHARGE_CACHE ) == null ) { IAtomContainer copy ; try { copy = org . clone ( ) ; } catch ( CloneNotSupportedException e ) { return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new ...
The method returns partial charges assigned to an heavy atom through MMFF94 method . It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .
28,376
private void fixNCNTypes ( String [ ] symbs , int [ ] [ ] graph ) { for ( int v = 0 ; v < graph . length ; v ++ ) { if ( "NCN+" . equals ( symbs [ v ] ) ) { boolean foundCNN = false ; for ( int w : graph [ v ] ) { foundCNN = foundCNN || "CNN+" . equals ( symbs [ w ] ) || "CIM+" . equals ( symbs [ w ] ) ; } if ( ! found...
Special case NCN + matches entries that the validation suite say should actually be NC = N . We can achieve 100% compliance by checking if NCN + is still next to CNN + or CIM + after aromatic types are assigned
28,377
private void checkPreconditions ( IAtomContainer container ) { for ( IAtom atom : container . atoms ( ) ) { if ( atom . getImplicitHydrogenCount ( ) == null || atom . getImplicitHydrogenCount ( ) != 0 ) throw new IllegalArgumentException ( "Hydrogens should be unsuppressed (explicit)" ) ; if ( atom . getFlag ( CDKConst...
preconditions 1 . all hydrogens must be present as explicit nodes in the connection table . this requires that each atom explicitly states it has exactly 0 hydrogens 2 . the SMARTS treat all atoms as aliphatic and therefore no aromatic flags should be set we could remove this but ideally we don t want to modify the str...
28,378
private void assignHydrogenTypes ( IAtomContainer container , String [ ] symbs , int [ ] [ ] graph ) { for ( int v = 0 ; v < graph . length ; v ++ ) { if ( container . getAtom ( v ) . getSymbol ( ) . equals ( "H" ) && graph [ v ] . length == 1 ) { int w = graph [ v ] [ 0 ] ; symbs [ v ] = this . hydrogenMap . get ( sym...
Hydrogen types assigned based on the MMFFHDEF . PAR parent associations .
28,379
private void assignPreliminaryTypes ( IAtomContainer container , String [ ] symbs ) { IAtomContainer cpy = container . getBuilder ( ) . newInstance ( IAtomContainer . class , container ) ; Cycles . markRingAtomsAndBonds ( cpy ) ; for ( AtomTypePattern matcher : patterns ) { for ( final int idx : matcher . matches ( cpy...
Preliminary atom types are assigned using SMARTS definitions .
28,380
static AtomTypePattern [ ] loadPatterns ( InputStream smaIn ) throws IOException { List < AtomTypePattern > matchers = new ArrayList < AtomTypePattern > ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( smaIn ) ) ; String line = null ; while ( ( line = br . readLine ( ) ) != null ) { if ( skipLine ...
Internal - load the SMARTS patterns for each atom type from MMFFSYMB . sma .
28,381
private Map < String , String > loadHydrogenDefinitions ( InputStream hdefIn ) throws IOException { final Map < String , String > hdefs = new HashMap < String , String > ( 200 ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( hdefIn ) ) ; br . readLine ( ) ; String line = null ; while ( ( line = br ....
Hydrogen atom types are assigned based on their parent types . The mmff - symb - mapping file provides this mapping .
28,382
public static IsotopePattern normalize ( IsotopePattern isotopeP ) { IsotopeContainer isoHighest = null ; double biggestAbundance = 0 ; for ( IsotopeContainer isoContainer : isotopeP . getIsotopes ( ) ) { double abundance = isoContainer . getIntensity ( ) ; if ( biggestAbundance < abundance ) { biggestAbundance = abund...
Return the isotope pattern normalized to the highest abundance .
28,383
public static IsotopePattern sortAndNormalizedByIntensity ( IsotopePattern isotopeP ) { IsotopePattern isoNorma = normalize ( isotopeP ) ; return sortByIntensity ( isoNorma ) ; }
Return the isotope pattern sorted and normalized by intensity to the highest abundance .
28,384
public static IsotopePattern sortByMass ( IsotopePattern isotopeP ) { try { IsotopePattern isoSort = ( IsotopePattern ) isotopeP . clone ( ) ; if ( isoSort . getNumberOfIsotopes ( ) == 0 ) return isoSort ; List < IsotopeContainer > listISO = isoSort . getIsotopes ( ) ; Collections . sort ( listISO , new Comparator < Is...
Return the isotope pattern sorted by mass to the highest abundance .
28,385
public double weight ( ) { double result = 0 ; Iterator edgeIterator = edgeSet ( ) . iterator ( ) ; while ( edgeIterator . hasNext ( ) ) { result += ( ( Edge ) edgeIterator . next ( ) ) . getWeight ( ) ; } return result ; }
Returns the sum of the weights of all edges in this cycle .
28,386
public List vertexList ( ) { List vertices = new ArrayList ( edgeSet ( ) . size ( ) ) ; Object startVertex = vertexSet ( ) . iterator ( ) . next ( ) ; Object vertex = startVertex ; Object previousVertex = null ; Object nextVertex = null ; while ( nextVertex != startVertex ) { assert ( degreeOf ( vertex ) == 2 ) ; List ...
Returns a list of the vertices contained in this cycle . The vertices are in the order of a traversal of the cycle .
28,387
public static Point3d [ ] zmatrixToCartesian ( double [ ] distances , int [ ] first_atoms , double [ ] angles , int [ ] second_atoms , double [ ] dihedrals , int [ ] third_atoms ) { Point3d [ ] cartesianCoords = new Point3d [ distances . length ] ; for ( int index = 0 ; index < distances . length ; index ++ ) { if ( in...
Takes the given Z Matrix coordinates and converts them to cartesian coordinates . The first Atom end up in the origin the second on on the x axis and the third one in the XY plane . The rest is added by applying the Zmatrix distances angles and dihedrals . Angles are in degrees .
28,388
public void setParameters ( Object [ ] params ) throws CDKException { if ( params . length > 1 ) { throw new CDKException ( "SigmaElectronegativityDescriptor only expects one parameter" ) ; } if ( ! ( params [ 0 ] instanceof Integer ) ) { throw new CDKException ( "The parameter must be of type Integer" ) ; } if ( param...
Sets the parameters attribute of the SigmaElectronegativityDescriptor object
28,389
public DescriptorValue calculate ( IAtom atom , IAtomContainer ac ) { IAtomContainer clone ; IAtom localAtom ; try { clone = ( IAtomContainer ) ac . clone ( ) ; localAtom = clone . getAtom ( ac . indexOf ( atom ) ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( clone ) ; } catch ( CDKException e ) { ...
The method calculates the sigma electronegativity of a given atom It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .
28,390
public void addIsotope ( IIsotope isotope , int countMin , int countMax ) { if ( isotope == null ) throw new IllegalArgumentException ( "Isotope must not be null" ) ; boolean flag = false ; for ( Iterator < IIsotope > it = isotopes ( ) . iterator ( ) ; it . hasNext ( ) ; ) { IIsotope thisIsotope = it . next ( ) ; if ( ...
Adds an Isotope to this MolecularFormulaExpand in a number of maximum and minimum occurrences allowed .
28,391
public Iterable < IIsotope > isotopes ( ) { return new Iterable < IIsotope > ( ) { public Iterator < IIsotope > iterator ( ) { return isotopesMax . keySet ( ) . iterator ( ) ; } } ; }
Returns an Iterator for looping over all isotopes in this MolecularFormulaExpand .
28,392
public void removeIsotope ( IIsotope isotope ) { isotopesMax . remove ( getIsotope ( isotope ) ) ; isotopesMin . remove ( getIsotope ( isotope ) ) ; }
Removes the given isotope from the MolecularFormulaExpand .
28,393
private IChemFile readChemFile ( IChemFile chemFile ) throws CDKException { IChemSequence chemSequence = chemFile . getBuilder ( ) . newInstance ( IChemSequence . class ) ; IChemModel chemModel = chemFile . getBuilder ( ) . newInstance ( IChemModel . class ) ; chemSequence . addChemModel ( readChemModel ( chemModel ) )...
Read a ChemFile from a file in MDL RDF format .
28,394
private IChemModel readChemModel ( IChemModel chemModel ) throws CDKException { IReactionSet setOfReactions = chemModel . getReactionSet ( ) ; if ( setOfReactions == null ) { setOfReactions = chemModel . getBuilder ( ) . newInstance ( IReactionSet . class ) ; } chemModel . setReactionSet ( readReactionSet ( setOfReacti...
Read a IChemModel from a file in MDL RDF format .
28,395
private IReactionSet readReactionSet ( IReactionSet setOfReactions ) throws CDKException { IReaction r = readReaction ( setOfReactions . getBuilder ( ) ) ; if ( r != null ) { setOfReactions . addReaction ( r ) ; } try { String line ; while ( ( line = input . readLine ( ) ) != null ) { logger . debug ( "line: " , line )...
Read a IReactionSet from a file in MDL RDF format .
28,396
void markRow ( int i , int marking ) { for ( int j = ( i * mCols ) , end = j + mCols ; j < end ; j ++ ) if ( data [ j ] > 0 ) data [ j ] = marking ; }
Mark all values in row i allowing it to be reset later .
28,397
public void setAtom ( IAtom atom , int position ) { if ( atoms [ position ] == null && atom != null ) atomCount ++ ; if ( atoms [ position ] != null && atom == null ) atomCount -- ; atoms [ position ] = atom ; }
Sets an Atom in this bond .
28,398
public void setOrder ( Order order ) { this . order = order ; if ( order != null ) { switch ( order ) { case SINGLE : this . electronCount = 2 ; break ; case DOUBLE : this . electronCount = 4 ; break ; case TRIPLE : this . electronCount = 6 ; break ; case QUADRUPLE : this . electronCount = 8 ; break ; case QUINTUPLE : ...
Sets the bond order of this bond .
28,399
public static int [ ] [ ] aaBondInfo ( ) { if ( aminoAcids == null ) { createAAs ( ) ; } int [ ] [ ] info = new int [ 153 ] [ 4 ] ; int counter = 0 ; int total = 0 ; for ( int aa = 0 ; aa < aminoAcids . length ; aa ++ ) { AminoAcid acid = aminoAcids [ aa ] ; LOGGER . debug ( "#bonds for " , acid . getProperty ( RESIDUE...
Creates matrix with info about the bonds in the amino acids . 0 = bond id 1 = atom1 in bond 2 = atom2 in bond 3 = bond order .