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);
}
}
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);
}
}
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());
}
Aggregations