Search in sources :

Example 1 with StartingMaterialsDataBase

use of ambit2.reactions.retrosynth.StartingMaterialsDataBase in project ambit-mirror by ideaconsult.

the class ReactionTestUtils method testStartingMaterialsDataBase.

public static void testStartingMaterialsDataBase(String smDBFileName, int n) throws Exception {
    StartingMaterialsDataBase smdb = new StartingMaterialsDataBase(new File(smDBFileName), n);
    Map<String, StartMaterialData> materials = smdb.getMaterials();
    for (Entry entry : materials.entrySet()) {
        String inchiKey = (String) entry.getKey();
        StartMaterialData sm = (StartMaterialData) entry.getValue();
        System.out.println(inchiKey + "  " + sm.id + "   " + sm.smiles);
    }
}
Also used : Entry(java.util.Map.Entry) StartingMaterialsDataBase(ambit2.reactions.retrosynth.StartingMaterialsDataBase) StartMaterialData(ambit2.reactions.retrosynth.StartingMaterialsDataBase.StartMaterialData) File(java.io.File)

Example 2 with StartingMaterialsDataBase

use of ambit2.reactions.retrosynth.StartingMaterialsDataBase in project ambit-mirror by ideaconsult.

the class ReactionTestUtils method testStartingMaterialsDataBase.

public static void testStartingMaterialsDataBase(String[] smiles) throws Exception {
    StartingMaterialsDataBase smdb = new StartingMaterialsDataBase(smiles);
    Map<String, StartMaterialData> materials = smdb.getMaterials();
    for (Entry entry : materials.entrySet()) {
        String inchiKey = (String) entry.getKey();
        StartMaterialData sm = (StartMaterialData) entry.getValue();
        System.out.println(inchiKey + "  " + sm.id + "   " + sm.smiles);
    }
}
Also used : Entry(java.util.Map.Entry) StartingMaterialsDataBase(ambit2.reactions.retrosynth.StartingMaterialsDataBase) StartMaterialData(ambit2.reactions.retrosynth.StartingMaterialsDataBase.StartMaterialData)

Example 3 with StartingMaterialsDataBase

use of ambit2.reactions.retrosynth.StartingMaterialsDataBase in project ambit-mirror by ideaconsult.

the class ReactionTestUtils method testReactionSequence.

public static void testReactionSequence(String targetSmiles, String reactionDBFileName, String startMatDBFileName, boolean isRandomStrategy) throws Exception {
    String[] startMatSmi = { "CC", "CCC", "CO", "NC(C)C", "Cl" };
    StartingMaterialsDataBase smdb = new StartingMaterialsDataBase(startMatSmi);
    // Set up reaction DB
    ReactionDataBase rdb;
    if (reactionDBFileName == null) {
        List<String> smirks = new ArrayList<String>();
        smirks.add("[C:1]Cl>>[C:1]");
        // smirks.add("[C:1][H]>>[C:1]O[H]");
        smirks.add("[H][C:1][C:2][H]>>[H][C:1][H].[H][C:2][H]");
        // smirks.add("[C:1][C:2]>>[C:1][H].[C:2][H]");
        rdb = new ReactionDataBase(smirks);
        System.out.println("ReactionDB:\n" + rdb.toString());
    } else {
        rdb = new ReactionDataBase(reactionDBFileName);
    }
    System.out.println("Staring material DB:");
    for (String s : startMatSmi) System.out.println("   " + s);
    System.out.println();
    System.out.println("Target: " + targetSmiles);
    IAtomContainer target = SmartsHelper.getMoleculeFromSmiles(targetSmiles);
    SMIRKSManager smrkMan0 = new SMIRKSManager(SilentChemObjectBuilder.getInstance());
    rdb.configureGenericReactions(smrkMan0);
    ReactionSequence rseq = new ReactionSequence();
    rseq.setStrategy(SyntheticStrategy.getDefaultSyntheticStrategy());
    SMIRKSManager smrkMan = rseq.getSmrkMan();
    // setup smrkMan
    smrkMan.setFlagProcessResultStructures(true);
    smrkMan.setFlagClearHybridizationBeforeResultProcess(true);
    smrkMan.setFlagClearImplicitHAtomsBeforeResultProcess(false);
    smrkMan.setFlagClearAromaticityBeforeResultProcess(true);
    smrkMan.setFlagAddImplicitHAtomsOnResultProcess(false);
    smrkMan.setFlagConvertAddedImplicitHToExplicitOnResultProcess(false);
    smrkMan.setFlagConvertExplicitHToImplicitOnResultProcess(false);
    smrkMan.setFlagApplyStereoTransformation(false);
    smrkMan.setFlagHAtomsTransformation(false);
    // smrkMan.setFlagHAtomsTransformationMode(FlagHAtomsTransformationMode);
    smrkMan.setFlagAromaticityTransformation(false);
    rseq.setReactDB(rdb);
    rseq.setStartMatDB(smdb);
    rseq.setTarget(target);
    rseq.initilize();
    if (isRandomStrategy) {
        ReactionSequenceLevel level = rseq.getFirstLevel();
        rseq.iterateLevelMoleculesRandomly(level);
        for (int i = 0; i < 30; i++) {
            level = level.nextLevel;
            if (level == null)
                break;
            rseq.iterateLevelMoleculesRandomly(level);
        }
    } else {
        ReactionSequenceLevel level = rseq.getFirstLevel();
        rseq.iterateLevelMolecules(level);
        for (int i = 0; i < 30; i++) {
            level = level.nextLevel;
            if (level == null)
                break;
            rseq.iterateLevelMolecules(level);
        }
    }
    System.out.println("ReactionSequence:\n" + rseq.toString());
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) StartingMaterialsDataBase(ambit2.reactions.retrosynth.StartingMaterialsDataBase) SMIRKSManager(ambit2.smarts.SMIRKSManager) ArrayList(java.util.ArrayList) ReactionDataBase(ambit2.reactions.ReactionDataBase) ReactionSequence(ambit2.reactions.retrosynth.ReactionSequence) ReactionSequenceLevel(ambit2.reactions.retrosynth.ReactionSequenceLevel)

Aggregations

StartingMaterialsDataBase (ambit2.reactions.retrosynth.StartingMaterialsDataBase)3 StartMaterialData (ambit2.reactions.retrosynth.StartingMaterialsDataBase.StartMaterialData)2 Entry (java.util.Map.Entry)2 ReactionDataBase (ambit2.reactions.ReactionDataBase)1 ReactionSequence (ambit2.reactions.retrosynth.ReactionSequence)1 ReactionSequenceLevel (ambit2.reactions.retrosynth.ReactionSequenceLevel)1 SMIRKSManager (ambit2.smarts.SMIRKSManager)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)1