-
Notifications
You must be signed in to change notification settings - Fork 845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to LoadSDF and WriteSDF #513
Conversation
samoturk
commented
Jun 1, 2015
- I used WriteSDF a bit and noticed that it saves floats with E notation which confused some programs. I fixed it so that now it formats the floats "correctly" with decimal notation.
- When I tried to fix the code I also noticed that if no properties are given it just pulls the properties from mol objects in "ROMol" and writes those. I modified the code so that embedded properties are removed before molecule is written.
- I added few lines to remove embedded properties when loading sdf with LoadSDF. embedProps=False is the default now. I think this reasonable default since all the data is already in columns and as a bonus it will save some memory..
- And finally I also renamed parameters to be consistent with LoadSDF. Will only break code where "titleColumn" was used.
…nd correctly formats floats (not to E notation). I also renamed some parameters to be consistent with LoadSDF
@@ -241,6 +241,10 @@ def LoadSDF(filename, idName='ID',molColName = 'ROMol',includeFingerprints=False | |||
for i, mol in enumerate(Chem.ForwardSDMolSupplier(f)): | |||
if mol is None: continue | |||
row = dict((k, mol.GetProp(k)) for k in mol.GetPropNames()) | |||
if embedProps == False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better style here would be: if not embedProps:
I made a few suggestions as part of the code review. Once those are addressed I will merge it in. It's safe to ignore the travis failure above: it doesn't look like anything real failed there (this happens occasionally). |
Fixed! Thanks for your suggestions and code review! |
Improvements to LoadSDF and WriteSDF