20package denoptim.fragspace;
23import java.io.IOException;
24import java.util.ArrayList;
25import java.util.HashMap;
26import java.util.HashSet;
30import java.util.logging.Level;
31import java.util.logging.Logger;
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);
521 }
catch (Throwable t)
559 msg =
"Cannot retrieve scaffolds before initialising the "
560 +
"scaffold library.";
567 msg =
"Cannot retrieve fragments before initialising the "
568 +
"fragment library.";
575 msg =
"Cannot retrieve capping groups before initialising"
576 +
"the library of capping groups.";
583 +
"type '" + bbType +
"' in the fragment space.");
586 Vertex originalVrtx =
null;
596 msg =
"Mismatch between scaffold bbIdx (" + bbIdx
597 +
") and size of the library (" +
scaffoldLib.size()
598 +
"). FragType: " + bbType;
611 msg =
"Mismatch between fragment bbIdx (" + bbIdx
612 +
") and size of the library (" +
fragmentLib.size()
613 +
"). FragType: " + bbType;
626 msg =
"Mismatch between capping group bbIdx " + bbIdx
627 +
") and size of the library (" +
cappingLib.size()
628 +
"). FragType: " + bbType;
635 msg =
"Attempting to take UNDEFINED type of building block from "
636 +
"fragment library.";
644 msg =
"Mismatch between fragment bbIdx (" + bbIdx
645 +
") and size of the library (" +
fragmentLib.size()
646 +
"). FragType: " + bbType;
653 msg =
"Unknown type of fragment '" + bbType +
"'.";
667 +
"the list of building blocks (" + bbIdx +
") for type "
689 if (reacFrags.size() > 0)
708 ArrayList<Integer> lstFragIdx =
new ArrayList<>();
713 if (lstRcn.contains(cmpReac))
772 ArrayList<Integer> selected =
new ArrayList<>();
871 return new ArrayList<APClass>();
949 ArrayList<Integer> lst =
new ArrayList<>();
988 ArrayList<IdFragmentAndAP> lst =
new ArrayList<IdFragmentAndAP>();
1018 ArrayList<Vertex> lst =
new ArrayList<Vertex>();
1045 List<Vertex> lst =
new ArrayList<Vertex>();
1082 Map<APClass,Integer> apcCounts)
1084 List<Vertex> matches =
new ArrayList<Vertex>();
1087 boolean isMatch =
true;
1088 for (
APClass apc : apcCounts.keySet())
1090 if (apcCounts.get(apc) >
1091 candidate.getAttachmentPoints().stream().filter(
1092 ap -> ap.getAPClass().equals(apc)).count())
1099 matches.add(candidate);
1116 List<Vertex> lst =
new ArrayList<Vertex>();
1121 if (!apc.toString().startsWith(root))
1126 if (!lst.contains(v))
1145 ArrayList<IdFragmentAndAP> srcAPs)
1148 ArrayList<IdFragmentAndAP> compatFragAps =
1152 Set<Integer> compatFragIds =
new HashSet<Integer>();
1155 compatFragIds.add(apId.getVertexMolId());
1159 ArrayList<Vertex> compatFrags =
new ArrayList<Vertex>();
1160 for (Integer fid : compatFragIds)
1166 +
"to get fragment '" + fid +
"'!");
1167 e.printStackTrace();
1185 List<Vertex> chosenRCVs =
new ArrayList<Vertex>();
1189 if (apc.
equals(rcv.getAP(0).getAPClass()))
1195 rcv.getBuildingBlockId());
1196 chosenRCVs.add(copyOfRCV);
1201 e.printStackTrace();
1220 List<Vertex> chosenRCVs =
new ArrayList<Vertex>();
1229 if (apcsCompatWithSrcAP.contains(rcv.getAP(0).getAPClass()))
1235 rcv.getBuildingBlockId());
1236 chosenRCVs.add(copyOfRCV);
1241 e.printStackTrace();
1259 ArrayList<AttachmentPoint> srcAPs)
1261 ArrayList<AttachmentPoint> compAps =
1262 new ArrayList<AttachmentPoint>();
1263 boolean first =
true;
1266 ArrayList<AttachmentPoint> compForOne =
1271 compAps.addAll(compForOne);
1276 ArrayList<AttachmentPoint> toKeep =
1277 new ArrayList<AttachmentPoint>();
1282 if (newCand == candAp)
1292 if (compAps.size()==0)
1310 ArrayList<IdFragmentAndAP> srcAPs)
1312 ArrayList<IdFragmentAndAP> compFrAps =
new ArrayList<IdFragmentAndAP>();
1313 boolean first =
true;
1317 ArrayList<IdFragmentAndAP> compForOne =
1322 compFrAps.addAll(compForOne);
1327 ArrayList<IdFragmentAndAP> toKeep =
1328 new ArrayList<IdFragmentAndAP>();
1333 if (newId.sameFragAndAp(candAp))
1343 if (compFrAps.size() == 0)
1365 ArrayList<AttachmentPoint> compatAps =
1366 new ArrayList<AttachmentPoint>();
1372 if (compatApClasses !=
null)
1374 for (
APClass klass : compatApClasses)
1381 if (ap.getAPClass() == klass)
1390 if (compatAps.size()==0)
1393 +
"AP found in the fragment space for APClass '"
1412 ArrayList<IdFragmentAndAP> compatFragAps =
1413 new ArrayList<IdFragmentAndAP>();
1419 if (compatApClasses !=
null)
1421 for (
APClass compClass : compatApClasses)
1426 return compatFragAps;
1529 ArrayList<APClass>> map)
1660 boolean addIfScaffold,
boolean addIfFragment)
1693 boolean addIfScaffold,
boolean addIfFragment,
1694 IAtomContainer wholeMol)
1696 List<DGraph> subgraphs =
null;
1703 +
"fused ring patters.");
1704 e1.printStackTrace();
1707 for (
DGraph g : subgraphs)
1709 BBType type = g.hasScaffoldTypeVertex() ?
1722 ArrayList<Vertex> library = type == BBType.FRAGMENT ?
1737 boolean has3Dgeometry =
false;
1738 IAtomContainer subIAC =
null;
1747 has3Dgeometry =
true;
1750 e1.printStackTrace();
1751 ArrayList<DGraph> lst =
new ArrayList<>();
1754 String forDebugFile =
"failedExtractIAC_"
1759 new File(forDebugFile), lst);
1761 "WARNING: failed to extract "
1762 +
"molecular representation of graph. "
1763 +
"See file '" + forDebugFile +
"'.");
1767 "WARNING: failed to extract "
1768 +
"molecular representation of graph, "
1769 +
"and failed to write graph to file.");
1774 String msg =
"Adding new template (Inner Graph id: "
1776 +
"library of " + type +
"s. The template is "
1777 +
"generated from graph " + graph.
getGraphId();
1780 msg = msg +
" candidate " + source.
getName();
1791 String destFileName = type == BBType.FRAGMENT ?
1806 e.printStackTrace();
1808 +
"failed to write newly "
1809 +
"generated " + type +
" to file '"
1810 + destFileName +
"'.");
1831 .filter(v -> v instanceof
Template)
1834 .anyMatch(graph::isIsomorphicTo);
1873 List<AttachmentPoint> listA,
1874 List<AttachmentPoint> listB,
int maxCombinations)
1876 Map<AttachmentPoint,List<AttachmentPoint>> apCompatilities =
1877 new HashMap<AttachmentPoint,List<AttachmentPoint>>();
1883 boolean compatible =
false;
1886 if (apA.getAPClass().isCPMapCompatibleWith(apB.getAPClass(),
1896 if (apCompatilities.containsKey(apA))
1898 apCompatilities.get(apA).add(apB);
1900 List<AttachmentPoint> lst =
1901 new ArrayList<AttachmentPoint>();
1903 apCompatilities.put(apA,lst);
1910 List<AttachmentPoint> keys =
1911 new ArrayList<AttachmentPoint>(
1912 apCompatilities.keySet());
1915 List<APMapping> apMappings =
new ArrayList<APMapping>();
1916 if (keys.size() > 0)
1921 apCompatilities, currentMapping, apMappings,
true,
1950 ArrayList<Integer> lst =
new ArrayList<>();
1968 for (
int j=0; j<lstAPs.size(); j++)
1971 ArrayList<Integer> apId =
new ArrayList<Integer>();
1987 ArrayList<ArrayList<Integer>> outLst =
1988 new ArrayList<ArrayList<Integer>>();
2038 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.
Logger getLogger()
Returns the logger associated with this fragment space's parameters.
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.