From 2600b236258ea25883aacc3e9230df31371a9be2 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Sat, 30 May 2026 07:37:29 -0700 Subject: [PATCH] Haplotype assay cleanup --- .../genotyping/HaplotypeProtocolBean.java | 17 +---------------- .../genotyping/HaplotypeProtocolSchema.java | 10 +++++----- .../labkey/genotyping/IlluminaFastqParser.java | 8 ++------ .../view/importHaplotypeAssignments.jsp | 4 ++-- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/genotyping/src/org/labkey/genotyping/HaplotypeProtocolBean.java b/genotyping/src/org/labkey/genotyping/HaplotypeProtocolBean.java index d6efa3ee..1c36ed80 100644 --- a/genotyping/src/org/labkey/genotyping/HaplotypeProtocolBean.java +++ b/genotyping/src/org/labkey/genotyping/HaplotypeProtocolBean.java @@ -22,22 +22,7 @@ * Date: 12/14/12 */ -public class HaplotypeProtocolBean +public record HaplotypeProtocolBean(HaplotypeDataCollector dataCollector, ExpProtocol protocol) { - private final HaplotypeDataCollector dataCollector; - private final ExpProtocol protocol; - - public HaplotypeProtocolBean(HaplotypeDataCollector dataCollector, ExpProtocol protocol){ - this.dataCollector = dataCollector; - this.protocol = protocol; - } - - public HaplotypeDataCollector getDataCollector(){ - return dataCollector; - } - - public ExpProtocol getProtocol(){ - return protocol; - } } diff --git a/genotyping/src/org/labkey/genotyping/HaplotypeProtocolSchema.java b/genotyping/src/org/labkey/genotyping/HaplotypeProtocolSchema.java index 1fa7d852..e89367fe 100644 --- a/genotyping/src/org/labkey/genotyping/HaplotypeProtocolSchema.java +++ b/genotyping/src/org/labkey/genotyping/HaplotypeProtocolSchema.java @@ -102,7 +102,7 @@ public TableInfo getTable(String name, @Nullable ContainerFilter cf, boolean inc @Override public @Nullable TableInfo createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - FilteredTable table = (FilteredTable)new GenotypingQuerySchema(getUser(), getContainer()).getTable(GenotypingQuerySchema.TableType.AnimalAnalysis.name(), cf,true, true); + FilteredTable table = (FilteredTable)new GenotypingQuerySchema(getUser(), getContainer()).getTable(GenotypingQuerySchema.TableType.AnimalAnalysis.name(), cf,true, true); List keys = new ArrayList<>(table.getDefaultVisibleColumns()); HashSet defaults = HaplotypeAssayProvider.getDefaultColumns(); List props = HaplotypeAssayProvider.getDomainProps(getProtocol()); @@ -147,14 +147,15 @@ private ExprColumn makeColumnFromRunField(DomainProperty prop, boolean max, SQLF String field = prop.getName(); String label = prop.getLabel() != null ? prop.getLabel() : ColumnInfo.labelFromName(prop.getName()); - String type = field.substring(0, prop.getName().length()-1).replaceAll("Haplotype", ""); //ColumnInfo.labelFromName(prop.getName()).split(" ")[0]; + String type = field.substring(0, prop.getName().length()-1).replace("Haplotype", ""); //ColumnInfo.labelFromName(prop.getName()).split(" ")[0]; SQLFragment sql = new SQLFragment("(SELECT "); sql.append("min"); sql.append("(x.Haplotype) FROM ("); sql.append(selectStatement); - sql.append(") AS x WHERE x.DiploidNumber = ? AND x.Type = '" + type + "' AND x.AnimalAnalysisId = " + ExprColumn.STR_TABLE_ALIAS + ".RowID)"); + sql.append(") AS x WHERE x.DiploidNumber = ? AND x.Type = ? AND x.AnimalAnalysisId = " + ExprColumn.STR_TABLE_ALIAS + ".RowID)"); sql.add(max ? 2 : 1); + sql.add(type); ExprColumn column = new ExprColumn(table, field, sql, JdbcType.VARCHAR); TableInfo haplotypeDetailsTableInfo = getHaplotypeDetailsTableInfo(); if (haplotypeDetailsTableInfo != null && haplotypeDetailsTableInfo.getGridURL(getContainer()) != null) @@ -180,8 +181,7 @@ public DataView createDataView() { DataView result = super.createDataView(); DataRegion rgn = result.getDataRegion(); - - ButtonBar bar = result.getDataRegion().getButtonBar(DataRegion.MODE_GRID); + ButtonBar bar = rgn.getButtonBar(DataRegion.MODE_GRID); if (!bar.isLocked()) { ActionButton reportButton = new ActionButton(GenotypingController.HaplotypeAssignmentReportAction.class, "Produce Report"); diff --git a/genotyping/src/org/labkey/genotyping/IlluminaFastqParser.java b/genotyping/src/org/labkey/genotyping/IlluminaFastqParser.java index 6b433035..5862b7bf 100644 --- a/genotyping/src/org/labkey/genotyping/IlluminaFastqParser.java +++ b/genotyping/src/org/labkey/genotyping/IlluminaFastqParser.java @@ -20,8 +20,8 @@ import org.apache.commons.collections4.ListValuedMap; import org.apache.commons.collections4.multimap.ArrayListValuedHashMap; import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; import org.junit.Assert; import org.junit.Before; @@ -58,10 +58,6 @@ * This is designed to parse the FASTQ files produced by a single run on an Illumina instrument and produce one gzipped FASTQ * for each sample in that run. Parsing that CSV file to obtain the sample list is upstream of this class. * It is designed to be called from a pipeline job, although it should not need to be. - * - * User: bbimber - * Date: 4/18/12 - * Time: 11:35 AM */ public class IlluminaFastqParser { @@ -351,7 +347,7 @@ else if(rc == 0 && readCount != 0) return fileName + " has " + readCount + " reads, while its pair file is empty and has 0 reads."; } else - m.put(fileNameWithoutPairingInfo, Integer.valueOf(readCount)); + m.put(fileNameWithoutPairingInfo, readCount); return null; diff --git a/genotyping/src/org/labkey/genotyping/view/importHaplotypeAssignments.jsp b/genotyping/src/org/labkey/genotyping/view/importHaplotypeAssignments.jsp index ae2cd3a2..b1e79896 100644 --- a/genotyping/src/org/labkey/genotyping/view/importHaplotypeAssignments.jsp +++ b/genotyping/src/org/labkey/genotyping/view/importHaplotypeAssignments.jsp @@ -28,7 +28,7 @@ <% JspView me = HttpView.currentView(); HaplotypeProtocolBean bean = me.getModelBean(); - HaplotypeDataCollector dataCollector = bean.getDataCollector(); + HaplotypeDataCollector dataCollector = bean.dataCollector(); String[] reshowData = {}; if (dataCollector.getReshowValue("data") != null && !dataCollector.getReshowValue("data").isEmpty()) { @@ -42,7 +42,7 @@