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

support for bond types >4 in MDLV3000Reader and MDLV3000Writer #1061

Open
uli-f opened this issue Apr 3, 2024 · 6 comments
Open

support for bond types >4 in MDLV3000Reader and MDLV3000Writer #1061

uli-f opened this issue Apr 3, 2024 · 6 comments

Comments

@uli-f
Copy link
Member

uli-f commented Apr 3, 2024

I would like to read a MDL V3000 file that has a bond type >4, that is, a query bond type. Looking at the code, an exception is raised for any bond type >4.

I'd be happy to add the ability to deal with query bond types to MDLV3000Reader and MDLV3000Writer. Given that there is support for query bond types in MDLV2000Reader and MDLV2000Writer it should be straightforward to add this to the V3000 reader and writer.

However, browsing through the issues (#952 , #971 ) a potential re-write of the MDL/SDF readers/writers was mentioned by @johnmay a while ago. There is also an open PR (#972) that changes some of the code of the MDL V3000 reader and writer.

I am happy to put in the work even if it might be replaced later. Some code (I am thinking tests) might be useful even if refactored later on.

Looking forward to feedback before starting with this :)

@johnmay
Copy link
Member

johnmay commented Apr 3, 2024

Sure, how would represent these? Ideally I would want these to come out as query bond expressions.

@uli-f
Copy link
Member Author

uli-f commented Apr 3, 2024

Sure, how would represent these? Ideally I would want these to come out as query bond expressions.

Agreed. That would be my aim, too.

I planned on using whatever is implemented in MDLV2000Reader and MDLV2000Writer as a guideline. Does that sound reasonable to you?

Do you want to merge PR #972 first before I start with this?

@johnmay
Copy link
Member

johnmay commented Apr 4, 2024

Oh yes, sorry I misread - V3000 should do whatever V2000 does. Not's bond type 9/10 is also undocumented and supported in V2000 - that might be need to be a different representation and is a bigger challenge.

@uli-f
Copy link
Member Author

uli-f commented Apr 4, 2024

Not's bond type 9/10 is also undocumented and supported in V2000 - that might be need to be a different representation and is a bigger challenge.

Just had a look at the spec. I heard about 9 = coordination before, but that is the first time that 10 = hydrogen registered with me.

I am mainly interested in the query bonds at this time, and would probably just throw an exception / log a warning if bond type 9 or 10 is encountered. Current behavior in MDLV3000Reader is to log a warning for any bond type >= 4.

Does CDK have anything in place to represent a dative/coordinative bond?

@johnmay
Copy link
Member

johnmay commented Apr 4, 2024

Does CDK have anything in place to represent a dative/coordinative bond?

Sort of - but it's not as simple as just adding a representation. Many places need to be updated/considered. For example in SMARTS does a dative bond count towards D and X? Are new operators needed to query it?

@johnmay
Copy link
Member

johnmay commented Apr 4, 2024

For now throw an exception and handle the query bonds since the representation in V2000 is already established. I'll get the other PR you referenced on the properties merged today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants