-
Notifications
You must be signed in to change notification settings - Fork 1
7. Network and tree analysis examples
Example analyses of the generated tree or network graphs (see article for details).
ScaffoldGenerator tmpScaffoldGen = new ScaffoldGenerator();
SmilesParser tmpSmiPar = new SmilesParser(SilentChemObjectBuilder.getInstance());
SmilesGenerator tmpSmiGen = tmpScaffoldGen.getSmilesGenerator();
IAtomContainer tmpDiazepam = tmpSmiPar.parseSmiles("CN1C(=O)CN=C(C2=C1C=CC(=C2)Cl)C3=CC=CC=C3");

IAtomContainer tmpBromazepam = tmpSmiPar.parseSmiles("C1C(=O)NC2=C(C=C(C=C2)Br)C(=N1)C3=CC=CC=N3");

IAtomContainer tmpZolazepam = tmpSmiPar.parseSmiles("CC1=NN(C2=C1C(=NCC(=O)N2C)C3=CC=CC=C3F)C");

List tmpInputMolecules = Arrays.asList(tmpDiazepam, tmpBromazepam, tmpZolazepam);
ScaffoldNetwork tmpDiazepinonesNetwork =
tmpScaffoldGen.generateScaffoldNetwork(tmpInputMolecules);
ScaffoldTree tmpDiazepinonesTree =
tmpScaffoldGen.generateSchuffenhauerForest(tmpInputMolecules).get(0);
IAtomContainer tmpBenzene = tmpSmiPar.parseSmiles("c1ccccc1");

//false, the Benzene parent scaffold is not prioritised according to the scaffold tree rules
System.out.println("\nDiazepinones tree contains benzene: "
+ tmpDiazepinonesTree.containsMolecule(tmpBenzene));
//true, scaffold network contains all possible parent scaffolds
System.out.println("\nDiazepinones network contains benzene: "
+ tmpDiazepinonesNetwork.containsMolecule(tmpBenzene));
NetworkNode tmpBenzeneNetworkNode =
(NetworkNode) tmpDiazepinonesNetwork.getNode(tmpBenzene);
System.out.println("Level of Benzene node: " + tmpBenzeneNetworkNode.getLevel());
System.out.println("Benzene is a root node in the network (\"orphan\", does not have parents): "
+ tmpBenzeneNetworkNode.isOrphan());
System.out.println("Benzene is a leaf node in the network (does not have children): "
+ tmpBenzeneNetworkNode.isLeaf());
System.out.println("Direct children of Benzene network node:");
for (Object tmpParentNode : tmpBenzeneNetworkNode.getChildren()) {
System.out.println(tmpSmiGen.create(
(IAtomContainer)((NetworkNode)tmpParentNode).getMolecule()));
}
//origin: input molecules that possess the respective scaffold,
// or it is generated as a parent scaffold of their scaffold
System.out.println("Number of origin molecules of Benzene: "
+ tmpBenzeneNetworkNode.getOriginCount());
System.out.println("List of origins as SMILES strings:");
List tmpOriginSmiles = tmpBenzeneNetworkNode.getOriginSmilesList();
for (String tmpOriginSmilesString : tmpOriginSmiles) {
System.out.println(tmpOriginSmilesString);
}
//virtual origin: the scaffold was only created as a parent scaffold for the respective input molecule
//non-virtual origin: the scaffold was the primary extracted scaffold of the input molecule (i.e. extracted using getScaffold())
System.out.println("Benzene has non-virtual origin molecules in the network: "
+ tmpBenzeneNetworkNode.hasNonVirtualOriginSmiles());
System.out.println("Non-virtual origin count: "
+ tmpBenzeneNetworkNode.getNonVirtualOriginCount());
//empty list, no benzene derivative was among the input molecules,
// the scaffold was only generated as a parent scaffold
System.out.println("List of non-virtual origins as SMILES strings:");
List tmpNonVirtualOriginSmiles =
tmpBenzeneNetworkNode.getNonVirtualOriginSmilesList();
for (String tmpNonVirtualOriginSmilesString : tmpNonVirtualOriginSmiles) {
System.out.println(tmpNonVirtualOriginSmilesString);
}
//following analysis produces the three input molecules and their scaffolds
// in this example because they all had the same number of rings.
//this way, there are no scaffolds on lower levels that have non-virtual origins
System.out.println("\nSearching for scaffolds with non-virtual origins in the network: ");
for (ScaffoldNodeBase tmpNode : tmpDiazepinonesNetwork.getAllNodes()) {
if (tmpNode.hasNonVirtualOriginSmiles()) {
System.out.println("\nNetwork scaffold: " + tmpSmiGen.create(
(IAtomContainer) tmpNode.getMolecule()));
System.out.println("Non-virtual origin molecules: ");
for (Object tmpSMILES : tmpNode.getNonVirtualOriginSmilesList()) {
System.out.println(tmpSMILES);
}
}
}
Output:
Diazepinones tree contains benzene: false
Diazepinones network contains benzene: true
Level of Benzene node: 0
Benzene is a root node in the network ("orphan", does not have parents): true
Benzene is a leaf node in the network (does not have children): false
Direct children of Benzene network node:
O=C1Nc2ccccc2C=NC1

O=C1NC=CC(=NC1)c2ccccc2

Number of origin molecules of Benzene: 3
List of origins as SMILES strings:
O=C1N(C=2C=CC(Cl)=CC2C(=NC1)C3=CC=CC=C3)C

O=C1NC=2C=CC(Br)=CC2C(=NC1)C=3N=CC=CC3

O=C1N(C2=C(C(=NC1)C3=CC=CC=C3F)C(=NN2C)C)C

Benzene has non-virtual origin molecules in the network: false
Non-virtual origin count: 0
List of non-virtual origins as SMILES strings:
Searching for scaffolds with non-virtual origins in the network:
Network scaffold: O=C1Nc2ccccc2C(=NC1)c3ccccc3

Non-virtual origin molecules:
O=C1N(C=2C=CC(Cl)=CC2C(=NC1)C3=CC=CC=C3)C

Network scaffold: O=C1Nc2ccccc2C(=NC1)c3ncccc3

Non-virtual origin molecules:
O=C1NC=2C=CC(Br)=CC2C(=NC1)C=3N=CC=CC3

Network scaffold: O=C1Nc2[nH]ncc2C(=NC1)c3ccccc3

Non-virtual origin molecules:
O=C1N(C2=C(C(=NC1)C3=CC=CC=C3F)C(=NN2C)C)C
