Search in sources :

Example 1 with ProcessingStatus

use of de.ipbhalle.metfraglib.process.ProcessingStatus in project MetFragRelaunched by ipb-halle.

the class MetFusionMoNASpectralSimilarityInitialiser method initScoreParameters.

@Override
public void initScoreParameters(Settings settings) throws Exception {
    /*
		 * 
		 */
    // initialise MoNA web service
    MoNARestWebService webService = new MoNARestWebService(settings);
    ((ProcessingStatus) settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME)).setProcessStatusString("Retrieving Results from MoNA");
    CandidateList candidatesFromMoNA = null;
    try {
        candidatesFromMoNA = webService.performSpectrumSimilaritySearch();
    } catch (Exception e) {
        settings.set(VariableNames.METFUSION_MONA_SPECTRAL_SIMILARITY_CANDIDATES_NAME, new CandidateList());
        e.printStackTrace();
        return;
    }
    for (int i = 0; i < candidatesFromMoNA.getNumberElements(); i++) {
        IBitFingerprint fingerprint = TanimotoSimilarity.calculateFingerPrint(candidatesFromMoNA.getElement(i).getAtomContainer());
        candidatesFromMoNA.getElement(i).setProperty("Fingerprint", fingerprint);
    }
    settings.set(VariableNames.METFUSION_MONA_SPECTRAL_SIMILARITY_CANDIDATES_NAME, candidatesFromMoNA);
}
Also used : IBitFingerprint(org.openscience.cdk.fingerprint.IBitFingerprint) MoNARestWebService(de.ipbhalle.metfraglib.functions.MoNARestWebService) CandidateList(de.ipbhalle.metfraglib.list.CandidateList) ProcessingStatus(de.ipbhalle.metfraglib.process.ProcessingStatus) IBitFingerprint(org.openscience.cdk.fingerprint.IBitFingerprint)

Example 2 with ProcessingStatus

use of de.ipbhalle.metfraglib.process.ProcessingStatus in project MetFragRelaunched by ipb-halle.

the class OnlineExtendedPubChemDatabase method getCandidateByIdentifier.

/**
 * @throws Exception
 */
public ICandidate getCandidateByIdentifier(String identifier) throws Exception {
    ICandidate candidate = super.getCandidateByIdentifier(identifier);
    if (candidate == null)
        return null;
    ArrayList<String> cid = new ArrayList<String>();
    cid.add(identifier);
    ProcessingStatus processingStatus = null;
    if (this.settings.containsKey(VariableNames.PROCESS_STATUS_OBJECT_NAME) && this.settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME) != null)
        processingStatus = (ProcessingStatus) this.settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME);
    logger.info("Fetching PubMed references");
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving References");
    this.assignNumberOfPubMedReferences(cid);
    logger.info("Fetching patents");
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving Patents");
    this.assignNumberOfPatents(cid);
    this.addExtendedInformation(candidate);
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving Candidates");
    return candidate;
}
Also used : ArrayList(java.util.ArrayList) ProcessingStatus(de.ipbhalle.metfraglib.process.ProcessingStatus) ICandidate(de.ipbhalle.metfraglib.interfaces.ICandidate)

Example 3 with ProcessingStatus

use of de.ipbhalle.metfraglib.process.ProcessingStatus in project MetFragRelaunched by ipb-halle.

the class LocalExtendedMetChemDatabase method getCandidateByIdentifier.

public CandidateList getCandidateByIdentifier(ArrayList<String> identifiers) {
    CandidateList candidateList = super.getCandidateByIdentifier(identifiers);
    ArrayList<String> cids = new ArrayList<String>();
    for (int i = 0; i < candidateList.getNumberElements(); i++) {
        cids.add(candidateList.getElement(i).getIdentifier());
    }
    ProcessingStatus processingStatus = null;
    if (this.settings.containsKey(VariableNames.PROCESS_STATUS_OBJECT_NAME) && this.settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME) != null)
        processingStatus = (ProcessingStatus) this.settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME);
    logger.info("Fetching PubMed references");
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving References");
    this.assignNumberOfPubMedReferences(cids);
    logger.info("Fetching patents");
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving Patents");
    this.assignNumberOfPatents(cids);
    logger.info("Fetching XLogP");
    this.assignXlogpValues(cids);
    for (int i = 0; i < candidateList.getNumberElements(); i++) {
        this.addExtendedInformation(candidateList.getElement(i));
    }
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving Candidates");
    return candidateList;
}
Also used : ArrayList(java.util.ArrayList) CandidateList(de.ipbhalle.metfraglib.list.CandidateList) ProcessingStatus(de.ipbhalle.metfraglib.process.ProcessingStatus)

Example 4 with ProcessingStatus

use of de.ipbhalle.metfraglib.process.ProcessingStatus in project MetFragRelaunched by ipb-halle.

the class LocalExtendedPubChemDatabase method getCandidateByIdentifier.

public ICandidate getCandidateByIdentifier(String identifier) throws DatabaseIdentifierNotFoundException {
    ICandidate candidate = super.getCandidateByIdentifier(identifier);
    ArrayList<String> cid = new ArrayList<String>();
    cid.add(identifier);
    ProcessingStatus processingStatus = null;
    if (this.settings.containsKey(VariableNames.PROCESS_STATUS_OBJECT_NAME) && this.settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME) != null)
        processingStatus = (ProcessingStatus) this.settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME);
    logger.info("Fetching PubMed references");
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving References");
    this.assignNumberOfPubMedReferences(cid);
    logger.info("Fetching patents");
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving Patents");
    this.assignNumberOfPatents(cid);
    this.assignNumberOfPatents(cid);
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving Candidates");
    return candidate;
}
Also used : ArrayList(java.util.ArrayList) ProcessingStatus(de.ipbhalle.metfraglib.process.ProcessingStatus) ICandidate(de.ipbhalle.metfraglib.interfaces.ICandidate)

Example 5 with ProcessingStatus

use of de.ipbhalle.metfraglib.process.ProcessingStatus in project MetFragRelaunched by ipb-halle.

the class OnlineExtendedPubChemDatabase method getCandidateByIdentifier.

/**
 * @throws Exception
 */
public CandidateList getCandidateByIdentifier(java.util.ArrayList<String> identifiers) throws Exception {
    CandidateList candidates = super.getCandidateByIdentifier(identifiers);
    ArrayList<String> cids = new ArrayList<String>();
    for (int i = 0; i < candidates.getNumberElements(); i++) {
        cids.add(candidates.getElement(i).getIdentifier());
    }
    ProcessingStatus processingStatus = null;
    if (this.settings.containsKey(VariableNames.PROCESS_STATUS_OBJECT_NAME) && this.settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME) != null)
        processingStatus = (ProcessingStatus) this.settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME);
    logger.info("Fetching PubMed references");
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving References");
    this.assignNumberOfPubMedReferences(cids);
    logger.info("Fetching patents");
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving Patents");
    this.assignNumberOfPatents(cids);
    for (int i = 0; i < candidates.getNumberElements(); i++) {
        this.addExtendedInformation(candidates.getElement(i));
    }
    if (processingStatus != null)
        processingStatus.setRetrievingStatusString("Retrieving Candidates");
    return candidates;
}
Also used : ArrayList(java.util.ArrayList) CandidateList(de.ipbhalle.metfraglib.list.CandidateList) ProcessingStatus(de.ipbhalle.metfraglib.process.ProcessingStatus)

Aggregations

ProcessingStatus (de.ipbhalle.metfraglib.process.ProcessingStatus)7 ArrayList (java.util.ArrayList)6 CandidateList (de.ipbhalle.metfraglib.list.CandidateList)4 ICandidate (de.ipbhalle.metfraglib.interfaces.ICandidate)3 MoNARestWebService (de.ipbhalle.metfraglib.functions.MoNARestWebService)1 IBitFingerprint (org.openscience.cdk.fingerprint.IBitFingerprint)1