use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.TransClust.de.layclust.taskmanaging.io.InfoFile in project clusterMaker2 by RBVI.
the class ClusteringManagerTask method run.
public void run() {
try {
TaskConfig.monitor.setStatusMessage("-----------------------------------");
TaskConfig.monitor.setStatusMessage("Running ... " + TaskConfig.NAME + " v" + TaskConfig.VERSION);
Date date = new Date(System.currentTimeMillis());
TaskConfig.monitor.setStatusMessage(date.toString());
TaskConfig.monitor.setStatusMessage("-----------------------------------");
if (TaskConfig.mode == TaskConfig.CLUSTERING_MODE) {
long time = System.currentTimeMillis();
this.clusterManager = new ClusteringManager(TaskConfig.cmPath);
try {
this.clusterManager.initParametersAndCCs();
this.clusterManager.runClustering();
// System.out.println(this.clusterManager.getConnectedComponents().size());
time = System.currentTimeMillis() - time;
TaskConfig.monitor.setStatusMessage("Time taken for complete clustering process: " + TaskUtility.convertTime(time));
} catch (InvalidInputFileException e) {
TaskConfig.monitor.showMessage(TaskMonitor.Level.ERROR, e.getMessage());
// e.printStackTrace();
System.exit(-1);
} catch (InvalidTypeException e) {
TaskConfig.monitor.showMessage(TaskMonitor.Level.ERROR, e.getMessage());
// e.printStackTrace();
System.exit(-1);
}
} else /* start general training */
if (TaskConfig.mode == TaskConfig.GENERAL_TRAINING_MODE) {
try {
long time = System.currentTimeMillis();
ClusteringManager clustermanage = new ClusteringManager(TaskConfig.cmPath);
GeneralParameterTraining generalParameterTraining = new GeneralParameterTraining(clustermanage);
IParameters[] layoutParams = generalParameterTraining.runGeneralTraining();
/* save newly found parameters to config file */
TaskConfig.saveConfigurationsToConfigFile(TaskConfig.outConfigPath);
/* print out information about training */
TaskConfig.monitor.setStatusMessage(TaskConfig.NL + "###### Best Parameter Configurations Found ######");
for (int i = 0; i < layoutParams.length; i++) {
TaskConfig.monitor.setStatusMessage(layoutParams[i].toString());
InfoFile.appendLnProjectResults(layoutParams[i].toString());
}
time = System.currentTimeMillis() - time;
TaskConfig.monitor.setStatusMessage("Time taken for complete general training: " + TaskUtility.convertTime(time));
} catch (InvalidInputFileException e) {
TaskConfig.monitor.showMessage(TaskMonitor.Level.ERROR, e.getMessage());
// e.printStackTrace();
} catch (InvalidTypeException e) {
TaskConfig.monitor.showMessage(TaskMonitor.Level.ERROR, e.getMessage());
// e.printStackTrace();
}
} else if (TaskConfig.mode == TaskConfig.COMPARISON_MODE || TaskConfig.mode == TaskConfig.HIERARICHAL_MODE) {
Thread t = new IteratorThread();
t.start();
} else /* no such mode */
{
TaskConfig.monitor.showMessage(TaskMonitor.Level.ERROR, "ERROR: This mode does not exist: " + TaskConfig.mode);
}
/* create info file */
if (TaskConfig.info) {
InfoFile info = new InfoFile();
info.instantiateFile(TaskConfig.infoPath);
info.createAndCloseInfoFile();
/* clear information from StringBuffers in InfoFile */
InfoFile.clearData();
}
// /* ====== CLEAN UP AT END ====== */
} catch (Exception e) {
TaskConfig.monitor.showMessage(TaskMonitor.Level.ERROR, "ERROR occured in run with the following message: " + e.getMessage());
// e.printStackTrace();
}
/* release permit in semaphore if necessary */
if (semaphore != null) {
semaphore.release();
}
/* reset the run button back to "RUN" and reset action command */
}
Aggregations