The problem was that I caught exceptions and parsed molecules without
sanitization, which eventually led to RuntimeErrors. Using only
sanitized mols, the list comprehension works fine - request withdrawn!
:)

On Fri, Apr 4, 2008 at 3:27 PM, Greg Landrum <greg.land...@gmail.com> wrote:
> On Fri, Apr 4, 2008 at 12:45 PM, Adrian Schreyer <ams...@cam.ac.uk> wrote:
>  > Thanks Greg, this is what I suspected. By the way, will you change
>  >  error handling in RDKit generally? Currently,
>  >  GetAtomPairFingerprintAsIntVect(mol) will throw a RuntimeError if the
>  >  molecule is invalid (an error occurs) - maybe this can be changed
>  >  analogous to the supplier functions.
>
>  I agree that it should do something more informative than a
>  RuntimeError (a ValueError at the very least). Are you requesting that
>  the fingerprinting code return None instead of generating an error if
>  you pass it an empty molecule? That's not a solution I particularly
>  like.
>
>
>  >  This would make the use of
>  >  generator expressions or list comprehensions easier.
>
>  Something like this:
>  fps = [GetAtomPairFingerprintAsIntVect(mol) for mol in suppl if mol]
>  avoids the empty molecule problem.
>
>  >  In addition,
>  >  would it be possible to have a BulkDiceSimilarity function for
>  >  SparseIntVects as welll? I guess it would be considerably faster than
>  >  iterating through a Python list and calling
>  >  SparseIntVect.DiceSimilarity each time.
>
>  Indeed it will be. I will come up with a solution for this.
>
>  Thanks for the suggestions,
>  -greg
>

Reply via email to