From 73b732e0ff694158ecf9c8bd205b93013fece580 Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Mon, 29 Jan 2024 10:08:07 -0500 Subject: [PATCH 01/11] Initial logic implementation --- .../qualitycontrol/QcPassFailCriteria.java | 230 ++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java new file mode 100644 index 00000000..765cc5a9 --- /dev/null +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -0,0 +1,230 @@ +package com.velox.sloan.cmo.workflows.qualitycontrol; + +import com.velox.sapioutils.server.plugin.DefaultGenericPlugin; +import com.velox.api.datarecord.DataRecord; +import com.velox.api.datarecord.InvalidValue; +import com.velox.api.datarecord.IoError; +import com.velox.api.datarecord.NotFound; +import com.velox.api.plugin.PluginResult; +import com.velox.api.util.ServerException; +import com.velox.api.workflow.ActiveTask; +import com.velox.sapioutils.server.plugin.DefaultGenericPlugin; +import com.velox.sapioutils.shared.enums.PluginOrder; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; + +import java.io.IOError; +import java.io.IOException; +import java.rmi.RemoteException; +import com.velox.api.util.ServerException; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +public class QcPassFailCriteria extends DefaultGenericPlugin { + public boolean isRNAQcReportStep = false; + public boolean isDNAQcReportStep = false; + public QcPassFailCriteria() { + setTaskEntry(true); + setOrder(PluginOrder.LAST.getOrder()); + } + + public boolean shouldRun() throws RemoteException { + this.logInfo(""); + return this.activeTask.getTask().getTaskOptions().containsKey("Autofill QC DECISION COMMENT") && !this.activeTask.getTask().getTaskOptions().containsKey("_Autofilled"); + } + public PluginResult run() throws RemoteException { + try { + if (this.activeTask.getTask().getTaskName().contains("Generate QC Report DNA")) { + this.isDNAQcReportStep = true; + } + if (this.activeTask.getTask().getTaskName().contains("Generate QC Report RNA")) { + this.isRNAQcReportStep = true; + } + List attachedSamples = this.activeTask.getAttachedDataRecords("Sample", this.user); + List attachedQcDNAReports = this.activeTask.getAttachedDataRecords("QcReportDna", this.user); + List attachedQcRNAReports = this.activeTask.getAttachedDataRecords("QcReportRna", this.user); + List sampleObjects = new LinkedList<>(); + for (DataRecord sample : attachedSamples) { + sampleObjects.add(sample); + } + List qcReports = getQcReportRecordsForSamples(sampleObjects, isDNAQcReportStep); + for (DataRecord sample : attachedSamples) { + String recipe = sample.getStringVal("Recipe", user); + int mass = Integer.parseInt(sample.getStringVal("TotalMass", user)); + String igoId = sample.getStringVal("SampleId", user); + String preservation = sample.getStringVal("Preservation", user); + String sampleType = sample.getStringVal("ExemplarSampleType", user); + + + if (recipe.toLowerCase().equals("ampliconseq")) { + if (isDNAQcReportStep) { + if(attachedQcDNAReports.isEmpty()) { + this.clientCallback.displayError("No DNA QC report attached to this task."); + return new PluginResult(false); + } + + } else if (isRNAQcReportStep) { + if(attachedQcRNAReports.isEmpty()) { + this.clientCallback.displayError("No RNA QC report attached to this task."); + return new PluginResult(false); + } + } + if (mass > 100) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + } + } + + } else if (10 < mass && mass < 100) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + } + + } else if (mass < 10) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Failed", user); + qcReport.setDataField("Comments", "Low quantity", user); + } + } + } + } else if (recipe.toLowerCase().equals("chipseq")) { + if (mass >= 10) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + } + } + } + else { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + } + } + + } else if (recipe.toLowerCase().equals("impact505")) { + if (sampleType.equalsIgnoreCase("cfDNA")) { + if (mass > 100) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + if (true) { // all samples passed + qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); + } + } + } + + } else if (mass > 5 && mass < 100) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + } + } else if (mass < 5) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Failed", user); + qcReport.setDataField("Comments", "Low quantity", user); + } + } + } + } + if (preservation.equalsIgnoreCase("FFPE")) { + if (mass > 200) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + if (true) { // all samples passed + qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); + } + } + } + + } else if (mass > 40 && mass < 200) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + } + } else if (mass < 40) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Failed", user); + qcReport.setDataField("Comments", "Low quantity", user); + } + } + } + } + else { // other preservations than FFPE + if (mass > 100) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + if (true) { // all samples passed + qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); + } + } + } + + } else if (mass > 20 && mass < 100) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + } + + } else if (mass < 20) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Failed", user); + qcReport.setDataField("Comments", "Low quantity", user); + } + } + } + + } + } + } + } catch (NotFound | ServerException | IoError | InvalidValue | RemoteException e) { + String errMsg = String.format("Remote Exception while QC report generation:\n%s", ExceptionUtils.getStackTrace(e)); + //clientCallback.displayError(errMsg); + logError(errMsg); + return new PluginResult(false); + } + + return new PluginResult(true); + } + + private List getQcReportRecordsForSamples(List sampleIdList, boolean isDNAQcReportStep) { + List qcReportRecords = new ArrayList<>(); + try { + if (isDNAQcReportStep) { + qcReportRecords = dataRecordManager.queryDataRecords("QcReportDna", "SampleId", sampleIdList, user); + } + else if (isRNAQcReportStep) { + qcReportRecords = dataRecordManager.queryDataRecords("QcReportRna", "SampleId", sampleIdList, user); + } + } catch (NotFound notFound) { + logError(String.format("NotFound Exception while getting QC report records for attached Samples:\n%s", ExceptionUtils.getStackTrace(notFound))); + } catch (IoError ioError) { + logError(String.format("IoError Exception while getting QC report records for attached Samples:\n%s", ExceptionUtils.getStackTrace(ioError))); + } catch (ServerException e) { + logError(String.format("ServerException while getting QC records for attached Samples:\n%s", ExceptionUtils.getStackTrace(e))); + } catch (RemoteException e) { + logError(String.format("RemoteException while getting QC report records for attached Samples:\n%s", ExceptionUtils.getStackTrace(e))); + } + return qcReportRecords; + } +} From 368321e216f4c9e861f43d8ffd280ce983b9441d Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Thu, 1 Feb 2024 10:46:07 -0500 Subject: [PATCH 02/11] Added logic for finding the qc status of all samples in one request. --- .../qualitycontrol/QcPassFailCriteria.java | 93 ++++++++++++++++--- 1 file changed, 82 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index 765cc5a9..8274f708 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -18,11 +18,13 @@ import java.rmi.RemoteException; import com.velox.api.util.ServerException; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; +import javax.xml.crypto.Data; +import java.util.*; +import java.util.regex.Pattern; public class QcPassFailCriteria extends DefaultGenericPlugin { + private final static String IGO_ID_WITHOUT_ALPHABETS_PATTERN = "^[0-9]+_[0-9]+.*$"; // sample id without alphabets + private final static String IGO_ID_WITH_ALPHABETS_PATTERN = "^[0-9]+_[A-Z]+_[0-9]+.*$"; // sample id without alphabets public boolean isRNAQcReportStep = false; public boolean isDNAQcReportStep = false; public QcPassFailCriteria() { @@ -45,18 +47,41 @@ public PluginResult run() throws RemoteException { List attachedSamples = this.activeTask.getAttachedDataRecords("Sample", this.user); List attachedQcDNAReports = this.activeTask.getAttachedDataRecords("QcReportDna", this.user); List attachedQcRNAReports = this.activeTask.getAttachedDataRecords("QcReportRna", this.user); - List sampleObjects = new LinkedList<>(); + List sampleObjects = new LinkedList<>(attachedSamples); + List qcReports = getQcReportRecordsForSamples(sampleObjects, isDNAQcReportStep); + Map> requestIdToSampleMap = new HashMap<>(); + Map requestToAllSamplesQcStatus = new HashMap<>(); + for (DataRecord sample : attachedSamples) { - sampleObjects.add(sample); + String requestId = getRequestId(sample.getStringVal("SampleId", user)); + if(!requestIdToSampleMap.containsKey(requestId)) { + requestIdToSampleMap.put(requestId, new LinkedList<>()); + } + requestIdToSampleMap.get(requestId).add(sample); } - List qcReports = getQcReportRecordsForSamples(sampleObjects, isDNAQcReportStep); + + for (Map.Entry> entry : requestIdToSampleMap.entrySet()) { + boolean currentRequestSamplesQcStatus = true; + List entryValueObjects = new LinkedList<>(entry.getValue()); + List qcRecs = getQcRecordsForSamples(entryValueObjects); + for (DataRecord qcRecords : qcRecs) { + if(!qcRecords.getBooleanVal("QCStatus", user)) { + currentRequestSamplesQcStatus = false; + break; + } + } + requestToAllSamplesQcStatus.put(entry.getKey(), currentRequestSamplesQcStatus); + } + + + for (DataRecord sample : attachedSamples) { String recipe = sample.getStringVal("Recipe", user); int mass = Integer.parseInt(sample.getStringVal("TotalMass", user)); String igoId = sample.getStringVal("SampleId", user); String preservation = sample.getStringVal("Preservation", user); String sampleType = sample.getStringVal("ExemplarSampleType", user); - + String requestId = getRequestId(igoId); if (recipe.toLowerCase().equals("ampliconseq")) { if (isDNAQcReportStep) { @@ -117,7 +142,7 @@ public PluginResult run() throws RemoteException { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); - if (true) { // all samples passed + if (requestToAllSamplesQcStatus.get(requestId)) { // all samples passed qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); } } @@ -144,7 +169,7 @@ public PluginResult run() throws RemoteException { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); - if (true) { // all samples passed + if (requestToAllSamplesQcStatus.get(requestId)) { // all samples passed qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); } } @@ -171,7 +196,7 @@ public PluginResult run() throws RemoteException { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); - if (true) { // all samples passed + if (requestToAllSamplesQcStatus.get(requestId)) { // all samples passed qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); } } @@ -199,7 +224,6 @@ public PluginResult run() throws RemoteException { } } catch (NotFound | ServerException | IoError | InvalidValue | RemoteException e) { String errMsg = String.format("Remote Exception while QC report generation:\n%s", ExceptionUtils.getStackTrace(e)); - //clientCallback.displayError(errMsg); logError(errMsg); return new PluginResult(false); } @@ -227,4 +251,51 @@ else if (isRNAQcReportStep) { } return qcReportRecords; } + + /** + * get QCDatum DataRecords for a sample. + * + * @param sampleIdList + * @return List + * @throws RemoteException + * @throws IoError + * @throws NotFound + * @throws ServerException + */ + private List getQcRecordsForSamples(List sampleIdList) { + List qcRecords = new ArrayList<>(); + try { + qcRecords = dataRecordManager.queryDataRecords("QCDatum", "SampleId", sampleIdList, user); + } catch (NotFound notFound) { + logError(String.format("NotFound Exception while getting QC records for attached Samples:\n%s", ExceptionUtils.getStackTrace(notFound))); + } catch (IoError ioError) { + logError(String.format("IoError Exception while getting QC records for attached Samples:\n%s", ExceptionUtils.getStackTrace(ioError))); + } catch (ServerException e) { + logError(String.format("ServerException while getting QC records for attached Samples:\n%s", ExceptionUtils.getStackTrace(e))); + } catch (RemoteException e) { + logError(String.format("RemoteException while getting QC records for attached Samples:\n%s", ExceptionUtils.getStackTrace(e))); + } + return qcRecords; + } + + /** + * Method to get base Sample ID when aliquot annotation is present. + * Example: for sample id 012345_1_1_2, base sample id is 012345 + * Example2: for sample id 012345_B_1_1_2, base sample id is 012345_B + * @param sampleId + * @return + */ + public static String getRequestId(String sampleId){ + Pattern alphabetPattern = Pattern.compile(IGO_ID_WITH_ALPHABETS_PATTERN); + Pattern withoutAlphabetPattern = Pattern.compile(IGO_ID_WITHOUT_ALPHABETS_PATTERN); + if (alphabetPattern.matcher(sampleId).matches()){ + String[] sampleIdValues = sampleId.split("_"); + return String.join("_", Arrays.copyOfRange(sampleIdValues,0,2)); + } + if(withoutAlphabetPattern.matcher(sampleId).matches()){ + String[] sampleIdValues = sampleId.split("_"); + return String.join("_", Arrays.copyOfRange(sampleIdValues,0,1)); + } + return sampleId; + } } From 53a644b4952e3cdebfd71a4c51247da8b5f681b6 Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Mon, 5 Feb 2024 10:41:12 -0500 Subject: [PATCH 03/11] Testing/debugging stated conditions. --- .../qualitycontrol/QcPassFailCriteria.java | 86 ++++++++++++------- 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index 8274f708..712848aa 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -28,8 +28,8 @@ public class QcPassFailCriteria extends DefaultGenericPlugin { public boolean isRNAQcReportStep = false; public boolean isDNAQcReportStep = false; public QcPassFailCriteria() { - setTaskEntry(true); - setOrder(PluginOrder.LAST.getOrder()); + setTaskSubmit(true); + setOrder(PluginOrder.FIRST.getOrder()); } public boolean shouldRun() throws RemoteException { @@ -38,64 +38,79 @@ public boolean shouldRun() throws RemoteException { } public PluginResult run() throws RemoteException { try { - if (this.activeTask.getTask().getTaskName().contains("Generate QC Report DNA")) { + if (this.activeTask.getTask().getTaskName().trim().equalsIgnoreCase("Generate QC report for DNA")) { this.isDNAQcReportStep = true; + logInfo("It's a DNA QC Report step!!"); } - if (this.activeTask.getTask().getTaskName().contains("Generate QC Report RNA")) { + if (this.activeTask.getTask().getTaskName().trim().equalsIgnoreCase("Generate QC report for RNA")) { this.isRNAQcReportStep = true; + logInfo("It's a RNA QC Report step!!"); } List attachedSamples = this.activeTask.getAttachedDataRecords("Sample", this.user); - List attachedQcDNAReports = this.activeTask.getAttachedDataRecords("QcReportDna", this.user); + List attachedQcDNAReports = this.activeTask.getAttachedDataRecords("QcReportDna", this.user); List attachedQcRNAReports = this.activeTask.getAttachedDataRecords("QcReportRna", this.user); List sampleObjects = new LinkedList<>(attachedSamples); - List qcReports = getQcReportRecordsForSamples(sampleObjects, isDNAQcReportStep); - Map> requestIdToSampleMap = new HashMap<>(); + List qcReports = new LinkedList<>();//getQcReportRecordsForSamples(sampleObjects, isDNAQcReportStep); + + Map> requestIdToSampleMap = new HashMap<>(); Map requestToAllSamplesQcStatus = new HashMap<>(); for (DataRecord sample : attachedSamples) { - String requestId = getRequestId(sample.getStringVal("SampleId", user)); + String sampleId = sample.getStringVal("SampleId", user); + String requestId = getRequestId(sampleId); + logInfo("Retrieved request id for sample: " + sample.getStringVal("SampleId", user) + " = " + requestId); if(!requestIdToSampleMap.containsKey(requestId)) { requestIdToSampleMap.put(requestId, new LinkedList<>()); } - requestIdToSampleMap.get(requestId).add(sample); + requestIdToSampleMap.get(requestId).add(sampleId); + logInfo("Added " + sampleId + " for request " + requestId + " to the request to samples map"); } - for (Map.Entry> entry : requestIdToSampleMap.entrySet()) { + for (Map.Entry> entry : requestIdToSampleMap.entrySet()) { boolean currentRequestSamplesQcStatus = true; - List entryValueObjects = new LinkedList<>(entry.getValue()); - List qcRecs = getQcRecordsForSamples(entryValueObjects); + //List entryValueObjects = new LinkedList<>(entry.getValue()); + List qcRecs = getQcRecordsForSamples(entry.getValue()); for (DataRecord qcRecords : qcRecs) { - if(!qcRecords.getBooleanVal("QCStatus", user)) { + if(qcRecords.getStringVal("QCStatus", user).trim().equalsIgnoreCase("failed")) { currentRequestSamplesQcStatus = false; + logInfo("QC status become failed."); break; } } requestToAllSamplesQcStatus.put(entry.getKey(), currentRequestSamplesQcStatus); + logInfo("Value " + currentRequestSamplesQcStatus + " has been initialized for request " + entry.getKey() + " in requestToAllSamplesQcStatus map."); } + if (isDNAQcReportStep) { + if(attachedQcDNAReports.isEmpty()) { + this.clientCallback.displayError("No DNA QC report attached to this task."); + return new PluginResult(false); + } + qcReports.addAll(attachedQcDNAReports); + logInfo("qcReports populated for DNA"); + } else if (isRNAQcReportStep) { + if(attachedQcRNAReports.isEmpty()) { + this.clientCallback.displayError("No RNA QC report attached to this task."); + return new PluginResult(false); + } + qcReports.addAll(attachedQcRNAReports); + logInfo("qcReports populated for RNA"); + } for (DataRecord sample : attachedSamples) { String recipe = sample.getStringVal("Recipe", user); - int mass = Integer.parseInt(sample.getStringVal("TotalMass", user)); + double mass = sample.getDoubleVal("TotalMass", user); String igoId = sample.getStringVal("SampleId", user); String preservation = sample.getStringVal("Preservation", user); String sampleType = sample.getStringVal("ExemplarSampleType", user); String requestId = getRequestId(igoId); - if (recipe.toLowerCase().equals("ampliconseq")) { - if (isDNAQcReportStep) { - if(attachedQcDNAReports.isEmpty()) { - this.clientCallback.displayError("No DNA QC report attached to this task."); - return new PluginResult(false); - } + logInfo("Logging sample info: \nIGO ID = " + igoId + "\nrecipe = " + recipe + "\ntotal mass = " + mass + + "\npreservation = " + preservation + "\nsample type = " + sampleType); - } else if (isRNAQcReportStep) { - if(attachedQcRNAReports.isEmpty()) { - this.clientCallback.displayError("No RNA QC report attached to this task."); - return new PluginResult(false); - } - } + if (recipe.trim().equalsIgnoreCase("ampliconseq")) { + logInfo("ampliconseq logic!"); if (mass > 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { @@ -112,14 +127,16 @@ public PluginResult run() throws RemoteException { } } else if (mass < 10) { + logInfo("mass is < 10"); for (DataRecord qcReport : qcReports) { + logInfo("amliconseq sample with mass < 10. Qc reports are getting modified!"); if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Failed", user); qcReport.setDataField("Comments", "Low quantity", user); } } } - } else if (recipe.toLowerCase().equals("chipseq")) { + } else if (recipe.trim().equalsIgnoreCase("chipseq")) { if (mass >= 10) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { @@ -136,12 +153,14 @@ public PluginResult run() throws RemoteException { } } - } else if (recipe.toLowerCase().equals("impact505")) { + } else if (recipe.trim().equalsIgnoreCase("impact505")) { if (sampleType.equalsIgnoreCase("cfDNA")) { + logInfo("recipe impact 505, sample type cfdna"); if (mass > 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); + logInfo("requestToAllSamplesQcStatus.get(requestId) for requestId" + requestId + " is: " + requestToAllSamplesQcStatus.get(requestId)); if (requestToAllSamplesQcStatus.get(requestId)) { // all samples passed qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); } @@ -156,19 +175,23 @@ public PluginResult run() throws RemoteException { } } } else if (mass < 5) { + logInfo("mass is < 10"); + logInfo("qcReports size = " + qcReports.size()); for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + logInfo("SampleId matched!!"); qcReport.setDataField("IgoQcRecommendation", "Failed", user); qcReport.setDataField("Comments", "Low quantity", user); } } } } - if (preservation.equalsIgnoreCase("FFPE")) { + if (preservation.trim().equalsIgnoreCase("FFPE")) { if (mass > 200) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); + logInfo("requestToAllSamplesQcStatus.get(requestId) = " + requestToAllSamplesQcStatus.get(requestId)); if (requestToAllSamplesQcStatus.get(requestId)) { // all samples passed qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); } @@ -218,7 +241,6 @@ public PluginResult run() throws RemoteException { } } } - } } } @@ -227,7 +249,7 @@ public PluginResult run() throws RemoteException { logError(errMsg); return new PluginResult(false); } - + this.activeTask.getTask().getTaskOptions().put("_Autofilled", ""); return new PluginResult(true); } @@ -283,7 +305,7 @@ private List getQcRecordsForSamples(List sampleIdList) { * Example: for sample id 012345_1_1_2, base sample id is 012345 * Example2: for sample id 012345_B_1_1_2, base sample id is 012345_B * @param sampleId - * @return + * @return requestId */ public static String getRequestId(String sampleId){ Pattern alphabetPattern = Pattern.compile(IGO_ID_WITH_ALPHABETS_PATTERN); From 4a962aeaa14732755c01a3d5b58d34febc300e9c Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Tue, 6 Feb 2024 16:47:47 -0500 Subject: [PATCH 04/11] updated the logic to look into qc report instead of QC datum --- .../qualitycontrol/QcPassFailCriteria.java | 105 ++++++++++++------ 1 file changed, 73 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index 712848aa..139fb13c 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -66,21 +66,6 @@ public PluginResult run() throws RemoteException { logInfo("Added " + sampleId + " for request " + requestId + " to the request to samples map"); } - for (Map.Entry> entry : requestIdToSampleMap.entrySet()) { - boolean currentRequestSamplesQcStatus = true; - //List entryValueObjects = new LinkedList<>(entry.getValue()); - List qcRecs = getQcRecordsForSamples(entry.getValue()); - for (DataRecord qcRecords : qcRecs) { - if(qcRecords.getStringVal("QCStatus", user).trim().equalsIgnoreCase("failed")) { - currentRequestSamplesQcStatus = false; - logInfo("QC status become failed."); - break; - } - } - requestToAllSamplesQcStatus.put(entry.getKey(), currentRequestSamplesQcStatus); - logInfo("Value " + currentRequestSamplesQcStatus + " has been initialized for request " + entry.getKey() + " in requestToAllSamplesQcStatus map."); - } - if (isDNAQcReportStep) { if(attachedQcDNAReports.isEmpty()) { this.clientCallback.displayError("No DNA QC report attached to this task."); @@ -111,14 +96,14 @@ public PluginResult run() throws RemoteException { if (recipe.trim().equalsIgnoreCase("ampliconseq")) { logInfo("ampliconseq logic!"); - if (mass > 100) { + if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); } } - } else if (10 < mass && mass < 100) { + } else if (10 <= mass && mass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -156,18 +141,15 @@ public PluginResult run() throws RemoteException { } else if (recipe.trim().equalsIgnoreCase("impact505")) { if (sampleType.equalsIgnoreCase("cfDNA")) { logInfo("recipe impact 505, sample type cfdna"); - if (mass > 100) { + if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); logInfo("requestToAllSamplesQcStatus.get(requestId) for requestId" + requestId + " is: " + requestToAllSamplesQcStatus.get(requestId)); - if (requestToAllSamplesQcStatus.get(requestId)) { // all samples passed - qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); - } } } - } else if (mass > 5 && mass < 100) { + } else if (mass >= 5 && mass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -187,18 +169,15 @@ public PluginResult run() throws RemoteException { } } if (preservation.trim().equalsIgnoreCase("FFPE")) { - if (mass > 200) { + if (mass >= 200) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); logInfo("requestToAllSamplesQcStatus.get(requestId) = " + requestToAllSamplesQcStatus.get(requestId)); - if (requestToAllSamplesQcStatus.get(requestId)) { // all samples passed - qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); - } } } - } else if (mass > 40 && mass < 200) { + } else if (mass >= 40 && mass < 200) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -215,17 +194,14 @@ public PluginResult run() throws RemoteException { } } else { // other preservations than FFPE - if (mass > 100) { + if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); - if (requestToAllSamplesQcStatus.get(requestId)) { // all samples passed - qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); - } } } - } else if (mass > 20 && mass < 100) { + } else if (mass >= 20 && mass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -243,6 +219,71 @@ public PluginResult run() throws RemoteException { } } } + } + // Map of request ID to boolean value indicating if all samples under that request have igo QC recommendation value of "passed" + for (Map.Entry> entry : requestIdToSampleMap.entrySet()) { + boolean currentRequestSamplesQcStatus = true; + //List entryValueObjects = new LinkedList<>(entry.getValue()); + List qcRecs = getQcReportRecordsForSamples(entry.getValue(), isDNAQcReportStep); + for (DataRecord qcRecords : qcRecs) { + if(!qcRecords.getStringVal("IgoQcRecommendation", user).trim().equalsIgnoreCase("passed")) { + currentRequestSamplesQcStatus = false; + logInfo("QC report of the project has a failed value."); + break; + } + } + requestToAllSamplesQcStatus.put(entry.getKey(), currentRequestSamplesQcStatus); + logInfo("Value " + currentRequestSamplesQcStatus + " has been initialized for request " + entry.getKey() + " in requestToAllSamplesQcStatus map."); + } + + // Setting the investigator decision for each sample based on the all samples in a request igo QC recommendation field value + for (DataRecord sample : attachedSamples) { + String recipe = sample.getStringVal("Recipe", user); + double mass = sample.getDoubleVal("TotalMass", user); + String igoId = sample.getStringVal("SampleId", user); + String preservation = sample.getStringVal("Preservation", user); + String sampleType = sample.getStringVal("ExemplarSampleType", user); + String requestId = getRequestId(igoId); + + if (recipe.trim().equalsIgnoreCase("impact505")) { + if (sampleType.equalsIgnoreCase("cfDNA")) { + logInfo("recipe impact 505, sample type cfdna"); + if (mass >= 100) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + if (requestToAllSamplesQcStatus.get(requestId)) { + qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); + } + } + } + } + } + if (preservation.trim().equalsIgnoreCase("FFPE")) { + if (mass >= 200) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + if (requestToAllSamplesQcStatus.get(requestId)) { + qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); + } + } + } + } + } + else { // other preservations than FFPE + if (mass >= 100) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + if (requestToAllSamplesQcStatus.get(requestId)) { + qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); + } + } + } + } + } + } + + + } } catch (NotFound | ServerException | IoError | InvalidValue | RemoteException e) { String errMsg = String.format("Remote Exception while QC report generation:\n%s", ExceptionUtils.getStackTrace(e)); From 39b5ff8916a05b655f06b59d979e381d2a3db89f Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Wed, 7 Feb 2024 15:18:30 -0500 Subject: [PATCH 05/11] Added ddPCR logic --- .../qualitycontrol/QcPassFailCriteria.java | 181 ++++++++++++++---- 1 file changed, 145 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index 139fb13c..f06c1a17 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -39,10 +39,12 @@ public boolean shouldRun() throws RemoteException { public PluginResult run() throws RemoteException { try { if (this.activeTask.getTask().getTaskName().trim().equalsIgnoreCase("Generate QC report for DNA")) { + this.isRNAQcReportStep = false; this.isDNAQcReportStep = true; logInfo("It's a DNA QC Report step!!"); } if (this.activeTask.getTask().getTaskName().trim().equalsIgnoreCase("Generate QC report for RNA")) { + this.isDNAQcReportStep = false; this.isRNAQcReportStep = true; logInfo("It's a RNA QC Report step!!"); } @@ -219,6 +221,107 @@ public PluginResult run() throws RemoteException { } } } + else if (recipe.trim().equalsIgnoreCase("ddpcr")) { + String[] assays = sample.getStringVal("Assay", user).split(";"); + int minimumMassRequired = assays.length * 1; + if (sampleType.equalsIgnoreCase("cDNA")) { + if (mass >= minimumMassRequired) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + } + } + } else { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + } + } + } + if(isDNAQcReportStep) { + if (!sampleType.equalsIgnoreCase("cDNA")) { // Other sample types than cDNA + minimumMassRequired = assays.length * 20; + if (mass >= minimumMassRequired) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + } + } + } else { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + } + } + } + } + else { //RNA QC step + if (preservation.equalsIgnoreCase("FFPE")) { + minimumMassRequired = assays.length * 2; + if (mass >= minimumMassRequired) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + if (Integer.parseInt(qcReport.getStringVal("DV200", user)) >= 50) { + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + else { + qcReport.setDataField("Comments", "Suboptimal quality", user); + } + } + } + } + else { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + if (Integer.parseInt(qcReport.getStringVal("DV200", user)) >= 50) { + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + else { + qcReport.setDataField("Comments", "Suboptimal quantity and suboptimal quality", user); + } + } + } + } + } + else { //preservation other than FFPE + if (mass >= minimumMassRequired) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + if (Integer.parseInt(qcReport.getStringVal("RIN", user)) >= 6) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + } + else { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quality", user); + } + } + } + } + else { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + if (Integer.parseInt(qcReport.getStringVal("RIN", user)) < 6) { + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + else { + qcReport.setDataField("Comments", "Suboptimal quantity and suboptimal quality", user); + } + } + } + } + } + } + } + else if (recipe.trim().equalsIgnoreCase("")) { + + } } // Map of request ID to boolean value indicating if all samples under that request have igo QC recommendation value of "passed" for (Map.Entry> entry : requestIdToSampleMap.entrySet()) { @@ -245,45 +348,51 @@ public PluginResult run() throws RemoteException { String sampleType = sample.getStringVal("ExemplarSampleType", user); String requestId = getRequestId(igoId); - if (recipe.trim().equalsIgnoreCase("impact505")) { - if (sampleType.equalsIgnoreCase("cfDNA")) { - logInfo("recipe impact 505, sample type cfdna"); - if (mass >= 100) { - for (DataRecord qcReport : qcReports) { - if (igoId.equals(qcReport.getStringVal("SampleId", user))) { - if (requestToAllSamplesQcStatus.get(requestId)) { - qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); - } - } - } - } - } - if (preservation.trim().equalsIgnoreCase("FFPE")) { - if (mass >= 200) { - for (DataRecord qcReport : qcReports) { - if (igoId.equals(qcReport.getStringVal("SampleId", user))) { - if (requestToAllSamplesQcStatus.get(requestId)) { - qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); - } - } - } - } - } - else { // other preservations than FFPE - if (mass >= 100) { - for (DataRecord qcReport : qcReports) { - if (igoId.equals(qcReport.getStringVal("SampleId", user))) { - if (requestToAllSamplesQcStatus.get(requestId)) { - qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); - } - } - } +// if (recipe.trim().equalsIgnoreCase("impact505")) { +// if (sampleType.equalsIgnoreCase("cfDNA")) { +// logInfo("recipe impact 505, sample type cfdna"); +// if (mass >= 100) { +// for (DataRecord qcReport : qcReports) { +// if (igoId.equals(qcReport.getStringVal("SampleId", user))) { +// if (requestToAllSamplesQcStatus.get(requestId)) { +// qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); +// } +// } +// } +// } +// } +// if (preservation.trim().equalsIgnoreCase("FFPE")) { +// if (mass >= 200) { +// for (DataRecord qcReport : qcReports) { +// if (igoId.equals(qcReport.getStringVal("SampleId", user))) { +// if (requestToAllSamplesQcStatus.get(requestId)) { +// qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); +// } +// } +// } +// } +// } +// else { // other preservations than FFPE +// if (mass >= 100) { +// for (DataRecord qcReport : qcReports) { +// if (igoId.equals(qcReport.getStringVal("SampleId", user))) { +// if (requestToAllSamplesQcStatus.get(requestId)) { +// qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); +// } +// } +// } +// } +// } +// } + // Below should work for all recipes. No need to check conditions again when the igo recommendation is passed! + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user)) && + qcReport.getStringVal("IgoQcRecommendation", user).trim().equalsIgnoreCase("passed")) { + if (requestToAllSamplesQcStatus.get(requestId)) { + qcReport.setDataField("InvestigatorDecision", "Already moved forward by IGO", user); } } } - - - } } catch (NotFound | ServerException | IoError | InvalidValue | RemoteException e) { String errMsg = String.format("Remote Exception while QC report generation:\n%s", ExceptionUtils.getStackTrace(e)); From 78ee149495a0d90ca2626b40e5edc18f336d5b36 Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Tue, 13 Feb 2024 10:57:52 -0500 Subject: [PATCH 06/11] mass condiftions updated based on volume restriction --- .../qualitycontrol/QcPassFailCriteria.java | 63 +++++++++++-------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index f06c1a17..944b0453 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -85,9 +85,16 @@ public PluginResult run() throws RemoteException { logInfo("qcReports populated for RNA"); } + Map recipeToVolCoefficient = new HashMap<>() + {{ + put("ampliconseq", 50); + put("chipseq", 50); + put("impact505", 50); + }}; for (DataRecord sample : attachedSamples) { String recipe = sample.getStringVal("Recipe", user); double mass = sample.getDoubleVal("TotalMass", user); + double concentration = sample.getDoubleVal("Concentration", user); String igoId = sample.getStringVal("SampleId", user); String preservation = sample.getStringVal("Preservation", user); String sampleType = sample.getStringVal("ExemplarSampleType", user); @@ -96,16 +103,17 @@ public PluginResult run() throws RemoteException { logInfo("Logging sample info: \nIGO ID = " + igoId + "\nrecipe = " + recipe + "\ntotal mass = " + mass + "\npreservation = " + preservation + "\nsample type = " + sampleType); + double calculatedMass = concentration * recipeToVolCoefficient.get(recipe); if (recipe.trim().equalsIgnoreCase("ampliconseq")) { logInfo("ampliconseq logic!"); - if (mass >= 100) { + if (calculatedMass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); } } - } else if (10 <= mass && mass < 100) { + } else if (10 <= calculatedMass && calculatedMass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -113,7 +121,7 @@ public PluginResult run() throws RemoteException { } } - } else if (mass < 10) { + } else if (calculatedMass < 10) { logInfo("mass is < 10"); for (DataRecord qcReport : qcReports) { logInfo("amliconseq sample with mass < 10. Qc reports are getting modified!"); @@ -124,7 +132,7 @@ public PluginResult run() throws RemoteException { } } } else if (recipe.trim().equalsIgnoreCase("chipseq")) { - if (mass >= 10) { + if (calculatedMass >= 10) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -143,7 +151,7 @@ public PluginResult run() throws RemoteException { } else if (recipe.trim().equalsIgnoreCase("impact505")) { if (sampleType.equalsIgnoreCase("cfDNA")) { logInfo("recipe impact 505, sample type cfdna"); - if (mass >= 100) { + if (calculatedMass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -151,14 +159,14 @@ public PluginResult run() throws RemoteException { } } - } else if (mass >= 5 && mass < 100) { + } else if (calculatedMass >= 5 && calculatedMass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); qcReport.setDataField("Comments", "Suboptimal quantity", user); } } - } else if (mass < 5) { + } else if (calculatedMass < 5) { logInfo("mass is < 10"); logInfo("qcReports size = " + qcReports.size()); for (DataRecord qcReport : qcReports) { @@ -171,7 +179,7 @@ public PluginResult run() throws RemoteException { } } if (preservation.trim().equalsIgnoreCase("FFPE")) { - if (mass >= 200) { + if (calculatedMass >= 200) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -179,14 +187,14 @@ public PluginResult run() throws RemoteException { } } - } else if (mass >= 40 && mass < 200) { + } else if (calculatedMass >= 40 && calculatedMass < 200) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); qcReport.setDataField("Comments", "Suboptimal quantity", user); } } - } else if (mass < 40) { + } else if (calculatedMass < 40) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Failed", user); @@ -196,14 +204,14 @@ public PluginResult run() throws RemoteException { } } else { // other preservations than FFPE - if (mass >= 100) { + if (calculatedMass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); } } - } else if (mass >= 20 && mass < 100) { + } else if (calculatedMass >= 20 && calculatedMass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -211,7 +219,7 @@ public PluginResult run() throws RemoteException { } } - } else if (mass < 20) { + } else if (calculatedMass < 20) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Failed", user); @@ -224,24 +232,25 @@ public PluginResult run() throws RemoteException { else if (recipe.trim().equalsIgnoreCase("ddpcr")) { String[] assays = sample.getStringVal("Assay", user).split(";"); int minimumMassRequired = assays.length * 1; - if (sampleType.equalsIgnoreCase("cDNA")) { - if (mass >= minimumMassRequired) { - for (DataRecord qcReport : qcReports) { - if (igoId.equals(qcReport.getStringVal("SampleId", user))) { - qcReport.setDataField("IgoQcRecommendation", "Passed", user); + if(isDNAQcReportStep) { + if (sampleType.equalsIgnoreCase("cDNA")) { + minimumMassRequired *= 9; + if (mass >= minimumMassRequired) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + } } - } - } else { - for (DataRecord qcReport : qcReports) { - if (igoId.equals(qcReport.getStringVal("SampleId", user))) { - qcReport.setDataField("IgoQcRecommendation", "Try", user); - qcReport.setDataField("Comments", "Suboptimal quantity", user); + } else { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } } } } - } - if(isDNAQcReportStep) { - if (!sampleType.equalsIgnoreCase("cDNA")) { // Other sample types than cDNA + else { // Other sample types than cDNA minimumMassRequired = assays.length * 20; if (mass >= minimumMassRequired) { for (DataRecord qcReport : qcReports) { From 9a835c2199df27a00f5f1d1c7811767eebd44d65 Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Tue, 13 Feb 2024 15:38:22 -0500 Subject: [PATCH 07/11] ddPCR logic added --- .../qualitycontrol/QcPassFailCriteria.java | 49 +++++++++++++------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index 944b0453..a10307ab 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -231,11 +231,11 @@ public PluginResult run() throws RemoteException { } else if (recipe.trim().equalsIgnoreCase("ddpcr")) { String[] assays = sample.getStringVal("Assay", user).split(";"); - int minimumMassRequired = assays.length * 1; if(isDNAQcReportStep) { if (sampleType.equalsIgnoreCase("cDNA")) { - minimumMassRequired *= 9; - if (mass >= minimumMassRequired) { + mass = 9 * concentration; + calculatedMass = assays.length * 1; + if (mass >= calculatedMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -251,8 +251,9 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { } } else { // Other sample types than cDNA - minimumMassRequired = assays.length * 20; - if (mass >= minimumMassRequired) { + mass = 9 * concentration; + calculatedMass = assays.length * 20; + if (mass >= calculatedMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -269,13 +270,32 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { } } else { //RNA QC step + if (sampleType.equalsIgnoreCase("cDNA")) { + mass = 9 * concentration; + calculatedMass = assays.length * 1; + if (mass >= calculatedMass) { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Passed", user); + } + } + } else { + for (DataRecord qcReport : qcReports) { + if (igoId.equals(qcReport.getStringVal("SampleId", user))) { + qcReport.setDataField("IgoQcRecommendation", "Try", user); + qcReport.setDataField("Comments", "Suboptimal quantity", user); + } + } + } + } if (preservation.equalsIgnoreCase("FFPE")) { - minimumMassRequired = assays.length * 2; - if (mass >= minimumMassRequired) { + mass = 18 * concentration; + calculatedMass = assays.length * 2; + if (mass >= calculatedMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); - if (Integer.parseInt(qcReport.getStringVal("DV200", user)) >= 50) { + if (!qcReport.getStringVal("DV200", user).isEmpty() && Integer.parseInt(qcReport.getStringVal("DV200", user)) >= 50) { qcReport.setDataField("Comments", "Suboptimal quantity", user); } else { @@ -288,7 +308,7 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); - if (Integer.parseInt(qcReport.getStringVal("DV200", user)) >= 50) { + if (!qcReport.getStringVal("DV200", user).isEmpty() && Integer.parseInt(qcReport.getStringVal("DV200", user)) >= 50) { qcReport.setDataField("Comments", "Suboptimal quantity", user); } else { @@ -299,10 +319,12 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { } } else { //preservation other than FFPE - if (mass >= minimumMassRequired) { + mass = 18 * concentration; + calculatedMass = assays.length * 2; + if (mass >= calculatedMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { - if (Integer.parseInt(qcReport.getStringVal("RIN", user)) >= 6) { + if (!qcReport.getStringVal("RIN", user).isEmpty() && Integer.parseInt(qcReport.getStringVal("RIN", user)) >= 6) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); } else { @@ -316,7 +338,7 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); - if (Integer.parseInt(qcReport.getStringVal("RIN", user)) < 6) { + if (!qcReport.getStringVal("RIN", user).isEmpty() && Integer.parseInt(qcReport.getStringVal("RIN", user)) >= 6) { qcReport.setDataField("Comments", "Suboptimal quantity", user); } else { @@ -328,9 +350,6 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { } } } - else if (recipe.trim().equalsIgnoreCase("")) { - - } } // Map of request ID to boolean value indicating if all samples under that request have igo QC recommendation value of "passed" for (Map.Entry> entry : requestIdToSampleMap.entrySet()) { From c5a559537feede2a59d3d4529a3f36ddce72e9a2 Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Thu, 15 Feb 2024 10:33:00 -0500 Subject: [PATCH 08/11] Mass recalculate logic --- .../qualitycontrol/QcPassFailCriteria.java | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index a10307ab..4ffed074 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -90,10 +90,12 @@ public PluginResult run() throws RemoteException { put("ampliconseq", 50); put("chipseq", 50); put("impact505", 50); + put("ddpcr", 20); }}; for (DataRecord sample : attachedSamples) { String recipe = sample.getStringVal("Recipe", user); double mass = sample.getDoubleVal("TotalMass", user); + double volume = sample.getDoubleVal("Volume", user); double concentration = sample.getDoubleVal("Concentration", user); String igoId = sample.getStringVal("SampleId", user); String preservation = sample.getStringVal("Preservation", user); @@ -103,17 +105,19 @@ public PluginResult run() throws RemoteException { logInfo("Logging sample info: \nIGO ID = " + igoId + "\nrecipe = " + recipe + "\ntotal mass = " + mass + "\npreservation = " + preservation + "\nsample type = " + sampleType); - double calculatedMass = concentration * recipeToVolCoefficient.get(recipe); + if (volume > recipeToVolCoefficient.get(recipe.trim().toLowerCase())) { + mass = concentration * recipeToVolCoefficient.get(recipe.trim().toLowerCase()); + } if (recipe.trim().equalsIgnoreCase("ampliconseq")) { logInfo("ampliconseq logic!"); - if (calculatedMass >= 100) { + if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); } } - } else if (10 <= calculatedMass && calculatedMass < 100) { + } else if (10 <= mass && mass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -121,7 +125,7 @@ public PluginResult run() throws RemoteException { } } - } else if (calculatedMass < 10) { + } else if (mass < 10) { logInfo("mass is < 10"); for (DataRecord qcReport : qcReports) { logInfo("amliconseq sample with mass < 10. Qc reports are getting modified!"); @@ -132,7 +136,7 @@ public PluginResult run() throws RemoteException { } } } else if (recipe.trim().equalsIgnoreCase("chipseq")) { - if (calculatedMass >= 10) { + if (mass >= 10) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -151,7 +155,7 @@ public PluginResult run() throws RemoteException { } else if (recipe.trim().equalsIgnoreCase("impact505")) { if (sampleType.equalsIgnoreCase("cfDNA")) { logInfo("recipe impact 505, sample type cfdna"); - if (calculatedMass >= 100) { + if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -159,14 +163,14 @@ public PluginResult run() throws RemoteException { } } - } else if (calculatedMass >= 5 && calculatedMass < 100) { + } else if (mass >= 5 && mass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); qcReport.setDataField("Comments", "Suboptimal quantity", user); } } - } else if (calculatedMass < 5) { + } else if (mass < 5) { logInfo("mass is < 10"); logInfo("qcReports size = " + qcReports.size()); for (DataRecord qcReport : qcReports) { @@ -179,7 +183,7 @@ public PluginResult run() throws RemoteException { } } if (preservation.trim().equalsIgnoreCase("FFPE")) { - if (calculatedMass >= 200) { + if (mass >= 200) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -187,14 +191,14 @@ public PluginResult run() throws RemoteException { } } - } else if (calculatedMass >= 40 && calculatedMass < 200) { + } else if (mass >= 40 && mass < 200) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); qcReport.setDataField("Comments", "Suboptimal quantity", user); } } - } else if (calculatedMass < 40) { + } else if (mass < 40) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Failed", user); @@ -204,14 +208,14 @@ public PluginResult run() throws RemoteException { } } else { // other preservations than FFPE - if (calculatedMass >= 100) { + if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); } } - } else if (calculatedMass >= 20 && calculatedMass < 100) { + } else if (mass >= 20 && mass < 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -219,7 +223,7 @@ public PluginResult run() throws RemoteException { } } - } else if (calculatedMass < 20) { + } else if (mass < 20) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Failed", user); @@ -230,12 +234,13 @@ public PluginResult run() throws RemoteException { } } else if (recipe.trim().equalsIgnoreCase("ddpcr")) { - String[] assays = sample.getStringVal("Assay", user).split(";"); + String[] assays = sample.getStringVal("Assay", user).split(","); + if(isDNAQcReportStep) { if (sampleType.equalsIgnoreCase("cDNA")) { - mass = 9 * concentration; - calculatedMass = assays.length * 1; - if (mass >= calculatedMass) { + int minimumRequiredMass = assays.length * 1; + logInfo("minimumRequiredMass = " + minimumRequiredMass); + if (mass >= minimumRequiredMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -251,9 +256,9 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { } } else { // Other sample types than cDNA - mass = 9 * concentration; - calculatedMass = assays.length * 20; - if (mass >= calculatedMass) { + int minimumRequiredMass = assays.length * 20; + logInfo("minimumRequiredMass = " + minimumRequiredMass); + if (mass >= minimumRequiredMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -271,9 +276,8 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { } else { //RNA QC step if (sampleType.equalsIgnoreCase("cDNA")) { - mass = 9 * concentration; - calculatedMass = assays.length * 1; - if (mass >= calculatedMass) { + int minimumRequiredMass = assays.length * 1; + if (mass >= minimumRequiredMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Passed", user); @@ -289,9 +293,8 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { } } if (preservation.equalsIgnoreCase("FFPE")) { - mass = 18 * concentration; - calculatedMass = assays.length * 2; - if (mass >= calculatedMass) { + int minimunRequiredMass = assays.length * 2; + if (mass >= minimunRequiredMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { qcReport.setDataField("IgoQcRecommendation", "Try", user); @@ -319,9 +322,8 @@ else if (recipe.trim().equalsIgnoreCase("ddpcr")) { } } else { //preservation other than FFPE - mass = 18 * concentration; - calculatedMass = assays.length * 2; - if (mass >= calculatedMass) { + int minimunRequiredMass = assays.length * 2; + if (mass >= minimunRequiredMass) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { if (!qcReport.getStringVal("RIN", user).isEmpty() && Integer.parseInt(qcReport.getStringVal("RIN", user)) >= 6) { From e00fc57a669508e4003bf45329c945ab18f76787 Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Mon, 15 Apr 2024 08:36:47 -0400 Subject: [PATCH 09/11] Updating recipe names --- .../qualitycontrol/QcPassFailCriteria.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index 4ffed074..5dad69b7 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -87,9 +87,12 @@ public PluginResult run() throws RemoteException { Map recipeToVolCoefficient = new HashMap<>() {{ - put("ampliconseq", 50); - put("chipseq", 50); - put("impact505", 50); + put("dna_amplicon", 50); + put("dna_chip", 50); + put("dna_cunt&run", 50); + put("user_chip", 50); + put("user_cut&run", 50); + put("hc_impact", 50); put("ddpcr", 20); }}; for (DataRecord sample : attachedSamples) { @@ -108,8 +111,8 @@ public PluginResult run() throws RemoteException { if (volume > recipeToVolCoefficient.get(recipe.trim().toLowerCase())) { mass = concentration * recipeToVolCoefficient.get(recipe.trim().toLowerCase()); } - if (recipe.trim().equalsIgnoreCase("ampliconseq")) { - logInfo("ampliconseq logic!"); + if (recipe.trim().equalsIgnoreCase("dna_amplicon")) { + logInfo("dna_amplicon logic!"); if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { @@ -135,7 +138,8 @@ public PluginResult run() throws RemoteException { } } } - } else if (recipe.trim().equalsIgnoreCase("chipseq")) { + } else if (recipe.trim().equalsIgnoreCase("dna_chip") || recipe.trim().equalsIgnoreCase("dna_cut&run") + || recipe.trim().equalsIgnoreCase("user_chip") || recipe.trim().equalsIgnoreCase("user_cut&run")) { if (mass >= 10) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { @@ -152,9 +156,9 @@ public PluginResult run() throws RemoteException { } } - } else if (recipe.trim().equalsIgnoreCase("impact505")) { + } else if (recipe.trim().equalsIgnoreCase("hc_impact")) { if (sampleType.equalsIgnoreCase("cfDNA")) { - logInfo("recipe impact 505, sample type cfdna"); + logInfo("recipe hc_impact, sample type cfdna"); if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { From 5aae51c213e103c31d01f980bcddc3262af3a377 Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Mon, 15 Apr 2024 10:51:17 -0400 Subject: [PATCH 10/11] keeping both recipe names --- .../qualitycontrol/QcPassFailCriteria.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index 5dad69b7..53b5160a 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -87,12 +87,13 @@ public PluginResult run() throws RemoteException { Map recipeToVolCoefficient = new HashMap<>() {{ - put("dna_amplicon", 50); - put("dna_chip", 50); - put("dna_cunt&run", 50); - put("user_chip", 50); - put("user_cut&run", 50); - put("hc_impact", 50); + put("ampliconseq", 50); + put("chipseq", 50); +// put("dna_chip", 50); +// put("dna_cunt&run", 50); +// put("user_chip", 50); +// put("user_cut&run", 50); + put("impact505", 50); put("ddpcr", 20); }}; for (DataRecord sample : attachedSamples) { @@ -111,8 +112,8 @@ public PluginResult run() throws RemoteException { if (volume > recipeToVolCoefficient.get(recipe.trim().toLowerCase())) { mass = concentration * recipeToVolCoefficient.get(recipe.trim().toLowerCase()); } - if (recipe.trim().equalsIgnoreCase("dna_amplicon")) { - logInfo("dna_amplicon logic!"); + if (recipe.trim().equalsIgnoreCase("ampliconseq")) { + logInfo("ampliconseq logic!"); if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { @@ -138,8 +139,9 @@ public PluginResult run() throws RemoteException { } } } - } else if (recipe.trim().equalsIgnoreCase("dna_chip") || recipe.trim().equalsIgnoreCase("dna_cut&run") - || recipe.trim().equalsIgnoreCase("user_chip") || recipe.trim().equalsIgnoreCase("user_cut&run")) { +// } else if (recipe.trim().equalsIgnoreCase("dna_chip") || recipe.trim().equalsIgnoreCase("dna_cut&run") +// || recipe.trim().equalsIgnoreCase("user_chip") || recipe.trim().equalsIgnoreCase("user_cut&run")) { + } else if (recipe.trim().equalsIgnoreCase("chipseq")) { if (mass >= 10) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { @@ -156,9 +158,9 @@ public PluginResult run() throws RemoteException { } } - } else if (recipe.trim().equalsIgnoreCase("hc_impact")) { + } else if (recipe.trim().equalsIgnoreCase("impact505")) { if (sampleType.equalsIgnoreCase("cfDNA")) { - logInfo("recipe hc_impact, sample type cfdna"); + logInfo("recipe impact505, sample type cfdna"); if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { From f92a31c4d19b9e017586932f6b766d00c18d1c27 Mon Sep 17 00:00:00 2001 From: Mirhaj Date: Wed, 14 Aug 2024 12:02:15 -0400 Subject: [PATCH 11/11] recipe updates reflected --- .../qualitycontrol/QcPassFailCriteria.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java index 53b5160a..e70a0c09 100644 --- a/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java +++ b/src/main/java/com/velox/sloan/cmo/workflows/qualitycontrol/QcPassFailCriteria.java @@ -87,13 +87,10 @@ public PluginResult run() throws RemoteException { Map recipeToVolCoefficient = new HashMap<>() {{ - put("ampliconseq", 50); - put("chipseq", 50); -// put("dna_chip", 50); -// put("dna_cunt&run", 50); -// put("user_chip", 50); -// put("user_cut&run", 50); - put("impact505", 50); + put("dna_amplicon", 50); + put("dna_chip", 50); + put("dna_cut&run", 50); + put("hc_impact", 50); put("ddpcr", 20); }}; for (DataRecord sample : attachedSamples) { @@ -112,8 +109,8 @@ public PluginResult run() throws RemoteException { if (volume > recipeToVolCoefficient.get(recipe.trim().toLowerCase())) { mass = concentration * recipeToVolCoefficient.get(recipe.trim().toLowerCase()); } - if (recipe.trim().equalsIgnoreCase("ampliconseq")) { - logInfo("ampliconseq logic!"); + if (recipe.trim().equalsIgnoreCase("dna_amplicon") || recipe.trim().equalsIgnoreCase("dna_cut&run")) { + logInfo("dna amplicon or dna cut&run logic!"); if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) { @@ -158,9 +155,9 @@ public PluginResult run() throws RemoteException { } } - } else if (recipe.trim().equalsIgnoreCase("impact505")) { + } else if (recipe.trim().equalsIgnoreCase("hc_impact")) { if (sampleType.equalsIgnoreCase("cfDNA")) { - logInfo("recipe impact505, sample type cfdna"); + logInfo("recipe hc_impact, sample type cfdna"); if (mass >= 100) { for (DataRecord qcReport : qcReports) { if (igoId.equals(qcReport.getStringVal("SampleId", user))) {