use of org.openscience.cdk.exception.CDKException in project Smiles2Monomers by yoann-dufresne.
the class ResidueCreator method removeExclusions.
/*
* Remove results corresponding to an exclusion in rule
*/
private void removeExclusions(List<List<RMap>> matches, String ex, IMolecule mol) {
// Verifying exclusions
boolean areExclusion = false;
IMolecule exclusionMol = null;
try {
exclusionMol = SmilesConverter.conv.transform(ex, false, false, true);
} catch (InvalidSmilesException e) {
System.err.println("Impossible to parse " + ex);
return;
}
try {
areExclusion = UniversalIsomorphismTester.isSubgraph(mol, exclusionMol);
} catch (CDKException e) {
e.printStackTrace();
}
if (areExclusion) {
List<RMap> toExclude = null;
boolean flag = false;
List<List<RMap>> exclusions = null;
try {
exclusions = UniversalIsomorphismTester.getSubgraphAtomsMaps(mol, exclusionMol);
} catch (CDKException e) {
e.printStackTrace();
}
for (List<RMap> exclusion : exclusions) {
for (List<RMap> match : matches) {
for (RMap rmMatch : match) {
for (RMap exId : exclusion) {
if (rmMatch.getId1() == exId.getId1()) {
flag = true;
break;
}
}
if (flag)
break;
}
if (flag) {
toExclude = match;
break;
}
}
if (flag) {
matches.remove(toExclude);
toExclude = null;
flag = false;
}
}
}
/**/
}
Aggregations