Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add literature references to peak identifiers #1929

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.chemclipse.model;bundle-version="0.8.0",
org.eclipse.chemclipse.csd.model;bundle-version="0.8.0",
org.eclipse.chemclipse.processing;bundle-version="0.8.0",
org.eclipse.chemclipse.logging;bundle-version="0.8.0"
org.eclipse.chemclipse.logging;bundle-version="0.8.0",
org.eclipse.chemclipse.support;bundle-version="0.9.0"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.chemclipse.chromatogram.csd.identifier.impl,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2019 Lablicate GmbH.
* Copyright (c) 2018, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -12,12 +12,18 @@
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.csd.identifier.peak;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.chemclipse.chromatogram.csd.identifier.settings.IIdentifierSettingsCSD;
import org.eclipse.chemclipse.csd.model.core.IPeakCSD;
import org.eclipse.chemclipse.model.exceptions.ValueMustNotBeNullException;
import org.eclipse.chemclipse.support.literature.LiteratureReference;

public abstract class AbstractPeakIdentifierCSD<T> implements IPeakIdentifierCSD<T> {

private List<LiteratureReference> literatureReferences = new ArrayList<>();

/**
* Validates that the peak is not null.<br/>
* If yes, an exception will be thrown.
Expand All @@ -44,4 +50,10 @@ public void validateSettings(IIdentifierSettingsCSD identifierSettings) throws V
throw new ValueMustNotBeNullException("The identifier settings must not be null.");
}
}

@Override
public List<LiteratureReference> getLiteratureReferences() {

return literatureReferences;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Lablicate GmbH.
* Copyright (c) 2018, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -17,6 +17,7 @@
import org.eclipse.chemclipse.chromatogram.csd.identifier.settings.IPeakIdentifierSettingsCSD;
import org.eclipse.chemclipse.csd.model.core.IPeakCSD;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.chemclipse.support.literature.LiteratureReference;
import org.eclipse.core.runtime.IProgressMonitor;

public interface IPeakIdentifierCSD<T> {
Expand All @@ -30,4 +31,6 @@ public interface IPeakIdentifierCSD<T> {
* @return {@link IProcessingInfo}
*/
IProcessingInfo<T> identify(List<? extends IPeakCSD> peaks, IPeakIdentifierSettingsCSD peakIdentifierSettings, IProgressMonitor monitor);

List<LiteratureReference> getLiteratureReferences();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2023 Lablicate GmbH.
* Copyright (c) 2008, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -125,6 +125,7 @@ public static IPeakIdentifierSupportCSD getPeakIdentifierSupport() {
try {
IPeakIdentifierSettingsCSD instance = (IPeakIdentifierSettingsCSD)element.createExecutableExtension(Identifier.IDENTIFIER_SETTINGS);
supplier.setIdentifierSettingsClass(instance.getClass());
supplier.getLiteratureReferences().addAll(instance.getLiteratureReferences());
} catch(CoreException e) {
logger.error(e);
// settings class is optional, set null instead
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2023 Lablicate GmbH.
* Copyright (c) 2019, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -64,6 +64,7 @@ private static final class PeakIdentifierProcessorSupplier extends ChromatogramS
public PeakIdentifierProcessorSupplier(IPeakIdentifierSupplierCSD supplier, IProcessTypeSupplier parent) {

super("PeakIdentifierCSD." + supplier.getId(), supplier.getIdentifierName(), supplier.getDescription(), (Class<IPeakIdentifierSettingsCSD>)supplier.getSettingsClass(), parent, DataType.CSD); //$NON-NLS-1$
getLiteratureReferences().addAll(supplier.getLiteratureReferences());
this.supplier = supplier;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2018 Lablicate GmbH.
* Copyright (c) 2008, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -12,11 +12,16 @@
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.msd.identifier.peak;

import java.util.List;

import org.eclipse.chemclipse.chromatogram.msd.identifier.settings.IPeakIdentifierSettingsMSD;
import org.eclipse.chemclipse.model.identifier.core.ISupplier;
import org.eclipse.chemclipse.support.literature.LiteratureReference;

public interface IPeakIdentifierSupplierMSD extends ISupplier {

@Override
Class<? extends IPeakIdentifierSettingsMSD> getSettingsClass();

List<LiteratureReference> getLiteratureReferences();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2022 Lablicate GmbH.
* Copyright (c) 2008, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -127,6 +127,7 @@ public static IPeakIdentifierSupportMSD getPeakIdentifierSupport() {
try {
IPeakIdentifierSettingsMSD instance = (IPeakIdentifierSettingsMSD)element.createExecutableExtension(Identifier.IDENTIFIER_SETTINGS);
supplier.setIdentifierSettingsClass(instance.getClass());
supplier.getLiteratureReferences().addAll(instance.getLiteratureReferences());
} catch(CoreException e) {
logger.warn(e);
// settings class is optional, set null instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private static final class PeakIdentifierProcessorSupplier extends ChromatogramS
public PeakIdentifierProcessorSupplier(IPeakIdentifierSupplierMSD supplier, IProcessTypeSupplier parent) {

super("PeakIdentifierMSD." + supplier.getId(), supplier.getIdentifierName(), supplier.getDescription(), (Class<IPeakIdentifierSettingsMSD>)supplier.getSettingsClass(), parent, DataType.MSD);
getLiteratureReferences().addAll(supplier.getLiteratureReferences());
this.supplier = supplier;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2021 Lablicate GmbH.
* Copyright (c) 2018, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -12,12 +12,18 @@
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.wsd.identifier.peak;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.chemclipse.chromatogram.wsd.identifier.settings.IIdentifierSettingsWSD;
import org.eclipse.chemclipse.model.exceptions.ValueMustNotBeNullException;
import org.eclipse.chemclipse.support.literature.LiteratureReference;
import org.eclipse.chemclipse.wsd.model.core.IPeakWSD;

public abstract class AbstractPeakIdentifierWSD<T> implements IPeakIdentifierWSD<T> {

private List<LiteratureReference> literatureReferences = new ArrayList<>();

/**
* Validates that the peak is not null.<br/>
* If yes, an exception will be thrown.
Expand All @@ -44,4 +50,10 @@ public void validateSettings(IIdentifierSettingsWSD identifierSettings) throws V
throw new ValueMustNotBeNullException("The identifier settings must not be null.");
}
}

@Override
public List<LiteratureReference> getLiteratureReferences() {

return literatureReferences;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2021 Lablicate GmbH.
* Copyright (c) 2018, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -16,6 +16,7 @@

import org.eclipse.chemclipse.chromatogram.wsd.identifier.settings.IPeakIdentifierSettingsWSD;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.chemclipse.support.literature.LiteratureReference;
import org.eclipse.chemclipse.wsd.model.core.IPeakWSD;
import org.eclipse.core.runtime.IProgressMonitor;

Expand All @@ -30,4 +31,6 @@ public interface IPeakIdentifierWSD<T> {
* @return {@link IProcessingInfo}
*/
IProcessingInfo<T> identify(List<? extends IPeakWSD> peaks, IPeakIdentifierSettingsWSD peakIdentifierSettings, IProgressMonitor monitor);

List<LiteratureReference> getLiteratureReferences();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2023 Lablicate GmbH.
* Copyright (c) 2008, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -124,6 +124,7 @@ public static IPeakIdentifierSupportWSD getPeakIdentifierSupport() {
try {
IPeakIdentifierSettingsWSD instance = (IPeakIdentifierSettingsWSD)element.createExecutableExtension(Identifier.IDENTIFIER_SETTINGS);
supplier.setIdentifierSettingsClass(instance.getClass());
supplier.getLiteratureReferences().addAll(instance.getLiteratureReferences());
} catch(CoreException e) {
logger.error(e);
// settings class is optional, set null instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private static final class PeakIdentifierProcessorSupplier extends ChromatogramS
public PeakIdentifierProcessorSupplier(IPeakIdentifierSupplierWSD supplier, IProcessTypeSupplier parent) {

super("PeakIdentifierWSD." + supplier.getId(), supplier.getIdentifierName(), supplier.getDescription(), (Class<IPeakIdentifierSettingsWSD>)supplier.getSettingsClass(), parent, DataType.WSD);
getLiteratureReferences().addAll(supplier.getLiteratureReferences());
this.supplier = supplier;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.eclipse.chemclipse.msd.model.core.IPeakMSD;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.chemclipse.processing.core.ProcessingInfo;
import org.eclipse.chemclipse.support.literature.LiteratureReference;
import org.eclipse.chemclipse.wsd.model.core.IPeakWSD;
import org.eclipse.core.runtime.IProgressMonitor;

Expand Down Expand Up @@ -89,4 +90,10 @@ private IProcessingInfo<IPeakIdentificationResults> runIdentification(List<? ext
//
return processingInfo;
}

@Override
public List<LiteratureReference> getLiteratureReferences() {

return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2018 Lablicate GmbH.
* Copyright (c) 2008, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -12,14 +12,19 @@
*******************************************************************************/
package org.eclipse.chemclipse.model.identifier.core;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.chemclipse.model.identifier.IIdentifierSettings;
import org.eclipse.chemclipse.support.literature.LiteratureReference;

public abstract class AbstractSupplier<S extends IIdentifierSettings> implements ISupplierSetter {

private String description = "";
private String id = "";
private String identifierName = "";
private Class<? extends S> identifierSettingsClass;
private List<LiteratureReference> literatureReference = new ArrayList<>();

@Override
public boolean equals(final Object otherObject) {
Expand Down Expand Up @@ -95,6 +100,12 @@ public void setIdentifierSettingsClass(Class<? extends S> identifierSettingsClas
this.identifierSettingsClass = identifierSettingsClass;
}

@Override
public List<LiteratureReference> getLiteratureReferences() {

return literatureReference;
}

@Override
public String toString() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018 Lablicate GmbH.
* Copyright (c) 2018, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -11,7 +11,10 @@
*******************************************************************************/
package org.eclipse.chemclipse.model.identifier.core;

import java.util.List;

import org.eclipse.chemclipse.model.identifier.IIdentifierSettings;
import org.eclipse.chemclipse.support.literature.LiteratureReference;

public interface ISupplier {

Expand Down Expand Up @@ -43,4 +46,6 @@ public interface ISupplier {
* @return
*/
Class<? extends IIdentifierSettings> getSettingsClass();

List<LiteratureReference> getLiteratureReferences();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023 Lablicate GmbH.
* Copyright (c) 2023, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -21,6 +21,7 @@
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.identifier.IIdentifierSettings;
import org.eclipse.chemclipse.model.identifier.ILibraryInformation;
import org.eclipse.chemclipse.support.literature.LiteratureReference;
import org.eclipse.chemclipse.xxd.identifier.supplier.pubchem.rest.PowerUserGateway;

public class PubChemExternalTargetIdentifier implements ITargetIdentifierSupplier {
Expand Down Expand Up @@ -70,4 +71,10 @@ public URL getURL(ILibraryInformation libraryInformation) {
}
return url;
}

@Override
public List<LiteratureReference> getLiteratureReferences() {

return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023 Lablicate GmbH.
* Copyright (c) 2023, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -15,12 +15,14 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;

import org.eclipse.chemclipse.chromatogram.xxd.identifier.targets.ITargetIdentifierSupplier;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.cas.CasSupport;
import org.eclipse.chemclipse.model.identifier.IIdentifierSettings;
import org.eclipse.chemclipse.model.identifier.ILibraryInformation;
import org.eclipse.chemclipse.support.literature.LiteratureReference;
import org.eclipse.chemclipse.xxd.identifier.supplier.wikidata.query.QueryEntity;

public class WikidataExternalTargetIdentifier implements ITargetIdentifierSupplier {
Expand Down Expand Up @@ -76,4 +78,10 @@ public URL getURL(ILibraryInformation libraryInformation) {
}
return null;
}

@Override
public List<LiteratureReference> getLiteratureReferences() {

return null;
}
}