Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IMoleculeSet


    }
  }
 
  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


    public void setTolerence(double theTolerance) {
        this.itsTolerance = theTolerance;
    }

    public IMoleculeSet matchBetweenMoleculeSetAndPeakList() {
        IMoleculeSet theMoleculeSet = new MoleculeSet();

        for (IAtomContainer theSingleMolecule : this.getMoleculeSet().molecules()) {
            if (this.__ismatchedBetweenMoleculeAndPeakList(theSingleMolecule)) {
                theMoleculeSet.addMolecule((IMolecule) theSingleMolecule);
            }
        }

        return theMoleculeSet;
    }
View Full Code Here

        String pklDir = "E:\\FG\\FTICRDATA\\140815";
        ArrayList<String> theBSPropertyNames = new ArrayList<>();
        theBSPropertyNames.add("SciName");
        theBSPropertyNames.add("Biological_Source");

        IMoleculeSet theResultMoleculeSet = new MoleculeSet();
        double theTolerance = 0.0005;
        IMoleculeSet inputMolSet = new MoleculeSet();
       
        inputMolSet.add(ModifyClass.readFolderWithTag(theGinsengMoleculeFolder, "SciName", "Panax ginseng"));
        inputMolSet.add(ModifyClass.readFolderWithTag(theLamMoleculeFolder, "SciName", "Laminaria japonica"));
        inputMolSet.add(ModifyClass.readFolderWithTag(theScutellariaMoleculeFolder, "SciName", "Scutellaria baicalensis"));
        inputMolSet.add(ModifyClass.readFolderWithTag(thePoriaMoleculeFolder, "SciName", "Poria cocos"));
        inputMolSet.add(ModifyClass.readFolderWithTag(theOphiopogonMoleculeFolder, "SciName", "Ophiopogon japonicus"));
       
       
       
       
        for (File[] theInputMoleculeFolder : theFileLists) {
            String theDBSourceText = theInputMoleculeFolder[0].getParent().split("\\\\")[3];
            for (File inputSDF : theInputMoleculeFolder) {
                try {
                    IteratingMDLReader reader = new IteratingMDLReader(new FileInputStream(inputSDF), DefaultChemObjectBuilder.getInstance());
                    while (reader.hasNext()) {
                        inputMolSet.addMolecule((IMolecule) reader.next());
                        //inputMolSet.getAtomContainer(inputMolSet.getMoleculeCount()).setProperty("DBSourceText", theDBSourceText);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
       
       
        /*
         try {
         IteratingMDLReader reader = new IteratingMDLReader(new FileInputStream(theInputMoleculeFile), DefaultChemObjectBuilder.getInstance());
         while (reader.hasNext()) {
         inputMolSet.addMolecule((IMolecule) reader.next());
         }
         } catch (Exception e) {
         e.printStackTrace();
         }
       

         String[] drg = {"Platycodon grandiflorum"};
         String[] sbc = {"Saururus chinensis", "Houttuynia cordata"};
         String[] hso = {"Polygonum multiflorum"};
         */
        //Main.calculateExactMass(inputMolSet, "IDE.MF");
        Module.addHydrogen(inputMolSet, "cdkErrors.txt");
        ModifyClass.setMF(inputMolSet);
        ModifyClass.calculateExactMass(inputMolSet, "Molecular_Formula");
        //Main.calculateExactMass(inputMolSet, "Formula");
        //inputMolSet = Main.getMoleculesWithMuchInfo(inputMolSet);
        //inputMolSet = Main.filterMoleculeByBiologicalSource(inputMolSet, "SciName", drg);
        System.out.println("found " + inputMolSet.getMoleculeCount());
        //inputMolSet = Main.filterMoleculeByBiologicalSource(inputMolSet, "Biological_Source", sbc);
        /*
        for (String[] theBSText : Main.readBScsv(theBSInformationFile)){
            ArrayList<String> theFilterString = new ArrayList<>();
            for (int i = 2; i<theBSText.length; i++){
View Full Code Here

        for (IAtomContainer theMolecule : molSet.molecules()) {
            theMolecule.setProperty("Molecular_Formula", MolecularFormulaManipulator.getString(MolecularFormulaManipulator.getMolecularFormula(theMolecule)));
        }
    }
    public static IMoleculeSet readFolderWithTag(File folder, String tagPropertyName, String tag){
        IMoleculeSet resultMol = new MoleculeSet();
        for (File inputSDF : folder.listFiles()) {
                try {
                    IteratingMDLReader reader = new IteratingMDLReader(new FileInputStream(inputSDF), DefaultChemObjectBuilder.getInstance());
                    while (reader.hasNext()) {
                        resultMol.addMolecule((IMolecule) reader.next());
                        //inputMolSet.getAtomContainer(inputMolSet.getMoleculeCount()).setProperty("DBSourceText", theDBSourceText);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        for (int i =0; i<resultMol.getMoleculeCount(); i++){
            resultMol.getMolecule(i).setProperty(tagPropertyName, tag);
        }
        return resultMol;
    }
View Full Code Here

            molSet.getAtomContainer(i).setProperty("exact mass", exactMass);
        }
    }

    public static IMoleculeSet getMoleculesWithMuchInfo(IMoleculeSet molSet) {
        IMoleculeSet resultSet = new MoleculeSet();
        for (IAtomContainer eachMol : molSet.molecules()) {
            if (eachMol.getProperties().keySet().size() > 30) {
                resultSet.addMolecule((IMolecule) eachMol);
            }
        }
        return resultSet;
    }
View Full Code Here

        }
        return resultSet;
    }

    public static IMoleculeSet filterMoleculeByBiologicalSource(IMoleculeSet molSet, String BSPropertyName, String[] filterString) {
        IMoleculeSet resultSet = new MoleculeSet();
        for (IAtomContainer eachMol : molSet.molecules()) {
            for (int i = 0; i < filterString.length; i++) {
                if (((String) eachMol.getProperty(BSPropertyName)).toLowerCase().contains(filterString[i].toLowerCase())) {
                    resultSet.addMolecule((IMolecule) eachMol);
                }
            }
        }
        return resultSet;
    }
View Full Code Here

        }
        return resultSet;
    }

    public static IMoleculeSet filterMoleculeByBiologicalSource(IMoleculeSet molSet, String BSPropertyName, ArrayList<String> filterString) {
        IMoleculeSet resultSet = new MoleculeSet();
        for (IAtomContainer eachMol : molSet.molecules()) {
            if (eachMol.getProperty(BSPropertyName) != null) {
                for (int i = 0; i < filterString.size(); i++) {
                    if (((String) eachMol.getProperty(BSPropertyName)).toLowerCase().contains(filterString.get(i).toLowerCase())) {
                        resultSet.addMolecule((IMolecule) eachMol);
                    }
                }
            }
        }
        return resultSet;
View Full Code Here

            }
        }
        return resultSet;
    }
    public static IMoleculeSet filterMoleculeByBiologicalSource(IMoleculeSet molSet, ArrayList<String> BSPropertyName, ArrayList<String> filterString){
        IMoleculeSet resultSet = new MoleculeSet();
        for (String a : BSPropertyName){
            if (resultSet != null){
                resultSet.add(ModifyClass.filterMoleculeByBiologicalSource(molSet, a, filterString));
            }
        }
        return resultSet;
    }
View Full Code Here

        }
        return resultSet;
    }

    public static IMoleculeSet filterMoleculeByStringProperty(IMoleculeSet molSet, String propertyName, String filterString) {
        IMoleculeSet resultSet = new MoleculeSet();
        for (IAtomContainer eachMol : molSet.molecules()) {
            for (int i = 0; i < filterString.length(); i++) {
                if (((String) eachMol.getProperty(propertyName)).toLowerCase().contains(filterString.toLowerCase())) {
                    resultSet.addMolecule((IMolecule) eachMol);
                }
            }
        }
        return resultSet;
    }
View Full Code Here

        }
        return resultSet;
    }

    public static IMoleculeSet filterMoleculeByDoubleProperty(IMoleculeSet molSet, String propertyName, Double filterThreshold) {
        IMoleculeSet resultSet = new MoleculeSet();
        for (IAtomContainer eachMol : molSet.molecules()) {
            Boolean isRemaining = false;
            for (String eachString : ((String) eachMol.getProperty(propertyName)).split("\n")) {
                if (Double.parseDouble(eachString) >= filterThreshold) {
                    isRemaining = true;
                }
            }
            if (isRemaining) {
                resultSet.addMolecule((IMolecule) eachMol);
            }
        }
        return resultSet;
    }
View Full Code Here

TOP

Related Classes of org.openscience.cdk.interfaces.IMoleculeSet

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.