20package denoptim.fragspace;
23import java.io.IOException;
24import java.util.ArrayList;
25import java.util.Collection;
26import java.util.HashMap;
27import java.util.HashSet;
31import java.util.logging.Level;
33import javax.vecmath.Point3d;
35import org.openscience.cdk.Atom;
36import org.openscience.cdk.PseudoAtom;
37import org.openscience.cdk.interfaces.IAtomContainer;
39import denoptim.constants.DENOPTIMConstants;
40import denoptim.exception.DENOPTIMException;
41import denoptim.files.UndetectedFileFormatException;
42import denoptim.graph.APClass;
43import denoptim.graph.APMapping;
44import denoptim.graph.AttachmentPoint;
45import denoptim.graph.Candidate;
46import denoptim.graph.DGraph;
47import denoptim.graph.Fragment;
48import denoptim.graph.GraphPattern;
49import denoptim.graph.Template;
50import denoptim.graph.Vertex;
51import denoptim.graph.Vertex.BBType;
52import denoptim.graph.rings.RingClosingAttractor;
53import denoptim.io.DenoptimIO;
54import denoptim.utils.GraphUtils;
55import denoptim.utils.MoleculeUtils;
56import denoptim.utils.Randomizer;
107 private ArrayList<Vertex>
rcvs =
new ArrayList<Vertex>();
130 new HashMap<Integer,ArrayList<Integer>>();
136 new HashMap<Integer,ArrayList<APClass>>();
144 new HashMap<APClass,ArrayList<ArrayList<Integer>>>();
149 private final Object
LOCK =
new Object();
206 String fragFile, String capFile, String cpmFile)
209 this(
settings, scaffFile, fragFile, capFile, cpmFile,
"",
210 new HashMap<APClass, Double>());
237 ArrayList<Vertex> scaffLib,
238 ArrayList<Vertex> fragLib,
239 ArrayList<Vertex> cappLib,
240 HashMap<
APClass, ArrayList<APClass>> cpMap,
241 HashMap<APClass, APClass> capMap,
242 HashSet<APClass> forbEnds,
243 HashMap<
APClass, ArrayList<APClass>> rcCpMap)
246 define(
settings, scaffLib, fragLib, cappLib, cpMap, capMap, forbEnds,
275 ArrayList<Vertex> scaffLib,
276 ArrayList<Vertex> fragLib,
277 ArrayList<Vertex> cappLib,
278 HashMap<
APClass, ArrayList<APClass>> cpMap,
279 HashMap<APClass, APClass> capMap,
280 HashSet<APClass> forbEnds,
281 HashMap<
APClass, ArrayList<APClass>> rcCpMap,
282 HashMap<APClass, Double> symCntrMap)
285 define(
settings, scaffLib, fragLib, cappLib, cpMap, capMap, forbEnds,
286 rcCpMap, symCntrMap);
311 String fragFile, String capFile, String cpmFile, String rcpmFile,
314 HashMap<APClass, ArrayList<APClass>> cpMap =
315 new HashMap<APClass, ArrayList<APClass>>();
316 HashMap<APClass, APClass> capMap =
new HashMap<APClass, APClass>();
317 HashSet<APClass> forbEnds =
new HashSet<APClass>();
318 if (cpmFile.length() > 0)
324 HashMap<APClass, ArrayList<APClass>> rcCpMap =
325 new HashMap<APClass, ArrayList<APClass>>();
326 if (rcpmFile !=
null && rcpmFile.length() > 0)
331 ArrayList<Vertex> cappLib =
new ArrayList<Vertex>();
332 if (capFile.length() > 0)
338 for (
int i=0; i<cappLib.size(); i++)
340 cappLib.get(i).setBuildingBlockId(i);
346 +
"groups from file '" + capFile +
"'.", e);
350 ArrayList<Vertex> fragLib =
new ArrayList<Vertex>();
351 if (fragFile !=
null && fragFile.length() > 0)
357 for (
int i=0; i<fragLib.size(); i++)
359 fragLib.get(i).setBuildingBlockId(i);
365 +
"from file '" + fragFile +
"'.", e);
369 ArrayList<Vertex> scaffLib =
new ArrayList<Vertex>();
370 if (scaffFile !=
null && scaffFile.length() > 0)
376 for (
int i=0; i<scaffLib.size(); i++)
378 scaffLib.get(i).setBuildingBlockId(i);
384 +
"from file '" + fragFile +
"'.", e);
388 define(
settings, scaffLib, fragLib, cappLib, cpMap, capMap, forbEnds,
389 rcCpMap, symCntrMap);
416 ArrayList<Vertex> scaffLib,
417 ArrayList<Vertex> fragLib,
418 ArrayList<Vertex> cappLib,
419 HashMap<
APClass, ArrayList<APClass>> cpMap,
420 HashMap<APClass, APClass> capMap,
421 HashSet<APClass> forbEnds,
422 HashMap<
APClass, ArrayList<APClass>> rcCpMap,
423 HashMap<APClass, Double> symCntrMap)
434 || (rcCpMap!=
null && rcCpMap.size()>0);
510 }
catch (Throwable t)
548 msg =
"Cannot retrieve scaffolds before initialising the "
549 +
"scaffold library.";
556 msg =
"Cannot retrieve fragments before initialising the "
557 +
"fragment library.";
564 msg =
"Cannot retrieve capping groups before initialising"
565 +
"the library of capping groups.";
572 +
"type '" + bbType +
"' in the fragment space.");
575 Vertex originalVrtx =
null;
585 msg =
"Mismatch between scaffold bbIdx (" + bbIdx
586 +
") and size of the library (" +
scaffoldLib.size()
587 +
"). FragType: " + bbType;
600 msg =
"Mismatch between fragment bbIdx (" + bbIdx
601 +
") and size of the library (" +
fragmentLib.size()
602 +
"). FragType: " + bbType;
615 msg =
"Mismatch between capping group bbIdx " + bbIdx
616 +
") and size of the library (" +
cappingLib.size()
617 +
"). FragType: " + bbType;
624 msg =
"Attempting to take UNDEFINED type of building block from "
625 +
"fragment library.";
633 msg =
"Mismatch between fragment bbIdx (" + bbIdx
634 +
") and size of the library (" +
fragmentLib.size()
635 +
"). FragType: " + bbType;
642 msg =
"Unknown type of fragment '" + bbType +
"'.";
656 +
"the list of building blocks (" + bbIdx +
") for type "
678 if (reacFrags.size() > 0)
697 ArrayList<Integer> lstFragIdx =
new ArrayList<>();
702 if (lstRcn.contains(cmpReac))
761 ArrayList<Integer> selected =
new ArrayList<>();
860 return new ArrayList<APClass>();
938 ArrayList<Integer> lst =
new ArrayList<>();
977 ArrayList<IdFragmentAndAP> lst =
new ArrayList<IdFragmentAndAP>();
1007 ArrayList<Vertex> lst =
new ArrayList<Vertex>();
1034 List<Vertex> lst =
new ArrayList<Vertex>();
1071 Map<APClass,Integer> apcCounts)
1073 List<Vertex> matches =
new ArrayList<Vertex>();
1076 boolean isMatch =
true;
1077 for (
APClass apc : apcCounts.keySet())
1079 if (apcCounts.get(apc) >
1080 candidate.getAttachmentPoints().stream().filter(
1081 ap -> ap.getAPClass().equals(apc)).count())
1088 matches.add(candidate);
1105 List<Vertex> lst =
new ArrayList<Vertex>();
1110 if (!apc.toString().startsWith(root))
1115 if (!lst.contains(v))
1134 ArrayList<IdFragmentAndAP> srcAPs)
1137 ArrayList<IdFragmentAndAP> compatFragAps =
1141 Set<Integer> compatFragIds =
new HashSet<Integer>();
1144 compatFragIds.add(apId.getVertexMolId());
1148 ArrayList<Vertex> compatFrags =
new ArrayList<Vertex>();
1149 for (Integer fid : compatFragIds)
1155 +
"to get fragment '" + fid +
"'!");
1156 e.printStackTrace();
1174 List<Vertex> chosenRCVs =
new ArrayList<Vertex>();
1178 if (apc.
equals(rcv.getAP(0).getAPClass()))
1184 rcv.getBuildingBlockId());
1185 chosenRCVs.add(copyOfRCV);
1190 e.printStackTrace();
1209 List<Vertex> chosenRCVs =
new ArrayList<Vertex>();
1218 if (apcsCompatWithSrcAP.contains(rcv.getAP(0).getAPClass()))
1224 rcv.getBuildingBlockId());
1225 chosenRCVs.add(copyOfRCV);
1230 e.printStackTrace();
1248 ArrayList<AttachmentPoint> srcAPs)
1250 ArrayList<AttachmentPoint> compAps =
1251 new ArrayList<AttachmentPoint>();
1252 boolean first =
true;
1255 ArrayList<AttachmentPoint> compForOne =
1260 compAps.addAll(compForOne);
1265 ArrayList<AttachmentPoint> toKeep =
1266 new ArrayList<AttachmentPoint>();
1271 if (newCand == candAp)
1281 if (compAps.size()==0)
1299 ArrayList<IdFragmentAndAP> srcAPs)
1301 ArrayList<IdFragmentAndAP> compFrAps =
new ArrayList<IdFragmentAndAP>();
1302 boolean first =
true;
1306 ArrayList<IdFragmentAndAP> compForOne =
1311 compFrAps.addAll(compForOne);
1316 ArrayList<IdFragmentAndAP> toKeep =
1317 new ArrayList<IdFragmentAndAP>();
1322 if (newId.sameFragAndAp(candAp))
1332 if (compFrAps.size() == 0)
1354 ArrayList<AttachmentPoint> compatAps =
1355 new ArrayList<AttachmentPoint>();
1361 if (compatApClasses !=
null)
1363 for (
APClass klass : compatApClasses)
1370 if (ap.getAPClass() == klass)
1379 if (compatAps.size()==0)
1382 +
"AP found in the fragment space for APClass '"
1401 ArrayList<IdFragmentAndAP> compatFragAps =
1402 new ArrayList<IdFragmentAndAP>();
1408 if (compatApClasses !=
null)
1410 for (
APClass compClass : compatApClasses)
1415 return compatFragAps;
1518 ArrayList<APClass>> map)
1649 boolean addIfScaffold,
boolean addIfFragment)
1682 boolean addIfScaffold,
boolean addIfFragment,
1683 IAtomContainer wholeMol)
1685 List<DGraph> subgraphs =
null;
1692 +
"fused ring patters.");
1693 e1.printStackTrace();
1696 for (
DGraph g : subgraphs)
1698 BBType type = g.hasScaffoldTypeVertex() ?
1711 ArrayList<Vertex> library = type == BBType.FRAGMENT ?
1726 boolean has3Dgeometry =
false;
1727 IAtomContainer subIAC =
null;
1736 has3Dgeometry =
true;
1739 e1.printStackTrace();
1740 ArrayList<DGraph> lst =
new ArrayList<>();
1743 String forDebugFile =
"failedExtractIAC_"
1748 new File(forDebugFile), lst);
1750 "WARNING: failed to extract "
1751 +
"molecular representation of graph. "
1752 +
"See file '" + forDebugFile +
"'.");
1756 "WARNING: failed to extract "
1757 +
"molecular representation of graph, "
1758 +
"and failed to write graph to file.");
1763 String msg =
"Adding new template (Inner Graph id: "
1765 +
"library of " + type +
"s. The template is "
1766 +
"generated from graph " + graph.
getGraphId();
1769 msg = msg +
" candidate " + source.
getName();
1780 String destFileName = type == BBType.FRAGMENT ?
1795 e.printStackTrace();
1797 +
"failed to write newly "
1798 +
"generated " + type +
" to file '"
1799 + destFileName +
"'.");
1820 .filter(v -> v instanceof
Template)
1823 .anyMatch(graph::isIsomorphicTo);
1862 List<AttachmentPoint> listA,
1863 List<AttachmentPoint> listB,
int maxCombinations)
1865 Map<AttachmentPoint,List<AttachmentPoint>> apCompatilities =
1866 new HashMap<AttachmentPoint,List<AttachmentPoint>>();
1872 boolean compatible =
false;
1875 if (apA.getAPClass().isCPMapCompatibleWith(apB.getAPClass(),
1885 if (apCompatilities.containsKey(apA))
1887 apCompatilities.get(apA).add(apB);
1889 List<AttachmentPoint> lst =
1890 new ArrayList<AttachmentPoint>();
1892 apCompatilities.put(apA,lst);
1899 List<AttachmentPoint> keys =
1900 new ArrayList<AttachmentPoint>(
1901 apCompatilities.keySet());
1904 List<APMapping> apMappings =
new ArrayList<APMapping>();
1905 if (keys.size() > 0)
1910 apCompatilities, currentMapping, apMappings,
true,
1939 ArrayList<Integer> lst =
new ArrayList<>();
1957 for (
int j=0; j<lstAPs.size(); j++)
1960 ArrayList<Integer> apId =
new ArrayList<Integer>();
1976 ArrayList<ArrayList<Integer>> outLst =
1977 new ArrayList<ArrayList<Integer>>();
2027 rcv.
addAP(0,
new Point3d(1.5, 0.0, 0.0), apc);
General set of constants used in DENOPTIM.
static final double FLOATCOMPARISONTOLERANCE
Smallest difference for comparison of double and float numbers.
Class defining a space of building blocks.
HashMap< APClass, ArrayList< APClass > > getCompatibilityMatrix()
ArrayList< Vertex > getFragmentsCompatibleWithTheseAPs(ArrayList< IdFragmentAndAP > srcAPs)
Searches for all building blocks that are compatible with the given list of APs.
boolean hasSymmetryConstrain(APClass apClass)
Checks if there is a constraint on the constitutional symmetry probability for the given AP class.
ArrayList< APClass > getAPClassesPerFragment(int fragId)
Returns the APclasses associated with a given fragment.
List< APMapping > mapAPClassCompatibilities(List< AttachmentPoint > listA, List< AttachmentPoint > listB, int maxCombinations)
Given two lists of APs this method maps the APClass-compatibilities from between the two lists consid...
void addFusedRingsToFragmentLibrary(DGraph graph, boolean addIfScaffold, boolean addIfFragment)
Extracts a system of one or more fused rings and adds them to the fragment space if not already prese...
void classifyFragment(Vertex frg, int fragId)
Classify a fragment in terms of the number of APs and possibly their type (AP-Class).
void registerRCV(Vertex v)
Adds the reference to a ring-closing vertex (RCV) to the quick-access list of RCVs known in this buil...
HashMap< APClass, APClass > cappingMap
Data structure that stores the AP-classes to be used to cap unused APS on the growing molecule.
boolean apClassBasedApproch
Flag defining use of AP class-based approach.
double getSymmetryConstrain(APClass apClass)
Return the constitutional symmetry constrain for the given APclass, or null.
FragmentSpace(FragmentSpaceParameters settings, ArrayList< Vertex > scaffLib, ArrayList< Vertex > fragLib, ArrayList< Vertex > cappLib, HashMap< APClass, ArrayList< APClass > > cpMap, HashMap< APClass, APClass > capMap, HashSet< APClass > forbEnds, HashMap< APClass, ArrayList< APClass > > rcCpMap, HashMap< APClass, Double > symCntrMap)
Define all components of a fragment space that implements the attachment point class-approach.
void setScaffoldLibrary(ArrayList< Vertex > lib)
void appendVertexToLibrary(Vertex v, Vertex.BBType bbt, ArrayList< Vertex > library)
Takes a vertex and add it to a given library.
ArrayList< IdFragmentAndAP > getFragAPsCompatibleWithTheseAPs(ArrayList< IdFragmentAndAP > srcAPs)
Searches for all APs that are compatible with the given list of APs.
void setCompatibilityMatrix(HashMap< APClass, ArrayList< APClass > > map)
FragmentSpaceParameters settings
Settings used to configure this fragment space.
void addFusedRingsToFragmentLibrary(DGraph graph, boolean addIfScaffold, boolean addIfFragment, IAtomContainer wholeMol)
Extracts a system of one or more fused rings and adds them to the fragment space if not already prese...
HashMap< APClass, ArrayList< APClass > > rcCompatMap
Data structure that stores compatible APclasses for joining APs in ring-closing bonds.
boolean isValid
Flag signaling that this fragment space was built and validated.
HashMap< Integer, ArrayList< Integer > > getMapOfFragsPerNumAps()
Randomizer getRandomizer()
Returns the program-specific randomizer that is associated with this program-specific fragment space.
void importRCCompatibilityMatrixFromFile(String inFile)
Load info for ring closures compatibilities from a compatibility matrix file.
ArrayList< AttachmentPoint > getAPsCompatibleWithClass(APClass aPC1)
Returns the list of attachment points found in the fragment space and that are compatible with a give...
FragmentSpace(FragmentSpaceParameters settings, String scaffFile, String fragFile, String capFile, String cpmFile, String rcpmFile, HashMap< APClass, Double > symCntrMap)
Define all components of a fragment space that implements the attachment point class-approach.
APClass getAPClassForFragment(IdFragmentAndAP apId)
Search for a specific AP on a specific fragment and finds out its class.
void define(FragmentSpaceParameters settings, ArrayList< Vertex > scaffLib, ArrayList< Vertex > fragLib, ArrayList< Vertex > cappLib, HashMap< APClass, ArrayList< APClass > > cpMap, HashMap< APClass, APClass > capMap, HashSet< APClass > forbEnds, HashMap< APClass, ArrayList< APClass > > rcCpMap, HashMap< APClass, Double > symCntrMap)
Define all components of this fragment space.
boolean useAPclassBasedApproach()
Check usage of APClass-based approach, i.e., uses attachment points with annotated data (i....
boolean isDefined()
Checks for valid definition of this fragment space.
Vertex getVertexFromLibrary(Vertex.BBType bbType, int bbIdx)
Returns a clone of the requested building block.
void importCompatibilityMatrixFromFile(String inFile)
Load info from a compatibility matrix file.
ArrayList< Vertex > cappingLib
Data structure containing the molecular representation of building blocks: capping group section - fr...
void setAPclassBasedApproach(boolean useAPC)
Set the fragment space to behave according to APClass-based approach.
ArrayList< IdFragmentAndAP > getFragsWithAPClass(APClass apc)
Returns the list of attachment points with the given class.
ArrayList< Integer > getCappingGroupsWithAPClass(APClass capApCls)
ArrayList< AttachmentPoint > getAPsCompatibleWithThese(ArrayList< AttachmentPoint > srcAPs)
Searches for all attachment points that are compatible with the given list of attachment points.
final Object LOCK
Lock for synchronizing tasks.
void groupAndClassifyFragments(boolean apClassBasedApproch)
Performs grouping and classification operations on the library of building blocks of BBType#FRAGMENT.
Set< APClass > getForbiddenEndList()
void appendVerticesToLibrary(ArrayList< Vertex > list, Vertex.BBType bbt, ArrayList< Vertex > library)
Takes a list of vertices and add them to a given library.
void clearAll()
Clears all settings of this fragment space.
HashMap< APClass, ArrayList< ArrayList< Integer > > > fragsApsPerApClass
Clusters of fragments'AP based on AP classes.
void setForbiddenEndList(Set< APClass > lst)
void setFragmentLibrary(ArrayList< Vertex > lib)
APClass getAPClassOfCappingVertex(APClass srcApClass)
List< Vertex > getVerticesWithAPClassStartingWith(String root)
Extracts vertexes from the collection of vertexes defined by this FragmentSpace.
ArrayList< Vertex > scaffoldLib
Data structure containing the molecular representation of building blocks: scaffolds section - fragme...
HashMap< APClass, ArrayList< APClass > > getRCCompatibilityMatrix()
Returns the compatibility matrix for ring closing fragment-fragment connections or null if not provid...
HashMap< APClass, ArrayList< APClass > > apClassCompatibilityMatrix
Data structure that stored the true entries of the attachment point classes compatibility matrix.
HashMap< Integer, ArrayList< APClass > > apClassesPerFrag
List of APClasses per each fragment.
HashMap< APClass, Double > symmConstraints
APclass-specific constraints to constitutional symmetry.
static Vertex getPolarizedRCV(boolean polarity)
Returns a newly-built vertex that can play the role of a ring-closing vertex even when working with 3...
ArrayList< Integer > getCompatibleCappingFragments(APClass cmpReac)
Retrieve a list of compatible capping groups.
void setCappingMap(HashMap< APClass, APClass > map)
Vertex makeRandomScaffold()
Randomly select a scaffold and return a fully configured clone of it.
ArrayList< Vertex > getRCVs()
Returns the list of registered ring-closing vertexes (RCVs).
boolean imposeSymmetryOnAPsOfClass(APClass apClass)
Checks if the symmetry settings impose use of symmetry on attachment points of the given AP class.
List< Vertex > getRCVsWithAPClass(APClass apc)
Searches for all building blocks that are ring-closing vertexes and hold an AP with the given class.
Set< APClass > getAllAPClassesFromCPMap()
Return the set of APClasses that used in the compatibility matrix for the growing graph APs.
boolean hasIsomorph(DGraph graph, BBType type)
Checks if a graph is isomorphic to another template's inner graph in its appropriate fragment space l...
Set< APClass > forbiddenEndList
Data structure that stores AP classes that cannot be held unused.
FragmentSpace(FragmentSpaceParameters settings, String scaffFile, String fragFile, String capFile, String cpmFile)
Define all components of a fragment space that implements the attachment point class-approach.
ArrayList< IdFragmentAndAP > getFragAPsCompatibleWithClass(APClass aPC1)
Returns the list of attachment points found in the fragment space and that are compatible with a give...
Vertex getCappingVertexWithAPClass(APClass capApCls)
void setCappingLibrary(ArrayList< Vertex > lib)
HashMap< Integer, ArrayList< Integer > > fragPoolPerNumAP
Clusters of fragments based on the number of APs.
ArrayList< Vertex > getCappingLibrary()
ArrayList< Vertex > rcvs
Store references to the Ring-Closing Vertexes found in the library of fragments.
ArrayList< Vertex > fragmentLib
Data structure containing the molecular representation of building blocks: fragment section - fragmen...
FragmentSpace(FragmentSpaceParameters settings, ArrayList< Vertex > scaffLib, ArrayList< Vertex > fragLib, ArrayList< Vertex > cappLib, HashMap< APClass, ArrayList< APClass > > cpMap, HashMap< APClass, APClass > capMap, HashSet< APClass > forbEnds, HashMap< APClass, ArrayList< APClass > > rcCpMap)
Define all components of a fragment space that implements the attachment point class-approach.
void addFusedRingsToFragmentLibrary(DGraph graph)
Extracts a system of one or more fused rings and adds them to the fragment space if not already prese...
ArrayList< Vertex > getVerticesWithAPClass(APClass apc)
Returns the list of vertexes with attachment points of the given class.
List< Vertex > getVerticesWithAPClasses(Set< APClass > apcs)
Returns the list of vertexes with at least one attachment point of each of the given classes.
HashMap< APClass, APClass > getCappingMap()
ArrayList< APClass > getCompatibleAPClasses(APClass apc)
Returns a list of APClasses compatible with the given APClass.
void setSymmConstraints(HashMap< APClass, Double > map)
ArrayList< Vertex > getScaffoldLibrary()
FragmentSpace()
Creates an empty fragment space, which is marked as invalid.
ArrayList< Integer > getFragsWithNumAps(int nAps)
Returns the list of fragments with given number of APs.
void setRCCompatibilityMatrix(HashMap< APClass, ArrayList< APClass > > map)
ArrayList< Vertex > getFragmentLibrary()
List< Vertex > getRCVsForAPClass(APClass apc)
Searches for all building blocks that are ring-closing vertexes and are compatible with the given AP.
int getCappingFragment(APClass rcnCap)
Select a compatible capping group for the given APClass.
List< Vertex > getVerticesWithAPFingerprint(Map< APClass, Integer > apcCounts)
Returns the list of vertexes that have the specified number of AttachmentPoints with the given APClas...
Parameters defining the fragment space.
boolean enforceSymmetry
Flag enforcing constitutional symmetry.
String getPathnameToAppendedFragments()
String getPathnameToAppendedScaffolds()
void setFragmentSpace(FragmentSpace fragmentSpace)
Sets the fragment space linked to these parameters.
Utility class for the fragment space.
static boolean recursiveCombiner(List< AttachmentPoint > keys, int currentKey, Map< AttachmentPoint, List< AttachmentPoint > > possibilities, APMapping combination, List< APMapping > completeCombinations, boolean screenAll, int maxCombs)
Search for all possible combinations of compatible APs.
Data structure containing information that identifies a single AP of a vertex/fragment.
BBType getVertexMolType()
static final APClass RCACLASSPLUS
Conventional class of attachment points on ring-closing vertexes.
static final APClass RCACLASSMINUS
Conventional class of attachment points on ring-closing vertexes.
Class representing a mapping between attachment points (APs).
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
APClass getAPClass()
Returns the Attachment Point class.
boolean isAvailable()
Check availability of this attachment point.
A candidate is the combination of a denoptim graph with molecular representation and may include also...
Container for the list of vertices and the edges that connect them.
List< DGraph > extractPattern(GraphPattern pattern)
Extracts subgraphs that match the provided pattern.
Candidate getCandidateOwner()
Returns the reference of the candidate item that is defined by this graph.
Class representing a continuously connected portion of chemical object holding attachment points.
void addAP(int atomPositionNumber)
Adds an attachment point with a dummy APClass.
void setInnerGraph(DGraph innerGraph)
void setIAtomContainer(IAtomContainer mol, boolean updateAPsAccordingToIAC)
Attaches a molecular representation to this template.
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
abstract Vertex clone()
Returns a deep-copy of this vertex.
int getBuildingBlockId()
Returns the index of the building block that should correspond to the position of the building block ...
ArrayList< APClass > getAllAPClasses()
Returns the list of all APClasses present on this vertex.
void setVertexId(long vertexId2)
void setAsRCV(boolean isRCV)
abstract List< AttachmentPoint > getAttachmentPoints()
void setBuildingBlockId(int buildingBlockId)
void setBuildingBlockType(Vertex.BBType buildingBlockType)
static Vertex newVertexFromLibrary(int bbId, Vertex.BBType bbt, FragmentSpace fragSpace)
Builds a new molecular fragment kind of vertex.
The RingClosingAttractor represent the available valence/connection that allows to close a ring.
static final HashMap< APClass, String > RCALABELPERAPCLASS
Conventional labels for attractor pseudoatom.
Utility methods for input/output.
static void readRCCompatibilityMatrix(String fileName, HashMap< APClass, ArrayList< APClass > > rcCompatMap)
Reads the APclass compatibility matrix for ring-closing connections (the RC-CPMap).
static void writeSDFFile(String fileName, IAtomContainer mol)
Writes IAtomContainer to SDF file.
static void writeGraphToSDF(File file, DGraph graph, boolean append, boolean make3D, Logger logger, Randomizer randomizer)
Writes the graph to SDF file.
static void readCompatibilityMatrix(String fileName, HashMap< APClass, ArrayList< APClass > > compatMap, HashMap< APClass, APClass > cappingMap, Set< APClass > forbiddenEndList)
Read the APclass compatibility matrix data from file.
static ArrayList< Vertex > readVertexes(File file, Vertex.BBType bbt)
Reads Vertexes from any file that can contain such items.
static void writeGraphsToJSON(File file, List< DGraph > graphs)
Writes the graphs to JSON file.
Logger getLogger()
Get the name of the program specific logger.
Randomizer getRandomizer()
Returns the current program-specific randomizer.
static synchronized long getUniqueVertexIndex()
Unique counter for the number of graph vertices generated.
Utilities for molecule conversion.
static IAtomContainer extractIACForSubgraph(IAtomContainer wholeIAC, DGraph subGraph, DGraph wholeGraph, Logger logger, Randomizer randomizer)
Selects only the atoms that originate from a subgraph of a whole graph that originated the whole mole...
Tool to generate random numbers and random decisions.
public< T > T randomlyChooseOne(Collection< T > c)
Chooses one member among the given collection.
int nextInt(int i)
Returns a pseudo-random, uniformly distributed int value between 0 (inclusive) and the specified valu...
The type of building block.