datamol-io / datamol

Molecular Processing Made Easy.
https://docs.datamol.io
Apache License 2.0
462 stars 48 forks source link

request to add a mol2 file reader #173

Closed Pakman450 closed 1 year ago

Pakman450 commented 1 year ago

Hello!

My laboratory deals with a lot of multi-mol2 files. So adding a function that reads in a multi-mol2 file would be super helpful! I have created a feature that reads in the mol2 file and be able to return a list of rdkit objects so it can be worked on ASAP.

NOTE: In the RDKIT docs, the rdmolfiles.MolFromMol2Block and rdmolfiles.MolFromMol2File are strongly compatible with mol2 data that has CORINA atom types. (more info)

Further, rdmolfiles.MolFromMol2File is definitely exist to take in a Mol2 file, but for some reason they only process the first molecule, which is weird. So that is why I added some logic to process multiple molecules.

Thank You, Steven Pak

btw, great repo! It definitely easier to process molecules!

Checklist:


Pakman450 commented 1 year ago

Should I also edit the authors file?

hadim commented 1 year ago

Thanks, @Pakman450, for your contribution. I'll review soon!

hadim commented 1 year ago

Should I also edit the authors file?

No need for that, it's automatic during the release process.

codecov[bot] commented 1 year ago

Codecov Report

Merging #173 (5f1b805) into main (a923213) will increase coverage by 0.05%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #173      +/-   ##
==========================================
+ Coverage   91.08%   91.13%   +0.05%     
==========================================
  Files          47       47              
  Lines        3509     3529      +20     
==========================================
+ Hits         3196     3216      +20     
  Misses        313      313              
Flag Coverage Δ
unittests 91.13% <100.00%> (+0.05%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
datamol/__init__.py 100.00% <100.00%> (ø)
datamol/io.py 92.94% <100.00%> (+0.97%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

Pakman450 commented 1 year ago

Also, it seems I have to reformat the newly edited files using black. So I am gonna do that also.

hadim commented 1 year ago

Thanks @Pakman450 !