use of de.ipbhalle.metfraglib.fragmenter.TopDownNeutralLossFragmenter in project MetFragRelaunched by ipb-halle.
the class MetfRag method generateAllFragments.
/**
* @param molecule
* @param maximumTreeDepth
* @return
*/
public static IAtomContainer[] generateAllFragments(IAtomContainer molecule, int maximumTreeDepth) {
Logger.getLogger("net.sf.jnati.deploy.artefact.ConfigManager").setLevel(Level.ERROR);
Logger.getLogger("net.sf.jnati.deploy.repository.ClasspathRepository").setLevel(Level.ERROR);
Logger.getLogger("net.sf.jnati.deploy.repository.LocalRepository").setLevel(Level.ERROR);
Logger.getLogger("net.sf.jnati.deploy.artefact.ManifestReader").setLevel(Level.ERROR);
Logger.getLogger("net.sf.jnati.deploy.NativeArtefactLocator").setLevel(Level.ERROR);
Logger.getLogger("net.sf.jnati.deploy.NativeLibraryLoader").setLevel(Level.ERROR);
MetFragGlobalSettings settings = new MetFragGlobalSettings();
MoleculeFunctions.prepareAtomContainer(molecule, true);
ICandidate candidate = null;
try {
candidate = new TopDownPrecursorCandidate(MoleculeFunctions.getInChIInfoFromAtomContainer(molecule)[0], "1");
candidate.initialisePrecursorCandidate();
} catch (AtomTypeNotKnownFromInputListException e1) {
e1.printStackTrace();
return new IAtomContainer[0];
} catch (Exception e1) {
e1.printStackTrace();
return new IAtomContainer[0];
}
settings.set(VariableNames.CANDIDATE_NAME, candidate);
settings.set(VariableNames.MAXIMUM_TREE_DEPTH_NAME, (byte) 2);
settings.set(VariableNames.MINIMUM_FRAGMENT_MASS_LIMIT_NAME, 0.0);
settings.set(VariableNames.MAXIMUM_NUMBER_OF_TOPDOWN_FRAGMENT_ADDED_TO_QUEUE, (byte) maximumTreeDepth);
TopDownNeutralLossFragmenter fragmenter = null;
try {
fragmenter = new TopDownNeutralLossFragmenter(settings);
} catch (Exception e) {
e.printStackTrace();
}
FragmentList fragmentList = fragmenter.generateFragments();
IAtomContainer[] fragments = new IAtomContainer[fragmentList.getNumberElements()];
for (int i = 0; i < fragmentList.getNumberElements(); i++) {
fragments[i] = fragmentList.getElement(i).getStructureAsIAtomContainer(candidate.getPrecursorMolecule());
}
return fragments;
}
Aggregations