Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-05-25 Thread Greg Landrum
On Wed, May 23, 2012 at 2:24 PM, JP jeanpaul.ebe...@inhibox.com wrote: This molecule with no atoms being valid is a questionable design decision (not your fault of course, you are just implementing a spec). I think that the smiles writer should not write an empty molecule (you could change

Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-05-25 Thread Eddie Cao
Hi, One potential improvement that may help is to use Python's warning package. If RDKit generates warnings using this package, then user can control whether they want the empty SMILES to return None silently or raise an exception. Eddie On May 24, 2012, at 11:06 PM, Greg Landrum wrote: On

Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-05-25 Thread Paul Emsley
On 23/05/12 13:24, JP wrote: The generator is going to give me an empty (third) molecule? So I have to always dirty my code with m.GetNumAtoms() 0 in that loop. What is the empty molecule is at the end of the file (ouch)? I'm curious about this point in particular. I don't know the

Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-05-23 Thread Greg Landrum
Dear all, The svn version of the RDKit now behaves like this: In [2]: m = Chem.MolFromMolFile('empty.mol') In [3]: m.GetNumAtoms() Out[3]: 0 Notice that there are no longer error messages. There is, however, the following wart: In [6]: Chem.MolToSmiles(m) Out[6]: '' In [7]: m2 =

Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-04-30 Thread Jan Holst Jensen
On 2012-04-30 13:41, Paul Emsley wrote: On 30/04/12 01:03, Eddie Cao wrote: Hi Andrew, I also prefer #2. #1 is not quite sensible because many readers like MolFromSmiles will return None on failure and it will be hard to distinguish bad input from an empty one if we choose to do #1.

Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-04-29 Thread Eddie Cao
Hi Andrew, I also prefer #2. #1 is not quite sensible because many readers like MolFromSmiles will return None on failure and it will be hard to distinguish bad input from an empty one if we choose to do #1. Semantically, in many RDKit use cases, None and Empty Mol are as different as a

Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-04-28 Thread Andrew Dalke
It looks like this discussion is still unresolved. Greg's going to have a pile of things on his desk (eDesk?) when he gets back from holidays. :) On Jan 30, 2012, at 1:26 PM, JP wrote: But then I will have to add the if not clean_mol.GetNumAtoms(): before/after replacing/editing molecule

Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-01-30 Thread JP
Thanks for the explanation and the helpful-as-ever code snippets Greg. A molecule without atoms sounds a bit weird to me but it seems to be a perfectly legal (in CTFile definition) to have a no-atom molecule. Each record can hold one molecule (which may be blank). from this very inspiring article

Re: [Rdkit-discuss] Molecule with no atoms, so is it valid?

2012-01-30 Thread Andrew Dalke
On Jan 30, 2012, at 9:24 PM, JP wrote: A molecule without atoms sounds a bit weird to me but it seems to be a perfectly legal (in CTFile definition) to have a no-atom molecule. Some SMILES files readers will break if there are no atoms. For example, the Daylight toolkit SMILES parser gives