idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
28,700 | public static String getChemicalSeries ( String symbol ) { Elements e = Elements . ofString ( symbol ) ; for ( Series s : Series . values ( ) ) if ( s . contains ( e ) ) return s . name ( ) ; return null ; } | Get the chemical series for an element . |
28,701 | public static String getPhase ( String symbol ) { Elements e = Elements . ofString ( symbol ) ; for ( Phase p : Phase . values ( ) ) if ( p . contains ( e ) ) return p . name ( ) ; return null ; } | Get the phase of the element . |
28,702 | private static Map < Elements , String > casIds ( ) { Map < Elements , String > result = ids ; if ( result == null ) { synchronized ( LOCK ) { result = ids ; if ( result == null ) { ids = result = initCasIds ( ) ; } } } return result ; } | Lazily obtain the CAS ID Mapping . |
28,703 | public static IBioPolymer addAminoAcidAtNTerminus ( IBioPolymer protein , IAminoAcid aaToAdd , IStrand strand , IAminoAcid aaToAddTo ) { addAminoAcid ( protein , aaToAdd , strand ) ; if ( protein . getMonomerCount ( ) == 0 ) { protein . addBond ( aaToAdd . getBuilder ( ) . newInstance ( IBond . class , aaToAddTo . getN... | Builds a protein by connecting a new amino acid at the N - terminus of the given strand . |
28,704 | private static int getMaxDepth ( int [ ] [ ] adjlist , int v , int prev ) { int longest = 0 ; for ( int w : adjlist [ v ] ) { if ( w == prev ) continue ; int length = getMaxDepth ( adjlist , w , v ) ; if ( length > longest ) longest = length ; } return 1 + longest ; } | Depth - First - Search on an acyclic graph . Since we have no cycles we don t need the visit flags and only need to know which atom we came from . |
28,705 | public Object getParameterType ( String name ) { if ( name . equals ( CHECK_RING_SYSTEM ) ) return Boolean . TRUE ; else throw new IllegalArgumentException ( "No parameter for name: " + name ) ; } | Gets the parameterType attribute of the LongestAliphaticChainDescriptor object . |
28,706 | private static IAtom findOtherSinglyBonded ( IAtomContainer container , IAtom atom , IAtom exclude ) { for ( final IBond bond : container . getConnectedBondsList ( atom ) ) { if ( ! IBond . Order . SINGLE . equals ( bond . getOrder ( ) ) || bond . contains ( exclude ) ) continue ; return bond . getOther ( atom ) ; } re... | Finds a neighbor attached to atom that is singley bonded and isn t exclude . If no such atom exists the atom is returned . |
28,707 | private IChemFile readChemFile ( IChemFile chemFile ) throws CDKException , IOException { IChemSequence sequence = chemFile . getBuilder ( ) . newInstance ( IChemSequence . class ) ; IChemModel model = null ; String line = input . readLine ( ) ; String levelOfTheory ; String description ; int modelCounter = 0 ; while (... | Read the Gaussian98 output . |
28,708 | private void readNMRData ( IChemModel model , String labelLine ) throws CDKException { List < IAtomContainer > containers = ChemModelManipulator . getAllAtomContainers ( model ) ; if ( containers . size ( ) == 0 ) { return ; } IAtomContainer ac = containers . get ( 0 ) ; String label ; if ( labelLine . indexOf ( "Diama... | Reads NMR nuclear shieldings . |
28,709 | private String parseLevelOfTheory ( String line ) { StringBuffer summary = new StringBuffer ( ) ; summary . append ( line ) ; try { do { line = input . readLine ( ) . trim ( ) ; summary . append ( line ) ; } while ( ! ( line . indexOf ( '@' ) >= 0 ) ) ; } catch ( Exception exc ) { logger . debug ( "syntax problem while... | Select the theory and basis set from the first archive line . |
28,710 | public double validate ( IMolecularFormula formula ) throws CDKException { logger . info ( "Start validation of " , formula ) ; double mass = MolecularFormulaManipulator . getTotalMassNumber ( formula ) ; if ( mass == 0 ) return 0.0 ; int numberN = MolecularFormulaManipulator . getElementCount ( formula , formula . get... | Validate the nitrogen rule of this IMolecularFormula . |
28,711 | private int getOthers ( IMolecularFormula formula ) { int number = 0 ; String [ ] elements = { "Co" , "Hg" , "Pt" , "As" } ; for ( int i = 0 ; i < elements . length ; i ++ ) number += MolecularFormulaManipulator . getElementCount ( formula , formula . getBuilder ( ) . newInstance ( IElement . class , elements [ i ] ) )... | Get the number of other elements which affect to the calculation of the nominal mass . For example Fe Co Hg Pt As . |
28,712 | public static IAtomContainer checkAndCleanMolecule ( IAtomContainer molecule ) { boolean isMarkush = false ; for ( IAtom atom : molecule . atoms ( ) ) { if ( atom . getSymbol ( ) . equals ( "R" ) ) { isMarkush = true ; break ; } } if ( isMarkush ) { System . err . println ( "Skipping Markush structure for sanity check"... | Modules for cleaning a molecule |
28,713 | Entry < String , Point2d [ ] > createEntry ( final IAtomContainer container ) { try { final int n = container . getAtomCount ( ) ; final int [ ] ordering = new int [ n ] ; final String smiles = cansmi ( container , ordering ) ; final Point2d [ ] points = new Point2d [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { Point2d po... | Create a library entry from an atom container . Note the entry is not added to the library . |
28,714 | static Point2d [ ] decodeCoordinates ( String str ) { if ( str . startsWith ( "|(" ) ) { int end = str . indexOf ( ')' , 2 ) ; if ( end < 0 ) return new Point2d [ 0 ] ; String [ ] strs = str . substring ( 2 , end ) . split ( ";" ) ; Point2d [ ] points = new Point2d [ strs . length ] ; for ( int i = 0 ; i < strs . lengt... | Decode coordinates that have been placed in a byte buffer . |
28,715 | static String encodeEntry ( Entry < String , Point2d [ ] > entry ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( entry . getKey ( ) ) ; sb . append ( ' ' ) ; sb . append ( encodeCoordinates ( entry . getValue ( ) ) ) ; return sb . toString ( ) ; } | Encodes an entry in a compact string representation . The encoded entry is a SMILES string with the coordinates suffixed in binary . |
28,716 | static String encodeCoordinates ( Point2d [ ] points ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "|(" ) ; for ( Point2d point : points ) { if ( sb . length ( ) > 2 ) sb . append ( ";" ) ; sb . append ( DECIMAL_FORMAT . format ( point . x ) ) ; sb . append ( ',' ) ; sb . append ( DECIMAL_FORMAT . format... | Encode coordinates in a string . |
28,717 | void add ( Entry < String , Point2d [ ] > entry ) { if ( entry != null ) templateMap . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } | Add a created entry to the library . |
28,718 | boolean assignLayout ( IAtomContainer container ) { try { int n = container . getAtomCount ( ) ; int [ ] ordering = new int [ n ] ; String smiles = cansmi ( container , ordering ) ; for ( Point2d [ ] points : templateMap . get ( smiles ) ) { for ( int i = 0 ; i < n ; i ++ ) { container . getAtom ( i ) . setPoint2d ( ne... | Assign a 2D layout to the atom container using the contents of the library . If multiple coordinates are available the first is choosen . |
28,719 | Collection < Point2d [ ] > getCoordinates ( IAtomContainer mol ) { try { int n = mol . getAtomCount ( ) ; int [ ] ordering = new int [ n ] ; String smiles = cansmi ( mol , ordering ) ; final Collection < Point2d [ ] > coordSet = templateMap . get ( smiles ) ; final List < Point2d [ ] > orderedCoordSet = new ArrayList <... | Get all templated coordinates for the provided molecule . The return collection has coordinates ordered based on the input . |
28,720 | static IdentityTemplateLibrary loadFromResource ( String resource ) { InputStream in = IdentityTemplateLibrary . class . getResourceAsStream ( resource ) ; try { return load ( in ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( "Could not load template library from resource " + resource , e ) ; } fi... | Load a template library from a resource on the class path . |
28,721 | static IdentityTemplateLibrary load ( InputStream in ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( in ) ) ; String line = null ; IdentityTemplateLibrary library = new IdentityTemplateLibrary ( ) ; while ( ( line = br . readLine ( ) ) != null ) { if ( line . charAt ( 0 ) == '#' ... | Load a template library from an input stream . |
28,722 | static Point2d [ ] reorderCoords ( Point2d [ ] coords , int [ ] order ) { Point2d [ ] neworder = new Point2d [ coords . length ] ; for ( int i = 0 ; i < order . length ; i ++ ) neworder [ order [ i ] ] = coords [ i ] ; return neworder ; } | Reorder coordinates . |
28,723 | void update ( IChemObjectBuilder bldr ) { final SmilesParser smipar = new SmilesParser ( bldr ) ; Multimap < String , Point2d [ ] > updated = LinkedListMultimap . create ( ) ; for ( Map . Entry < String , Collection < Point2d [ ] > > e : templateMap . asMap ( ) . entrySet ( ) ) { try { IAtomContainer mol = smipar . par... | Update the template library - can be called for safety after each load . |
28,724 | void store ( OutputStream out ) throws IOException { BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( out ) ) ; for ( Entry < String , Point2d [ ] > e : templateMap . entries ( ) ) { bw . write ( encodeEntry ( e ) ) ; bw . write ( '\n' ) ; } bw . close ( ) ; } | Store a template library to the provided output stream . |
28,725 | public boolean perfect ( int [ ] [ ] graph , BitSet subset ) { if ( graph . length != match . length || subset . cardinality ( ) > graph . length ) throw new IllegalArgumentException ( "graph and matching had different capacity" ) ; if ( ( subset . cardinality ( ) & 0x1 ) == 0x1 ) return false ; if ( arbitaryMatching (... | Attempt to augment the matching such that it is perfect over the subset of vertices in the provided graph . |
28,726 | boolean arbitaryMatching ( final int [ ] [ ] graph , final BitSet subset ) { final BitSet unmatched = new BitSet ( ) ; final int [ ] deg = new int [ graph . length ] ; final int [ ] deg1 = new int [ graph . length ] ; int nd1 = 0 , nMatched = 0 ; for ( int v = subset . nextSetBit ( 0 ) ; v >= 0 ; v = subset . nextSetBi... | Assign an arbitrary matching that covers the subset of vertices . |
28,727 | private int otherIndex ( int i ) { IDoubleBondStereochemistry element = ( IDoubleBondStereochemistry ) queryElements [ i ] ; return queryMap . get ( element . getStereoBond ( ) . getOther ( query . getAtom ( i ) ) ) ; } | Given an index of an atom in the query get the index of the other atom in the double bond . |
28,728 | public void setParameters ( String nameParam , String typeParam , String value ) { this . parameters . put ( nameParam , typeParam ) ; this . parametersValue . add ( value ) ; } | Set the parameters of the reaction . |
28,729 | public DescriptorValue calculate ( IAtomContainer container ) { IAtomContainer local = AtomContainerManipulator . removeHydrogens ( container ) ; int tradius = PathTools . getMolecularGraphRadius ( local ) ; int tdiameter = PathTools . getMolecularGraphDiameter ( local ) ; DoubleArrayResult retval = new DoubleArrayResu... | Calculates the two Petitjean shape indices . |
28,730 | public boolean apply ( final int [ ] mapping ) { if ( queryComponents == null ) return true ; int [ ] usedBy = new int [ targetComponents [ targetComponents . length - 1 ] + 1 ] ; int [ ] usedIn = new int [ queryComponents [ queryComponents . length - 1 ] + 1 ] ; for ( int v = 0 ; v < mapping . length ; v ++ ) { if ( q... | Does the mapping respected the component grouping specified by the query . |
28,731 | public void setTemplateHandler ( TemplateHandler templateHandler ) { IdentityTemplateLibrary lib = templateHandler . toIdentityTemplateLibrary ( ) ; lib . add ( identityLibrary ) ; identityLibrary = lib ; } | Sets the templateHandler attribute of the StructureDiagramGenerator object |
28,732 | public void generateExperimentalCoordinates ( Vector2d firstBondVector ) throws CDKException { IAtomContainer original = molecule ; IAtomContainer shallowCopy = molecule . getBuilder ( ) . newInstance ( IAtomContainer . class , molecule ) ; for ( IAtom curAtom : shallowCopy . atoms ( ) ) { if ( curAtom . getSymbol ( ) ... | Generates 2D coordinates on the non - hydrogen skeleton after which coordinates for the hydrogens are calculated . |
28,733 | private static int countAlignedBonds ( IAtomContainer mol ) { final double ref = Math . toRadians ( 30 ) ; final double diff = Math . toRadians ( 1 ) ; int count = 0 ; for ( IBond bond : mol . bonds ( ) ) { Point2d beg = bond . getBegin ( ) . getPoint2d ( ) ; Point2d end = bond . getEnd ( ) . getPoint2d ( ) ; if ( beg ... | Count the number of bonds aligned to 30 degrees . |
28,734 | private List < IAtom > selectIons ( IAtomContainer frag , int sign ) { int fragChg = frag . getProperty ( FRAGMENT_CHARGE ) ; assert Integer . signum ( fragChg ) == sign ; final List < IAtom > atoms = new ArrayList < > ( ) ; FIRST_PASS : for ( IAtom atom : frag . atoms ( ) ) { if ( fragChg == 0 ) break ; int atmChg = n... | Select ions from a charged fragment . Ions not in charge separated bonds are favoured but select if needed . If an atom has lost or gained more than one electron it is added mutliple times to the output list |
28,735 | private List < IAtomContainer > toList ( IAtomContainerSet frags ) { return new ArrayList < > ( FluentIterable . from ( frags . atomContainers ( ) ) . toList ( ) ) ; } | Utility - get the IAtomContainers as a list . |
28,736 | private boolean lookupRingSystem ( IRingSet rs , IAtomContainer molecule , boolean anon ) { if ( ! useIdentTemplates ) return false ; final IChemObjectBuilder bldr = molecule . getBuilder ( ) ; final IAtomContainer ringSystem = bldr . newInstance ( IAtomContainer . class ) ; for ( IAtomContainer container : rs . atomCo... | Using a fast identity template library lookup the the ring system and assign coordinates . The method indicates whether a match was found and coordinates were assigned . |
28,737 | private static boolean isHydrogen ( IAtom atom ) { if ( atom . getAtomicNumber ( ) != null ) return atom . getAtomicNumber ( ) == 1 ; return "H" . equals ( atom . getSymbol ( ) ) ; } | Is an atom a hydrogen atom . |
28,738 | private static IAtomContainer clearHydrogenCounts ( IAtomContainer container ) { for ( IAtom atom : container . atoms ( ) ) atom . setImplicitHydrogenCount ( 0 ) ; return container ; } | Simple helper function that sets all hydrogen counts to 0 . |
28,739 | private boolean isMacroCycle ( IRing ring , IRingSet rs ) { if ( ring . getAtomCount ( ) < 8 ) return false ; for ( IBond bond : ring . bonds ( ) ) { boolean found = false ; for ( IAtomContainer other : rs . atomContainers ( ) ) { if ( ring == other ) continue ; if ( other . contains ( bond ) ) { found = true ; break ;... | Check if a ring in a ring set is a macro cycle . We define this as a ring with > = 10 atom and has at least one bond that isn t contained in any other rings . |
28,740 | private void layoutAcyclicParts ( ) throws CDKException { logger . debug ( "Start of handleAliphatics" ) ; int safetyCounter = 0 ; IAtomContainer unplacedAtoms = null ; IAtomContainer placedAtoms = null ; IAtomContainer longestUnplacedChain = null ; IAtom atom = null ; Vector2d direction = null ; Vector2d startVector =... | Does a layout of all aliphatic parts connected to the parts of the molecule that have already been laid out . Starts at the first bond with unplaced neighbours and stops when a ring is encountered . |
28,741 | private void layoutCyclicParts ( ) throws CDKException { logger . debug ( "Start of layoutNextRingSystem()" ) ; resetUnplacedRings ( ) ; IAtomContainer placedAtoms = AtomPlacer . getPlacedAtoms ( molecule ) ; logger . debug ( "Finding attachment bond to already placed part..." ) ; IBond nextRingAttachmentBond = getNext... | Does the layout for the next RingSystem that is connected to those parts of the molecule that have already been laid out . Finds the next ring with an unplaced ring atom and lays out this ring . Then lays out the ring substituents of this ring . Then moves and rotates the laid out ring to match the position of its atta... |
28,742 | private IAtomContainer getUnplacedAtoms ( IAtom atom ) { IAtomContainer unplacedAtoms = atom . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; List bonds = molecule . getConnectedBondsList ( atom ) ; IAtom connectedAtom ; for ( int f = 0 ; f < bonds . size ( ) ; f ++ ) { connectedAtom = ( ( IBond ) bonds . ge... | Returns an AtomContainer with all unplaced atoms connected to a given atom |
28,743 | private IAtom getNextAtomWithAliphaticUnplacedNeigbors ( ) { IBond bond ; for ( int f = 0 ; f < molecule . getBondCount ( ) ; f ++ ) { bond = molecule . getBond ( f ) ; if ( bond . getEnd ( ) . getFlag ( CDKConstants . ISPLACED ) && ! bond . getBegin ( ) . getFlag ( CDKConstants . ISPLACED ) ) { return bond . getEnd ( ... | Returns the next atom with unplaced aliphatic neighbors |
28,744 | private IBond getNextBondWithUnplacedRingAtom ( ) { for ( IBond bond : molecule . bonds ( ) ) { IAtom beg = bond . getBegin ( ) ; IAtom end = bond . getEnd ( ) ; if ( beg . getPoint2d ( ) != null && end . getPoint2d ( ) != null ) { if ( end . getFlag ( CDKConstants . ISPLACED ) && ! beg . getFlag ( CDKConstants . ISPLA... | Returns the next bond with an unplaced ring atom |
28,745 | private boolean allPlaced ( IRingSet rings ) { for ( int f = 0 ; f < rings . getAtomContainerCount ( ) ; f ++ ) { if ( ! ( ( IRing ) rings . getAtomContainer ( f ) ) . getFlag ( CDKConstants . ISPLACED ) ) { logger . debug ( "allPlaced->Ring " + f + " not placed" ) ; return false ; } } return true ; } | Are all rings in the Vector placed? |
28,746 | private IAtom getRingAtom ( IBond bond ) { if ( bond . getBegin ( ) . getFlag ( CDKConstants . ISINRING ) && ! bond . getBegin ( ) . getFlag ( CDKConstants . ISPLACED ) ) { return bond . getBegin ( ) ; } if ( bond . getEnd ( ) . getFlag ( CDKConstants . ISINRING ) && ! bond . getEnd ( ) . getFlag ( CDKConstants . ISPLA... | Get the unplaced ring atom in this bond |
28,747 | private IRingSet getRingSystemOfAtom ( List ringSystems , IAtom ringAtom ) { IRingSet ringSet = null ; for ( int f = 0 ; f < ringSystems . size ( ) ; f ++ ) { ringSet = ( IRingSet ) ringSystems . get ( f ) ; if ( ringSet . contains ( ringAtom ) ) { return ringSet ; } } return null ; } | Get the ring system of which the given atom is part of |
28,748 | private void resetUnplacedRings ( ) { IRing ring = null ; if ( sssr == null ) { return ; } int unplacedCounter = 0 ; for ( int f = 0 ; f < sssr . getAtomContainerCount ( ) ; f ++ ) { ring = ( IRing ) sssr . getAtomContainer ( f ) ; if ( ! ring . getFlag ( CDKConstants . ISPLACED ) ) { logger . debug ( "Ring with " + ri... | Set all the atoms in unplaced rings to be unplaced |
28,749 | public IAtom getOtherBondAtom ( IAtom atom , IBond bond ) { if ( ! bond . contains ( atom ) ) return null ; if ( bond . getBegin ( ) . equals ( atom ) ) return bond . getEnd ( ) ; else return bond . getBegin ( ) ; } | Returns the other atom of the bond . Expects bond to have only two atoms . Returns null if the given atom is not part of the given bond . |
28,750 | private void placeSgroupBrackets ( IAtomContainer mol ) { List < Sgroup > sgroups = mol . getProperty ( CDKConstants . CTAB_SGROUPS ) ; if ( sgroups == null ) return ; final Multimap < IBond , Sgroup > bondMap = HashMultimap . create ( ) ; final Map < IBond , Integer > counter = new HashMap < > ( ) ; for ( Sgroup sgrou... | Place and update brackets for polymer Sgroups . |
28,751 | private SgroupBracket newCrossingBracket ( IBond bond , Multimap < IBond , Sgroup > bonds , Map < IBond , Integer > counter , boolean vert ) { final IAtom beg = bond . getBegin ( ) ; final IAtom end = bond . getEnd ( ) ; final Point2d begXy = beg . getPoint2d ( ) ; final Point2d endXy = end . getPoint2d ( ) ; final Vec... | Generate a new bracket across the provided bond . |
28,752 | private static boolean hasBrackets ( Sgroup sgroup ) { switch ( sgroup . getType ( ) ) { case CtabStructureRepeatUnit : case CtabAnyPolymer : case CtabCrossLink : case CtabComponent : case CtabMixture : case CtabFormulation : case CtabGraft : case CtabModified : case CtabMonomer : case CtabCopolymer : case CtabMultiple... | Determine whether and Sgroup type has brackets to be placed . |
28,753 | public IRingSet findSSSR ( ) { if ( atomContainer == null ) { return null ; } IRingSet ringSet = toRingSet ( atomContainer , cycleBasis ( ) . cycles ( ) ) ; return ringSet ; } | Finds a Smallest Set of Smallest Rings . The returned set is not uniquely defined . |
28,754 | public IRingSet findEssentialRings ( ) { if ( atomContainer == null ) { return null ; } IRingSet ringSet = toRingSet ( atomContainer , cycleBasis ( ) . essentialCycles ( ) ) ; return ringSet ; } | Finds the Set of Essential Rings . These rings are contained in every possible SSSR . The returned set is uniquely defined . |
28,755 | public IRingSet findRelevantRings ( ) { if ( atomContainer == null ) { return null ; } IRingSet ringSet = toRingSet ( atomContainer , cycleBasis ( ) . relevantCycles ( ) . keySet ( ) ) ; return ringSet ; } | Finds the Set of Relevant Rings . These rings are contained in every possible SSSR . The returned set is uniquely defined . |
28,756 | public int [ ] getEquivalenceClassesSizeVector ( ) { List equivalenceClasses = cycleBasis ( ) . equivalenceClasses ( ) ; int [ ] result = new int [ equivalenceClasses . size ( ) ] ; for ( int i = 0 ; i < equivalenceClasses . size ( ) ; i ++ ) { result [ i ] = ( ( Collection ) equivalenceClasses . get ( i ) ) . size ( )... | Returns a vector containing the size of the interchangeability equivalence classes . The vector is uniquely defined for any SSSR of a molecule . |
28,757 | public static long [ ] label ( IAtomContainer container , int [ ] [ ] g , long [ ] initial ) { if ( initial . length != g . length ) throw new IllegalArgumentException ( "number of initial != number of atoms" ) ; return new Canon ( g , initial , terminalHydrogens ( container , g ) , false ) . labelling ; } | Compute the canonical labels for the provided structure . The labelling does not consider isomer information or stereochemistry . This method allows provision of a custom array of initial invariants . |
28,758 | private long [ ] refine ( long [ ] invariants , boolean [ ] hydrogens ) { int ord = g . length ; InvariantRanker ranker = new InvariantRanker ( ord ) ; int [ ] currVs = new int [ ord ] ; int [ ] nextVs = new int [ ord ] ; int nnu = ord ; for ( int i = 0 ; i < ord ; i ++ ) currVs [ i ] = i ; long [ ] prev = invariants ;... | Internal - refine invariants to a canonical labelling and symmetry classes . |
28,759 | private static int atomicNumber ( IAtom atom ) { Integer elem = atom . getAtomicNumber ( ) ; if ( elem != null ) return elem ; if ( atom instanceof IPseudoAtom ) return 0 ; throw new NullPointerException ( "a non-pseudoatom had unset atomic number" ) ; } | Access atomic number of atom defaulting to 0 for pseudo atoms . |
28,760 | private static int implH ( IAtom atom ) { Integer h = atom . getImplicitHydrogenCount ( ) ; if ( h != null ) return h ; if ( atom instanceof IPseudoAtom ) return 0 ; throw new NullPointerException ( "a non-pseudoatom had unset hydrogen count" ) ; } | Access implicit hydrogen count of the atom defaulting to 0 for pseudo atoms . |
28,761 | private static int charge ( IAtom atom ) { Integer charge = atom . getFormalCharge ( ) ; if ( charge != null ) return charge ; return 0 ; } | Access formal charge of an atom defaulting to 0 if undefined . |
28,762 | static boolean [ ] terminalHydrogens ( final IAtomContainer ac , final int [ ] [ ] g ) { final boolean [ ] hydrogens = new boolean [ ac . getAtomCount ( ) ] ; for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { IAtom atom = ac . getAtom ( i ) ; hydrogens [ i ] = atom . getAtomicNumber ( ) == 1 && atom . getMassNumbe... | Locate explicit hydrogens that are attached to exactly one other atom . |
28,763 | public synchronized IChemObject readRecord ( int record ) throws Exception { String buffer = readContent ( record ) ; if ( chemObjectReader == null ) throw new CDKException ( "No chemobject reader!" ) ; else { chemObjectReader . setReader ( new StringReader ( buffer ) ) ; currentRecord = record ; return processContent ... | Returns the object at given record No . |
28,764 | protected String readContent ( int record ) throws IOException , CDKException { logger . debug ( "Current record " , record ) ; if ( ( record < 0 ) || ( record >= records ) ) { throw new CDKException ( "No such record " + record ) ; } raFile . seek ( index [ record ] [ 0 ] ) ; int length = ( int ) index [ record ] [ 1 ... | Reads the record text content into a String . |
28,765 | private static int [ ] inverse ( int [ ] perm ) { int [ ] inv = new int [ perm . length ] ; for ( int i = 0 , len = perm . length ; i < len ; i ++ ) inv [ perm [ i ] ] = i ; return inv ; } | calculate the inverse of a permutation |
28,766 | public List < IIsotope > readIsotopes ( ) { List < IIsotope > isotopes = new ArrayList < IIsotope > ( ) ; try { parser . setFeature ( "http://xml.org/sax/features/validation" , false ) ; logger . info ( "Deactivated validation" ) ; } catch ( SAXException exception ) { logger . warn ( "Cannot deactivate validation: " , ... | Triggers the XML parsing of the data file and returns the read Isotopes . It turns of XML validation before parsing . |
28,767 | public static IAtomContainerSet getAllProducts ( IReaction reaction ) { IAtomContainerSet moleculeSet = reaction . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; IAtomContainerSet products = reaction . getProducts ( ) ; for ( int i = 0 ; i < products . getAtomContainerCount ( ) ; i ++ ) { moleculeSet . ad... | get all products of a IReaction |
28,768 | public static IAtomContainerSet getAllReactants ( IReaction reaction ) { IAtomContainerSet moleculeSet = reaction . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; IAtomContainerSet reactants = reaction . getReactants ( ) ; for ( int i = 0 ; i < reactants . getAtomContainerCount ( ) ; i ++ ) { moleculeSet ... | get all reactants of a IReaction |
28,769 | public static IReaction reverse ( IReaction reaction ) { IReaction reversedReaction = reaction . getBuilder ( ) . newInstance ( IReaction . class ) ; if ( reaction . getDirection ( ) == IReaction . Direction . BIDIRECTIONAL ) { reversedReaction . setDirection ( IReaction . Direction . BIDIRECTIONAL ) ; } else if ( reac... | Returns a new Reaction object which is the reverse of the given Reaction . |
28,770 | public static IChemObject getMappedChemObject ( IReaction reaction , IChemObject chemObject ) { for ( IMapping mapping : reaction . mappings ( ) ) { if ( mapping . getChemObject ( 0 ) . equals ( chemObject ) ) { return mapping . getChemObject ( 1 ) ; } else if ( mapping . getChemObject ( 1 ) . equals ( chemObject ) ) r... | get the IAtom which is mapped |
28,771 | private static void assignRoleAndGrp ( IAtomContainer mol , ReactionRole role , int grpId ) { for ( IAtom atom : mol . atoms ( ) ) { atom . setProperty ( CDKConstants . REACTION_ROLE , role ) ; atom . setProperty ( CDKConstants . REACTION_GROUP , grpId ) ; } } | Assigns a reaction role and group id to all atoms in a molecule . |
28,772 | public void setMatchingAtoms ( int [ ] atomIndices ) { this . matchingAtoms = new int [ atomIndices . length ] ; System . arraycopy ( atomIndices , 0 , this . matchingAtoms , 0 , atomIndices . length ) ; Arrays . sort ( matchingAtoms ) ; } | Set the atoms of a target molecule that correspond to this group . |
28,773 | public static boolean isSquarePlanar ( IAtom atomA , IAtom atomB , IAtom atomC , IAtom atomD ) { Point3d pointA = atomA . getPoint3d ( ) ; Point3d pointB = atomB . getPoint3d ( ) ; Point3d pointC = atomC . getPoint3d ( ) ; Point3d pointD = atomD . getPoint3d ( ) ; return isSquarePlanar ( pointA , pointB , pointC , poin... | Checks these four atoms for square planarity . |
28,774 | public static boolean isOctahedral ( IAtom atomA , IAtom atomB , IAtom atomC , IAtom atomD , IAtom atomE , IAtom atomF , IAtom atomG ) { Point3d pointA = atomA . getPoint3d ( ) ; Point3d pointB = atomB . getPoint3d ( ) ; Point3d pointC = atomC . getPoint3d ( ) ; Point3d pointD = atomD . getPoint3d ( ) ; Point3d pointE ... | Checks these 7 atoms to see if they are at the points of an octahedron . |
28,775 | public static boolean isTrigonalBipyramidal ( IAtom atomA , IAtom atomB , IAtom atomC , IAtom atomD , IAtom atomE , IAtom atomF ) { Point3d pointA = atomA . getPoint3d ( ) ; Point3d pointB = atomB . getPoint3d ( ) ; Point3d pointC = atomC . getPoint3d ( ) ; Point3d pointD = atomD . getPoint3d ( ) ; Point3d pointE = ato... | Checks these 6 atoms to see if they form a trigonal - bipyramidal shape . |
28,776 | public static Stereo getStereo ( IAtom atom1 , IAtom atom2 , IAtom atom3 , IAtom atom4 ) { TetrahedralSign sign = StereoTool . getHandedness ( atom2 , atom3 , atom4 , atom1 ) ; if ( sign == TetrahedralSign . PLUS ) { return Stereo . ANTI_CLOCKWISE ; } else { return Stereo . CLOCKWISE ; } } | Take four atoms and return Stereo . CLOCKWISE or Stereo . ANTI_CLOCKWISE . The first atom is the one pointing towards the observer . |
28,777 | public static double signedDistanceToPlane ( Vector3d planeNormal , Point3d pointInPlane , Point3d point ) { if ( planeNormal == null ) return Double . NaN ; Vector3d pointPointDiff = new Vector3d ( ) ; pointPointDiff . sub ( point , pointInPlane ) ; return planeNormal . dot ( pointPointDiff ) ; } | Given a normalized normal for a plane any point in that plane and a point will return the distance between the plane and that point . |
28,778 | public static Rectangle2D calculateBounds ( IChemModel chemModel ) { IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; IReactionSet reactionSet = chemModel . getReactionSet ( ) ; Rectangle2D totalBounds = new Rectangle2D . Double ( ) ; if ( moleculeSet != null ) { totalBounds = totalBounds . createUnion ... | Calculate the bounding rectangle for a chem model . |
28,779 | public static Rectangle2D calculateBounds ( IReactionSet reactionSet ) { Rectangle2D totalBounds = new Rectangle2D . Double ( ) ; for ( IReaction reaction : reactionSet . reactions ( ) ) { Rectangle2D reactionBounds = calculateBounds ( reaction ) ; if ( totalBounds . isEmpty ( ) ) { totalBounds = reactionBounds ; } els... | Calculate the bounding rectangle for a reaction set . |
28,780 | public static Rectangle2D calculateBounds ( IReaction reaction ) { IAtomContainerSet reactants = reaction . getReactants ( ) ; IAtomContainerSet products = reaction . getProducts ( ) ; if ( reactants == null || products == null ) return null ; Rectangle2D reactantsBounds = calculateBounds ( reactants ) ; return reactan... | Calculate the bounding rectangle for a reaction . |
28,781 | public static Rectangle2D calculateBounds ( IAtomContainerSet moleculeSet ) { Rectangle2D totalBounds = new Rectangle2D . Double ( ) ; for ( int i = 0 ; i < moleculeSet . getAtomContainerCount ( ) ; i ++ ) { IAtomContainer container = moleculeSet . getAtomContainer ( i ) ; Rectangle2D acBounds = calculateBounds ( conta... | Calculate the bounding rectangle for a molecule set . |
28,782 | public static Rectangle2D calculateBounds ( IAtomContainer atomContainer ) { if ( atomContainer . getAtomCount ( ) == 0 ) { return new Rectangle2D . Double ( ) ; } else if ( atomContainer . getAtomCount ( ) == 1 ) { Point2d point = atomContainer . getAtom ( 0 ) . getPoint2d ( ) ; if ( point == null ) { throw new Illega... | Calculate the bounding rectangle for an atom container . |
28,783 | public String getDictionaryType ( String identifier ) { Entry [ ] dictEntries = dict . getEntries ( ) ; String specRef = getSpecRef ( identifier ) ; logger . debug ( "Got identifier: " + identifier ) ; logger . debug ( "Final spec ref: " + specRef ) ; for ( Entry dictEntry : dictEntries ) { if ( ! dictEntry . getClassN... | Returns the type of the descriptor as defined in the descriptor dictionary . |
28,784 | public String getDictionaryDefinition ( String identifier ) { Entry [ ] dictEntries = dict . getEntries ( ) ; String specRef = getSpecRef ( identifier ) ; if ( specRef == null ) { logger . error ( "Cannot determine specification for id: " , identifier ) ; return "" ; } String definition = null ; for ( Entry dictEntry :... | Gets the definition of the descriptor . |
28,785 | public String [ ] getAvailableDictionaryClasses ( ) { List < String > classList = new ArrayList < String > ( ) ; for ( IImplementationSpecification spec : speclist ) { String [ ] tmp = getDictionaryClass ( spec ) ; if ( tmp != null ) classList . addAll ( Arrays . asList ( tmp ) ) ; } Set < String > uniqueClasses = new ... | Get the all the unique dictionary classes that the descriptors belong to . |
28,786 | public static List < String > getDescriptorClassNameByInterface ( String interfaceName , String [ ] jarFileNames ) { if ( interfaceName == null || interfaceName . equals ( "" ) ) interfaceName = "IDescriptor" ; if ( ! interfaceName . equals ( "IDescriptor" ) && ! interfaceName . equals ( "IMolecularDescriptor" ) && ! i... | Returns a list containing the classes that implement a specific interface . |
28,787 | public static List < String > getDescriptorClassNameByPackage ( String packageName , String [ ] jarFileNames ) { if ( packageName == null || packageName . equals ( "" ) ) { packageName = "org.openscience.cdk.qsar.descriptors" ; } String [ ] jars ; if ( jarFileNames == null ) { String classPath = System . getProperty ( ... | Returns a list containing the classes found in the specified descriptor package . |
28,788 | public DescriptorValue calculate ( IAtomContainer atomContainer ) { wienerNumbers = new DoubleArrayResult ( 2 ) ; double wienerPathNumber = 0 ; double wienerPolarityNumber = 0 ; matr = ConnectionMatrix . getMatrix ( AtomContainerManipulator . removeHydrogens ( atomContainer ) ) ; int [ ] [ ] distances = PathTools . com... | Calculate the Wiener numbers . |
28,789 | public boolean setEnabled ( String label , boolean enabled ) { return enabled ? labels . contains ( label ) && disabled . remove ( label ) : labels . contains ( label ) && disabled . add ( label ) ; } | Set whether an abbreviation is enabled or disabled . |
28,790 | private int countUpper ( String str ) { if ( str == null ) return 0 ; int num = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) if ( Character . isUpperCase ( str . charAt ( i ) ) ) num ++ ; return num ; } | Count number of upper case chars . |
28,791 | private IQueryAtom matchExact ( final IAtomContainer mol , final IAtom atom ) { final IChemObjectBuilder bldr = atom . getBuilder ( ) ; int elem = atom . getAtomicNumber ( ) ; if ( elem == 0 ) return null ; int hcnt = atom . getImplicitHydrogenCount ( ) ; int val = hcnt ; int con = hcnt ; for ( IBond bond : mol . getCo... | Make a query atom that matches atomic number h count valence and connectivity . This effectively provides an exact match for that atom type . |
28,792 | public boolean add ( String line ) throws InvalidSmilesException { return add ( smipar . parseSmiles ( line ) , getSmilesSuffix ( line ) ) ; } | Convenience method to add an abbreviation from a SMILES string . |
28,793 | public int loadFromFile ( final String path ) throws IOException { InputStream in = null ; try { in = getClass ( ) . getResourceAsStream ( path ) ; if ( in != null ) return loadSmiles ( in ) ; File file = new File ( path ) ; if ( file . exists ( ) && file . canRead ( ) ) return loadSmiles ( new FileInputStream ( file )... | Load a set of abbreviations from a classpath resource or file in SMILES format . The title is seperated by a space . |
28,794 | public Color getAtomColor ( IAtom atom , Color defaultColor ) { Color color = defaultColor ; String symbol = atom . getSymbol ( ) ; if ( colorMap . containsKey ( symbol ) ) { color = colorMap . get ( symbol ) ; } return color ; } | Returns the Rasmol color for the given atom s element or defaults to the given color if no color is defined . |
28,795 | private IAtom findHydrogen ( final IAtom [ ] atoms ) { for ( final IAtom a : atoms ) { if ( Integer . valueOf ( 1 ) . equals ( a . getAtomicNumber ( ) ) ) return a ; } return null ; } | Given an array of atoms find the first hydrogen atom . |
28,796 | private IAtomContainer buildChain ( int length , boolean isMainCyclic ) { IAtomContainer currentChain ; if ( length > 0 ) { if ( isMainCyclic ) { currentChain = currentMolecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; currentChain . add ( currentMolecule . getBuilder ( ) . newInstance ( IRing . class... | Builds the main chain which may act as a foundation for futher working groups . |
28,797 | String getMetalAtomicSymbol ( String metalName ) { if ( "aluminium" . equals ( metalName ) ) { return "Al" ; } else if ( "magnesium" . equals ( metalName ) ) { return "Mg" ; } else if ( "gallium" . equals ( metalName ) ) { return "Ga" ; } else if ( "indium" . equals ( metalName ) ) { return "In" ; } else if ( "thallium... | Translates a metal s name into it s atomic symbol . |
28,798 | private void addAtom ( String newAtomType , IAtom otherConnectingAtom , Order bondOrder , int hydrogenCount ) { IAtom newAtom = currentMolecule . getBuilder ( ) . newInstance ( IAtom . class , newAtomType ) ; newAtom . setImplicitHydrogenCount ( hydrogenCount ) ; IBond newBond = currentMolecule . getBuilder ( ) . newIn... | Adds an atom to the current molecule . |
28,799 | private void addHeads ( List < AttachedGroup > attachedSubstituents ) { Iterator < AttachedGroup > substituentsIterator = attachedSubstituents . iterator ( ) ; while ( substituentsIterator . hasNext ( ) ) { AttachedGroup attachedSubstituent = substituentsIterator . next ( ) ; Iterator < Token > locationsIterator = atta... | Adds other chains to the main chain connected at the specified atom . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.