Package org.openscience.cdk.smiles

Examples of org.openscience.cdk.smiles.SmilesParser


      }
    }
   
    if(mol == null && request.getParameter("smiles") != null && request.getParameter("smiles").length() > 0) {
      try {
        mol = new SmilesParser(DefaultChemObjectBuilder.getInstance()).parseSmiles(request.getParameter("smiles"));
        if(mol != null) {
          StructureConverter.configureMolecule(mol);         
          makeStructure = !MultiFragmentStructureDiagramGenerator.hasStructure(mol);
          if(mol.getAtomCount() == 1) makeStructure = true;         
        }
View Full Code Here


  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {
    SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
    IMolecule mol = sp.parseSmiles("C1CC12CC2CC1CC1");
    AllRingsFinder ar = new AllRingsFinder();
    IRingSet ringSet = ar.findAllRings(mol);
    List l = RingPartitioner.partitionRings(ringSet);
    for(Object o : l) {
      IAtomContainer ac = RingPartitioner.convertToAtomContainer((IRingSet)o);
View Full Code Here

    if(myInstance == null) myInstance = new TimeoutSmilesParser();
    return myInstance;
  }
 
  private TimeoutSmilesParser() {
    smilesParser = new SmilesParser(DefaultChemObjectBuilder.getInstance());
  }
View Full Code Here

  private Map<String,List<String>> cache;
 
  public ChEBIGenerics() {
    try {
      cache = new HashMap<String,List<String>>();
      sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
      ha = new HydrogenAdder(new ValencyHybridChecker());
      OBOOntology o = OBOOntology.getInstance();
     
      qacs = new HashMap<String, QueryAtomContainer>();
      qsmiles = new HashMap<String, String>();
View Full Code Here

  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    IMolecule mol = null;
    try {
      if(request.getParameter("smiles") != null) {
        mol = new SmilesParser(DefaultChemObjectBuilder.getInstance()).parseSmiles(request.getParameter("smiles"));
        //StructureConverter.configureMolecule(mol);
      } else if(request.getParameter("inchi") != null) {
        /*try {
          PubChemSQL pcsql = PubChemSQL.getInstance();
          String mf = pcsql.getMolForInChI(request.getParameter("inchi"));
View Full Code Here

            } catch (IOException e) {
                JOptionPane.showMessageDialog(jChemPaintPanel, GT.get("Error in reading data from PubChem"));
                return null;
            }
        } else { // OK, it must be a SMILES
            SmilesParser smilesParser = new SmilesParser(DefaultChemObjectBuilder.getInstance());
            try {
                molecule = smilesParser.parseSmiles(text);
            } catch (InvalidSmilesException e1) {
                JOptionPane.showMessageDialog(jChemPaintPanel, GT.get("Invalid SMILES specified"));
                return null;
            }
        }
View Full Code Here

            }
        }
        if (!found) return null;

        // got the canonical SMILES, lets get the molecule
        SmilesParser smilesParser = new SmilesParser(DefaultChemObjectBuilder.getInstance());
        try {
          IAtomContainer mol=smilesParser.parseSmiles(smiles);
            //for some reason, smilesparser sets valencies, which we don't want in jcp
            for(int i=0;i<mol.getAtomCount();i++){
              mol.getAtom(i).setValency(null);
            }
            return mol;
View Full Code Here

                try{
                    if (content.toLowerCase().indexOf("inchi")>-1 ) {
                        toPaste = InChITool.parseInChI(content);
                    }
                    else {   
                        SmilesParser sp = new SmilesParser(
                                DefaultChemObjectBuilder.getInstance());
                        toPaste = sp.parseSmiles(
                                ((String) transfer.getTransferData(
                                        DataFlavor.stringFlavor)).trim());
                        toPaste = new FixBondOrdersTool().kekuliseAromaticRings(toPaste);

                        IAtomContainerSet mols = ConnectivityChecker.partitionIntoMolecules(toPaste);
View Full Code Here

     * @param fileURL
     */
    public void loadModelFromSmiles(String smiles) {
        if (smiles != null) {
            try {
                SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder
                        .getInstance());
                IAtomContainer mol = sp.parseSmiles(smiles);

                //for some reason, smilesparser sets valencies, which we don't want in jcp
                for(int i=0;i<mol.getAtomCount();i++){
                  mol.getAtom(i).setValency(null);
                }
View Full Code Here

   
    public EnterElementSwingModule(IChemModelRelay chemModelRelay) {
        super(chemModelRelay);
        String filename = "org/openscience/jchempaint/resources/funcgroups.txt";
        InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
        SmilesParser sp=new SmilesParser(DefaultChemObjectBuilder.getInstance());
        StringBuffer sb=new StringBuffer();
        InputStreamReader isr = new InputStreamReader(ins);
        try{
            while(true){
                int i=isr.read();
                if(i==-1){
                    break;
                }else if(((char)i)=='\n' || ((char)i)=='\r'){
                    if(!sb.toString().equals("")){
                        StringTokenizer st=new StringTokenizer(sb.toString());
                        String key=(String)st.nextElement();
                        String value=(String)st.nextElement();
                        IAtomContainer mol = sp.parseSmiles(value);
                        //for some reason, smilesparser sets valencies, which we don't want in jcp
                        for(int k=0;k<mol.getAtomCount();k++){
                            mol.getAtom(k).setValency(null);
                        }
                        funcgroupsmap.put(key, mol);
                        sb=new StringBuffer();
                    }
                }else{
                    sb.append((char)i);
                }
            }
            if(!sb.toString().equals("")){
                StringTokenizer st=new StringTokenizer(sb.toString());
                String key=(String)st.nextElement();
                String value=(String)st.nextElement();
                IAtomContainer mol = sp.parseSmiles(value);
                //for some reason, smilesparser sets valencies, which we don't want in jcp
                for(int k=0;k<mol.getAtomCount();k++){
                    mol.getAtom(k).setValency(null);
                }
                funcgroupsmap.put(key, mol);
View Full Code Here

TOP

Related Classes of org.openscience.cdk.smiles.SmilesParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.