iodata icon indicating copy to clipboard operation
iodata copied to clipboard

Added .mol functionality

Open nwoodweb opened this issue 3 years ago • 6 comments

The file iodata/formats/mol.py implements V2000 *.mol compatibility, based heavily off of currently implemented *.sdf compatibility

  • I had used load_one on a phenol.mol file I had made
  • I had passed Roberto CI check

nwoodweb avatar Jun 03 '22 15:06 nwoodweb

Codecov Report

Merging #290 (7f61aec) into master (73eee89) will increase coverage by 0.03%. The diff coverage is 96.75%.

@@            Coverage Diff             @@
##           master     #290      +/-   ##
==========================================
+ Coverage   95.00%   95.04%   +0.03%     
==========================================
  Files          74       76       +2     
  Lines        8790     8975     +185     
  Branches     1213     1227      +14     
==========================================
+ Hits         8351     8530     +179     
- Misses        191      194       +3     
- Partials      248      251       +3     
Impacted Files Coverage Δ
iodata/formats/mol.py 91.42% <91.42%> (ø)
iodata/test/test_mol.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 73eee89...7f61aec. Read the comment docs.

codecov[bot] avatar Jun 03 '22 15:06 codecov[bot]

@nwoodweb thanks for your contributions. As shared in issue #269, having a test for every line of code is part of our contribution guidelines, so we cannot review your PR until suitable tests are added.

FarnazH avatar Jun 03 '22 21:06 FarnazH

@FarnazH Ok thankyou for clarifying. I will add a testing script in iodata/test as well as at least 2 example files and a V2000 unit test in iodata/test/data

nwoodweb avatar Jun 03 '22 23:06 nwoodweb

I accidentally pushed to master, which is part of the pull request, then pushed my unit tests to new-feature so I had simply merged new-feature with my forks master

I added unit test file iodata/tests/test_mol.py as well as various example mol files

nwoodweb avatar Jun 04 '22 21:06 nwoodweb

Thanks for the contribution and my apologies for the delay. The code is almost identical to that for the SDF format. When looking for the differences, I could only find one thing related to the end marker for a single molecule:

  • For SDF this is
    M  END
    $$$$
    
  • For SDF this is
    M  END
    

Are there any other differences? If not, I'd suggest extending the SDF code to also handle the .mol case correctly. This way, we can avoid duplicated code.

tovrstra avatar Aug 03 '22 13:08 tovrstra

Hi @tovrstra

.sdf and .mol are for the most part identical besides the termination string at the end. In hindsight it might be better to use branch statements to differentiate M END and M END $$$$.

However, I do remember being confused about V2000 and V3000 formatting, as well as the bond block, so I will review those before implementing your recommendation.

nwoodweb avatar Aug 04 '22 04:08 nwoodweb