Coder Social home page Coder Social logo

Comments (4)

johnmay avatar johnmay commented on August 23, 2024

It would have been helpful if you split these into separate issues/support.

  1. In code you set it as an Attachment Point number on the pseudo atom, in CXSMILES:*c1ccccc1 |$_AP1$|, PseudoAtom.setAttachmentPoint number.
  2. API point is set carbon visibility (DepictionGenerator.withCarbonSymbols()) - however that example is mixed with the benzenes you would need something custom. Explained better here: https://github.com/cdk/cdk/wiki/Standard-Generator#symbol-visibility
  3. If you have given in the correct input it will be correct. CXSMILES: *c1ccccc1 |$A$|
C*.C*.C1=CC=CC=C1C=2C(C=CN3C2C=*C(=*3)C**)=O.C* |$;R2;;R3;;;;;;;;;;;;;;W;;A;;X;R4;;;R1$,m:0:5.4.9.8.7.6,2:7.6.5.4.9.8,24:4.9.8.7.6.5,Sg:n:20:m:ht| US 2007/0129372 (I)

  1. Please can you attach your code in text rather than a picture and will see what is going on.

from depict.

johnmay avatar johnmay commented on August 23, 2024
  1. might be you need abrv.setContractOnHetero(false);

from depict.

miracle1111111 avatar miracle1111111 commented on August 23, 2024

Thank you very much for your reply, I have the following 3 questions:

Question 1.
in CXSMILES:*c1ccccc1 |$_AP1$|, PseudoAtom.setAttachmentPoint number. Can you give me an example, such as
CC(C)C1=C(C(=C(C(=C1[R6])[R7])[R8])[R9])[R10]
image

C1CN(CC(=O)N(C1)[R11])[R]
image
Question 2.
Explained better here as you said: https://github.com/cdk/cdk/wiki/Standard-Generator#symbol-visibility
CH3 can be generated, however, CH, CH2 do not know how to generate.
image

Question 3.
For example, in the figure below, given smiles: B[*], Chemdraw generates A and D from *. I don't know why, generally * refers to a specific atom.
QQ截图20200717105701

from depict.

johnmay avatar johnmay commented on August 23, 2024

Question 1

In your first case it was encoded as iso-propyl, this is incorrect but common misconception. The attachment-point indication isn't formed from wavy bonds but is rather something explicitly for attachments.

Here's a screen shot from some sketch processing I did. https://www.nextmovesoftware.com/products/Praline_Sheffield2016.pdf

image

To input these I used CXSMILES: https://docs.chemaxon.com/display/docs/ChemAxon_Extended_SMILES_and_SMARTS_-_CXSMILES_and_CXSMARTS.html

*C1=C(C(=C(C(=C1[R6])[R7])[R8])[R9])[R10] |$_AP1$|

Actually the more correct way to encode this is:

*C1=C(C(=C(C(=C1*)*)*)*)* |$_AP1;;;;;;;R6;R7;R8;R9;R10$|

supporting [R1] isn't official in SMILES.

Here's your other one

C1CN(CC(=O)N(C1)[R11])* |$;;;;;;;;;_AP1$|

Here's how you can do this progamatically:

SmilesParser   smipar = new SmilesParser(SilentChemObjectBuilder.getInstance());
IAtomContainer mol    = smipar.parseSmiles("*CCO");
((IPseudoAtom)mol.getAtom(0)).setAttachPointNum(1); // set _AP1
new DepictionGenerator().depict(mol).writeTo("/tmp/tmp.svg");

Question 2

CH3 can be generated, however, CH, CH2 do not know how to generate.

You can give it custom function:

    SmilesParser   smipar = new SmilesParser(SilentChemObjectBuilder.getInstance());
    IAtomContainer mol    = smipar.parseSmiles("*CCO");
    DepictionGenerator depictgen = new DepictionGenerator();
    depictgen = depictgen.withParam(StandardGenerator.Visibility.class,
                                    new SymbolVisibility() {
                                      @Override
                                      public boolean visible(IAtom atom, List<IBond> neighbors, RendererModel model) {
                                        return atom.getAtomicNumber() != 6 || atom.getIndex() == 1;
                                      }
                                    });
    depictgen.depict(mol).writeTo("/tmp/tmp.svg");

image

depictgen = depictgen.withParam(StandardGenerator.Visibility.class,
                                    new SymbolVisibility() {
                                      @Override
                                      public boolean visible(IAtom atom, List<IBond> neighbors, RendererModel model) {
                                        return true; // everything
                                      }
                                    });

image

Question 3

In CDK * is *, not A. This is a display preference if you want you could change them all to the be this:

    for (IAtom atom : mol.atoms()) {
      // all unlabelled * => A
      if (atom instanceof IPseudoAtom &&
          ((IPseudoAtom) atom).getLabel().equals("*") &&
          ((IPseudoAtom) atom).getAttachPointNum() == 0) {
        ((IPseudoAtom) atom).setLabel("A");
      }
    }

image

Adding an option for D for [2H] is certainly useful though

from depict.

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.