return StructureConverter.cmlToInChI(cml);
}
}
} else if(dealkylmatcher.matches()) {
StereoInChIToMolecule.primeCacheForInChI(inchi);
IMolecule mol = ConverterToInChI.getMolFromInChI(inchi);
StructureConverter.configureMolecule(mol);
//System.out.println(mol.getAtomCount());
mol = (IMolecule)mol.clone();
String atomStr = dealkylmatcher.group(2);
//if(atomStr == null) return null;
int alkylSize = 0;
String groupStr = dealkylmatcher.group(3);
if(groupStr.equals("methyl")) {
alkylSize = 1;
} else if(groupStr.equals("ethyl")) {
alkylSize = 2;
} else if(groupStr.equals("propyl")) {
alkylSize = 3;
} else if(groupStr.equals("butyl")) {
alkylSize = 4;
} else if(groupStr.equals("pentyl")) {
alkylSize = 5;
} else if(groupStr.equals("hexyl")) {
alkylSize = 6;
}
if(alkylSize == 0) return null;
//StructureConverter.configureMolecule(mol);
List<List<IAtom>> alkyl = getXAlkyl(mol, atomStr, alkylSize);
if(alkyl.size() == 2 && alkyl.get(0).size() == alkyl.get(1).size()) {
Set<IAtom> touching = new HashSet<IAtom>();
for(IAtom atom : alkyl.get(0)) {
touching.addAll((List<IAtom>)mol.getConnectedAtomsList(atom));
}
for(IAtom atom : alkyl.get(1)) {
touching.addAll((List<IAtom>)mol.getConnectedAtomsList(atom));
}
touching.removeAll(alkyl.get(0));
touching.removeAll(alkyl.get(1));
if(touching.size() == 1) alkyl.remove(1);
}
if(alkyl.size() != 1) return null;
Set<IAtom> touching = new HashSet<IAtom>();
for(IAtom atom : alkyl.get(0)) {
touching.addAll((List<IAtom>)mol.getConnectedAtomsList(atom));
//System.out.println(mol.getAtomCount());
mol.removeAtomAndConnectedElectronContainers(atom);
//System.out.println(mol.getAtomCount());
}
touching.removeAll(alkyl);
for(IAtom atom : touching) {