Skip to content
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

Merged
merged 5 commits into from
Jun 2, 2015
Merged

Improvements to LoadSDF and WriteSDF #513

merged 5 commits into from
Jun 2, 2015

Conversation

samoturk
Copy link
Contributor

@samoturk 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:
Copy link
Member

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:

@greglandrum
Copy link
Member

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).

@samoturk
Copy link
Contributor Author

samoturk commented Jun 2, 2015

Fixed! Thanks for your suggestions and code review!

greglandrum added a commit that referenced this pull request Jun 2, 2015
Improvements to LoadSDF and WriteSDF
@greglandrum greglandrum merged commit 6f7cf44 into rdkit:master Jun 2, 2015
@greglandrum greglandrum added this to the 2015_09_1 milestone Jun 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants