Examples of IMolecule


Examples of org.openscience.cdk.interfaces.IMolecule

  }
 
  private IMolecule parseSmilesInternal(String smiles, long timeout) {
    final String finalSmiles = smiles;
    try {
      IMolecule mol = call (new Callable<IMolecule>() {
        public IMolecule call() throws Exception {
          return smilesParser.parseSmiles(finalSmiles);
        }
      }, timeout, TimeUnit.MICROSECONDS);
      return mol;
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

    Fingerprinter fingerprinter = new Fingerprinter();
    this.inchis = inchis;
    molecules = new HashMap<String,IMolecule>();
    fingerprints = new HashMap<String,BitSet>();
    for(String inchi : inchis) {
      IMolecule mol = ConverterToInChI.getMolFromInChI(inchi);
      if(mol != null) {
        molecules.put(inchi, mol);
        fingerprints.put(inchi, fingerprinter.getFingerprint(mol));
      }
    }
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

   

  }
 
  private Set<String> inchiToFingerprints(String inchi) throws Exception {
     IMolecule mol = ConverterToInChI.getMolFromInChI(inchi);
    if(mol == null) return null;
    BitSet fp = fingerprinter.getFingerprint(mol);
    Set<String> fps = new HashSet<String>();
    for(int i=fp.nextSetBit(0); i>=0; i=fp.nextSetBit(i+1)) {
      fps.add("FP" + i);
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

   * ConverterToInChI cache.
   *
   * @param inchi The InChI.
   */
  public static void primeCacheForInChI(String inchi) {
    IMolecule mol = null;
    boolean done = false;
    if(isStereoInChI(inchi)) {
      mol = ConverterToInChI.getMolFromInChICache(inchi);
      boolean generate = false;
      if(mol == null) {
        generate = true;
        // Small
      } else if(mol.getAtomCount() <= 1) {
        generate = false;
        // Layout-free?
      } else if(MultiFragmentStructureDiagramGenerator.hasStructure(mol)) {
        generate = true;
      }
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

  private IMolecule getMoleculeStructure(IMolecule inputMol) throws Exception {
    StructureDiagramGenerator sdg = new StructureDiagramGenerator();
    IMoleculeSet originalMols = ConnectivityChecker.partitionIntoMolecules(inputMol);
    MoleculeSet mols = new MoleculeSet();
    for(int i=0;i<originalMols.getMoleculeCount();i++) {
      IMolecule mol = originalMols.getMolecule(i);
      sdg.setMolecule(mol);
      //sdg.setMolecule(new Molecule(th.getTemplateAt(6)));
      sdg.setTemplateHandler(th);
      sdg.generateCoordinates();
      mols.addMolecule(sdg.getMolecule());
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

          return StructureConverter.cmlToInChI(cml);
        }
      }
    } else if(dealkylmatcher.matches()) {
      StereoInChIToMolecule.primeCacheForInChI(inchi);
      IMolecule mol = ConverterToInChI.getMolFromInChI(inchi);
      StructureConverter.configureMolecule(mol);
      //System.out.println(mol.getAtomCount());
      mol = (IMolecule)mol.clone();

      String atomStr = dealkylmatcher.group(2);
      //if(atomStr == null) return null;
      int alkylSize = 0;
      String groupStr = dealkylmatcher.group(3);
      if(groupStr.equals("methyl")) {
        alkylSize = 1;
      } else if(groupStr.equals("ethyl")) {
        alkylSize = 2;
      } else if(groupStr.equals("propyl")) {
        alkylSize = 3;
      } else if(groupStr.equals("butyl")) {
        alkylSize = 4;
      } else if(groupStr.equals("pentyl")) {
        alkylSize = 5;
      } else if(groupStr.equals("hexyl")) {
        alkylSize = 6;
      }
      if(alkylSize == 0) return null;
      //StructureConverter.configureMolecule(mol);

      List<List<IAtom>> alkyl = getXAlkyl(mol, atomStr, alkylSize);
      if(alkyl.size() == 2 && alkyl.get(0).size() == alkyl.get(1).size()) {
        Set<IAtom> touching = new HashSet<IAtom>();
        for(IAtom atom : alkyl.get(0)) {
          touching.addAll((List<IAtom>)mol.getConnectedAtomsList(atom));
        }
        for(IAtom atom : alkyl.get(1)) {
          touching.addAll((List<IAtom>)mol.getConnectedAtomsList(atom));
        }
        touching.removeAll(alkyl.get(0));
        touching.removeAll(alkyl.get(1));
        if(touching.size() == 1) alkyl.remove(1);
      }
      if(alkyl.size() != 1) return null;
      Set<IAtom> touching = new HashSet<IAtom>();
      for(IAtom atom : alkyl.get(0)) {
        touching.addAll((List<IAtom>)mol.getConnectedAtomsList(atom));
        //System.out.println(mol.getAtomCount());
        mol.removeAtomAndConnectedElectronContainers(atom);
        //System.out.println(mol.getAtomCount());
      }

      touching.removeAll(alkyl);
      for(IAtom atom : touching) {
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

    if(cache.containsKey(smiles)) {
      return cache.get(smiles);
    }
    List<String> ids = new ArrayList<String>();
    try {
      IMolecule mol = sp.parseSmiles(smiles);
      ha.addExplicitHydrogensToSatisfyValency(mol);
      for(String s : qacs.keySet()) {
        if(UniversalIsomorphismTester.isSubgraph(mol, qacs.get(s))) {
          ids.add(qid.get(s));
          //System.out.println(s + "\t" + qsmiles.get(s));             
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

      //e.printStackTrace();
    }
  }
 
  private QueryAtomContainer makeQAC(String smiles) throws Exception {
    IMolecule mol = sp.parseSmiles(smiles);
    ha.addExplicitHydrogensToSatisfyValency(mol);
    QueryAtomContainer qac = QueryAtomContainerCreator.createBasicQueryContainer(mol);
    for(int i=0;i<qac.getAtomCount();i++) {
      IAtom a = qac.getAtom(i);
      if(a.getSymbol().equals("R")) {
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

        trans.transform(new StreamSource(tmpFile), new StreamResult(new File(paperDir, id+".html")));
      } catch (Exception ee) {
        ee.printStackTrace();
      }
      try {
        IMolecule mol = ConverterToInChI.getMolFromInChI(inchi);
        StructureConverter.configureMolecule(mol);
        Molecule2Png m2p = new Molecule2Png();
        m2p.fixedWidthAndHeight = true;
        m2p.height = 300;
        m2p.width = 300;
View Full Code Here

Examples of org.openscience.cdk.interfaces.IMolecule

   * @throws Exception
   */
  public static IMolecule cmlToMolecule(Element cmlMol) throws Exception {
    ByteArrayInputStream bais = new ByteArrayInputStream(cmlMol.toXML().getBytes());
    IChemFile cf = (IChemFile) new CMLReader(bais).read(new ChemFile());
    IMolecule mol = cf.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
    configureMolecule(mol);
    return mol;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.