Skip to content
Open
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
3 changes: 1 addition & 2 deletions elisa/src/org/labkey/elisa/ElisaDataHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import org.labkey.elisa.query.ElisaManager;
import org.labkey.vfs.FileLike;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
Expand Down Expand Up @@ -349,7 +348,7 @@ private CurveFit<?> calculateStandardCurve(ExpRun run, Plate plate, @Nullable Si
regression.addData(concentration, mean);
}
else
LOG.info("Unable to find a standard concentration for the replicate well group : " + key);
LOG.info("Unable to find a standard concentration for the replicate well group : {}", key);
}

if (!points.isEmpty())
Expand Down
13 changes: 5 additions & 8 deletions elisa/src/org/labkey/elisa/HighThroughputImportHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void ensureData() throws ExperimentException
}
}
else
LOG.warn("No well location and plate name for row : " + row);
LOG.warn("No well location and plate name for row : {}", row);
}
}
catch (IOException e)
Expand Down Expand Up @@ -140,7 +140,7 @@ public Set<String> getPlates()
}

@Override
public Map<Integer, Plate> getAnalyteToPlate(String plateName) throws ExperimentException
public Map<Integer, Plate> getAnalyteToPlate(String plateName)
{
Map<Integer, Plate> analyteToPlate = new IntHashMap<>();
for (Map.Entry<Integer, double[][]> entry : _plateMap.get(plateName).getDataMap().entrySet())
Expand All @@ -152,7 +152,7 @@ public Map<Integer, Plate> getAnalyteToPlate(String plateName) throws Experiment
}

@Override
public Map<String, Double> getStandardConcentrations(String plateName, int analyteNum) throws ExperimentException
public Map<String, Double> getStandardConcentrations(String plateName, int analyteNum)
{
return _plateMap.get(plateName).getStdConcentrations(analyteNum);
}
Expand Down Expand Up @@ -190,10 +190,7 @@ public AnalytePlate(String plateName, Plate plateTemplate)

public Map<String, Double> getStdConcentrations(int analyteNum)
{
if (_stdConcentrations.containsKey(analyteNum))
return _stdConcentrations.get(analyteNum);
else
return Collections.emptyMap();
return _stdConcentrations.getOrDefault(analyteNum, Collections.emptyMap());
}

public Map<Integer, double[][]> getDataMap()
Expand Down Expand Up @@ -224,7 +221,7 @@ public void setRawSignal(Position position, Integer spot, Integer signal) throws
{
if (position != null && spot != null && signal != null)
{
double[][] data = _dataMap.computeIfAbsent(spot, s -> new double[_plateTemplate.getRows()][_plateTemplate.getColumns()]);
double[][] data = _dataMap.computeIfAbsent(spot, _ -> new double[_plateTemplate.getRows()][_plateTemplate.getColumns()]);

if (position.getRow() >= _plateTemplate.getRows() || position.getColumn()-1 >= _plateTemplate.getColumns())
{
Expand Down
1 change: 0 additions & 1 deletion elisa/src/org/labkey/elisa/ManualImportHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.labkey.elisa.plate.BioTekPlateReader;
import org.labkey.vfs.FileLike;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import org.springframework.web.servlet.ModelAndView;

import jakarta.servlet.ServletException;
import java.sql.SQLException;

import java.util.Collections;
import java.util.Map;

Expand Down Expand Up @@ -93,7 +93,7 @@ public void validateStep(ElisaRunUploadForm form, Errors errors)
}

@Override
public boolean executeStep(ElisaRunUploadForm form, BindException errors) throws ServletException, SQLException, ExperimentException
public boolean executeStep(ElisaRunUploadForm form, BindException errors) throws ServletException, ExperimentException
{
form.setSampleProperties(_postedSampleProperties);
for (Map.Entry<String, Map<DomainProperty, String>> entry : _postedSampleProperties.entrySet())
Expand Down Expand Up @@ -227,7 +227,7 @@ public void validateStep(ElisaRunUploadForm form, Errors errors)
}

@Override
public boolean executeStep(ElisaRunUploadForm form, BindException errors) throws ServletException, SQLException, ExperimentException
public boolean executeStep(ElisaRunUploadForm form, BindException errors)
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected void importData(ExpRun run, DataIteratorBuilder dataRows) throws Exper

int rowPos = ConvertHelper.convert(row.get(WELL_ROW_PROPERTY), Integer.class);
int colPos = ConvertHelper.convert(row.get(WELL_COLUMN_PROPERTY), Integer.class);
String dataRowLsid = ElispotDataHandler.getDataRowLsid(runData.get(0).getLSID(), rowPos, colPos).toString();
String dataRowLsid = ElispotDataHandler.getDataRowLsid(runData.getFirst().getLSID(), rowPos, colPos).toString();

Map<String, Object> runDataFields = new HashMap<>();
runDataFields.put("ObjectUri", dataRowLsid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.labkey.api.assay.plate.AbstractPlateBasedAssayProvider;
import org.labkey.api.data.Container;
import org.labkey.api.data.PropertyStorageSpec;
import org.labkey.api.exp.Lsid;
import org.labkey.api.exp.ObjectProperty;
import org.labkey.api.exp.PropertyType;
import org.labkey.api.exp.api.ExpData;
Expand Down Expand Up @@ -321,12 +320,7 @@ protected Pair<Domain,Map<DomainProperty,Object>> createRunDomain(Container c, U
protected Map<String, Set<String>> getRequiredDomainProperties()
{
Map<String, Set<String>> domainMap = super.getRequiredDomainProperties();
Set<String> runProperties = domainMap.get(ExpProtocol.ASSAY_DOMAIN_RUN);
if (runProperties == null)
{
runProperties = new HashSet<>();
domainMap.put(ExpProtocol.ASSAY_DOMAIN_RUN, runProperties);
}
Set<String> runProperties = domainMap.computeIfAbsent(ExpProtocol.ASSAY_DOMAIN_RUN, _ -> new HashSet<>());
runProperties.add(BACKGROUND_WELL_PROPERTY_NAME);
runProperties.add(READER_PROPERTY_NAME);

Expand Down
2 changes: 1 addition & 1 deletion elispotassay/src/org/labkey/elispot/ElispotController.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private List<WellInfo> createWellInfoList(ExpRun run, ExpProtocol protocol, Abst
{
Position position = template.getPosition(row, col);

Lsid dataRowLsid = ElispotDataHandler.getDataRowLsid(data.get(0).getLSID(), position);
Lsid dataRowLsid = ElispotDataHandler.getDataRowLsid(data.getFirst().getLSID(), position);
for (RunDataRow dataRow : ElispotManager.get().getRunDataRows(dataRowLsid.toString(), run.getContainer()))
{
WellInfo wellInfo = new WellInfo(dataRow, position);
Expand Down
5 changes: 2 additions & 3 deletions elispotassay/src/org/labkey/elispot/ElispotDataHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import org.labkey.elispot.plate.PlateInfo;
import org.labkey.vfs.FileLike;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -272,7 +271,7 @@ public static void populateAntigenDataProperties(ExpRun run, Plate plate, PlateR
if (data.size() != 1)
throw new ExperimentException("Elispot should only upload a single file per run.");

String dataLsid = data.get(0).getLSID();
String dataLsid = data.getFirst().getLSID();

// for each antigen well group, we want to flatten that information to the well level
for (WellGroup group : plate.getWellGroups(WellGroup.Type.ANTIGEN))
Expand Down Expand Up @@ -332,7 +331,7 @@ public static void populateAntigenRunProperties(ExpRun run, Plate plate, PlateRe
if (data.size() != 1)
throw new ExperimentException("Elispot should only upload a single file per run.");

String dataLsid = data.get(0).getLSID();
String dataLsid = data.getFirst().getLSID();

// calculate antigen statistics on a per sample basis
Map<String, ExpMaterial> materialMap = new HashMap<>();
Expand Down
2 changes: 1 addition & 1 deletion elispotassay/src/org/labkey/elispot/ElispotManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private RunDataRow getRunDataRow(Filter filter)
{
List<RunDataRow> runDataRows = new TableSelector(getTableInfoElispotRunData(), filter, null).getArrayList(RunDataRow.class);
if (!runDataRows.isEmpty())
return runDataRows.get(0);
return runDataRows.getFirst();
return null;
}

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

package org.labkey.elispot;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import org.labkey.api.data.ActionButton;
import org.labkey.api.data.ButtonBar;
import org.labkey.api.data.Container;
Expand Down Expand Up @@ -162,7 +162,7 @@ protected void populateButtonBar(DataView view, ButtonBar bar)
}

@Override
public QueryView createView(ViewContext context, QuerySettings settings, BindException errors)
public @NotNull QueryView createView(ViewContext context, QuerySettings settings, BindException errors)
{
String name = settings.getQueryName();
if (null != name && name.equalsIgnoreCase(ANTIGEN_STATS_TABLE_NAME))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import org.springframework.web.servlet.ModelAndView;

import jakarta.servlet.ServletException;
import java.sql.SQLException;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -327,7 +327,7 @@ public void validateStep(ElispotRunUploadForm form, Errors errors)
}

@Override
public boolean executeStep(ElispotRunUploadForm form, BindException errors) throws ServletException, SQLException, ExperimentException
public boolean executeStep(ElispotRunUploadForm form, BindException errors) throws ServletException, ExperimentException
{
form.setSampleProperties(_postedSampleProperties);
for (Map.Entry<String, Map<DomainProperty, String>> entry : _postedSampleProperties.entrySet())
Expand All @@ -352,7 +352,7 @@ public boolean executeStep(ElispotRunUploadForm form, BindException errors) thro
}

@Override
public ModelAndView getNextStep(ElispotRunUploadForm form, BindException errors) throws ServletException, SQLException, ExperimentException
public ModelAndView getNextStep(ElispotRunUploadForm form, BindException errors) throws ExperimentException
{
if (form.isResetDefaultValues() || errors.hasErrors())
return getRunPropertiesView(form, !form.isResetDefaultValues(), false, errors);
Expand Down Expand Up @@ -392,7 +392,7 @@ public void validateStep(ElispotRunUploadForm form, Errors errors)
}

@Override
public boolean executeStep(ElispotRunUploadForm form, BindException errors) throws ServletException, SQLException, ExperimentException
public boolean executeStep(ElispotRunUploadForm form, BindException errors) throws ServletException, ExperimentException
{
form.setAntigenProperties(_postedAntigenProperties);

Expand All @@ -413,7 +413,7 @@ public boolean executeStep(ElispotRunUploadForm form, BindException errors) thro
}

@Override
public ModelAndView getNextStep(ElispotRunUploadForm form, BindException errors) throws ServletException, SQLException, ExperimentException
public ModelAndView getNextStep(ElispotRunUploadForm form, BindException errors) throws ExperimentException
{
String detectionMethod = form.getProvider().getSelectedDetectionMethod(form.getContainer(), form.getProtocol());
boolean isLastStep = (detectionMethod == null || detectionMethod.equals(ElispotAssayProvider.DetectionMethodType.COLORIMETRIC.getLabel()));
Expand Down Expand Up @@ -459,7 +459,7 @@ public void validateStep(ElispotRunUploadForm form, Errors errors)
}

@Override
public boolean executeStep(ElispotRunUploadForm form, BindException errors) throws ServletException, SQLException, ExperimentException
public boolean executeStep(ElispotRunUploadForm form, BindException errors) throws ServletException, ExperimentException
{
PlateSamplePropertyHelper helper = form.getProvider().getSamplePropertyHelper(form,
getSelectedParticipantVisitResolverType(form.getProvider(), form));
Expand All @@ -479,7 +479,7 @@ public boolean executeStep(ElispotRunUploadForm form, BindException errors) thro
}

@Override
public ModelAndView getNextStep(ElispotRunUploadForm form, BindException errors) throws ServletException, SQLException, ExperimentException
public ModelAndView getNextStep(ElispotRunUploadForm form, BindException errors) throws ExperimentException
{
if (form.isResetDefaultValues() || errors.hasErrors())
return getAnalyteView(form, true, errors);
Expand Down Expand Up @@ -508,7 +508,7 @@ protected ExpRun finishPost(ElispotRunUploadForm form, BindException errors)
throw new ExperimentException("Elispot should only upload a single file per run.");

Plate template = provider.getPlate(form.getContainer(), form.getProtocol());
Map<PlateInfo, Plate> plates = Collections.EMPTY_MAP;
Map<PlateInfo, Plate> plates = Collections.emptyMap();
PlateReader reader = null;

// populate property name to value map
Expand All @@ -519,7 +519,7 @@ protected ExpRun finishPost(ElispotRunUploadForm form, BindException errors)
if (runPropMap.containsKey(ElispotAssayProvider.READER_PROPERTY_NAME))
{
reader = provider.getPlateReader(runPropMap.get(ElispotAssayProvider.READER_PROPERTY_NAME));
plates = ElispotDataHandler.initializePlates(form.getProtocol(), data.get(0).getFileLike(), template, reader);
plates = ElispotDataHandler.initializePlates(form.getProtocol(), data.getFirst().getFileLike(), template, reader);
}

boolean subtractBackground = NumberUtils.toInt(runPropMap.get(ElispotAssayProvider.BACKGROUND_WELL_PROPERTY_NAME), 0) > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void run()

if (plate != null)
{
String dataLsid = data.get(0).getLSID();
String dataLsid = data.getFirst().getLSID();
Map<String, Object> propMap = new HashMap<>();
Domain antigenDomain = AbstractAssayProvider.getDomainByPrefix(run.getProtocol(), ElispotAssayProvider.ASSAY_DOMAIN_ANTIGEN_WELLGROUP, false);

Expand All @@ -132,7 +132,7 @@ public void run()
// populate the property maps with cells per well and antigen name information (to simulate data upload)
for (WellGroup group : plate.getWellGroups(WellGroup.Type.ANTIGEN))
{
Position groupPos = group.getPositions().get(0);
Position groupPos = group.getPositions().getFirst();
Lsid dataRowLsid = ElispotDataHandler.getDataRowLsid(dataLsid, groupPos);
RunDataRow runDataRow = ElispotManager.get().getRunDataRow(dataRowLsid.toString(), run.getContainer());
if (null != runDataRow && null != cellWellProp && null != antigenNameProp)
Expand Down Expand Up @@ -185,7 +185,7 @@ private Plate initializePlate(PlateBasedAssayProvider provider, ExpRun run, Plat

if (reader != null)
{
FileLike dataFile = data.get(0).getFileLike();
FileLike dataFile = data.getFirst().getFileLike();

if (dataFile.exists())
{
Expand Down
10 changes: 3 additions & 7 deletions flow/enginesrc/org/labkey/flow/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,11 @@ private static void executeListSamples(File workspaceFile, Set<PopulationName> g
for (Workspace.SampleInfo sample : workspace.getSamplesComplete())
{
Analysis analysis = workspace.getSampleAnalysis(sample);
List<Workspace.SampleInfo> samples = analysisToSamples.get(analysis);
if (samples == null)
analysisToSamples.put(analysis, samples = new ArrayList<>());
List<Workspace.SampleInfo> samples = analysisToSamples.computeIfAbsent(analysis, _ -> new ArrayList<>());

samples.add(sample);

List<Workspace.SampleInfo> dups = sampleLabels.get(sample.getLabel());
if (dups == null)
sampleLabels.put(sample.getLabel(), dups = new ArrayList<>());
List<Workspace.SampleInfo> dups = sampleLabels.computeIfAbsent(sample.getLabel(), _ -> new ArrayList<>());
dups.add(sample);
}

Expand Down Expand Up @@ -225,7 +221,7 @@ private static void executeListSamples(File workspaceFile, Set<PopulationName> g
{
Analysis analysis = entry.getKey();
List<Workspace.SampleInfo> samples = entry.getValue();
String header = String.format(" %s: ", samples.get(0));
String header = String.format(" %s: ", samples.getFirst());
String indent = StringUtils.repeat(" ", header.length());
System.out.print(header);
printWrapped(System.out, indent, samples);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import org.labkey.flow.analysis.model.Polygon;
import java.awt.*;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;

Expand Down Expand Up @@ -119,7 +118,7 @@ protected void drawLine(Graphics2D g2, Rectangle2D dataArea, double x1, double y
xValues.sort(Double::compareTo);

// now draw the segments
double x = xValues.get(0);
double x = xValues.getFirst();
double y = m*x + b;
int prevX = (int)getDomainAxis().valueToJava2D(x, dataArea, RectangleEdge.BOTTOM);
int prevY = (int)getRangeAxis().valueToJava2D(y, dataArea, RectangleEdge.LEFT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public boolean render(Graphics2D g2, Rectangle2D dataArea, int series, PlotRende

if (_gates.size() == 1)
{
Range gate = _gates.get(0);
Range gate = _gates.getFirst();
int min = (int) getDomainAxis().valueToJava2D(gate.getLowerBound(), dataArea, getDomainAxisEdge());
int max = (int) getDomainAxis().valueToJava2D(gate.getUpperBound(), dataArea, getDomainAxisEdge());
g2.drawLine(min, (int) dataArea.getMinY(), min + 1, (int) dataArea.getMaxY());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void materializeGraphs(Set<GraphSpec> graphs, Population population, Sub
{
if (population.getGates().size() == 1)
{
Gate gate = population.getGates().get(0);
Gate gate = population.getGates().getFirst();
if (gate instanceof PolygonGate poly)
{
GraphSpec graph = new GraphSpec(parent, poly.getXAxis(), poly.getYAxis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import Jama.Matrix;
import org.apache.commons.lang3.StringUtils;
import org.apache.xerces.impl.Constants;
import org.junit.Assert;
import org.junit.Test;
import org.labkey.api.util.DateUtil;
Expand Down
Loading
Loading