Skip to content

Commit

Permalink
Merge branch '28-add-result-annotations-to-nightsky-api' into 'master'
Browse files Browse the repository at this point in the history
Resolve "add result Annotations to Nightsky API"

Closes #47 and #28

See merge request bright-giant/sirius/sirius-frontend!17
  • Loading branch information
Markus Fleischauer committed Oct 30, 2023
2 parents 25dd696 + d6f54b7 commit fa73ed0
Show file tree
Hide file tree
Showing 22 changed files with 593 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
package de.unijena.bioinf.ms.middleware.controller;

import de.unijena.bioinf.ms.middleware.model.SearchQueryType;
import de.unijena.bioinf.ms.middleware.model.annotations.*;
import de.unijena.bioinf.ms.middleware.model.features.AlignedFeature;
import de.unijena.bioinf.ms.middleware.model.features.annotations.*;
import de.unijena.bioinf.ms.middleware.model.spectra.AnnotatedSpectrum;
import de.unijena.bioinf.ms.middleware.service.projects.ProjectsProvider;
import io.swagger.v3.oas.annotations.Hidden;
Expand Down Expand Up @@ -111,12 +111,12 @@ public void deleteAlignedFeature(@PathVariable String projectId, @PathVariable S
* @return StructureCandidate of this feature (aligned over runs) candidate with specified optional fields.
*/
@GetMapping(value = "/{alignedFeatureId}/structures", produces = MediaType.APPLICATION_JSON_VALUE)
public Page<StructureCandidateExt> getStructureCandidates(
public Page<StructureCandidateFormula> getStructureCandidates(
@PathVariable String projectId, @PathVariable String alignedFeatureId,
@ParameterObject Pageable pageable,
@RequestParam(required = false) String searchQuery,
@RequestParam(defaultValue = "LUCENE") SearchQueryType querySyntax,
@RequestParam(defaultValue = "") EnumSet<StructureCandidate.OptFields> optFields
@RequestParam(defaultValue = "") EnumSet<StructureCandidateScored.OptFields> optFields
) {
return projectsProvider.getProjectOrThrow(projectId)
.findStructureCandidatesByFeatureId(alignedFeatureId, pageable, optFields);
Expand Down Expand Up @@ -177,12 +177,12 @@ public FormulaCandidate getFormulaCandidate(
* @return StructureCandidate of this formula candidate with specified optional fields.
*/
@GetMapping(value = "/{alignedFeatureId}/formulas/{formulaId}/structures", produces = MediaType.APPLICATION_JSON_VALUE)
public Page<StructureCandidate> getStructureCandidatesByFormula(
public Page<StructureCandidateScored> getStructureCandidatesByFormula(
@PathVariable String projectId, @PathVariable String alignedFeatureId, @PathVariable String formulaId,
@ParameterObject Pageable pageable,
@RequestParam(required = false) String searchQuery,
@RequestParam(defaultValue = "LUCENE") SearchQueryType querySyntax,
@RequestParam(defaultValue = "") EnumSet<StructureCandidate.OptFields> optFields
@RequestParam(defaultValue = "") EnumSet<StructureCandidateScored.OptFields> optFields
) {
return projectsProvider.getProjectOrThrow(projectId)
.findStructureCandidatesByFeatureIdAndFormulaId(formulaId, alignedFeatureId, pageable, optFields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import de.unijena.bioinf.ChemistryBase.fp.Fingerprint;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import de.unijena.bioinf.ChemistryBase.fp.NPCFingerprintVersion;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import de.unijena.bioinf.ChemistryBase.fp.ClassyfireProperty;
import de.unijena.bioinf.ChemistryBase.fp.FPIter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This file is part of the SIRIUS library for analyzing MS and MS/MS data
*
* Copyright (C) 2013-2020 Kai Dührkop, Markus Fleischauer, Marcus Ludwig, Martin A. Hoffman, Fleming Kretschmer and Sebastian Böcker,
* Chair of Bioinformatics, Friedrich-Schilller University.
* Chair of Bioinformatics, Friedrich-Schiller University.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -18,7 +18,7 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import de.unijena.bioinf.ChemistryBase.fp.ClassyfireProperty;
import de.unijena.bioinf.ChemistryBase.fp.NPCFingerprintVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This file is part of the SIRIUS library for analyzing MS and MS/MS data
*
* Copyright (C) 2013-2020 Kai Dührkop, Markus Fleischauer, Marcus Ludwig, Martin A. Hoffman, Fleming Kretschmer and Sebastian Böcker,
* Chair of Bioinformatics, Friedrich-Schilller University.
* Chair of Bioinformatics, Friedrich-Schiller University.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -18,8 +18,7 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/


package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import de.unijena.bioinf.ChemistryBase.fp.*;
import de.unijena.bioinf.canopus.CanopusResult;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
*
* This file is part of the SIRIUS library for analyzing MS and MS/MS data
*
* Copyright (C) 2013-2020 Kai Dührkop, Markus Fleischauer, Marcus Ludwig, Martin A. Hoffman, Fleming Kretschmer and Sebastian Böcker,
* Chair of Bioinformatics, Friedrich-Schilller University.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.annotations;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import java.util.List;

@Getter
@Setter
@SuperBuilder
abstract class ConsensusAnnotations {

/**
* Molecular formula of the consensus annotation
* Might be null if no consensus formula is available.
*/
protected String molecularFormula;

/**
* Compound classes (predicted with CANOPUS) corresponding to the molecularFormula
* Might be null if no fingerprints or compound classes are available.
*/
protected CompoundClasses compoundClasses;

/**
* FeatureIds where the topAnnotation supports this annotation.
*/
protected List<String> supportingFeatureIds;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
*
* This file is part of the SIRIUS library for analyzing MS and MS/MS data
*
* Copyright (C) 2013-2020 Kai Dührkop, Markus Fleischauer, Marcus Ludwig, Martin A. Hoffman, Fleming Kretschmer and Sebastian Böcker,
* Chair of Bioinformatics, Friedrich-Schilller University.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.annotations;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

@Getter
@Setter
@SuperBuilder
public class ConsensusAnnotationsCSI extends ConsensusAnnotations {
public enum Criterion {
MAJORITY_STRUCTURE,
CONFIDENCE_STRUCTURE,
SINGLETON_STRUCTURE,
MAJORITY_FORMULA,
TOP_FORMULA,
SINGLETON_FORMULA
}


/**
* Null if this is a custom selection
*/
protected Criterion selectionCriterion;

/**
* Database structure candidate (searched with CSI:FingerID), that also defines the molecularFormula
* Might be null if no consensus structure is available.
*/
protected StructureCandidate csiFingerIdStructure;

/**
* Confidence value that represents the certainty that reported consensus structure is exactly the measured one
* If multiple features support this consensus structure the maximum confidence is reported
*/
protected Double confidenceExactMatch;

/**
* Confidence value that represents the certainty that the exact consensus structure or a very similar
* structure (e.g. measured by Maximum Common Edge Subgraph Distance) is the measured one.
* If multiple features support this consensus structure the maximum confidence is reported
*/
protected Double confidenceApproxMatch;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
*
* This file is part of the SIRIUS library for analyzing MS and MS/MS data
*
* Copyright (C) 2013-2020 Kai Dührkop, Markus Fleischauer, Marcus Ludwig, Martin A. Hoffman, Fleming Kretschmer and Sebastian Böcker,
* Chair of Bioinformatics, Friedrich-Schilller University.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.annotations;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

@Getter
@Setter
@SuperBuilder
public class ConsensusAnnotationsDeNovo extends ConsensusAnnotations{
public enum Criterion {
MAJORITY_FORMULA,
TOP_FORMULA,
SINGLETON_FORMULA
}

protected Criterion selectionCriterion;

// /**
// * DeNovo Structure candidate (predicted with MSNovelist) corresponding to the molecularFormula
// * Might be null if no consensus structure is available.
// */
// protected StructureCandidate structureMsNovelist;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,32 @@
* You should have received a copy of the GNU Affero General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;

/**
* Summary of the results of a feature (aligned over runs). Can be added to a AlignedFeature.
* It is null within a AlignedFeature if it was not requested und non-null otherwise.
* The different annotation fields within this summary object are null if the corresponding
* feature does not contain the represented results. If fields are non-null
* the corresponding result has been computed but might still be empty.
* */
@Getter
@Setter
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Annotations {
//result previews
public class FeatureAnnotations {
/**
* Best matching FormulaCandidate.
*/
protected FormulaCandidate formulaAnnotation; // SIRIUS + ZODIAC
protected StructureCandidate structureAnnotation; // CSI:FingerID
/**
* Best matching StructureCandidate ranked by CSI:FingerID Score over all FormulaCandidates.
*/
protected StructureCandidateScored structureAnnotation; // CSI:FingerID or MSNovelist
/**
* Best matching compound classes that correspond to the formulaAnnotation
*/
protected CompoundClasses compoundClassAnnotation; // CANOPUS
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,12 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/


package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import com.fasterxml.jackson.annotation.JsonInclude;
import de.unijena.bioinf.ChemistryBase.ms.Deviation;
import de.unijena.bioinf.ChemistryBase.ms.ft.FTree;
import de.unijena.bioinf.GibbsSampling.ZodiacScore;
import de.unijena.bioinf.ms.middleware.model.spectra.AnnotatedSpectrum;
import de.unijena.bioinf.projectspace.FormulaResult;
import de.unijena.bioinf.projectspace.FormulaResultId;
import de.unijena.bioinf.projectspace.FormulaScoring;
import de.unijena.bioinf.sirius.FTreeMetricsHelper;
import de.unijena.bioinf.sirius.scores.IsotopeScore;
import de.unijena.bioinf.sirius.scores.SiriusScore;
import de.unijena.bioinf.sirius.scores.TreeScore;
import lombok.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Molecular formula candidate that holds a unique identifier (molecular formula + adduct).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This file is part of the SIRIUS library for analyzing MS and MS/MS data
*
* Copyright (C) 2013-2020 Kai Dührkop, Markus Fleischauer, Marcus Ludwig, Martin A. Hoffman, Fleming Kretschmer and Sebastian Böcker,
* Chair of Bioinformatics, Friedrich-Schilller University.
* Chair of Bioinformatics, Friedrich-Schiller University.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -18,7 +18,7 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import de.unijena.bioinf.ChemistryBase.ms.AnnotatedPeak;
import de.unijena.bioinf.ChemistryBase.ms.Deviation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* You should have received a copy of the GNU Lesser General Public License along with SIRIUS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>
*/

package de.unijena.bioinf.ms.middleware.model.features.annotations;
package de.unijena.bioinf.ms.middleware.model.annotations;

import lombok.Getter;
import lombok.Setter;
Expand Down
Loading

0 comments on commit fa73ed0

Please sign in to comment.