use of de.unijena.bioinf.chemdb.DBLink in project mzmine2 by mzmine.
the class SiriusCompound method loadProps.
/**
* Construct parameters from SiriusIonAnnotation Amount of params differ, either it is identified
* by SiriusIdentificationMethod, or also by FingerIdWebMethod
*
* @param annotation
* @return constructed Hashtable
*/
private static Hashtable<String, String> loadProps(final SiriusIonAnnotation annotation) {
String formula = MolecularFormulaManipulator.getString(annotation.getFormula());
String siriusScore = String.format("%.4f", annotation.getSiriusScore());
String name = null;
/* Put default properties */
Hashtable<String, String> props = new Hashtable<>(10);
props.put(PROPERTY_METHOD, "Sirius");
props.put(PROPERTY_FORMULA, formula);
props.put("Sirius score", siriusScore);
/* Check that annotation is processed by FingerIdWebMethod */
if (annotation.getFingerIdScore() != null) {
name = annotation.getDescription();
String inchi = annotation.getInchiKey();
String smiles = annotation.getSMILES();
props.put("SMILES", smiles);
props.put("Inchi", inchi);
String fingerScore = String.format("%.4f", annotation.getFingerIdScore());
props.put("FingerId score", fingerScore);
DBLink[] links = annotation.getDBLinks();
Set<String> dbnames = new HashSet<>();
/*
* DBLinks may contain several links to Pubchem (for example)
*/
for (DBLink link : links) {
dbnames.add(link.name);
}
String[] dbs = new String[dbnames.size()];
dbs = dbnames.toArray(dbs);
for (String db : dbs) props.put(db, "FOUND");
}
// Load name param with formula, if FingerId did not identify it
if (name == null)
name = formula;
props.put(PROPERTY_NAME, name);
return props;
}
use of de.unijena.bioinf.chemdb.DBLink in project mzmine2 by mzmine.
the class SiriusCompound method getDBS.
/**
* @return unique names of the databases
*/
public String[] getDBS() {
DBLink[] dblinks = getIonAnnotation().getDBLinks();
if (dblinks == null)
return null;
Set<String> dbNames = new TreeSet<String>();
for (DBLink link : dblinks) dbNames.add(link.name);
String[] dbs = new String[dbNames.size()];
dbs = dbNames.toArray(dbs);
return dbs;
}
use of de.unijena.bioinf.chemdb.DBLink in project mzmine2 by mzmine.
the class DBTableModel method addElement.
/**
* Method unwraps SiriusCompound and retrieves all the DB links Adds DB links one by one into the
* table
*
* @param compound
*/
public void addElement(SiriusCompound compound) {
SiriusIonAnnotation annotation = compound.getIonAnnotation();
DBLink[] links = annotation.getDBLinks();
if (links == null)
return;
for (DBLink link : links) {
compounds.add(new SiriusDBCompound(link.name, link.id));
fireTableRowsInserted(compounds.size() - 1, compounds.size() - 1);
}
}
Aggregations