/** Enumerates the combinatorial library. */ private void enumerateLibrary() throws Exception { boolean linkerEmpty; int numRGroups; int ringNumber; int[] currentCombination; StringBuilder intermediateProduct = new StringBuilder(); StringBuilder currentMolecule = new StringBuilder(); StringBuilder moleculeID = new StringBuilder(); // as long as new combination are available and thread shall not be stopped while (iterator.hasNext() & !stop) { // gets next combination currentCombination = iterator.next(); // StringBuilder with the currentMolecule gets a reset - so you can use one Object for all // molecules currentMolecule .delete(0, currentMolecule.length()) .append(compAdmin.getScaffoldString(currentCombination[0])); // StringBuilder with molecule ID gets a reset moleculeID .delete(0, moleculeID.length()) .append(compAdmin.getScaffoldID(currentCombination[0])); // gets number of variable side chains in the current scaffold numRGroups = compAdmin.getNumberOfRGroups(currentCombination[0]); ringNumber = 10; // for each variable side chain for (int i = 1; i <= numRGroups; i++) { linkerEmpty = compAdmin.getLinker(currentCombination[i]).isEmpty(); // ringnumber is checked, so that conflicts with existing ringnumbers in scaffold-, linker- // or buildingblock-SMILES can not occur while (compAdmin.numberBlacklisted( ringNumber, currentCombination[0], currentCombination[i], currentCombination[i + numRGroups])) ringNumber++; // if linker is not the empty linker if (!linkerEmpty) { // StringBuilder with the current intermediate gets a reset - so you can use one Object // for all intermediates intermediateProduct .delete(0, intermediateProduct.length()) .append(compAdmin.getLinker(currentCombination[i]).getLinkerForConcat(ringNumber)); // current intermediate is created smiConcat.concatenate( intermediateProduct, '.', compAdmin .getBuildingBlock(currentCombination[i + numRGroups]) .getBlockForConcat(ringNumber)); ringNumber++; // current intermediate gets attached to the scaffold smiConcat.concatenate( currentMolecule, intermediateProduct, '.', compAdmin.getScaffold(currentCombination[0]).getStringOfGroupWithIndex(i - 1), ringNumber); ringNumber++; // if linker is the empty linker } else { // building block gets directly attached to the scaffold smiConcat.concatenate( currentMolecule, compAdmin .getBuildingBlock(currentCombination[i + numRGroups]) .getBlockForConcat(ringNumber), '.', compAdmin.getScaffold(currentCombination[0]).getStringOfGroupWithIndex(i - 1), ringNumber); ringNumber++; } // molecule ID gets an update moleculeID .append('.') .append(compAdmin.getLinkerID(currentCombination[i])) .append('_') .append(compAdmin.getBuildingBlockID(currentCombination[i + numRGroups])); } // created molecule is written smiWri.writeSMILES(currentMolecule, moleculeID); compoundCounter++; } smiWri.close(); }