idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
28,400 | public static Map < String , IAminoAcid > getHashMapBySingleCharCode ( ) { IAminoAcid [ ] monomers = createAAs ( ) ; HashMap < String , IAminoAcid > map = new HashMap < String , IAminoAcid > ( ) ; for ( int i = 0 ; i < monomers . length ; i ++ ) { map . put ( ( String ) monomers [ i ] . getProperty ( RESIDUE_NAME_SHORT... | Returns a HashMap where the key is one of G A V L I S T C M D N E Q R K H F Y W and P . |
28,401 | public static Map < String , IAminoAcid > getHashMapByThreeLetterCode ( ) { AminoAcid [ ] monomers = createAAs ( ) ; Map < String , IAminoAcid > map = new HashMap < String , IAminoAcid > ( ) ; for ( int i = 0 ; i < monomers . length ; i ++ ) { map . put ( ( String ) monomers [ i ] . getProperty ( RESIDUE_NAME ) , monom... | Returns a HashMap where the key is one of GLY ALA VAL LEU ILE SER THR CYS MET ASP ASN GLU GLN ARG LYS HIS PHE TYR TRP AND PRO . |
28,402 | public static String convertThreeLetterCodeToOneLetterCode ( String threeLetterCode ) { AminoAcid [ ] monomers = createAAs ( ) ; for ( int i = 0 ; i < monomers . length ; i ++ ) { if ( monomers [ i ] . getProperty ( RESIDUE_NAME ) . equals ( threeLetterCode ) ) { return ( String ) monomers [ i ] . getProperty ( RESIDUE... | Returns the one letter code of an amino acid given a three letter code . For example it will return V when Val was passed . |
28,403 | public static String convertOneLetterCodeToThreeLetterCode ( String oneLetterCode ) { AminoAcid [ ] monomers = createAAs ( ) ; for ( int i = 0 ; i < monomers . length ; i ++ ) { if ( monomers [ i ] . getProperty ( RESIDUE_NAME_SHORT ) . equals ( oneLetterCode ) ) { return ( String ) monomers [ i ] . getProperty ( RESID... | Returns the three letter code of an amino acid given a one letter code . For example it will return Val when V was passed . |
28,404 | public static void rotate ( IAtomContainer atomCon , Point2d center , double angle ) { Point2d point ; double costheta = Math . cos ( angle ) ; double sintheta = Math . sin ( angle ) ; IAtom atom ; for ( int i = 0 ; i < atomCon . getAtomCount ( ) ; i ++ ) { atom = atomCon . getAtom ( i ) ; point = atom . getPoint2d ( )... | Rotates a molecule around a given center by a given angle . |
28,405 | public static void rotate ( IAtom atom , Point3d p1 , Point3d p2 , double angle ) { double costheta , sintheta ; Point3d r = new Point3d ( ) ; r . x = p2 . x - p1 . x ; r . y = p2 . y - p1 . y ; r . z = p2 . z - p1 . z ; normalize ( r ) ; angle = angle * Math . PI / 180.0 ; costheta = Math . cos ( angle ) ; sintheta = ... | Rotates a 3D point about a specified line segment by a specified angle . |
28,406 | public static void normalize ( Point3d point ) { double sum = Math . sqrt ( point . x * point . x + point . y * point . y + point . z * point . z ) ; point . x = point . x / sum ; point . y = point . y / sum ; point . z = point . z / sum ; } | Normalizes a point . |
28,407 | public static Rectangle2D getRectangle2D ( IAtomContainer container ) { double [ ] minmax = getMinMax ( container ) ; return new Rectangle2D . Double ( minmax [ 0 ] , minmax [ 1 ] , minmax [ 2 ] - minmax [ 0 ] , minmax [ 3 ] - minmax [ 1 ] ) ; } | Returns the 2D rectangle spanning the space occupied by the atom container . |
28,408 | public static double getAngle ( double xDiff , double yDiff ) { double angle = 0 ; if ( xDiff >= 0 && yDiff >= 0 ) { angle = Math . atan ( yDiff / xDiff ) ; } else if ( xDiff < 0 && yDiff >= 0 ) { angle = Math . PI + Math . atan ( yDiff / xDiff ) ; } else if ( xDiff < 0 && yDiff < 0 ) { angle = Math . PI + Math . atan ... | Gets the angle attribute of the GeometryTools class . |
28,409 | public static Vector2d calculatePerpendicularUnitVector ( Point2d point1 , Point2d point2 ) { Vector2d vector = new Vector2d ( ) ; vector . sub ( point2 , point1 ) ; vector . normalize ( ) ; return new Vector2d ( - 1.0 * vector . y , vector . x ) ; } | Determines the normalized vector orthogonal on the vector p1 - > ; p2 . |
28,410 | public static List < IAtom > findClosestInSpace ( IAtomContainer container , IAtom startAtom , int max ) throws CDKException { Point3d originalPoint = startAtom . getPoint3d ( ) ; if ( originalPoint == null ) { throw new CDKException ( "No point3d, but findClosestInSpace is working on point3ds" ) ; } Map < Double , IAt... | Returns the atoms which are closes to an atom in an AtomContainer by distance in 3d . |
28,411 | public static double getAllAtomRMSD ( IAtomContainer firstAtomContainer , IAtomContainer secondAtomContainer , Map < Integer , Integer > mappedAtoms , boolean Coords3d ) throws CDKException { double sum = 0 ; double RMSD ; Iterator < Integer > firstAtoms = mappedAtoms . keySet ( ) . iterator ( ) ; int firstAtomNumber ;... | Return the RMSD between the 2 aligned molecules . |
28,412 | public static double getHeavyAtomRMSD ( IAtomContainer firstAtomContainer , IAtomContainer secondAtomContainer , Map < Integer , Integer > mappedAtoms , boolean hetAtomOnly , boolean Coords3d ) { double sum = 0 ; double RMSD = 0 ; Iterator < Integer > firstAtoms = mappedAtoms . keySet ( ) . iterator ( ) ; int firstAtom... | Return the RMSD of the heavy atoms between the 2 aligned molecules . |
28,413 | public static double getBondLengthAverage3D ( IAtomContainer container ) { double bondLengthSum = 0 ; int bondCounter = 0 ; for ( IBond bond : container . bonds ( ) ) { IAtom atom1 = bond . getBegin ( ) ; IAtom atom2 = bond . getEnd ( ) ; if ( atom1 . getPoint3d ( ) != null && atom2 . getPoint3d ( ) != null ) { bondCou... | An average of all 3D bond length values is produced using point3ds in atoms . Atom s with no coordinates are disregarded . |
28,414 | public static Rectangle2D shiftContainer ( IAtomContainer container , Rectangle2D bounds , Rectangle2D last , double gap ) { if ( last . getMaxX ( ) + gap >= bounds . getMinX ( ) ) { double xShift = last . getMaxX ( ) + gap - bounds . getMinX ( ) ; Vector2d shift = new Vector2d ( xShift , 0.0 ) ; GeometryTools . transl... | Shift the container horizontally to the right to make its bounds not overlap with the other bounds . |
28,415 | public static Rectangle2D shiftReactionVertical ( IReaction reaction , Rectangle2D bounds , Rectangle2D last , double gap ) { if ( last . getMaxY ( ) + gap >= bounds . getMinY ( ) ) { double yShift = bounds . getHeight ( ) + last . getHeight ( ) + gap ; Vector2d shift = new Vector2d ( 0 , yShift ) ; List < IAtomContain... | Shift the containers in a reaction vertically upwards to not overlap with the reference Rectangle2D . The shift is such that the given gap is realized but only if the reactions are actually overlapping . |
28,416 | public String [ ] getNames ( ) { if ( descriptorNames == null || descriptorNames . length == 0 ) { String title = specification . getImplementationTitle ( ) ; if ( value instanceof BooleanResult || value instanceof DoubleResult || value instanceof IntegerResult ) { descriptorNames = new String [ 1 ] ; descriptorNames [... | Returns an array of names for each descriptor value calculated . |
28,417 | public Expr and ( Expr expr ) { if ( type == Type . TRUE ) { set ( expr ) ; } else if ( expr . type != Type . TRUE ) { if ( type . isLogical ( ) && ! expr . type . isLogical ( ) ) { if ( type == AND ) right . and ( expr ) ; else if ( type != NOT ) setLogical ( Type . AND , expr , new Expr ( this ) ) ; else setLogical (... | Utility combine this expression with another using conjunction . The expression will only match if both conditions are met . |
28,418 | public Expr or ( Expr expr ) { if ( type == Type . TRUE || type == Type . FALSE || type == NONE ) { set ( expr ) ; } else if ( expr . type != Type . TRUE && expr . type != Type . FALSE && expr . type != Type . NONE ) { if ( type . isLogical ( ) && ! expr . type . isLogical ( ) ) { if ( type == OR ) right . or ( expr ) ... | Utility combine this expression with another using disjunction . The expression will match if either conditions is met . |
28,419 | public void setPrimitive ( Type type , int val ) { if ( type . hasValue ( ) ) { this . type = type ; this . value = val ; this . left = null ; this . right = null ; this . query = null ; } else { throw new IllegalArgumentException ( "Value provided for non-value " + "expression type!" ) ; } } | Set the primitive value of this atom expression . |
28,420 | public void setLogical ( Type type , Expr left , Expr right ) { switch ( type ) { case AND : case OR : this . type = type ; this . value = 0 ; this . left = left ; this . right = right ; this . query = null ; break ; case NOT : this . type = type ; if ( left != null && right == null ) this . left = left ; else if ( lef... | Set the logical value of this atom expression . |
28,421 | private void setRecursive ( Type type , IAtomContainer mol ) { switch ( type ) { case RECURSIVE : this . type = type ; this . value = 0 ; this . left = null ; this . right = null ; this . query = mol ; this . ptrn = null ; break ; default : throw new IllegalArgumentException ( ) ; } } | Set the recursive value of this atom expression . |
28,422 | public static IAtomContainerSet getAllMolecules ( IReactionSet set ) { IAtomContainerSet moleculeSet = set . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; for ( IReaction reaction : set . reactions ( ) ) { IAtomContainerSet molecules = ReactionManipulator . getAllMolecules ( reaction ) ; for ( IAtomConta... | get all Molecules object from a set of Reactions . |
28,423 | public static IReactionSet getRelevantReactions ( IReactionSet reactSet , IAtomContainer molecule ) { IReactionSet newReactSet = reactSet . getBuilder ( ) . newInstance ( IReactionSet . class ) ; IReactionSet reactSetProd = getRelevantReactionsAsProduct ( reactSet , molecule ) ; for ( IReaction reaction : reactSetProd ... | Get all Reactions object containing a Molecule from a set of Reactions . |
28,424 | public static IReactionSet getRelevantReactionsAsReactant ( IReactionSet reactSet , IAtomContainer molecule ) { IReactionSet newReactSet = reactSet . getBuilder ( ) . newInstance ( IReactionSet . class ) ; for ( IReaction reaction : reactSet . reactions ( ) ) { for ( IAtomContainer atomContainer : reaction . getReactan... | Get all Reactions object containing a Molecule as a Reactant from a set of Reactions . |
28,425 | public static IReactionSet getRelevantReactionsAsProduct ( IReactionSet reactSet , IAtomContainer molecule ) { IReactionSet newReactSet = reactSet . getBuilder ( ) . newInstance ( IReactionSet . class ) ; for ( IReaction reaction : reactSet . reactions ( ) ) { for ( IAtomContainer atomContainer : reaction . getProducts... | Get all Reactions object containing a Molecule as a Product from a set of Reactions . |
28,426 | public static IReaction getReactionByAtomContainerID ( IReactionSet reactionSet , String id ) { for ( IReaction reaction : reactionSet . reactions ( ) ) { if ( AtomContainerSetManipulator . containsByID ( reaction . getProducts ( ) , id ) ) return reaction ; } for ( IReaction reaction : reactionSet . reactions ( ) ) { ... | Gets a reaction from a ReactionSet by ID of any product or reactant . If several exist only the first one will be returned . |
28,427 | public static IReaction getReactionByReactionID ( IReactionSet reactionSet , String id ) { Iterable < IReaction > reactionIter = reactionSet . reactions ( ) ; for ( IReaction reaction : reactionIter ) { if ( reaction . getID ( ) != null && reaction . getID ( ) . equals ( id ) ) { return reaction ; } } return null ; } | Gets a reaction from a ReactionSet by ID . If several exist only the first one will be returned . |
28,428 | public static int getAtomCount ( IChemSequence sequence ) { int count = 0 ; for ( int i = 0 ; i < sequence . getChemModelCount ( ) ; i ++ ) { count += ChemModelManipulator . getAtomCount ( sequence . getChemModel ( i ) ) ; } return count ; } | Get the total number of atoms inside an IChemSequence . |
28,429 | public static int getBondCount ( IChemSequence sequence ) { int count = 0 ; for ( int i = 0 ; i < sequence . getChemModelCount ( ) ; i ++ ) { count += ChemModelManipulator . getBondCount ( sequence . getChemModel ( i ) ) ; } return count ; } | Get the total number of bonds inside an IChemSequence . |
28,430 | public static List < IAtomContainer > getAllAtomContainers ( IChemSequence sequence ) { List < IAtomContainer > acList = new ArrayList < IAtomContainer > ( ) ; for ( IChemModel model : sequence . chemModels ( ) ) { acList . addAll ( ChemModelManipulator . getAllAtomContainers ( model ) ) ; } return acList ; } | Returns all the AtomContainer s of a ChemSequence . |
28,431 | public static List < IChemObject > getAllChemObjects ( IChemSequence sequence ) { List < IChemObject > list = new ArrayList < IChemObject > ( ) ; for ( int i = 0 ; i < sequence . getChemModelCount ( ) ; i ++ ) { list . add ( sequence . getChemModel ( i ) ) ; List < IChemObject > current = ChemModelManipulator . getAllC... | Returns a List of all IChemObject inside a ChemSequence . |
28,432 | public IRingSet getRings ( IBond bond ) { IRingSet rings = bond . getBuilder ( ) . newInstance ( IRingSet . class ) ; Ring ring ; for ( int i = 0 ; i < getAtomContainerCount ( ) ; i ++ ) { ring = ( Ring ) getAtomContainer ( i ) ; if ( ring . contains ( bond ) ) { rings . addAtomContainer ( ring ) ; } } return rings ; } | Returns a vector of all rings that this bond is part of . |
28,433 | public IRingSet getRings ( IAtom atom ) { IRingSet rings = new RingSet ( ) ; IRing ring ; for ( int i = 0 ; i < getAtomContainerCount ( ) ; i ++ ) { ring = ( Ring ) getAtomContainer ( i ) ; if ( ring . contains ( atom ) ) { rings . addAtomContainer ( ring ) ; } } return rings ; } | Returns a vector of all rings that this atom is part of . |
28,434 | public IRingSet getConnectedRings ( IRing ring ) { IRingSet connectedRings = ring . getBuilder ( ) . newInstance ( IRingSet . class ) ; IRing tempRing ; IAtom atom ; for ( int i = 0 ; i < ring . getAtomCount ( ) ; i ++ ) { atom = ring . getAtom ( i ) ; for ( int j = 0 ; j < getAtomContainerCount ( ) ; j ++ ) { tempRing... | Returns all the rings in the RingSet that share one or more atoms with a given ring . |
28,435 | public void add ( IRingSet ringSet ) { for ( int f = 0 ; f < ringSet . getAtomContainerCount ( ) ; f ++ ) { if ( ! contains ( ringSet . getAtomContainer ( f ) ) ) { addAtomContainer ( ringSet . getAtomContainer ( f ) ) ; } } } | Adds all rings of another RingSet if they are not already part of this ring set . |
28,436 | public boolean contains ( IAtom atom ) { for ( int i = 0 ; i < getAtomContainerCount ( ) ; i ++ ) { if ( getAtomContainer ( i ) . contains ( atom ) ) { return true ; } } return false ; } | True if at least one of the rings in the ringset contains the given atom . |
28,437 | public boolean contains ( IAtomContainer ring ) { for ( int i = 0 ; i < getAtomContainerCount ( ) ; i ++ ) { if ( ring == getAtomContainer ( i ) ) { return true ; } } return false ; } | Checks for presence of a ring in this RingSet . |
28,438 | private boolean verify ( int n , int m ) { for ( int n_prime : g1 [ n ] ) { boolean found = false ; for ( int m_prime : g2 [ m ] ) { if ( matrix . get ( n_prime , m_prime ) && bondMatcher . matches ( bond1 . get ( n , n_prime ) , bonds2 . get ( m , m_prime ) ) ) { found = true ; break ; } } if ( ! found ) return false ... | Verify that for every vertex adjacent to n there should be at least one feasible candidate adjacent which can be mapped . If no such candidate exists the mapping of n - > m is not longer valid . |
28,439 | private boolean hasCandidate ( int n ) { for ( int j = ( n * matrix . mCols ) , end = ( j + matrix . mCols ) ; j < end ; j ++ ) if ( matrix . get ( j ) ) return true ; return false ; } | Check if there are any feasible mappings left for the query vertex n . We scan the compatibility matrix to see if any value is > 0 . |
28,440 | public static AtomTypeFactory getInstance ( InputStream ins , String format , IChemObjectBuilder builder ) { return new AtomTypeFactory ( ins , format , builder ) ; } | Method to create a default AtomTypeFactory using the given InputStream . An AtomType of this kind is not cached . |
28,441 | private void readConfiguration ( String fileName , IChemObjectBuilder builder ) { logger . info ( "Reading config file from " , fileName ) ; InputStream ins ; { ins = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( fileName ) ; if ( ins == null ) { File file = new File ( fileName ) ; if ( file . exists... | Read the configuration from a text file . |
28,442 | public IAtomType getAtomType ( String identifier ) throws NoSuchAtomTypeException { IAtomType type = atomTypes . get ( identifier ) ; if ( type != null ) return type ; throw new NoSuchAtomTypeException ( "The AtomType " + identifier + " could not be found" ) ; } | Get an AtomType with the given ID . |
28,443 | public IAtomType [ ] getAtomTypes ( String symbol ) { logger . debug ( "Request for atomtype for symbol " , symbol ) ; List < IAtomType > atomList = new ArrayList < IAtomType > ( ) ; for ( IAtomType atomType : atomTypes . values ( ) ) { if ( Objects . equals ( atomType . getSymbol ( ) , symbol ) ) { atomList . add ( at... | Get an array of all atomTypes known to the AtomTypeFactory for the given element symbol and atomtype class . |
28,444 | public IAtomType [ ] getAllAtomTypes ( ) { logger . debug ( "Returning list of size: " , getSize ( ) ) ; return ( IAtomType [ ] ) atomTypes . values ( ) . toArray ( new IAtomType [ atomTypes . size ( ) ] ) ; } | Gets the allAtomTypes attribute of the AtomTypeFactory object . |
28,445 | public IAtom configure ( IAtom atom ) throws CDKException { if ( atom instanceof IPseudoAtom ) { return atom ; } try { IAtomType atomType ; String atomTypeName = atom . getAtomTypeName ( ) ; if ( atomTypeName == null || atomTypeName . length ( ) == 0 ) { logger . debug ( "Using atom symbol because atom type name is emp... | Configures an atom . Finds the correct element type by looking at the Atom s atom type name and if that fails picks the first atom type matching the Atom s element symbol .. |
28,446 | public Color getAtomColor ( IAtom atom , Color defaultColor ) { Color color = defaultColor ; if ( atom . getCharge ( ) == null ) return defaultColor ; double charge = atom . getCharge ( ) ; if ( charge > 0.0 ) { if ( charge < 1.0 ) { int index = 255 - ( int ) ( charge * 255.0 ) ; color = new Color ( index , index , 255... | Returns the a color reflecting the given atom s partial charge or defaults to the given color if no color is defined . |
28,447 | public IBitFingerprint getBitFingerprint ( IAtomContainer atomContainer ) throws CDKException { generateFp ( atomContainer ) ; BitSet fp = new BitSet ( FP_SIZE ) ; for ( int i = 0 ; i < FP_SIZE ; i ++ ) { if ( isBitOn ( i ) ) fp . set ( i ) ; } return new BitSetFingerprint ( fp ) ; } | Calculate 881 bit Pubchem fingerprint for a molecule . |
28,448 | public static BitSet decode ( String enc ) { byte [ ] fp = base64Decode ( enc ) ; if ( fp . length < 4 ) { throw new IllegalArgumentException ( "Input is not a proper PubChem base64 encoded fingerprint" ) ; } int len = ( fp [ 0 ] << 24 ) | ( fp [ 1 ] << 16 ) | ( fp [ 2 ] << 8 ) | ( fp [ 3 ] & 0xff ) ; if ( len != FP_SI... | Returns a fingerprint from a Base64 encoded Pubchem fingerprint . |
28,449 | private String encode ( ) { byte [ ] pack = new byte [ 4 + m_bits . length ] ; pack [ 0 ] = ( byte ) ( ( FP_SIZE & 0xffffffff ) >> 24 ) ; pack [ 1 ] = ( byte ) ( ( FP_SIZE & 0x00ffffff ) >> 16 ) ; pack [ 2 ] = ( byte ) ( ( FP_SIZE & 0x0000ffff ) >> 8 ) ; pack [ 3 ] = ( byte ) ( FP_SIZE & 0x000000ff ) ; for ( int i = 0 ... | the first four bytes contains the length of the fingerprint |
28,450 | public IReaction parseReactionSmiles ( String smiles ) throws InvalidSmilesException { if ( ! smiles . contains ( ">" ) ) throw new InvalidSmilesException ( "Not a reaction SMILES: " + smiles ) ; final int first = smiles . indexOf ( '>' ) ; final int second = smiles . indexOf ( '>' , first + 1 ) ; if ( second < 0 ) thr... | Parse a reaction SMILES . |
28,451 | private void parseMolCXSMILES ( String title , IAtomContainer mol ) { CxSmilesState cxstate ; int pos ; if ( title != null && title . startsWith ( "|" ) ) { if ( ( pos = CxSmilesParser . processCx ( title , cxstate = new CxSmilesState ( ) ) ) >= 0 ) { mol . setTitle ( title . substring ( pos ) ) ; final Map < IAtom , I... | Parses CXSMILES layer and set attributes for atoms and bonds on the provided molecule . |
28,452 | private void parseRxnCXSMILES ( String title , IReaction rxn ) { CxSmilesState cxstate ; int pos ; if ( title != null && title . startsWith ( "|" ) ) { if ( ( pos = CxSmilesParser . processCx ( title , cxstate = new CxSmilesState ( ) ) ) >= 0 ) { rxn . setProperty ( CDKConstants . TITLE , title . substring ( pos ) ) ; ... | Parses CXSMILES layer and set attributes for atoms and bonds on the provided reaction . |
28,453 | public void setParameters ( Object [ ] params ) throws CDKException { if ( params . length != 1 ) { throw new CDKException ( "AromaticBondsCountDescriptor expects one parameter" ) ; } if ( ! ( params [ 0 ] instanceof Boolean ) ) { throw new CDKException ( "The first parameter must be of type Boolean" ) ; } checkAromati... | Sets the parameters attribute of the AromaticBondsCountDescriptor object . |
28,454 | private void checkBond ( IAtomContainer atomContainer , int index ) throws CDKException { IBond bond = atomContainer . getBond ( index ) ; if ( bond != null && bond . getFlag ( CDKConstants . SINGLE_OR_DOUBLE ) ) { try { oldBondOrder = bond . getOrder ( ) ; bond . setOrder ( IBond . Order . SINGLE ) ; setMaxBondOrder (... | This method tries to set the bond order on the current bond . |
28,455 | private void setMaxBondOrder ( IBond bond , IAtomContainer atomContainer ) throws CDKException { if ( bondOrderCanBeIncreased ( bond , atomContainer ) ) { if ( bond . getOrder ( ) != IBond . Order . QUADRUPLE ) bond . setOrder ( BondManipulator . increaseBondOrder ( bond . getOrder ( ) ) ) ; else throw new CDKException... | This method decides the highest bond order that the bond can have and set it to that . |
28,456 | public boolean bondOrderCanBeIncreased ( IBond bond , IAtomContainer atomContainer ) throws CDKException { boolean atom0isUnsaturated = false , atom1isUnsaturated = false ; double sum ; if ( bond . getBegin ( ) . getBondOrderSum ( ) == null ) { sum = getAtomBondordersum ( bond . getEnd ( ) , atomContainer ) ; } else su... | Check if the bond order can be increased . This method assumes that the bond is between only two atoms . |
28,457 | private double getAtomBondordersum ( IAtom atom , IAtomContainer mol ) throws CDKException { double sum = 0 ; for ( IBond bond : mol . bonds ( ) ) if ( bond . contains ( atom ) ) sum += BondManipulator . destroyBondOrder ( bond . getOrder ( ) ) ; return sum ; } | This method is used if by some reason the bond order sum is not set for an atom . |
28,458 | private double bondsUsed ( IAtom atom , IAtomContainer atomContainer ) throws CDKException { int bondsToAtom = 0 ; for ( IBond bond : atomContainer . bonds ( ) ) if ( bond . contains ( atom ) ) bondsToAtom += BondManipulator . destroyBondOrder ( bond . getOrder ( ) ) ; int implicitHydrogens ; if ( atom . getImplicitHyd... | A small help method that count how many bonds an atom has regarding bonds due to its charge and to implicit hydrogens . |
28,459 | private static BufferedWriter ensureBuffered ( Writer wtr ) { if ( wtr == null ) throw new NullPointerException ( "Provided writer was null" ) ; return wtr instanceof BufferedWriter ? ( BufferedWriter ) wtr : new BufferedWriter ( wtr ) ; } | Ensures a writer is buffered . |
28,460 | public void setParameters ( Object [ ] params ) throws CDKException { if ( params . length > 1 ) { throw new CDKException ( "weight only expects one parameter" ) ; } if ( ! ( params [ 0 ] instanceof String ) ) { throw new CDKException ( "The parameter must be of type String" ) ; } elementName = ( String ) params [ 0 ] ... | Sets the parameters attribute of the WeightDescriptor object . |
28,461 | private IAtomContainer setInitialCharges ( IAtomContainer ac ) throws CDKException { Matcher matOC = null ; Matcher matOP = null ; Matcher matOS = null ; Matcher mat_p = null ; Matcher mat_n = null ; String hoseCode = "" ; for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { try { hoseCode = hcg . getHOSECode ( ac , ... | Sets the initialCharges attribute of the AtomTypeCharges object . |
28,462 | public DescriptorValue calculate ( IAtom atom , IAtomContainer container ) { int atomDegree = 0 ; List < IAtom > neighboors = container . getConnectedAtomsList ( atom ) ; for ( IAtom neighboor : neighboors ) { if ( ! neighboor . getSymbol ( ) . equals ( "H" ) ) atomDegree += 1 ; } return new DescriptorValue ( getSpecif... | This method calculates the number of not - H substituents of an atom . |
28,463 | public void paint ( IAtomContainerSet molecules , IDrawVisitor drawVisitor , Rectangle2D bounds , boolean resetCenter ) { Rectangle2D totalBounds = BoundsCalculator . calculateBounds ( molecules ) ; this . setupTransformToFit ( bounds , totalBounds , AverageBondLengthCalculator . calculateAverageBondLength ( molecules ... | Paint a set of molecules . |
28,464 | private boolean augment ( ) { Arrays . fill ( even , NIL ) ; Arrays . fill ( odd , NIL ) ; dsf = new DisjointSetForest ( graph . length ) ; bridges . clear ( ) ; queue . clear ( ) ; for ( int v = 0 ; v < graph . length ; v ++ ) { if ( subset . get ( v ) && matching . unmatched ( v ) ) { even [ v ] = v ; queue . add ( v... | Find an augmenting path an alternate it s matching . If an augmenting path was found then the search must be restarted . If a blossom was detected the blossom is contracted and the search continues . |
28,465 | private boolean check ( int v , int w ) { if ( dsf . getRoot ( v ) == dsf . getRoot ( w ) ) return false ; vAncestors . clear ( ) ; wAncestors . clear ( ) ; int vCurr = v ; int wCurr = w ; while ( true ) { vCurr = parent ( vAncestors , vCurr ) ; wCurr = parent ( wAncestors , wCurr ) ; if ( vCurr == wCurr ) { blossom ( ... | An edge was found which connects two even vertices in the forest . If the vertices have the same root we have a blossom otherwise we have identified an augmenting path . This method checks for these cases and responds accordingly . |
28,466 | private int parent ( BitSet ancestors , int curr ) { curr = dsf . getRoot ( curr ) ; ancestors . set ( curr ) ; int parent = dsf . getRoot ( even [ curr ] ) ; if ( parent == curr ) return curr ; ancestors . set ( parent ) ; return dsf . getRoot ( odd [ parent ] ) ; } | Access the next ancestor in a tree of the forest . Note we go back two places at once as we only need check even vertices . |
28,467 | private void blossom ( int v , int w , int base ) { base = dsf . getRoot ( base ) ; int [ ] supports1 = blossomSupports ( v , w , base ) ; int [ ] supports2 = blossomSupports ( w , v , base ) ; for ( int i = 0 ; i < supports1 . length ; i ++ ) dsf . makeUnion ( supports1 [ i ] , supports1 [ 0 ] ) ; for ( int i = 0 ; i ... | Create a new blossom for the specified bridge edge . |
28,468 | private void augment ( int v ) { int n = buildPath ( path , 0 , v , NIL ) ; for ( int i = 2 ; i < n ; i += 2 ) { matching . match ( path [ i ] , path [ i - 1 ] ) ; } } | Augment all ancestors in the tree of vertex v . |
28,469 | private int buildPath ( int [ ] path , int i , int start , int goal ) { while ( true ) { while ( odd [ start ] != NIL ) { Tuple bridge = bridges . get ( start ) ; int j = buildPath ( path , i , bridge . first , start ) ; reverse ( path , i , j - 1 ) ; i = j ; start = bridge . second ; } path [ i ++ ] = start ; if ( mat... | Builds the path backwards from the specified start vertex until the goal . If the path reaches a blossom then the path through the blossom is lifted to the original graph . |
28,470 | private static void reverse ( int [ ] path , int i , int j ) { while ( i < j ) { int tmp = path [ i ] ; path [ i ] = path [ j ] ; path [ j ] = tmp ; i ++ ; j -- ; } } | Reverse a section of a fixed size array . |
28,471 | static Matching maxamise ( Matching matching , int [ ] [ ] graph , BitSet subset ) { new EdmondsMaximumMatching ( graph , matching , subset ) ; return matching ; } | Attempt to maximise the provided matching over a subset of vertices in a graph . |
28,472 | private void writeAtomContainer ( IAtomContainerSet som ) throws IOException { String sym ; double chrg ; for ( int molnum = 0 ; molnum < som . getAtomContainerCount ( ) ; molnum ++ ) { IAtomContainer mol = som . getAtomContainer ( molnum ) ; try { String molname = "mol " + ( molnum + 1 ) + " " + mol . getTitle ( ) ; w... | writes all the molecules supplied in a MoleculeSet class to a single HIN file . You can also supply a single Molecule object as well |
28,473 | public static IAtomContainer makePyrroleAnion ( ) { IAtomContainer mol = new AtomContainer ( ) ; IAtom nitrogenAnion = new Atom ( "N" ) ; nitrogenAnion . setFormalCharge ( - 1 ) ; mol . addAtom ( new Atom ( "C" ) ) ; mol . addAtom ( nitrogenAnion ) ; mol . addAtom ( new Atom ( "C" ) ) ; mol . addAtom ( new Atom ( "C" )... | Returns pyrrole anion without explicit hydrogens . |
28,474 | public static IAtomContainer makePyridineOxide ( ) { IAtomContainer mol = new AtomContainer ( ) ; mol . addAtom ( new Atom ( "C" ) ) ; mol . addAtom ( new Atom ( "N" ) ) ; mol . getAtom ( 1 ) . setFormalCharge ( 1 ) ; mol . addAtom ( new Atom ( "C" ) ) ; mol . addAtom ( new Atom ( "C" ) ) ; mol . addAtom ( new Atom ( "... | Returns pyridine oxide without explicit hydrogens . |
28,475 | public Collection < List < IAtom > > findRings ( IAtomContainer molecule ) { if ( molecule == null ) return null ; rings . clear ( ) ; PathGraph graph = new PathGraph ( molecule ) ; for ( int i = 0 ; i < molecule . getAtomCount ( ) ; i ++ ) { List < PathEdge > edges = graph . remove ( molecule . getAtom ( i ) ) ; for (... | Returns a collection of rings . |
28,476 | public IRingSet getRingSet ( IAtomContainer molecule ) throws CDKException { Collection < List < IAtom > > cycles = findRings ( molecule ) ; IRingSet ringSet = molecule . getBuilder ( ) . newInstance ( IRingSet . class ) ; for ( List < IAtom > ringAtoms : cycles ) { IRing ring = molecule . getBuilder ( ) . newInstance ... | Returns Ring set based on Hanser Ring Finding method |
28,477 | public DescriptorValue calculate ( IAtomContainer container ) { IRingSet rs ; try { AllRingsFinder arf = new AllRingsFinder ( ) ; rs = arf . findAllRings ( container ) ; } catch ( Exception e ) { return getDummyDescriptorValue ( new CDKException ( "Could not find all rings: " + e . getMessage ( ) ) ) ; } String [ ] fra... | The AlogP descriptor . |
28,478 | private static boolean processAtomLabels ( final CharIter iter , final Map < Integer , String > dest ) { int atomIdx = 0 ; while ( iter . hasNext ( ) ) { while ( iter . nextIf ( ';' ) ) atomIdx ++ ; char c = iter . next ( ) ; if ( c == '$' ) { iter . nextIf ( ',' ) ; return true ; } else { iter . pos -- ; int beg = ite... | Process atom labels from extended SMILES in a char iter . |
28,479 | private static boolean processPolymerSgroups ( CharIter iter , CxSmilesState state ) { if ( state . sgroups == null ) state . sgroups = new ArrayList < > ( ) ; int beg = iter . pos ; while ( iter . hasNext ( ) && ! isSgroupDelim ( iter . curr ( ) ) ) iter . next ( ) ; final String keyword = iter . substr ( beg , iter .... | Polymer Sgroups describe variations of repeating units . Only the atoms and not crossing bonds are written . |
28,480 | private static boolean processRadicals ( CharIter iter , CxSmilesState state ) { if ( state . atomRads == null ) state . atomRads = new TreeMap < > ( ) ; CxSmilesState . Radical rad ; switch ( iter . next ( ) ) { case '1' : rad = CxSmilesState . Radical . Monovalent ; break ; case '2' : rad = CxSmilesState . Radical . ... | CXSMILES radicals . |
28,481 | private static boolean processIntList ( CharIter iter , char sep , List < Integer > dest ) { while ( iter . hasNext ( ) ) { char c = iter . curr ( ) ; if ( isDigit ( c ) ) { int r = processUnsignedInt ( iter ) ; if ( r < 0 ) return false ; iter . nextIf ( sep ) ; dest . add ( r ) ; } else { return true ; } } return fal... | Process a list of unsigned integers . |
28,482 | public IDescriptorResult getCachedDescriptorValue ( IBond bond ) { if ( cachedDescriptorValues == null ) return null ; return ( IDescriptorResult ) cachedDescriptorValues . get ( bond ) ; } | Returns the cached DescriptorValue for the given IBond . |
28,483 | public void setup ( IReactionSet reactionSet , Rectangle screen ) { this . setScale ( reactionSet ) ; Rectangle2D bounds = BoundsCalculator . calculateBounds ( reactionSet ) ; this . modelCenter = new Point2d ( bounds . getCenterX ( ) , bounds . getCenterY ( ) ) ; this . drawCenter = new Point2d ( screen . getCenterX (... | Setup the transformations necessary to draw this Reaction Set . |
28,484 | public void setScale ( IReactionSet reactionSet ) { double bondLength = AverageBondLengthCalculator . calculateAverageBondLength ( reactionSet ) ; double scale = this . calculateScaleForBondLength ( bondLength ) ; this . rendererModel . getParameter ( Scale . class ) . setValue ( scale ) ; } | Set the scale for an IReactionSet . It calculates the average bond length of the model and calculates the multiplication factor to transform this to the bond length that is set in the RendererModel . |
28,485 | public void paint ( IReactionSet reactionSet , IDrawVisitor drawVisitor , Rectangle2D bounds , boolean resetCenter ) { Rectangle2D totalBounds = BoundsCalculator . calculateBounds ( reactionSet ) ; this . setupTransformToFit ( bounds , totalBounds , AverageBondLengthCalculator . calculateAverageBondLength ( reactionSet... | Paint a set of reactions . |
28,486 | public static void translate2DCenterTo ( IAtomContainer container , Point2d p ) { Point2d com = get2DCenter ( container ) ; Vector2d translation = new Vector2d ( p . x - com . x , p . y - com . y ) ; for ( IAtom atom : container . atoms ( ) ) { if ( atom . getPoint2d ( ) != null ) { atom . getPoint2d ( ) . add ( transl... | Translates the geometric 2DCenter of the given AtomContainer container to the specified Point2d p . |
28,487 | public static boolean has2DCoordinates ( IReaction reaction ) { for ( IAtomContainer mol : reaction . getReactants ( ) . atomContainers ( ) ) if ( ! has2DCoordinates ( mol ) ) return false ; for ( IAtomContainer mol : reaction . getProducts ( ) . atomContainers ( ) ) if ( ! has2DCoordinates ( mol ) ) return false ; for... | Determine if all parts of a reaction have coodinates |
28,488 | public static double getBondLengthRMSD ( IAtomContainer firstAtomContainer , IAtomContainer secondAtomContainer , Map < Integer , Integer > mappedAtoms , boolean Coords3d ) { Iterator < Integer > firstAtoms = mappedAtoms . keySet ( ) . iterator ( ) ; IAtom centerAtomFirstMolecule ; IAtom centerAtomSecondMolecule ; List... | Return the RMSD of bonds length between the 2 aligned molecules . |
28,489 | public static double getAngleRMSD ( IAtomContainer firstAtomContainer , IAtomContainer secondAtomContainer , Map < Integer , Integer > mappedAtoms ) { Iterator < Integer > firstAtoms = mappedAtoms . keySet ( ) . iterator ( ) ; IAtom firstAtomfirstAC ; IAtom centerAtomfirstAC ; IAtom firstAtomsecondAC ; IAtom secondAtom... | Return the variation of each angle value between the 2 aligned molecules . |
28,490 | public void calculateOverlapsAndReduce ( IAtomContainer molecule1 , IAtomContainer molecule2 , boolean shouldMatchBonds ) throws CDKException { setSource ( molecule1 ) ; setTarget ( molecule2 ) ; setMappings ( new ArrayList < Map < Integer , Integer > > ( ) ) ; if ( ( getSource ( ) . getAtomCount ( ) == 1 ) || ( getTar... | This function calculates all the possible combinations of MCS |
28,491 | public < S extends T > S get ( String name , Class < S > c ) { return ( S ) get ( name ) ; } | Convenience method that allows specification of return ISetting type so that you can nest the call to access the setting value . |
28,492 | public IMatrix getIy ( ) { return ( new IMatrix ( getIplus ( ) . sub ( getIminus ( ) ) ) ) . mul ( new Complex ( 0d , 1d ) ) . mul ( new Complex ( 0.5 , 0d ) ) ; } | Calculates the Iy operator |
28,493 | public IMatrix getIz ( ) { IMatrix Iz = new IMatrix ( size , size ) ; int i , j ; for ( i = 0 ; i < size ; i ++ ) for ( j = 0 ; j < size ; j ++ ) { Iz . realmatrix [ i ] [ j ] = 0d ; Iz . imagmatrix [ i ] [ j ] = 0d ; } for ( i = 0 ; i < size ; i ++ ) { Iz . realmatrix [ i ] [ i ] = J - i ; Iz . imagmatrix [ i ] [ i ] ... | Calculates the Iz operator |
28,494 | public Matrix getIplus ( ) { Matrix Iplus = new Matrix ( size , size ) ; int i , j ; for ( i = 0 ; i < size ; i ++ ) for ( j = 0 ; j < size ; j ++ ) Iplus . matrix [ i ] [ j ] = 0d ; for ( i = 1 ; i < size ; i ++ ) Iplus . matrix [ i - 1 ] [ i ] = Math . sqrt ( J * J + J - ( J - i + 1 ) * ( J - i + 1 ) + ( J - i + 1 ) ... | Calculates the I + operator |
28,495 | public Matrix getIminus ( ) { Matrix Iminus = new Matrix ( size , size ) ; int i , j ; for ( i = 0 ; i < size ; i ++ ) for ( j = 0 ; j < size ; j ++ ) Iminus . matrix [ i ] [ j ] = 0d ; for ( i = 1 ; i < size ; i ++ ) Iminus . matrix [ i ] [ i - 1 ] = Math . sqrt ( J * J + J - ( J - i ) * ( J - i ) - ( J - i ) ) ; retu... | Calculates the I - operator |
28,496 | public Vector getSpinVector ( double theta , double phi ) { Vector spinvector = new Vector ( 3 ) ; spinvector . vector [ 0 ] = Math . sin ( theta ) * Math . cos ( phi ) ; spinvector . vector [ 1 ] = Math . sin ( theta ) * Math . sin ( phi ) ; spinvector . vector [ 2 ] = Math . cos ( phi ) ; return spinvector ; } | Calculates a spin vector by a direction specified by theta and phi |
28,497 | public static void markAromaticRings ( IRing ring ) { for ( IAtom atom : ring . atoms ( ) ) if ( ! atom . getFlag ( CDKConstants . ISAROMATIC ) ) return ; for ( IBond bond : ring . bonds ( ) ) if ( ! bond . getFlag ( CDKConstants . ISAROMATIC ) ) return ; ring . setFlag ( CDKConstants . ISAROMATIC , true ) ; } | Marks the ring aromatic if all atoms and all bonds are aromatic . |
28,498 | public DescriptorValue calculate ( IAtomContainer atomContainer ) { int n = 0 ; for ( IBond bond : atomContainer . bonds ( ) ) { if ( bond . getBegin ( ) . getAtomicNumber ( ) != 1 && bond . getEnd ( ) . getAtomicNumber ( ) != 1 ) { n ++ ; } } double vadjMa = 0 ; if ( n > 0 ) { vadjMa += ( Math . log ( n ) / Math . log... | calculates the VAdjMa descriptor for an atom container |
28,499 | public List < IAtomType > readAtomTypes ( IChemObjectBuilder builder ) { List < IAtomType > isotopes = new ArrayList < IAtomType > ( ) ; try { parser . setFeature ( "http://xml.org/sax/features/validation" , false ) ; logger . info ( "Deactivated validation" ) ; } catch ( SAXException exception ) { logger . warn ( "Can... | Reads the atom types from the data file . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.