rd_filters icon indicating copy to clipboard operation
rd_filters copied to clipboard

inelegant exit for smiles file with no names

Open MikeBowerReverie opened this issue 5 years ago • 3 comments

using a *.smi file which contains smiles strings but no names causes an inelegant error.

benzene.smi = c1ccccc1

rd_filters filter --in benzene.smi --prefix foo using 8 cores Using alerts from Inpharmatica Wrote SMILES for molecules passing filters to foo.smi Wrote detailed data to foo.csv Traceback (most recent call last): File "/Users/mikebower/anaconda3/envs/reverie_env/bin/rd_filters", line 8, in sys.exit(main()) File "/Users/mikebower/anaconda3/envs/reverie_env/lib/python3.6/site-packages/rd_filters/rd_filters.py", line 202, in main fraction_passed = "%.1f" % (num_output_rows / num_input_rows * 100.0) ZeroDivisionError: division by zero

but benzene.smi = c1ccccc1 benzene

rd_filters filter --in benzene.smi --prefix foo using 8 cores Using alerts from Inpharmatica Wrote SMILES for molecules passing filters to foo.smi Wrote detailed data to foo.csv 1 of 1 passed filters 100.0% Elapsed time 0.31 seconds

people who have worked with your code before will know to have the compound id or name there, but others may not understand what the error comes from.

MikeBowerReverie avatar Feb 11 '20 15:02 MikeBowerReverie

I had the same issue. If the test.smi was given or error message was clear to the real source of the problem, I would find the solution a lot easier.

hyoo avatar Jul 17 '20 20:07 hyoo

Or, maybe, a crash-proof behavior. Such as: if a SMILES has no name, use the SMILES itself as a default name.

UnixJunkie avatar Oct 01 '21 08:10 UnixJunkie

Good idea, I'll make this change

PatWalters avatar Oct 01 '21 14:10 PatWalters