$darkmode
DENOPTIM
ParallelConformerExtractionAlgorithm.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Marco Foscato <marco.foscato@uib.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.fragmenter;
20
21import java.io.File;
22import java.io.IOException;
23import java.util.ArrayList;
24import java.util.List;
25
26import denoptim.graph.Vertex;
27import denoptim.graph.Vertex.BBType;
28import denoptim.io.DenoptimIO;
29import denoptim.programs.fragmenter.FragmenterParameters;
30import denoptim.task.ParallelAsynchronousTaskExecutor;
31
32
41{
42
47
48
49//-----------------------------------------------------------------------------
50
56 {
58 this.settings = settings;
59 }
60
61//------------------------------------------------------------------------------
62
63 protected boolean doPreFlightOperations()
64 {
65 return true;
66 }
67
68//------------------------------------------------------------------------------
69
70 protected void createAndSubmitTasks()
71 {
72 // Looping over the current champions. These are just the first fragment
73 // found for each isomorphic family's sample.
74 for (File mwSlotFile : ParallelFragmentationAlgorithm
75 .getFilesCollectingIsomorphicFamilyChampions(new File(
77 {
78 List<Vertex> oldChampions;
79 try
80 {
81 oldChampions = DenoptimIO.readVertexes(mwSlotFile,
83 } catch (Throwable e)
84 {
85 throw new Error("Unable to extract representative "
86 + "conformations. Problems opening file '"
87 + mwSlotFile + "'.", e);
88 }
89 for (Vertex oldChampion : oldChampions)
90 {
92 try
93 {
94 task = new ConformerExtractorTask(oldChampion, settings);
95 } catch (SecurityException | IOException e)
96 {
97 throw new Error("Unable to start fragmentation thread.",e);
98 }
99 submitTask(task, task.getLogFilePathname());
100 }
101 }
102 }
103
104//------------------------------------------------------------------------------
105
106 protected boolean doPostFlightOperations()
107 {
108 return true;
109 }
110
111//------------------------------------------------------------------------------
112
113
120 public List<String> getResults()
121 {
122 List<String> pathnames = new ArrayList<String>();
123 results.stream().forEach(o -> pathnames.add((String) o));
124 return pathnames;
125 }
126
127//------------------------------------------------------------------------------
128
129}
Task that analyzes an isomorphic family of fragments to identify the most representative fragment (i....
Runs threads that extract the most representative conformer of fragments given as input.
FragmenterParameters settings
All settings controlling the tasks executed by this class.
List< String > getResults()
Returns the list of pathnames collecting the most representative conformers, as defined by the settin...
void createAndSubmitTasks()
Implementations of this method must call the submitTask(Task, String) method to actually send the tas...
Fragments a list of chemical systems by running parallel fragmentation tasks.
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
Definition: Vertex.java:61
Utility methods for input/output.
static ArrayList< Vertex > readVertexes(File file, Vertex.BBType bbt)
Reads Vertexes from any file that can contain such items.
String getWorkDirectory()
Gets the pathname to the working directory.
Logger getLogger()
Get the name of the program specific logger.
Parameters controlling execution of the fragmenter.
final List< Object > results
List of object returned by completed tasks.
The type of building block.
Definition: Vertex.java:86