visualise progress of loop.

Somedays ago, I read a blog post about useful python library and I found cool library.
The name of library was ‘tqdm’.
The library can visualise progress bar very easily.
For example, if I want to visualise progress of loops, I could do it only call tqdm.
That’s all. ;-)
Then I could get following progress bar.
Hmm That’s cool.

In [1]: from rdkit import Chem
In [2]: from tqdm import tqdm
In [3]: sdf = Chem.SDMolSupplier( 'cdk2.sdf' )
In [4]: mols = [ mol for mol in tqdm( sdf ) ]
100%|█████████████████████████████████████████| 47/47 [00:00<00:00, 1081.43it/s]
In [8]: for mol in tqdm( mols ):
   ...:     print( Chem.MolToSmiles( mol ) )
   ...:     
  0%|                                                    | 0/47 [00:00<?, ?it/s]CC(C)C(=O)COc1nc(N)nc2[nH]cnc12
Nc1nc(OCC2CCCO2)c2nc[nH]c2n1
Nc1nc(OCC2CCC(=O)N2)c2nc[nH]c2n1
Nc1nc(OCC2CCCCC2)c2nc[nH]c2n1
~~~~~~~~~cut~~~~~~~~~~~~~~~~
O=C1Nc2ccc3ncsc3c2C1=CNc1ccc(S(=O)(=O)Nc2ccccn2)cc1
100%|█████████████████████████████████████████| 47/47 [00:00<00:00, 3283.24it/s]
Advertisement

Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: