Skip to content

Commit

Permalink
added remaining time estimate to loadSMILESFile
Browse files Browse the repository at this point in the history
(also chagned to update for every ten molecules instead of 100. Converting SMILES is not a quick thing...)
  • Loading branch information
jonalv committed Apr 27, 2012
1 parent 4327ae8 commit f19802f
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -52,6 +52,7 @@
import net.bioclipse.core.domain.RecordableList;
import net.bioclipse.core.domain.SMILESMolecule;
import net.bioclipse.core.util.LogUtils;
import net.bioclipse.core.util.TimeCalculator;
import net.bioclipse.jobs.IReturner;
import net.bioclipse.managers.business.IBioclipseManager;
import nu.xom.Element;
Expand Down Expand Up @@ -1863,6 +1864,7 @@ public List<ICDKMolecule> loadSMILESFile( InputStream contents,

//Read subsequent lines until end
int lineno=2;
long before = System.currentTimeMillis();
for (String line : lines) {

if (monitor.isCanceled())
Expand Down Expand Up @@ -1918,10 +1920,13 @@ public List<ICDKMolecule> loadSMILESFile( InputStream contents,
lineno++;

monitor.worked(1);
if (lineno%100==0){
if (lineno%10==0){
if (monitor.isCanceled())
return null;
monitor.subTask("Processed: " + lineno + "/" + noLines);
monitor.subTask("Processed: " + lineno + "/" + noLines
+ " (" +
TimeCalculator.generateTimeRemainEst(
before, lineno, noLines ) + ")" );
}
}
} catch (IOException e) {
Expand Down

0 comments on commit f19802f

Please sign in to comment.