diff --git a/GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysController.java b/GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysController.java index 0d9ab5f37..761c97a83 100644 --- a/GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysController.java +++ b/GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysController.java @@ -130,7 +130,7 @@ public ApiResponse execute(CacheAnalysesForm form, BindException errors) return null; } - Pair, List> ret = GenotypeAssaysManager.get().cacheAnalyses(getViewContext(), protocol, form.getAlleleNames()); + Pair, List> ret = GenotypeAssaysManager.get().cacheAnalyses(getViewContext(), protocol, form.getAlleleNames()); resultProperties.put("runsCreated", ret.first); resultProperties.put("runsDeleted", ret.second); } @@ -209,7 +209,7 @@ public ApiResponse execute(CacheAnalysesForm form, BindException errors) return null; } - Pair, List> ret = GenotypeAssaysManager.get().cacheHaplotypes(getViewContext(), protocol, new JSONArray(form.getJson())); + Pair, List> ret = GenotypeAssaysManager.get().cacheHaplotypes(getViewContext(), protocol, new JSONArray(form.getJson())); resultProperties.put("runsCreated", ret.first); resultProperties.put("runsDeleted", ret.second); } diff --git a/GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysManager.java b/GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysManager.java index fc48d2aef..68267c268 100644 --- a/GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysManager.java +++ b/GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysManager.java @@ -24,6 +24,8 @@ import org.labkey.api.assay.AssayProvider; import org.labkey.api.assay.AssayService; import org.labkey.api.collections.CaseInsensitiveHashMap; +import org.labkey.api.collections.IntHashMap; +import org.labkey.api.collections.IntHashSet; import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.CompareType; import org.labkey.api.data.Container; @@ -88,11 +90,11 @@ public static GenotypeAssaysManager get() } - public Pair, List> cacheAnalyses(final ViewContext ctx, final ExpProtocol protocol, String[] pks) throws IllegalArgumentException + public Pair, List> cacheAnalyses(final ViewContext ctx, final ExpProtocol protocol, String[] pks) throws IllegalArgumentException { final User u = ctx.getUser(); - final List runsCreated = new ArrayList<>(); - final List runsDeleted = new ArrayList<>(); + final List runsCreated = new ArrayList<>(); + final List runsDeleted = new ArrayList<>(); try (DbScope.Transaction transaction = DbScope.getLabKeyScope().ensureTransaction()) { @@ -118,8 +120,8 @@ public Pair, List> cacheAnalyses(final ViewContext ctx, f AssayProtocolSchema schema = ap.createProtocolSchema(u, ctx.getContainer(), protocol, null); final TableInfo assayDataTable = schema.getTable(AssayProtocolSchema.DATA_TABLE_NAME); - final Map>> rowHash = new HashMap<>(); - final Map> toDeleteByAnalysis = new HashMap<>(); + final Map>> rowHash = new IntHashMap<>(); + final Map> toDeleteByAnalysis = new IntHashMap<>(); TableSelector tsAlignments = new TableSelector(tableAlignments, cols.values(), new SimpleFilter(FieldKey.fromString("key"), Arrays.asList(pks), CompareType.IN), null); tsAlignments.forEach(new Selector.ForEachBlock() @@ -139,7 +141,7 @@ public void exec(ResultSet object) throws SQLException filter.addCondition(FieldKey.fromString("Run/assayType"), SBT_LINEAGE_ASSAY_TYPE); TableSelector ts = new TableSelector(assayDataTable, PageFlowUtil.set("RowId"), filter, null); - Set existing = new HashSet<>(ts.getArrayList(Integer.class)); + Set existing = new IntHashSet(ts.getArrayList(Integer.class)); if (!existing.isEmpty()) { Set toDelete = toDeleteByAnalysis.containsKey(analysisId) ? toDeleteByAnalysis.get(analysisId) : new HashSet(); @@ -178,11 +180,11 @@ public void exec(ResultSet object) throws SQLException } } - public Pair, List> cacheHaplotypes(final ViewContext ctx, final ExpProtocol protocol, JSONArray data) throws IllegalArgumentException + public Pair, List> cacheHaplotypes(final ViewContext ctx, final ExpProtocol protocol, JSONArray data) throws IllegalArgumentException { final User u = ctx.getUser(); - final List runsCreated = new ArrayList<>(); - final List runsDeleted = new ArrayList<>(); + final List runsCreated = new ArrayList<>(); + final List runsDeleted = new ArrayList<>(); //next identify a build up the results TableInfo tableAnalyses = QueryService.get().getUserSchema(u, ctx.getContainer(), SEQUENCEANALYSIS_SCHEMA).getTable("sequence_analyses"); @@ -196,8 +198,8 @@ public Pair, List> cacheHaplotypes(final ViewContext ctx, fieldKeys.add(FieldKey.fromString("readset/subjectid")); fieldKeys.add(FieldKey.fromString("readset/sampledate")); - Set analysisIds = new HashSet<>(); - final Map> haploMap = new HashMap<>(); + Set analysisIds = new IntHashSet(); + final Map> haploMap = new IntHashMap<>(); for (JSONObject row : JsonUtil.toJSONObjectList(data)) { Integer analysisId = row.getInt("analysisId"); @@ -217,8 +219,8 @@ public Pair, List> cacheHaplotypes(final ViewContext ctx, AssayProtocolSchema schema = ap.createProtocolSchema(u, ctx.getContainer(), protocol, null); final TableInfo assayDataTable = schema.getTable(AssayProtocolSchema.DATA_TABLE_NAME); - final Map>> rowHash = new HashMap<>(); - final Map> toDeleteByAnalysis = new HashMap<>(); + final Map>> rowHash = new IntHashMap<>(); + final Map> toDeleteByAnalysis = new IntHashMap<>(); TableSelector tsAlignments = new TableSelector(tableAnalyses, cols.values(), new SimpleFilter(FieldKey.fromString("rowid"), analysisIds, CompareType.IN), null); tsAlignments.forEach(new Selector.ForEachBlock() @@ -244,10 +246,10 @@ public void exec(ResultSet object) throws SQLException filter.addCondition(FieldKey.fromString("Run/assayType"), HAPLOTYPE_ASSAY_TYPE); TableSelector ts = new TableSelector(assayDataTable, PageFlowUtil.set("RowId"), filter, null); - Set existing = new HashSet<>(ts.getArrayList(Integer.class)); + Set existing = new IntHashSet(ts.getArrayList(Integer.class)); if (!existing.isEmpty()) { - Set toDelete = toDeleteByAnalysis.containsKey(analysisId) ? toDeleteByAnalysis.get(analysisId) : new HashSet<>(); + Set toDelete = toDeleteByAnalysis.containsKey(analysisId) ? toDeleteByAnalysis.get(analysisId) : new IntHashSet(); toDelete.addAll(existing); toDeleteByAnalysis.put(analysisId, toDelete); } @@ -288,7 +290,7 @@ public void exec(ResultSet object) throws SQLException return Pair.of(runsCreated, runsDeleted); } - private void processSet(String assayType, Map>> rowHash, TableInfo assayDataTable, User u, ViewContext ctx, Map> toDeleteByAnalysis, AssayProvider ap, ExpProtocol protocol, List runsCreated) + private void processSet(String assayType, Map>> rowHash, TableInfo assayDataTable, User u, ViewContext ctx, Map> toDeleteByAnalysis, AssayProvider ap, ExpProtocol protocol, List runsCreated) { for (Integer analysisId : rowHash.keySet()) { diff --git a/elispot_assay/src/org/labkey/elispot_assay/assay/DefaultImportMethod.java b/elispot_assay/src/org/labkey/elispot_assay/assay/DefaultImportMethod.java index 921984c64..220d9c454 100644 --- a/elispot_assay/src/org/labkey/elispot_assay/assay/DefaultImportMethod.java +++ b/elispot_assay/src/org/labkey/elispot_assay/assay/DefaultImportMethod.java @@ -32,6 +32,8 @@ import java.util.List; import java.util.Map; +import static org.labkey.api.exp.api.ExperimentService.asInteger; + /** * Created with IntelliJ IDEA. * User: bimber @@ -134,7 +136,7 @@ protected List> calculatePositivity(List if (TYPE.NEG.getText().equals(row.get(CATEGORY_FIELD))) { - Integer spots = (Integer)row.get(SPOTS_FIELD); + Integer spots = asInteger(row.get(SPOTS_FIELD)); List negCtls = negWellMap.get(negCtlKey); if (negCtls == null) negCtls = new ArrayList(); @@ -188,8 +190,8 @@ protected List> calculatePositivity(List int rowIdx = 0; for (Map row : rowSet) { - totalSpots += (Integer)row.get(SPOTS_FIELD); - allSpots[rowIdx] = (Integer)row.get(SPOTS_FIELD); + totalSpots += asInteger(row.get(SPOTS_FIELD)); + allSpots[rowIdx] = asInteger(row.get(SPOTS_FIELD)); rowIdx++; } Double avgSpots = totalSpots / rowSet.size(); @@ -262,7 +264,7 @@ protected List> calculatePositivity(List row.put(QCFLAG_FIELD, StringUtils.join(qcflags, "\n")); //subtract background - Integer spots = (Integer)row.get(SPOTS_FIELD); + Integer spots = asInteger(row.get(SPOTS_FIELD)); Double adj = spots - negCtlSummary.getMean(); List comments = new ArrayList(); if (row.get("comment") != null) diff --git a/mGAP/src/org/labkey/mgap/mGAPController.java b/mGAP/src/org/labkey/mgap/mGAPController.java index 09d8cde8c..042eea0ae 100644 --- a/mGAP/src/org/labkey/mgap/mGAPController.java +++ b/mGAP/src/org/labkey/mgap/mGAPController.java @@ -122,6 +122,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import static org.labkey.api.exp.api.ExperimentService.asInteger; + public class mGAPController extends SpringActionController { @@ -413,7 +415,7 @@ public Object execute(ApproveUserRequestsForm form, BindException errors) throws User u; if (map.get("userId") != null) { - Integer userId = (Integer) map.get("userId"); + Integer userId = asInteger(map.get("userId")); u = UserManager.getUser(userId); existingUsersGivenAccess.add(u); } @@ -556,7 +558,7 @@ else if (!rowContainer.hasPermission(u, ReadPermission.class)) private static SequenceOutputFile getOutputFile(Map row, ReleaseForm form, Errors errors) { - SequenceOutputFile so = SequenceOutputFile.getForId((Integer) row.get("vcfId")); + SequenceOutputFile so = SequenceOutputFile.getForId(asInteger(row.get("vcfId"))); if (so == null) { errors.reject(ERROR_MSG, "Unknown VCF file ID: " + form.getReleaseId()); diff --git a/mcc/src/org/labkey/mcc/MccController.java b/mcc/src/org/labkey/mcc/MccController.java index 9eede3c1a..97581124c 100644 --- a/mcc/src/org/labkey/mcc/MccController.java +++ b/mcc/src/org/labkey/mcc/MccController.java @@ -104,6 +104,8 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; +import static org.labkey.api.exp.api.ExperimentService.asInteger; + public class MccController extends SpringActionController { private static final DefaultActionResolver _actionResolver = new DefaultActionResolver(MccController.class); @@ -356,7 +358,7 @@ public Object execute(ApproveUserRequestsForm form, BindException errors) throws User u; if (map.get("userId") != null) { - Integer userId = (Integer)map.get("userId"); + Integer userId = asInteger(map.get("userId")); u = UserManager.getUser(userId); existingUsersGivenAccess.add(u); } diff --git a/mcc/src/org/labkey/mcc/query/TriggerHelper.java b/mcc/src/org/labkey/mcc/query/TriggerHelper.java index 9df99ae2a..0870c9773 100644 --- a/mcc/src/org/labkey/mcc/query/TriggerHelper.java +++ b/mcc/src/org/labkey/mcc/query/TriggerHelper.java @@ -49,6 +49,8 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; +import static org.labkey.api.exp.api.ExperimentService.asInteger; + /** * Created by bimber */ @@ -135,7 +137,7 @@ public void ensureReviewRecordsCreated(String objectId, String status, @Nullable } Map row = records.get(0); - if (score != (Integer)row.get("preliminaryScore")) + if (score != asInteger(row.get("preliminaryScore"))) { row.put("preliminaryScore", score); row.put("modified", new Date()); diff --git a/primeseq/src/org/labkey/primeseq/analysis/MethylationRateComparisonHandler.java b/primeseq/src/org/labkey/primeseq/analysis/MethylationRateComparisonHandler.java index e7f1e0fd1..b7309f9ce 100644 --- a/primeseq/src/org/labkey/primeseq/analysis/MethylationRateComparisonHandler.java +++ b/primeseq/src/org/labkey/primeseq/analysis/MethylationRateComparisonHandler.java @@ -15,6 +15,8 @@ import org.jetbrains.annotations.Nullable; import org.json.JSONArray; import org.json.JSONObject; +import org.labkey.api.collections.IntHashMap; +import org.labkey.api.collections.StringHashMap; import org.labkey.api.data.Container; import org.labkey.api.jbrowse.JBrowseService; import org.labkey.api.module.Module; @@ -49,7 +51,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; -import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -188,7 +189,7 @@ public void processFilesRemote(List inputFiles, JobContext c ctx.getLogger().info(groupNames.getString(i)); } - Map fileToGroupMap = new HashMap<>(); + Map fileToGroupMap = new IntHashMap<>(); JSONObject map = ctx.getParams().getJSONObject("fileToGroupMap"); for (String id : map.keySet()) { @@ -201,7 +202,7 @@ public void processFilesRemote(List inputFiles, JobContext c String statisticalMethod = ctx.getParams().optString("statisticalMethod"); //build map of site rates - Map>>> rateMap = new HashMap<>(); + Map>>> rateMap = new StringHashMap<>(); int i = 0; for (SequenceOutputFile o : inputFiles) @@ -268,12 +269,12 @@ public void processFilesRemote(List inputFiles, JobContext c if (!rateMap.containsKey(chr)) { - rateMap.put(chr, new HashMap<>()); + rateMap.put(chr, new IntHashMap<>()); } if (!rateMap.get(chr).containsKey(pos)) { - rateMap.get(chr).put(pos, new HashMap<>()); + rateMap.get(chr).put(pos, new IntHashMap<>()); } if (!rateMap.get(chr).get(pos).containsKey(groupNum)) diff --git a/primeseq/src/org/labkey/primeseq/pipeline/BismarkWrapper.java b/primeseq/src/org/labkey/primeseq/pipeline/BismarkWrapper.java index 043f26965..91f5a36e9 100644 --- a/primeseq/src/org/labkey/primeseq/pipeline/BismarkWrapper.java +++ b/primeseq/src/org/labkey/primeseq/pipeline/BismarkWrapper.java @@ -511,7 +511,7 @@ else if (getProvider().getParameterByName("siteReport") != null && getProvider() @Override public Output performAnalysisPerSampleLocal(AnalysisModel model, File inputBam, File referenceFasta, File outDir) throws PipelineJobException { - Integer runId = SequenceAnalysisService.get().getExpRunIdForJob(getPipelineCtx().getJob(), true); + Long runId = SequenceAnalysisService.get().getExpRunIdForJob(getPipelineCtx().getJob(), true); Set toCreate = new HashSet<>(); SequenceOutputTracker sot = ((SequenceOutputTracker)getPipelineCtx().getJob()); diff --git a/primeseq/src/org/labkey/primeseq/pipeline/MhcMigrationPipelineJob.java b/primeseq/src/org/labkey/primeseq/pipeline/MhcMigrationPipelineJob.java index 339b31543..eb899851c 100644 --- a/primeseq/src/org/labkey/primeseq/pipeline/MhcMigrationPipelineJob.java +++ b/primeseq/src/org/labkey/primeseq/pipeline/MhcMigrationPipelineJob.java @@ -5,6 +5,8 @@ import org.labkey.api.assay.AssayProvider; import org.labkey.api.assay.AssayService; import org.labkey.api.collections.CaseInsensitiveHashMap; +import org.labkey.api.collections.IntHashMap; +import org.labkey.api.collections.LongHashMap; import org.labkey.api.data.CompareType; import org.labkey.api.data.Container; import org.labkey.api.data.ContainerManager; @@ -397,10 +399,11 @@ private void createAlignmentSummary() throws PipelineJobException continue; } - final Map alignmentSummaryMap = new HashMap<>(srr.getRowCount().intValue()); + final Map alignmentSummaryMap = new IntHashMap<>(srr.getRowCount().intValue()); srr.getRowset().forEach(rs -> { CaseInsensitiveHashMap map = new CaseInsensitiveHashMap<>(); - Integer localId = analysisMap.get(rs.getValue("analysis_id")); + Number analysisId = (Number)rs.getValue("analysis_id"); + Integer localId = analysisMap.get(analysisId.intValue()); if (localId == null) { throw new RuntimeException("Unable to find analysis: " + rs.getValue("analysis_id")); @@ -640,17 +643,17 @@ else if (r.getValue("dataid/Run/JobId/FilePath") != null) //All of these map remote Id to local Id private final Map workbookMap = new TreeMap<>(); - private final Map readsetMap = new HashMap<>(); - private final Map readdataMap = new HashMap<>(); - private final Map analysisMap = new HashMap<>(); - private final Map analysisToFileMap = new HashMap<>(); //local analysis_id -> alignment file - private final Map analysisToJobPath = new HashMap<>(); - private final Map libraryMap = new HashMap<>(); - private final Map outputFileMap = new HashMap<>(); - private final Map sequenceMap = new HashMap<>(); - private final Map runIdMap = new HashMap<>(5000); - private final Map jobIdMap = new HashMap<>(5000); - private final Map expDataMap = new HashMap<>(10000); + private final Map readsetMap = new IntHashMap<>(); + private final Map readdataMap = new IntHashMap<>(); + private final Map analysisMap = new IntHashMap<>(); + private final Map analysisToFileMap = new IntHashMap<>(); //local analysis_id -> alignment file + private final Map analysisToJobPath = new IntHashMap<>(); + private final Map libraryMap = new IntHashMap<>(); + private final Map outputFileMap = new IntHashMap<>(); + private final Map sequenceMap = new IntHashMap<>(); + private final Map runIdMap = new LongHashMap<>(5000); + private final Map jobIdMap = new IntHashMap<>(5000); + private final Map expDataMap = new HashMap<>(10000); private void createLibraryMembers(Set preExisting) { @@ -970,7 +973,7 @@ private void createOutputFiles() //Create run: if (rd.getValue("runid") != null && rd.getValue("runid/JobId") != null) { - int runId = createExpRun(Integer.parseInt(String.valueOf(rd.getValue("runid"))), targetWorkbook, String.valueOf(rd.getValue("runid/Name")), jobId); + long runId = createExpRun(Integer.parseInt(String.valueOf(rd.getValue("runid"))), targetWorkbook, String.valueOf(rd.getValue("runid/Name")), jobId); toCreate.put("runid", runId); } else @@ -1126,7 +1129,7 @@ private void createAnalyses() //Create run: if (rd.getValue("runid") != null && rd.getValue("runid/JobId") != null) { - int runId = createExpRun(Integer.parseInt(String.valueOf(rd.getValue("runid"))), targetWorkbook, String.valueOf(rd.getValue("runid/Name")), jobId); + long runId = createExpRun(Integer.parseInt(String.valueOf(rd.getValue("runid"))), targetWorkbook, String.valueOf(rd.getValue("runid/Name")), jobId); toCreate.put("runid", runId); } else @@ -1293,7 +1296,7 @@ else if (srr.getRowCount().intValue() == 0) //Create run: if (rd.getValue("runid") != null && jobId != null) { - int runId = createExpRun(Integer.parseInt(String.valueOf(rd.getValue("runid"))), targetWorkbook, String.valueOf(rd.getValue("runid/Name")), jobId); + long runId = createExpRun(Integer.parseInt(String.valueOf(rd.getValue("runid"))), targetWorkbook, String.valueOf(rd.getValue("runid/Name")), jobId); toCreate.put("runid", runId); } else @@ -1359,7 +1362,7 @@ private File inferLogForFile(String path) private int createdExpData = 0; private int expDataCacheHits = 0; - private int getOrCreateExpData(URI uri, Container workbook, String fileName) + private long getOrCreateExpData(URI uri, Container workbook, String fileName) { if (uri.toString().contains("/C:/")) { @@ -1473,7 +1476,7 @@ private void createReadsets() { int remoteJobId = Integer.parseInt(String.valueOf(rs.getValue("runid/JobId"))); int jobId = getOrCreateJob(remoteJobId, targetWorkbook); - int runid = createExpRun(Integer.parseInt(String.valueOf(rs.getValue("runid"))), targetWorkbook, String.valueOf(rs.getValue("runid/Name")), jobId); + long runid = createExpRun(Integer.parseInt(String.valueOf(rs.getValue("runid"))), targetWorkbook, String.valueOf(rs.getValue("runid/Name")), jobId); toCreate.put("runid", runid); } else if (rs.getValue("totalForwardReads") != null) @@ -1670,7 +1673,7 @@ else if (filepath.contains("sequenceAnalysis")) } } - private int createExpRun(int remoteId, Container c, String name, int localJobId) throws Exception + private long createExpRun(long remoteId, Container c, String name, long localJobId) throws Exception { if (runIdMap.containsKey(remoteId)) { @@ -1681,7 +1684,7 @@ private int createExpRun(int remoteId, Container c, String name, int localJobId) TableSelector ts = new TableSelector(ExperimentService.get().getTinfoExperimentRun(), PageFlowUtil.set("RowId"), new SimpleFilter(FieldKey.fromString("JobId"), localJobId), null); if (ts.exists()) { - List rowIds = ts.getArrayList(Integer.class); + List rowIds = ts.getArrayList(Long.class); Collections.sort(rowIds, Comparator.reverseOrder()); runIdMap.put(remoteId, rowIds.get(0)); diff --git a/tcrdb/src/org/labkey/tcrdb/TCRdbController.java b/tcrdb/src/org/labkey/tcrdb/TCRdbController.java index 766949205..f9c46e2ae 100644 --- a/tcrdb/src/org/labkey/tcrdb/TCRdbController.java +++ b/tcrdb/src/org/labkey/tcrdb/TCRdbController.java @@ -26,6 +26,9 @@ import org.labkey.api.action.ExportAction; import org.labkey.api.action.SimpleViewAction; import org.labkey.api.action.SpringActionController; +import org.labkey.api.collections.IntHashMap; +import org.labkey.api.collections.IntHashSet; +import org.labkey.api.collections.StringHashMap; import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.CompareType; import org.labkey.api.data.Container; @@ -528,7 +531,7 @@ public void export(DownloadCloneMaterialsForm form, HttpServletResponse response } StringBuilder fasta = new StringBuilder(); - Map> segmentsByLibrary = new HashMap<>(); + Map> segmentsByLibrary = new IntHashMap<>(); //find assay records SimpleFilter assayFilter = new SimpleFilter(FieldKey.fromString("rowId"), rowIds, CompareType.IN); @@ -689,12 +692,12 @@ public void export(DownloadCloneMaterialsForm form, HttpServletResponse response TableSelector ts = new TableSelector(assayData, cols.values(), assayFilter, null); Set segmentsByName = new HashSet<>(); - Map> segmentsByLibrary = new HashMap<>(); + Map> segmentsByLibrary = new IntHashMap<>(); - Map> clnaToCloneMap = new HashMap<>(); - Map clnaToCDR3Map = new HashMap<>(); + Map> clnaToCloneMap = new IntHashMap<>(); + Map clnaToCDR3Map = new StringHashMap<>(); StringBuilder imputedSequences = new StringBuilder(); - Set analyses = new HashSet<>(); + Set analyses = new IntHashSet(); final String[] segmentFields = new String[]{"vHit", "jHit", "cHit"}; ts.forEachResults(rs -> { Integer libraryId = rs.getObject(FieldKey.fromString("libraryId/libraryId")) == null ? null : rs.getInt(FieldKey.fromString("libraryId/libraryId")); diff --git a/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerVDJUtils.java b/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerVDJUtils.java index 1bea4bf76..b9a86e8db 100644 --- a/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerVDJUtils.java +++ b/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerVDJUtils.java @@ -9,6 +9,8 @@ import org.labkey.api.assay.AssayProvider; import org.labkey.api.assay.AssayService; import org.labkey.api.collections.CaseInsensitiveHashMap; +import org.labkey.api.collections.IntHashMap; +import org.labkey.api.collections.StringHashMap; import org.labkey.api.data.Container; import org.labkey.api.data.SimpleFilter; import org.labkey.api.data.TableInfo; @@ -66,7 +68,7 @@ public CellRangerVDJUtils(Logger log) _log = log; } - public void importAssayData(PipelineJob job, AnalysisModel model, File vLoupeFile, File outDir, Integer assayId, @Nullable Integer runId, boolean deleteExisting) throws PipelineJobException + public void importAssayData(PipelineJob job, AnalysisModel model, File vLoupeFile, File outDir, Integer assayId, @Nullable Long runId, boolean deleteExisting) throws PipelineJobException { File cellRangerOutDir = vLoupeFile.getParentFile(); @@ -125,8 +127,8 @@ public void importAssayData(PipelineJob job, AnalysisModel model, File vLoupeFil } File cDNAFile = CellHashingService.get().getCDNAInfoFile(outDir); - Map htoNameToCDNAMap = new HashMap<>(); - Map cDNAMap = new HashMap<>(); + Map htoNameToCDNAMap = new StringHashMap<>(); + Map cDNAMap = new IntHashMap<>(); if (cDNAFile.exists()) { try (CSVReader reader = new CSVReader(Readers.getReader(cDNAFile), '\t')) @@ -277,7 +279,7 @@ else if ("Low Counts".equals(hto)) } Map rows = new HashMap<>(); - Map> totalCellsBySample = new HashMap<>(); + Map> totalCellsBySample = new IntHashMap<>(); Set uniqueContigNames = new HashSet<>(); _log.info("processing clonotype CSV: " + allCsv.getPath()); @@ -617,7 +619,7 @@ private static class AssayModel private String coalescedContigName; } - private Map processRow(AssayModel assayModel, AnalysisModel model, Map cDNAMap, Integer runId, Map> totalCellsBySample, Map sequenceMap) throws PipelineJobException + private Map processRow(AssayModel assayModel, AnalysisModel model, Map cDNAMap, Long runId, Map> totalCellsBySample, Map sequenceMap) throws PipelineJobException { CDNA_Library cDNARecord = cDNAMap.get(assayModel.cdna); if (cDNARecord == null) @@ -665,7 +667,7 @@ private String removeNone(String input) return "None".equals(input) ? null : StringUtils.trimToNull(input); } - private void saveRun(PipelineJob job, ExpProtocol protocol, AnalysisModel model, List> rows, File outDir, Integer runId, boolean deleteExisting) throws PipelineJobException + private void saveRun(PipelineJob job, ExpProtocol protocol, AnalysisModel model, List> rows, File outDir, Long runId, boolean deleteExisting) throws PipelineJobException { ViewBackgroundInfo info = job.getInfo(); ViewContext vc = ViewContext.getMockViewContext(info.getUser(), info.getContainer(), info.getURL(), false); @@ -732,7 +734,7 @@ private void saveRun(PipelineJob job, ExpProtocol protocol, AnalysisModel model, } } - public static void deleteExistingData(AssayProvider ap, ExpProtocol protocol, Container c, User u, Logger log, int readsetId) throws PipelineJobException + public static void deleteExistingData(AssayProvider ap, ExpProtocol protocol, Container c, User u, Logger log, long readsetId) throws PipelineJobException { log.info("Preparing to delete any existing runs from this container for the same readset: " + readsetId); diff --git a/tcrdb/src/org/labkey/tcrdb/pipeline/MiXCRAnalysis.java b/tcrdb/src/org/labkey/tcrdb/pipeline/MiXCRAnalysis.java index 7e6807af4..1d568740b 100644 --- a/tcrdb/src/org/labkey/tcrdb/pipeline/MiXCRAnalysis.java +++ b/tcrdb/src/org/labkey/tcrdb/pipeline/MiXCRAnalysis.java @@ -12,6 +12,7 @@ import org.labkey.api.assay.AssayProvider; import org.labkey.api.assay.AssayService; import org.labkey.api.collections.CaseInsensitiveHashMap; +import org.labkey.api.collections.IntHashMap; import org.labkey.api.data.CompareType; import org.labkey.api.data.Container; import org.labkey.api.data.SimpleFilter; @@ -290,11 +291,11 @@ public Output performAnalysisPerSampleRemote(Readset rs, File inputBam, Referenc String version = new MiXCRWrapper(getPipelineCtx().getLogger()).getVersionString(); //iterate selected species/loci: - Map>>> tables = new HashMap<>(); + Map>>> tables = new IntHashMap<>(); JSONArray libraries = getTcrDbs(); - Map>> totalReadsInExportedAlignments = new HashMap<>(); - Map>> totalReadsInExportedClones = new HashMap<>(); + Map>> totalReadsInExportedAlignments = new IntHashMap<>(); + Map>> totalReadsInExportedClones = new IntHashMap<>(); for (JSONObject library : JsonUtil.toJSONObjectList(libraries)) { @@ -1221,7 +1222,7 @@ private TableInfo getCdnaTable() private void parseCloneOutput(Map runMap, File table, AnalysisModel model, File inputBam) throws PipelineJobException { - Integer runId = SequencePipelineService.get().getExpRunIdForJob(getPipelineCtx().getJob()); + Long runId = SequencePipelineService.get().getExpRunIdForJob(getPipelineCtx().getJob()); ExpRun run = ExperimentService.get().getExpRun(runId); List cloneDatas = run.getInputDatas(CLONES_FILE, ExpProtocol.ApplicationType.ExperimentRunOutput); @@ -1328,7 +1329,7 @@ private void parseCloneOutput(Map runMap, File table, AnalysisM } } - private Map getBaseRow(AnalysisModel model, Integer runId, TableInfo cDNATable) throws PipelineJobException + private Map getBaseRow(AnalysisModel model, Long runId, TableInfo cDNATable) throws PipelineJobException { Map row = new CaseInsensitiveHashMap<>(); if (model.getReadset() != null) @@ -1563,7 +1564,7 @@ private void importRun(RunData rd, File outDir, AnalysisModel model, ExpProtocol runProps.put("Name", "Analysis: " + model.getAnalysisId()); runProps.put("analysisId", model.getAnalysisId()); - Integer runId = SequencePipelineService.get().getExpRunIdForJob(getPipelineCtx().getJob()); + Long runId = SequencePipelineService.get().getExpRunIdForJob(getPipelineCtx().getJob()); runProps.put("pipelineRunId", runId); runProps.put("totalAlignments", rd.totalAlignments);