Skip to content
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
8 changes: 2 additions & 6 deletions api-src/org/labkey/api/targetedms/SkylineAnnotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@
*/
package org.labkey.api.targetedms;

import org.labkey.api.data.Container;

import java.util.Date;

/**
* User: vsharma
* Date: 8/26/2015
* Time: 2:13 PM
*/
public interface SkylineAnnotation
{
public String getName();
public String getValue();
String getName();
String getValue();
}
7 changes: 0 additions & 7 deletions api-src/org/labkey/api/targetedms/TargetedMSService.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,26 +143,19 @@ enum FolderType
/**
* Returns the name of a chromatogram library file according to the naming pattern used for creating
* .clib files for a specific revision number in a given container.
* @param container
* @param revision
* @return
*/
String getChromLibFileName(@NotNull Container container, int revision);

/**
* Returns the revision number from the file name if the given file name matches the chromatogram library
* naming pattern. Example: chromlib_314_rev5.clib; revision number is 5.
* Returns null if the given file name does not match the expected pattern.
* @param chromLibFileName
* @return
*/
@Nullable
Integer parseChromLibRevision(@NotNull String chromLibFileName);

/**
*
* @param sampleFileId
* @param container container that has the Skyline document that the sample file belongs to.
* @return the replicate name associated with the given sampleFileId. Returns null if a database row with the given
* sampleFileId does not exist, or if the Skyline document with the sample file is not in the given container.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ else if(isMolecule)

//skip selected precursors that are already excluded
selectedRowsKeys.forEach(id -> {
List<ExcludedPrecursor> prec = precursorsList.stream().filter(p -> p.getId() == id).collect(Collectors.toList());
List<ExcludedPrecursor> prec = precursorsList.stream().filter(p -> p.getId() == id).toList();
ExcludedPrecursor precursor = prec.get(0);
precursor.setIsPeptide(isPeptide);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

public class QCSummaryMenuCustomizer implements NavTreeCustomizer
{
private @NotNull String actionName;
private @NotNull String menuLabel;
private final @NotNull String actionName;
private final @NotNull String menuLabel;

public QCSummaryMenuCustomizer(@NotNull String actionName, @NotNull String menuLabel)
{
Expand Down
1 change: 0 additions & 1 deletion src/org/labkey/targetedms/IrtPeptide.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ public void setGeneralMoleculeId(Long generalMoleculeId)

/**
* Include a new import value in the weighted average iRT value for the peptide sequence.
* @param newObservation
*/
public void reweighValue(double newObservation)
{
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/targetedms/SkylineAuditLogManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public void deleteDocumentVersionLog(long pRunId) throws AuditLogException
{
SimpleFilter runAuditLogFilter = new SimpleFilter(FieldKey.fromParts("VersionId"), pRunId);

if (deleteEntryIds.size() > 0)
if (!deleteEntryIds.isEmpty())
{
SimpleFilter entryFilter = new SimpleFilter(
new SimpleFilter.InClause(FieldKey.fromParts("entryId"), deleteEntryIds, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public interface IRetentionScoreCalculator
{
public String getName();
String getName();

Double ScoreSequence(String modifiedSequence);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ public static RegressionLine calcRegressionLine(IRetentionTimeProvider retention
}
}

if (existingPeptideList.size() > 0)
if (!existingPeptideList.isEmpty())
{
pipelineLog.info("Attempting to calculate iRT regression line from shared peptides.");
// Attempt to get a regression based on shared peptides
CurrentCalculator calculator = new CurrentCalculator(standardPeptideList, existingPeptideList);
ArrayList<MeasuredRetentionTime> peptidesTimes = retentionTimes.getPeptideRetentionTimes();
//var peptidesTimes = retentionTimes.getPeptideRetentionTimes().toArray();
RetentionTimeRegression regression = RetentionTimeRegression.FindThreshold(MIN_IRT_TO_TIME_CORRELATION, RetentionTimeRegression.getThresholdPrecision(), peptidesTimes, new ArrayList<MeasuredRetentionTime>(), peptidesTimes, calculator, false);
RetentionTimeRegression regression = RetentionTimeRegression.FindThreshold(MIN_IRT_TO_TIME_CORRELATION, RetentionTimeRegression.getThresholdPrecision(), peptidesTimes, new ArrayList<>(), peptidesTimes, calculator, false);

if (regression != null && regression.getPeptideTimes().size() >= MIN_IRT_TO_TIME_POINT_COUNT)
{
Expand Down Expand Up @@ -142,10 +142,10 @@ private static Statistics GetTrial(ArrayList<Double> listValues, int i, RefObjec

private final static class CurrentCalculator extends RetentionScoreCalculatorSpec
{
private LinkedHashMap<String, Double> _dictStandards = new LinkedHashMap<>();
private LinkedHashMap<String, Double> _dictLibrary = new LinkedHashMap<>();
private final LinkedHashMap<String, Double> _dictStandards = new LinkedHashMap<>();
private final LinkedHashMap<String, Double> _dictLibrary = new LinkedHashMap<>();

private double _unknownScore;
private final double _unknownScore;

public CurrentCalculator(Iterable<IrtPeptide> standardPeptides, Iterable<IrtPeptide> libraryPeptides)
{
Expand Down
6 changes: 2 additions & 4 deletions src/org/labkey/targetedms/SkylinePort/Irt/RegressionLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ private void setIntercept(double value)
for a given x.

@param x Value in x dimension
@return
*/
*/
@Override
public double GetY(double x)
{
Expand All @@ -93,8 +92,7 @@ public double GetY(double x)
for a given y.

@param y Value in y dimension
@return
*/
*/
public double GetX(double y)
{
return (y - getIntercept()) / getSlope();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
public final class RegressionLineElement implements IRegressionFunction
{
private RegressionLine _regressionLine;
private final RegressionLine _regressionLine;

public RegressionLine getRegressionLine()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ private static Double GetRetentionTime(double score, IRegressionFunction convers
*/
public RetentionTimeStatistics CalcStatistics(ArrayList<MeasuredRetentionTime> peptidesTimes, java.util.Map<String, Double> scoreCache)
{
java.util.ArrayList<String> listPeptides = new java.util.ArrayList<String>();
java.util.ArrayList<Double> listHydroScores = new java.util.ArrayList<Double>();
java.util.ArrayList<Double> listPredictions = new java.util.ArrayList<Double>();
java.util.ArrayList<Double> listRetentionTimes = new java.util.ArrayList<Double>();
java.util.ArrayList<String> listPeptides = new java.util.ArrayList<>();
java.util.ArrayList<Double> listHydroScores = new java.util.ArrayList<>();
java.util.ArrayList<Double> listPredictions = new java.util.ArrayList<>();
java.util.ArrayList<Double> listRetentionTimes = new java.util.ArrayList<>();

boolean usableCalc = getCalculator().IsUsable();

Expand Down Expand Up @@ -500,7 +500,7 @@ public static RetentionTimeRegression CalcRegression(String name, ArrayList<Rete
RetentionScoreCalculatorSpec s = null;
RefObject<RetentionScoreCalculatorSpec> tempRef_s = new RefObject<>(s);
RetentionTimeRegression tempVar = CalcRegression(name, calculators, measuredPeptides, null, false, statistics, tempRef_s);
s = tempRef_s.get();
tempRef_s.get();
return tempVar;
}

Expand All @@ -514,8 +514,7 @@ This function chooses the best calculator (by r value) and returns a regression
@param allPeptides If true, do not let the calculator pick which peptides to use in the regression
@param statistics Statistics from the regression of the best calculator
@param calculatorSpec The best calculator
@return
*/
*/
public static RetentionTimeRegression CalcRegression(String name, ArrayList<RetentionScoreCalculatorSpec> calculators, ArrayList<MeasuredRetentionTime> measuredPeptides, RetentionTimeScoreCache scoreCache, boolean allPeptides, RefObject<RetentionTimeStatistics> statistics, RefObject<RetentionScoreCalculatorSpec> calculatorSpec)
{
// Get a list of peptide names for use by the calculators to choose their regression peptides
Expand Down Expand Up @@ -545,7 +544,7 @@ public static RetentionTimeRegression CalcRegression(String name, ArrayList<Rete
// An arraylist, indexed by calculator, of actual retention times for the peptides in peptideScoresByCalc
List<ArrayList<Double>> listRTs = new ArrayList<>(calcs);

LinkedHashMap<String, Double> dictMeasuredPeptides = new LinkedHashMap<String, Double>();
LinkedHashMap<String, Double> dictMeasuredPeptides = new LinkedHashMap<>();

for (MeasuredRetentionTime measured : measuredPeptides)
{
Expand Down Expand Up @@ -575,7 +574,7 @@ public static RetentionTimeRegression CalcRegression(String name, ArrayList<Rete

try
{
listRTs.set(i, new ArrayList<Double>());
listRTs.set(i, new ArrayList<>());
calcPeptides.set(i, allPeptides ? listPeptides : calc.ChooseRegressionPeptides(listPeptides));
peptideScoresByCalc.set(i, RetentionTimeScoreCache.CalcScores(calc, calcPeptides.get(i), scoreCache));
}
Expand Down Expand Up @@ -714,8 +713,8 @@ public static RetentionTimeRegression FindThreshold(double threshold, Integer pr
RefObject<RetentionTimeStatistics> tempRef_statisticsRefined = new RefObject<>(statisticsRefined);
RefObject<LinkedHashSet<Integer>> tempRef_outIndexes = new RefObject<>(outIndexes);
RetentionTimeRegression tempVar = regressionInitial.FindThreshold(threshold, precision, 0, measuredPeptides.size(), standardPeptides, variablePeptides, statisticsAll, calculator, scoreCache, isCanceled, tempRef_statisticsRefined, tempRef_outIndexes);
statisticsRefined = tempRef_statisticsRefined.get(); // TPG: TODO Proper handling of the ref conversion
outIndexes = tempRef_outIndexes.get();
tempRef_statisticsRefined.get();
tempRef_outIndexes.get();
return tempVar;

}
Expand Down Expand Up @@ -840,7 +839,7 @@ else if (!outIndexes.get().contains(i) && iNextStat < listPredictions.size())
Collections.sort(listDeltas);

// Remove points with the highest deltas above mid
outIndexes.set(new LinkedHashSet<Integer>());
outIndexes.set(new LinkedHashSet<>());
int countOut = variablePeptides.size() - mid - 1;
for (int i = 0; i < countOut; i++)
{
Expand All @@ -859,9 +858,9 @@ else if (!outIndexes.get().contains(i) && iNextStat < listPredictions.size())
peptidesTimesTry.addAll(requiredPeptides);

RetentionScoreCalculatorSpec s = null;
RefObject<RetentionScoreCalculatorSpec> tempRef_s = new RefObject<RetentionScoreCalculatorSpec>(s);
RefObject<RetentionScoreCalculatorSpec> tempRef_s = new RefObject<>(s);
RetentionTimeRegression tempVar = CalcRegression(getName(), Lists.newArrayList(calculator), peptidesTimesTry, scoreCache, true, statisticsResult, tempRef_s);
s = tempRef_s.get(); // TPG TODO: By ref handled correctly?
tempRef_s.get();
return tempVar;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void RecalculateCalcCache(RetentionScoreCalculatorSpec calculator)
Map<String, Double> calcCache = _cache.get(calculator.getName());
if(calcCache != null)
{
LinkedHashMap<String, Double> newCalcCache = new LinkedHashMap<String, Double>();
LinkedHashMap<String, Double> newCalcCache = new LinkedHashMap<>();

for (String key : calcCache.keySet())
{
Expand All @@ -77,7 +77,7 @@ public void RecalculateCalcCache(RetentionScoreCalculatorSpec calculator)

public double CalcScore(IRetentionScoreCalculator calculator, String peptide)
{
LinkedHashMap<String, Double> cacheCalc = null;
LinkedHashMap<String, Double> cacheCalc;
cacheCalc = _cache.get(calculator.getName());
return CalcScore(calculator, peptide, cacheCalc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void setListRetentionTimes(java.util.ArrayList<Double> value)

public java.util.Map<String, Double> getScoreCache()
{
LinkedHashMap<String, Double> scoreCache = new LinkedHashMap<String, Double>();
LinkedHashMap<String, Double> scoreCache = new LinkedHashMap<>();
for (int i = 0; i < getPeptides().size(); i++)
{
String sequence = getPeptides().get(i);
Expand Down
5 changes: 2 additions & 3 deletions src/org/labkey/targetedms/SkylinePort/Irt/Statistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ public final double Covariance(Statistics s)

@param s1 First set of numbers
@param s2 Second set of numbers
@return
*/
*/
public static double Covariance(Statistics s1, Statistics s2)
{
try
Expand Down Expand Up @@ -549,7 +548,7 @@ public static Statistics Residuals(Statistics y, Statistics x)
double a = ATerm2(y, x);
double b = BTerm2(y, x);

java.util.ArrayList<Double> residuals = new java.util.ArrayList<Double>();
java.util.ArrayList<Double> residuals = new java.util.ArrayList<>();
for (int i = 0; i < x.getLength(); i++)
{
residuals.add(y._list[i] - (a*x._list[i] + b));
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/targetedms/TargetedMSController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7866,7 +7866,7 @@ public void validateForm(ClustergrammerForm form, Errors errors)
public ApiResponse execute(ClustergrammerForm form, BindException errors) throws Exception
{
Map<String, Map<String, Double>> results = TargetedMSManager.getClustergrammerQuery(getUser(), getContainer(), form.getSelectedIds());
if (results.size() == 0)
if (results.isEmpty())
{
errors.reject(ERROR_MSG, "No results for the selected file(s)");
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/targetedms/TargetedMSFolderType.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void addManageLinks(NavTree adminNavTree, Container container, User user)

if (container.hasPermission(user, AdminPermission.class))
{
if (Portal.getParts(container, RAW_FILES_TAB).size() == 0)
if (Portal.getParts(container, RAW_FILES_TAB).isEmpty())
{
ActionURL url = new ActionURL(TargetedMSController.AddRawDataTabAction.class, container);
NavTree addRawData = new NavTree("Add Raw Data Tab", url);
Expand Down
4 changes: 1 addition & 3 deletions src/org/labkey/targetedms/TargetedMSManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ public static TargetedMSRun getRunByLsid(String lsid, Container c)

public static boolean updateSkydDataId(ITargetedMSRun run, ExpData newSkydData, User user)
{
if (!(run instanceof TargetedMSRun))
if (!(run instanceof TargetedMSRun targetedRun))
{
throw new IllegalArgumentException("Invalid run type. Expected TargetedMSRun but received " +
(run != null ? run.getClass().getName() : "null"));
Expand All @@ -921,8 +921,6 @@ public static boolean updateSkydDataId(ITargetedMSRun run, ExpData newSkydData,
throw new IllegalArgumentException("Cannot update with null newSkydData. A valid ExpData object is required");
}

TargetedMSRun targetedRun = (TargetedMSRun) run;

ExpRun expRun = ExperimentService.get().getExpRun(targetedRun.getExperimentRunLSID());
if (expRun == null) return false;

Expand Down
1 change: 0 additions & 1 deletion src/org/labkey/targetedms/TargetedMSModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
import org.labkey.targetedms.search.ProteinSearchWebPart;
import org.labkey.targetedms.view.CalibrationCurveView;
import org.labkey.targetedms.view.CrossLinkedPeptideInfo;
import org.labkey.targetedms.view.FiguresOfMeritView;
import org.labkey.targetedms.view.LibraryQueryViewWebPart;
import org.labkey.targetedms.view.ReplicateSummaryWebPart;
import org.labkey.targetedms.view.TargetedMSRunsWebPartView;
Expand Down
3 changes: 2 additions & 1 deletion src/org/labkey/targetedms/TargetedMSRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public void setCalibrationCurveCount(int calibrationCurveCount)

public void setAuditLogEntriesCount(int auditLogEntriesCount){this._auditLogEntriesCount = auditLogEntriesCount;}

@Override
public RunRepresentativeDataState getRepresentativeDataState()
{
return _representativeDataState;
Expand Down Expand Up @@ -416,7 +417,7 @@ public TransitionSettings.FullScanSettings fetchFullScanSettings()
{
if (_fullScanSettings == null)
{
_fullScanSettings = TargetedMSManager.get().getTransitionFullScanSettings(getId());
_fullScanSettings = TargetedMSManager.getTransitionFullScanSettings(getId());
}
return _fullScanSettings;
}
Expand Down
1 change: 1 addition & 0 deletions src/org/labkey/targetedms/TargetedMSServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ public ITargetedMSRun getRunByLsid(String lsid, Container container)
return TargetedMSManager.getRunByLsid(lsid, container);
}

@Override
public boolean updateSkydDataId(ITargetedMSRun run, ExpData newSkydData, User user)
{
return TargetedMSManager.updateSkydDataId(run, newSkydData, user);
Expand Down
Loading