20package denoptim.fragspace;
23import java.io.IOException;
24import java.util.ArrayList;
25import java.util.HashMap;
26import java.util.HashSet;
30import java.util.logging.Level;
32import javax.vecmath.Point3d;
34import org.openscience.cdk.Atom;
35import org.openscience.cdk.PseudoAtom;
36import org.openscience.cdk.interfaces.IAtomContainer;
38import denoptim.constants.DENOPTIMConstants;
39import denoptim.exception.DENOPTIMException;
40import denoptim.files.UndetectedFileFormatException;
41import denoptim.graph.APClass;
42import denoptim.graph.APMapping;
43import denoptim.graph.AttachmentPoint;
44import denoptim.graph.Candidate;
45import denoptim.graph.DGraph;
46import denoptim.graph.Fragment;
47import denoptim.graph.GraphPattern;
48import denoptim.graph.Template;
49import denoptim.graph.Vertex;
50import denoptim.graph.Vertex.BBType;
51import denoptim.graph.rings.RingClosingAttractor;
52import denoptim.io.DenoptimIO;
53import denoptim.utils.GraphUtils;
54import denoptim.utils.MoleculeUtils;
55import denoptim.utils.Randomizer;
106 private ArrayList<Vertex>
rcvs =
new ArrayList<Vertex>();
129 new HashMap<Integer,ArrayList<Integer>>();
135 new HashMap<Integer,ArrayList<APClass>>();
143 new HashMap<APClass,ArrayList<ArrayList<Integer>>>();
148 private final Object
LOCK =
new Object();
205 String fragFile, String capFile, String cpmFile)
208 this(
settings, scaffFile, fragFile, capFile, cpmFile,
"",
209 new HashMap<APClass, Double>());
236 ArrayList<Vertex> scaffLib,
237 ArrayList<Vertex> fragLib,
238 ArrayList<Vertex> cappLib,
239 HashMap<
APClass, ArrayList<APClass>> cpMap,
240 HashMap<APClass, APClass> capMap,
241 HashSet<APClass> forbEnds,
242 HashMap<
APClass, ArrayList<APClass>> rcCpMap)
245 define(
settings, scaffLib, fragLib, cappLib, cpMap, capMap, forbEnds,
274 ArrayList<Vertex> scaffLib,
275 ArrayList<Vertex> fragLib,
276 ArrayList<Vertex> cappLib,
277 HashMap<
APClass, ArrayList<APClass>> cpMap,
278 HashMap<APClass, APClass> capMap,
279 HashSet<APClass> forbEnds,
280 HashMap<
APClass, ArrayList<APClass>> rcCpMap,
281 HashMap<APClass, Double> symCntrMap)
284 define(
settings, scaffLib, fragLib, cappLib, cpMap, capMap, forbEnds,
285 rcCpMap, symCntrMap);
310 String fragFile, String capFile, String cpmFile, String rcpmFile,
313 HashMap<APClass, ArrayList<APClass>> cpMap =
314 new HashMap<APClass, ArrayList<APClass>>();
315 HashMap<APClass, APClass> capMap =
new HashMap<APClass, APClass>();
316 HashSet<APClass> forbEnds =
new HashSet<APClass>();
317 if (cpmFile.length() > 0)
323 HashMap<APClass, ArrayList<APClass>> rcCpMap =
324 new HashMap<APClass, ArrayList<APClass>>();
325 if (rcpmFile !=
null && rcpmFile.length() > 0)
330 ArrayList<Vertex> cappLib =
new ArrayList<Vertex>();
331 if (capFile.length() > 0)
337 for (
int i=0; i<cappLib.size(); i++)
339 cappLib.get(i).setBuildingBlockId(i);
345 +
"groups from file '" + capFile +
"'.", e);
349 ArrayList<Vertex> fragLib =
new ArrayList<Vertex>();
350 if (fragFile !=
null && fragFile.length() > 0)
356 for (
int i=0; i<fragLib.size(); i++)
358 fragLib.get(i).setBuildingBlockId(i);
364 +
"from file '" + fragFile +
"'.", e);
368 ArrayList<Vertex> scaffLib =
new ArrayList<Vertex>();
369 if (scaffFile !=
null && scaffFile.length() > 0)
375 for (
int i=0; i<scaffLib.size(); i++)
377 scaffLib.get(i).setBuildingBlockId(i);
383 +
"from file '" + fragFile +
"'.", e);
387 define(
settings, scaffLib, fragLib, cappLib, cpMap, capMap, forbEnds,
388 rcCpMap, symCntrMap);
415 ArrayList<Vertex> scaffLib,
416 ArrayList<Vertex> fragLib,
417 ArrayList<Vertex> cappLib,
418 HashMap<
APClass, ArrayList<APClass>> cpMap,
419 HashMap<APClass, APClass> capMap,
420 HashSet<APClass> forbEnds,
421 HashMap<
APClass, ArrayList<APClass>> rcCpMap,
422 HashMap<APClass, Double> symCntrMap)
433 || (rcCpMap!=
null && rcCpMap.size()>0);
509 }
catch (Throwable t)
547 msg =
"Cannot retrieve scaffolds before initialising the "
548 +
"scaffold library.";
555 msg =
"Cannot retrieve fragments before initialising the "
556 +
"fragment library.";
563 msg =
"Cannot retrieve capping groups before initialising"
564 +
"the library of capping groups.";
571 +
"type '" + bbType +
"' in the fragment space.");
574 Vertex originalVrtx =
null;
584 msg =
"Mismatch between scaffold bbIdx (" + bbIdx
585 +
") and size of the library (" +
scaffoldLib.size()
586 +
"). FragType: " + bbType;
599 msg =
"Mismatch between fragment bbIdx (" + bbIdx
600 +
") and size of the library (" +
fragmentLib.size()
601 +
"). FragType: " + bbType;
614 msg =
"Mismatch between capping group bbIdx " + bbIdx
615 +
") and size of the library (" +
cappingLib.size()
616 +
"). FragType: " + bbType;
623 msg =
"Attempting to take UNDEFINED type of building block from "
624 +
"fragment library.";
632 msg =
"Mismatch between fragment bbIdx (" + bbIdx
633 +
") and size of the library (" +
fragmentLib.size()
634 +
"). FragType: " + bbType;
641 msg =
"Unknown type of fragment '" + bbType +
"'.";
655 +
"the list of building blocks (" + bbIdx +
") for type "
677 if (reacFrags.size() > 0)
696 ArrayList<Integer> lstFragIdx =
new ArrayList<>();
701 if (lstRcn.contains(cmpReac))
760 ArrayList<Integer> selected =
new ArrayList<>();
859 return new ArrayList<APClass>();
937 ArrayList<Integer> lst =
new ArrayList<>();
976 ArrayList<IdFragmentAndAP> lst =
new ArrayList<IdFragmentAndAP>();
1006 ArrayList<Vertex> lst =
new ArrayList<Vertex>();
1033 List<Vertex> lst =
new ArrayList<Vertex>();
1070 Map<APClass,Integer> apcCounts)
1072 List<Vertex> matches =
new ArrayList<Vertex>();
1075 boolean isMatch =
true;
1076 for (
APClass apc : apcCounts.keySet())
1078 if (apcCounts.get(apc) >
1079 candidate.getAttachmentPoints().stream().filter(
1080 ap -> ap.getAPClass().equals(apc)).count())
1087 matches.add(candidate);
1104 List<Vertex> lst =
new ArrayList<Vertex>();
1109 if (!apc.toString().startsWith(root))
1114 if (!lst.contains(v))
1133 ArrayList<IdFragmentAndAP> srcAPs)
1136 ArrayList<IdFragmentAndAP> compatFragAps =
1140 Set<Integer> compatFragIds =
new HashSet<Integer>();
1143 compatFragIds.add(apId.getVertexMolId());
1147 ArrayList<Vertex> compatFrags =
new ArrayList<Vertex>();
1148 for (Integer fid : compatFragIds)
1154 +
"to get fragment '" + fid +
"'!");
1155 e.printStackTrace();
1173 List<Vertex> chosenRCVs =
new ArrayList<Vertex>();
1177 if (apc.
equals(rcv.getAP(0).getAPClass()))
1183 rcv.getBuildingBlockId());
1184 chosenRCVs.add(copyOfRCV);
1189 e.printStackTrace();
1208 List<Vertex> chosenRCVs =
new ArrayList<Vertex>();
1217 if (apcsCompatWithSrcAP.contains(rcv.getAP(0).getAPClass()))
1223 rcv.getBuildingBlockId());
1224 chosenRCVs.add(copyOfRCV);
1229 e.printStackTrace();
1247 ArrayList<AttachmentPoint> srcAPs)
1249 ArrayList<AttachmentPoint> compAps =
1250 new ArrayList<AttachmentPoint>();
1251 boolean first =
true;
1254 ArrayList<AttachmentPoint> compForOne =
1259 compAps.addAll(compForOne);
1264 ArrayList<AttachmentPoint> toKeep =
1265 new ArrayList<AttachmentPoint>();
1270 if (newCand == candAp)
1280 if (compAps.size()==0)
1298 ArrayList<IdFragmentAndAP> srcAPs)
1300 ArrayList<IdFragmentAndAP> compFrAps =
new ArrayList<IdFragmentAndAP>();
1301 boolean first =
true;
1305 ArrayList<IdFragmentAndAP> compForOne =
1310 compFrAps.addAll(compForOne);
1315 ArrayList<IdFragmentAndAP> toKeep =
1316 new ArrayList<IdFragmentAndAP>();
1321 if (newId.sameFragAndAp(candAp))
1331 if (compFrAps.size() == 0)
1353 ArrayList<AttachmentPoint> compatAps =
1354 new ArrayList<AttachmentPoint>();
1360 if (compatApClasses !=
null)
1362 for (
APClass klass : compatApClasses)
1369 if (ap.getAPClass() == klass)
1378 if (compatAps.size()==0)
1381 +
"AP found in the fragment space for APClass '"
1400 ArrayList<IdFragmentAndAP> compatFragAps =
1401 new ArrayList<IdFragmentAndAP>();
1407 if (compatApClasses !=
null)
1409 for (
APClass compClass : compatApClasses)
1414 return compatFragAps;
1517 ArrayList<APClass>> map)
1648 boolean addIfScaffold,
boolean addIfFragment)
1681 boolean addIfScaffold,
boolean addIfFragment,
1682 IAtomContainer wholeMol)
1684 List<DGraph> subgraphs =
null;
1691 +
"fused ring patters.");
1692 e1.printStackTrace();
1695 for (
DGraph g : subgraphs)
1697 BBType type = g.hasScaffoldTypeVertex() ?
1710 ArrayList<Vertex> library = type == BBType.FRAGMENT ?
1725 boolean has3Dgeometry =
false;
1726 IAtomContainer subIAC =
null;
1735 has3Dgeometry =
true;
1738 e1.printStackTrace();
1739 ArrayList<DGraph> lst =
new ArrayList<>();
1742 String forDebugFile =
"failedExtractIAC_"
1747 new File(forDebugFile), lst);
1749 "WARNING: failed to extract "
1750 +
"molecular representation of graph. "
1751 +
"See file '" + forDebugFile +
"'.");
1755 "WARNING: failed to extract "
1756 +
"molecular representation of graph, "
1757 +
"and failed to write graph to file.");
1762 String msg =
"Adding new template (Inner Graph id: "
1764 +
"library of " + type +
"s. The template is "
1765 +
"generated from graph " + graph.
getGraphId();
1768 msg = msg +
" candidate " + source.
getName();
1779 String destFileName = type == BBType.FRAGMENT ?
1794 e.printStackTrace();
1796 +
"failed to write newly "
1797 +
"generated " + type +
" to file '"
1798 + destFileName +
"'.");
1819 .filter(v -> v instanceof
Template)
1822 .anyMatch(graph::isIsomorphicTo);
1861 List<AttachmentPoint> listA,
1862 List<AttachmentPoint> listB,
int maxCombinations)
1864 Map<AttachmentPoint,List<AttachmentPoint>> apCompatilities =
1865 new HashMap<AttachmentPoint,List<AttachmentPoint>>();
1871 boolean compatible =
false;
1874 if (apA.getAPClass().isCPMapCompatibleWith(apB.getAPClass(),
1884 if (apCompatilities.containsKey(apA))
1886 apCompatilities.get(apA).add(apB);
1888 List<AttachmentPoint> lst =
1889 new ArrayList<AttachmentPoint>();
1891 apCompatilities.put(apA,lst);
1898 List<AttachmentPoint> keys =
1899 new ArrayList<AttachmentPoint>(
1900 apCompatilities.keySet());
1903 List<APMapping> apMappings =
new ArrayList<APMapping>();
1904 if (keys.size() > 0)
1909 apCompatilities, currentMapping, apMappings,
true,
1938 ArrayList<Integer> lst =
new ArrayList<>();
1956 for (
int j=0; j<lstAPs.size(); j++)
1959 ArrayList<Integer> apId =
new ArrayList<Integer>();
1975 ArrayList<ArrayList<Integer>> outLst =
1976 new ArrayList<ArrayList<Integer>>();
2026 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.