piątek, 28 września 2012

Open Babel with progress bar

I've tried to evaluate progress of Open Babel conversion from sdf (or mol/mol2 etc) to smi. First I've used bar for this, worked fine, but slightly different that I've expected:
obabel in.sdf -osmi | bar -of out.smi
Output was:
44.9KB at   11.2KB/s  elapsed:   0:00:04
only cnversion rate and time elapsed... Then I found a pv program, which can be configured to show the regular progress bar with some additional information (ETA, conversion rate etc):
obabel in.sdf -osmi | pv -lperat -s `count_mol.sh in.sdf` > out.smi
(this script uses count_mol.sh script I've mentioned in one of my previous posts.) The output from this command looks similar to:
0:00:01 [ 267/s] [ 267/s] [====>                   ]  9% ETA 0:00:09
and it does everything I need (ie progress and ETA).