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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<column columnName="Hypothesis">
<shownInInsertView>false</shownInInsertView>
</column>
<column columnName="Comments">
<column columnName="comments">
<shownInInsertView>false</shownInInsertView>
</column>
<column columnName="importMethod">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<column columnName="Name">
<columnTitle>Run Name</columnTitle>
</column>
<column columnName="Comments">
<column columnName="comments">
<columnTitle>Run Description</columnTitle>
<nullable>true</nullable>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<column columnName="Hypothesis">
<shownInInsertView>false</shownInInsertView>
</column>
<column columnName="Comments">
<column columnName="comments">
<shownInInsertView>false</shownInInsertView>
</column>
<column columnName="importMethod">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<column columnName="Name">
<columnTitle>Run Name</columnTitle>
</column>
<column columnName="Comments">
<column columnName="comments">
<columnTitle>Run Description</columnTitle>
<nullable>true</nullable>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.labkey.genotypeassays;

import org.json.old.JSONArray;
import org.json.JSONArray;
import org.labkey.api.action.ApiResponse;
import org.labkey.api.action.ApiSimpleResponse;
import org.labkey.api.action.ConfirmAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.old.JSONArray;
import org.json.old.JSONObject;
import org.json.JSONArray;
import org.json.JSONObject;
import org.labkey.api.assay.AssayProtocolSchema;
import org.labkey.api.assay.AssayProvider;
import org.labkey.api.assay.AssayService;
Expand All @@ -45,6 +45,7 @@
import org.labkey.api.query.ValidationException;
import org.labkey.api.security.User;
import org.labkey.api.util.FileUtil;
import org.labkey.api.util.JsonUtil;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.util.Pair;
import org.labkey.api.view.ViewContext;
Expand Down Expand Up @@ -197,7 +198,7 @@ public Pair<List<Integer>, List<Integer>> cacheHaplotypes(final ViewContext ctx,

Set<Integer> analysisIds = new HashSet<>();
final Map<Integer, List<JSONObject>> haploMap = new HashMap<>();
for (JSONObject row : data.toJSONObjectArray())
for (JSONObject row : JsonUtil.toJSONObjectList(data))
{
Integer analysisId = row.getInt("analysisId");
analysisIds.add(analysisId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.labkey.genotypeassays.assay;

import org.apache.commons.lang3.StringUtils;
import org.labkey.api.data.Container;
import org.labkey.api.gwt.client.util.StringUtils;
import org.labkey.api.laboratory.assay.AssayImportMethod;
import org.labkey.api.laboratory.assay.AssayParser;
import org.labkey.api.laboratory.assay.DefaultAssayImportMethod;
Expand All @@ -27,12 +27,13 @@ public DefaultGenotypeAssaysImportMethod()
super(GenotypeAssaysManager.GENOTYPE_ASSAY_PROVIDER);
}

@Override
public AssayParser getFileParser(Container c, User u, int assayId)
{
return new DefaultGenotypeAssayParser(this, c, u, assayId);
}

public class DefaultGenotypeAssayParser extends DefaultAssayParser
public static class DefaultGenotypeAssayParser extends DefaultAssayParser
{
public DefaultGenotypeAssayParser(AssayImportMethod method, Container c, User u, int assayId)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.genotypeassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.exp.api.ExpProtocol;
import org.labkey.api.laboratory.assay.DefaultAssayImportMethod;
import org.labkey.api.view.ViewContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.genotypeassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.laboratory.NavItem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.genotypeassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.laboratory.assay.AbstractAssayDataProvider;
import org.labkey.api.module.Module;
import org.labkey.api.view.ViewContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.genotypeassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.laboratory.assay.AbstractAssayDataProvider;
import org.labkey.api.laboratory.assay.AssayImportMethod;
import org.labkey.api.module.Module;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.genotypeassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.Container;
import org.labkey.api.exp.api.ExpProtocol;
Expand Down Expand Up @@ -72,7 +72,7 @@ protected List<Map<String, Object>> processRowsFromFile(List<Map<String, Object>

while (rowsIter.hasNext())
{
Map<String, Object> row = new CaseInsensitiveHashMap(rowsIter.next());
Map<String, Object> row = new CaseInsensitiveHashMap<>(rowsIter.next());
appendPromotedResultFields(row, context);

helper.normalizeResultField(row, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private Map<String, String> getResultValues()

TableSelector ts = new TableSelector(ti);
Map<String, Object>[] rows = ts.getMapArray();
Map<String, String> ret = new CaseInsensitiveHashMap();
Map<String, String> ret = new CaseInsensitiveHashMap<>();
for (Map<String, Object> row : rows)
{
ret.put((String)row.get("result"), (String)row.get("result"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.genotypeassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.Container;
import org.labkey.api.exp.api.ExpProtocol;
Expand Down Expand Up @@ -51,6 +51,7 @@ public JSONObject getMetadata(ViewContext ctx, ExpProtocol protocol)
return _importMethod.getMetadata(ctx, protocol);
}

@Override
public String getTooltip()
{
return "Choose this option to upload data using a template with many allele typings per row";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.labpurchasing;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.data.Container;
import org.labkey.api.laboratory.AbstractDataProvider;
import org.labkey.api.laboratory.DetailsUrlWithoutLabelNavItem;
Expand Down
2 changes: 1 addition & 1 deletion covidseq/src/org/labkey/covidseq/CovidseqDataProvider.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.covidseq;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.data.Container;
import org.labkey.api.data.TableInfo;
import org.labkey.api.laboratory.AbstractDataProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.labkey.elispot_assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.laboratory.NavItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import au.com.bytecode.opencsv.CSVWriter;
import org.apache.commons.lang3.StringUtils;
import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.Container;
import org.labkey.api.exp.api.ExpExperiment;
Expand Down Expand Up @@ -74,6 +74,7 @@ public String getTemplateInstructions()
return super.getTemplateInstructions() + "<br><br>This import path assumes you prepared this run by creating/saving a template from this site, which defines your plate layout and sample information. The results you enter below will be merged with that previously imported sample information using well. When you select a saved plate template using the \'Saved Sample Information\' section above, you should see a list of the samples you uploaded.";
}

@Override
public AssayParser getFileParser(Container c, User u, int assayId)
{
return new Parser(this, c, u, assayId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.apache.commons.math3.stat.inference.TestUtils;
import org.apache.logging.log4j.Level;
import org.jetbrains.annotations.Nullable;
import org.json.old.JSONArray;
import org.json.old.JSONObject;
import org.json.JSONArray;
import org.json.JSONObject;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.Container;
import org.labkey.api.data.ConvertHelper;
Expand All @@ -21,6 +21,7 @@
import org.labkey.api.query.BatchValidationException;
import org.labkey.api.query.ValidationException;
import org.labkey.api.security.User;
import org.labkey.api.util.JsonUtil;
import org.labkey.api.view.ViewContext;

import java.text.DecimalFormat;
Expand Down Expand Up @@ -106,12 +107,12 @@ protected List<Map<String, Object>> calculatePositivity(List<Map<String, Object>
{
String delim = "/";

JSONObject runProperties = context.getRunProperties();
List<Map<String, Object>> newRows = new ArrayList<Map<String, Object>>();
Map<String, List<Double>> negWellMap = new CaseInsensitiveHashMap<List<Double>>();
Map<String, String> sampleKeyToNegCtlKey = new HashMap<String, String>();
Map<String, Object> runProperties = context.getRunProperties();
List<Map<String, Object>> newRows = new ArrayList<>();
Map<String, List<Double>> negWellMap = new CaseInsensitiveHashMap<>();
Map<String, String> sampleKeyToNegCtlKey = new HashMap<>();

Map<String, List<Map<String, Object>>> map = new CaseInsensitiveHashMap<List<Map<String, Object>>>();
Map<String, List<Map<String, Object>>> map = new CaseInsensitiveHashMap<>();
for (Map<String, Object> row : rows)
{
//build a map of rows, grouped by id/date/peptide
Expand All @@ -123,7 +124,7 @@ protected List<Map<String, Object>> calculatePositivity(List<Map<String, Object>

List<Map<String, Object>> foundRows = map.get(key);
if (foundRows == null)
foundRows = new ArrayList<Map<String, Object>>();
foundRows = new ArrayList<>();

foundRows.add(row);
map.put(key, foundRows);
Expand Down Expand Up @@ -169,14 +170,14 @@ protected List<Map<String, Object>> calculatePositivity(List<Map<String, Object>
}
}

Integer minspots = runProperties.containsKey(MIN_SPOTS_FIELD) ? Integer.valueOf(runProperties.getInt(MIN_SPOTS_FIELD)) : null;
Integer minspots = runProperties.get(MIN_SPOTS_FIELD) != null ? Integer.valueOf(runProperties.get(MIN_SPOTS_FIELD).toString()) : null;
if (minspots == null)
{
minspots = 0;
runProperties.put(MIN_SPOTS_FIELD, minspots);
}

Double threshold = runProperties.containsKey(THRESHOLD_FIELD) ? runProperties.getDouble(THRESHOLD_FIELD) : null;
Double threshold = runProperties.get(THRESHOLD_FIELD) != null ? Double.parseDouble(runProperties.get(THRESHOLD_FIELD).toString()) : null;
if (threshold == null)
{
threshold = 0.05;
Expand Down Expand Up @@ -295,7 +296,7 @@ public void validateTemplate(User u, Container c, ExpProtocol protocol, @Nullabl

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Map<String, Double> negCtlCounts = new HashMap<String, Double>();
for (JSONObject row : rawResults.toJSONObjectArray())
for (JSONObject row : JsonUtil.toJSONObjectList(rawResults))
{
for (String prop : resultDefaults.keySet())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.labkey.flowassays;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.laboratory.AbstractDataProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.flowassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.Container;
import org.labkey.api.exp.api.ExpProtocol;
Expand Down Expand Up @@ -64,7 +64,7 @@ protected List<Map<String, Object>> processRowsFromFile(List<Map<String, Object>

while (rowsIter.hasNext())
{
Map<String, Object> row = new CaseInsensitiveHashMap(rowsIter.next());
Map<String, Object> row = new CaseInsensitiveHashMap<>(rowsIter.next());
appendPromotedResultFields(row, context);

helper.normalizePopulationField(row, "population", context);
Expand Down
14 changes: 7 additions & 7 deletions flowassays/src/org/labkey/flowassays/assay/FlowImportHelper.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.labkey.flowassays.assay;

import org.json.old.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.TableInfo;
import org.labkey.api.data.TableSelector;
import org.labkey.api.gwt.client.util.StringUtils;
import org.labkey.api.laboratory.assay.ImportContext;
import org.labkey.flowassays.FlowAssaysSchema;

Expand All @@ -28,10 +28,10 @@ public FlowImportHelper()

public void normalizePopulationField(Map<String, Object> row, String populationField, ImportContext context)
{
if (!row.containsKey(populationField))
if (!row.containsKey(populationField) || row.get(populationField) == null)
return;

String population = StringUtils.trimToNull((String) row.get(populationField));
String population = row.get(populationField) == null ? null : StringUtils.trimToNull(row.get(populationField).toString());
if (population == null)
return;

Expand Down Expand Up @@ -79,7 +79,7 @@ public String guessPopulation(String population)

public Map<String, String> getGuessedValues(Map<String, String> allowable)
{
Map<String, String> guesses = new CaseInsensitiveHashMap();
Map<String, String> guesses = new CaseInsensitiveHashMap<>();
for (String key : allowable.keySet())
{
String guess = key.replaceAll(" ", "");
Expand All @@ -103,7 +103,7 @@ private Map<String, String> getResultValues()
TableInfo ti = FlowAssaysSchema.getInstance().getTable(FlowAssaysSchema.TABLE_POPULATIONS);
TableSelector ts = new TableSelector(ti);
Map<String, Object>[] rows = ts.getMapArray();
Map<String, String> ret = new CaseInsensitiveHashMap();
Map<String, String> ret = new CaseInsensitiveHashMap<>();
for (Map<String, Object> row : rows)
{
ret.put((String)row.get(NAME_FIELD), (String)row.get(NAME_FIELD));
Expand Down Expand Up @@ -159,6 +159,6 @@ public static JSONObject applyDefaultMetadata(JSONObject meta)

private static JSONObject getJsonObject(JSONObject parent, String key)
{
return parent.containsKey(key) ? parent.getJSONObject(key): new JSONObject();
return parent.has(key) ? parent.getJSONObject(key): new JSONObject();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.flowassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.data.Container;
import org.labkey.api.exp.api.ExpProtocol;
import org.labkey.api.laboratory.assay.AssayImportMethod;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.flowassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.laboratory.assay.AbstractAssayDataProvider;
import org.labkey.api.laboratory.assay.AssayImportMethod;
import org.labkey.api.module.Module;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.flowassays.assay;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.laboratory.assay.AbstractAssayDataProvider;
import org.labkey.api.laboratory.assay.AssayImportMethod;
import org.labkey.api.module.Module;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.labkey.mgap.columnTransforms;

import org.json.old.JSONObject;
import org.json.JSONObject;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.ColumnInfo;
import org.labkey.api.data.DbSchema;
Expand Down
Loading