Code Monkey home page Code Monkey logo

Comments (5)

KramerChristian avatar KramerChristian commented on September 23, 2024

Dear Jen,

If I understand you correctly, you would like to see something like a SMILES or SMARTS for a given environment. This is currently not stored in the DB, so there is no direct way to access it.

A workaround could be that for a given rule_environment, you extract one sample pair and display this, together with the radius (as integer). If the from_smiles and to_smiles are known, the environment for a given radius can then be inferred from looking at the pair.

Please note that the environment is grouped via the Morgan fingerprint, rooted at the attachment atom. The Morgan Fingerprint for each atom amongst others features the number of neighboring atoms. Therefore, a radius 1 Fingerprint in reality is more a kind of radius 1.5 fingerprint. For this reason, if you wanted to depict the Morgan Fingerprint environment as a SMILES, this would get be rather complicated.

Does this answer your question?

from mmpdb.

chemcomp-Jen avatar chemcomp-Jen commented on September 23, 2024

Hi Christian,

Thanks for the reply. Yes, I would like to see the SMILES or SMARTS for a given environment. Good to know there is a workaround. I think it should work.

I will give a try to extract one example pair/or all pairs (if possible) from a given rule_environment. Would you mind give an example of how to do that? Is there any existing functions in the package I can use?

Thanks,
Jen

from mmpdb.

KramerChristian avatar KramerChristian commented on September 23, 2024

Hi Jen,

there is no existing function that does exactly what you ask. But if you are coding already anyway, and you know the rule_environment_id for which you want to see a pair, you could try something like this:

sql = """
SELECT pair.id,
lhs_compound.clean_smiles, rhs_compound.clean_smiles,
lhs_compound.public_id, rhs_compound.public_id
FROM pair,
compound as lhs_compound, compound as rhs_compound
WHERE pair.rule_environment_id = ?
AND pair.compound1_id = lhs_compound.id
AND pair.compound2_id = rhs_compound.id
LIMIT 1
"""
c = cursor.execute(sql, (environment_id, ))

Disclaimer: The concept of the statement should work, but I have not tested it and my python has gotten a little rusty lately, you may need to fix some of the commas etc. Please let me know if this works.

from mmpdb.

chemcomp-Jen avatar chemcomp-Jen commented on September 23, 2024

Hi Christians,

Thank you so much for the details. I will code the query and try to grab the pair information. I will keep you posted how it works.

Best, Jen

from mmpdb.

chemcomp-Jen avatar chemcomp-Jen commented on September 23, 2024

Hi Christian, It works as expected!

Thanks, Jen.

from mmpdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.