Skip to content

Commit

Permalink
Merge branch '59-paras-vs-params' into 'master'
Browse files Browse the repository at this point in the history
Renaming typos and bad name Choices

Closes #53, #54, #58, #57, and #59

See merge request bright-giant/sirius/sirius-frontend!18
  • Loading branch information
Markus Fleischauer committed Oct 30, 2023
2 parents fa73ed0 + d9ab081 commit 4a37c65
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void deleteAlignedFeature(@PathVariable String projectId, @PathVariable S

/**
* List of StructureCandidates for the given 'alignedFeatureId' with minimal information.
* StructureCandidates can be enriched with molecular fingerprint, structure database links and pubmed ids.
* StructureCandidates can be enriched with molecular fingerprint, structure database links.
*
* @param projectId project-space to read from.
* @param alignedFeatureId feature (aligned over runs) the structure candidates belong to.
Expand Down Expand Up @@ -166,7 +166,7 @@ public FormulaCandidate getFormulaCandidate(

/**
* List of StructureCandidates the given 'formulaId' with minimal information.
* StructureCandidates can be enriched with molecular fingerprint, structure database links and pubmed ids,
* StructureCandidates can be enriched with molecular fingerprint, structure database links.
*
* @param projectId project-space to read from.
* @param alignedFeatureId feature (aligned over runs) the formula result belongs to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Compound getCompound(@PathVariable String projectId, @PathVariable String
* @param compoundId identifier of the compound to delete.
*/
@DeleteMapping(value = "/{compoundId}")
public void deleteAlignedFeature(@PathVariable String projectId, @PathVariable String compoundId) {
public void deleteCompound(@PathVariable String projectId, @PathVariable String compoundId) {
projectsProvider.getProjectOrThrow(projectId).deleteCompoundById(compoundId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public enum OptFields {statistics, fragmentationTree, simulatedIsotopePattern, p
*/
protected Double zodiacScore;

protected Integer numOfexplainedPeaks;
protected Integer numOfexplainablePeaks;
protected Integer numOfExplainedPeaks;
protected Integer numOfExplainablePeaks;

protected Double totalExplainedIntensity;
protected Deviation medianMassDeviation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class FragmentNode {
String molecularFormula;
String ionType;
double massDeviationDa;
double massErrorPpm;
double massDeviationPpm;
double score;

double intensity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static FragmentationTree fromFtree(FTree sourceTree) {
if (anoPeak.get(f).isMeasured()) {
Deviation dev = sourceTree.getMassError(f);
fn.setMassDeviationDa(dev.getAbsolute());
fn.setMassErrorPpm(dev.getPpm());
fn.setMassDeviationPpm(dev.getPpm());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class StructureCandidate {
protected String structureName;
protected String smiles;

protected Integer numOfPubMedIds;
protected Double xlogP;
protected String inchiKey;

Expand All @@ -52,11 +51,6 @@ public class StructureCandidate {
* OPTIONAL: needs to be added by parameter
*/
List<DBLink> refSpectraLinks;
/**
* PubMed IDs belonging to this structure candidate
* OPTIONAL: needs to be added by parameter
*/
int[] pubmedIds;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import de.unijena.bioinf.ChemistryBase.chem.PrecursorIonType;
import de.unijena.bioinf.ChemistryBase.fp.Fingerprint;
import de.unijena.bioinf.chemdb.CompoundCandidate;
import de.unijena.bioinf.chemdb.PubmedLinks;
import de.unijena.bioinf.fingerid.ConfidenceScore;
import de.unijena.bioinf.projectspace.FormulaResultId;
import de.unijena.bioinf.projectspace.FormulaScoring;
Expand Down Expand Up @@ -103,13 +102,6 @@ public static StructureCandidateFormula of(Scored<CompoundCandidate> can, @Nulla
sSum.setXlogP(can.getCandidate().getXlogp());

//meta data
PubmedLinks pubMedIds = can.getCandidate().getPubmedIDs();
if (pubMedIds != null) {
sSum.setNumOfPubMedIds(pubMedIds.getNumberOfPubmedIDs());
if (optFields.contains(OptFields.pubmedIds))
sSum.setPubmedIds(pubMedIds.getCopyOfPubmedIDs());
}

if (optFields.contains(OptFields.dbLinks))
sSum.setDbLinks(can.getCandidate().getLinks());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({ "molecularFormula", "adduct"})
public class StructureCandidateScored extends StructureCandidate {
public enum OptFields {fingerprint, dbLinks, refSpectraLinks, pubmedIds}
public enum OptFields {fingerprint, dbLinks, refSpectraLinks}

protected Double csiScore;
protected Double tanimotoSimilarity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,27 @@ public class JobSubmission {
* Parameter Object for molecular formula identification tool (CLI-Tool: formula, sirius).
* If NULL the tool will not be executed.
*/
Sirius formulaIdParas;
Sirius formulaIdParams;
/**
* Parameter Object for network based molecular formula re-ranking (CLI-Tool: zodiac).
* If NULL the tool will not be executed.
*/
Zodiac zodiacParas;
Zodiac zodiacParams;
/**
* Parameter Object for Fingerprint prediction with CSI:FingerID (CLI-Tool: fingerint).
* If NULL the tool will not be executed.
*/
FingerprintPrediction fingerprintPredictionParas;
FingerprintPrediction fingerprintPredictionParams;
/**
* Parameter Object for structure database search with CSI:FingerID (CLI-Tool: structure).
* If NULL the tool will not be executed.
*/
StructureDbSearch structureDbSearchParas;
StructureDbSearch structureDbSearchParams;
/**
* Parameter Object for CANOPUS compound class prediction tool (CLI-Tool: canopus).
* If NULL the tool will not be executed.
*/
Canopus canopusParas;
Canopus canopusParams;

//todo passatutto api.

Expand All @@ -147,11 +147,11 @@ public static JobSubmission createDefaultInstance(boolean includeConfigMap) {
j.setEnforcedAdducts(settings.getEnforced().stream().map(PrecursorIonType::toString).collect(Collectors.toList()));
j.setDetectableAdducts(settings.getDetectable().stream().map(PrecursorIonType::toString).collect(Collectors.toList()));
j.setRecompute(false);
j.setFormulaIdParas(new Sirius());
j.setZodiacParas(new Zodiac());
j.setFingerprintPredictionParas(new FingerprintPrediction());
j.setStructureDbSearchParas(new StructureDbSearch());
j.setCanopusParas(new Canopus());
j.setFormulaIdParams(new Sirius());
j.setZodiacParams(new Zodiac());
j.setFingerprintPredictionParams(new FingerprintPrediction());
j.setStructureDbSearchParams(new StructureDbSearch());
j.setCanopusParams(new Canopus());
if (includeConfigMap) {
final Map<String, String> configMap = new HashMap<>();
PropertyManager.DEFAULTS.getConfigKeys().forEachRemaining(k ->
Expand All @@ -164,7 +164,7 @@ public static JobSubmission createDefaultInstance(boolean includeConfigMap) {

@JsonIgnore
public List<Tool<?>> getEnabledTools() {
return Stream.of(formulaIdParas, zodiacParas, fingerprintPredictionParas, structureDbSearchParas, canopusParas)
return Stream.of(formulaIdParams, zodiacParams, fingerprintPredictionParams, structureDbSearchParams, canopusParams)
.filter(Objects::nonNull).filter(Tool::isEnabled).collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ public static FormulaCandidate asFormulaCandidate(@NotNull FormulaResult formula
formulaResult.getAnnotation(FTree.class).
ifPresent(fTree -> {
final FTreeMetricsHelper metrHelp = new FTreeMetricsHelper(fTree);
frs.setNumOfexplainedPeaks(metrHelp.getNumOfExplainedPeaks());
frs.setNumOfexplainablePeaks(metrHelp.getNumberOfExplainablePeaks());
frs.setNumOfExplainedPeaks(metrHelp.getNumOfExplainedPeaks());
frs.setNumOfExplainablePeaks(metrHelp.getNumberOfExplainablePeaks());
frs.setTotalExplainedIntensity(metrHelp.getExplainedIntensityRatio());
frs.setMedianMassDeviation(metrHelp.getMedianMassDeviation());
});
Expand Down Expand Up @@ -533,7 +533,7 @@ public static FeatureAnnotations extractTopAnnotationsDeNovo(Instance inst) {
// topHit.getAnnotation(FBCandidates.class).map(FBCandidates::getResults)
// .filter(l -> !l.isEmpty()).map(r -> r.get(0)).map(s ->
// StructureCandidateFormula.of(s, topHit.getAnnotationOrThrow(FormulaScoring.class),
// EnumSet.of(StructureCandidateScored.OptFields.dbLinks, StructureCandidateScored.OptFields.pubmedIds, StructureCandidateScored.OptFields.refSpectraLinks), topHit.getId()))
// EnumSet.of(StructureCandidateScored.OptFields.dbLinks, StructureCandidateScored.OptFields.refSpectraLinks), topHit.getId()))
// .ifPresent(cSum::setStructureAnnotation);

topHit.getAnnotation(CanopusResult.class).map(CompoundClasses::of).
Expand All @@ -557,7 +557,7 @@ public static FeatureAnnotations extractTopAnnotations(Instance inst) {
topHit.getAnnotation(FBCandidates.class).map(FBCandidates::getResults)
.filter(l -> !l.isEmpty()).map(r -> r.get(0)).map(s ->
StructureCandidateFormula.of(s, topHit.getAnnotationOrThrow(FormulaScoring.class),
EnumSet.of(StructureCandidateScored.OptFields.dbLinks, StructureCandidateScored.OptFields.pubmedIds, StructureCandidateScored.OptFields.refSpectraLinks), topHit.getId()))
EnumSet.of(StructureCandidateScored.OptFields.dbLinks, StructureCandidateScored.OptFields.refSpectraLinks), topHit.getId()))
.ifPresent(cSum::setStructureAnnotation);

topHit.getAnnotation(CanopusResult.class).map(CompoundClasses::of).
Expand Down

0 comments on commit 4a37c65

Please sign in to comment.