diff --git a/Tests/test_targeteddataset.py b/Tests/test_targeteddataset.py index 9b6758a..57900ce 100644 --- a/Tests/test_targeteddataset.py +++ b/Tests/test_targeteddataset.py @@ -4749,8 +4749,13 @@ def setUp(self): 'quantiles': tmpDataset.Attributes['quantiles'], 'methodName': 'Bruker Quant-UR Data', 'externalID': [], - 'sampleMetadataNotExported': ['Acqu Date', 'Acqu Time', 'Sample Type'], - 'featureMetadataNotExported': ['comment'], + 'sampleMetadataNotExported': ["AUNM", "BF1", "BYTORDP", "Computer", "File Path", "NC_proc", "NS", "O1", + "OFFSET", "OWNER", "P", "PROBHD", "PULPROG", "RG", "SF", "SFO1", "SI", "SW", "SW_p", + "TD", "XDIM", "Delta PPM", "ERETIC Integral","ERETIC Concentration (mM)", + "Line Width (Hz)", "Exclusion Details", "CalibrationFail", "LineWidthFail", + "WaterPeakFail", "SolventPeakFail", "BaselineFail", "Sample Base Name", "expno", + "Acqu Date", "Acqu Time", "Sample Type"], + 'featureMetadataNotExported': ['comment', 'Exclusion Details'], 'analyticalMeasurements': {'Acquired Time': 'date', 'Acquisition batch': 'categorical', 'Assay data location': 'categorical', 'Assay data name': 'categorical', 'Assay protocol': 'categorical', 'AssayRole': 'categorical', 'Batch': 'categorical', 'Correction Batch': 'categorical', 'Dilution': 'continuous', 'Exclusion Details': 'categorical', diff --git a/nPYc/StudyDesigns/SOP/BrukerBI-LISA.json b/nPYc/StudyDesigns/SOP/BrukerBI-LISA.json index d55c82e..f7b1a61 100644 --- a/nPYc/StudyDesigns/SOP/BrukerBI-LISA.json +++ b/nPYc/StudyDesigns/SOP/BrukerBI-LISA.json @@ -3,8 +3,13 @@ "fileNamePattern":".*?results\\.xml$", "externalID":[], "rsdThreshold": 30, - "sampleMetadataNotExported":["Acqu Date", "Acqu Time", "Sample Type"], - "featureMetadataNotExported":["comment"], + "sampleMetadataNotExported" : ["AUNM", "BF1", "BYTORDP", "Computer", "File Path", "NC_proc", "NS", "O1", + "OFFSET", "OWNER", "P", "PROBHD", "PULPROG", "RG", "SF", "SFO1", "SI", "SW", "SW_p", + "TD", "XDIM", "Delta PPM", "ERETIC Integral","ERETIC Concentration (mM)", + "Line Width (Hz)", "Exclusion Details", "CalibrationFail", "LineWidthFail", + "WaterPeakFail", "SolventPeakFail", "BaselineFail", "Sample Base Name", "expno", + "Acqu Date", "Acqu Time", "Sample Type"], + "featureMetadataNotExported":["comment", "Exclusion Details"], "analyticalMeasurements":{"Study" : "categorical", "Instrument" : "categorical", "Re-Run" : "categorical", "Suplemental Injections" : "categorical", "Matrix" : "categorical", "Well" : "categorical", "Plate" : "categorical", "Batch" : "categorical", "Dilution" : "continuous", "Measurement Date" : "date", "Measurement Time" : "date", "Acquired Time" : "date", "Run Order" : "continuous", "Correction Batch" : "categorical", "Assay data name": "categorical", "Assay data location": "categorical", "Sample position": "categorical", "Sample batch": "categorical", "Acquisition batch": "categorical", "Plot Sample Type": "categorical", "AssayRole": "categorical", "SampleType": "categorical", "Exclusion Details": "categorical", "Skipped": "categorical", "Assay protocol": "categorical"}, "excludeFromPlotting":["Sample File Name", "Sample Base Name", "Batch Termini", "Study Reference", "Long-Term Reference", "Method Reference", "Dilution Series", "Skipped", "Study Sample", "File Path", "Exclusion Details", "Assay protocol", "Status", "Measurement Date", "Measurement Time", "Data Present", "LIMS Present", "LIMS Marked Missing", "Assay data name", "Assay data location", "AssayRole", "SampleType", "Sample ID", "Plot Sample Type", "SubjectInfoData", "Detector Unit", "TargetLynx Sample ID", "MassLynx Row ID"], "additionalQuantParamColumns":["LOD", "Lower Reference Percentile", "Lower Reference Value", "Upper Reference Percentile", "Upper Reference Value"] diff --git a/nPYc/StudyDesigns/SOP/BrukerBI-QUANT-PS.json b/nPYc/StudyDesigns/SOP/BrukerBI-QUANT-PS.json index d1ee09d..ec74696 100644 --- a/nPYc/StudyDesigns/SOP/BrukerBI-QUANT-PS.json +++ b/nPYc/StudyDesigns/SOP/BrukerBI-QUANT-PS.json @@ -3,8 +3,13 @@ "fileNamePattern":".*?plasma_quant_report\\.xml$", "externalID":[], "rsdThreshold": 30, - "sampleMetadataNotExported":["Acqu Date", "Acqu Time", "Sample Type"], - "featureMetadataNotExported":["comment"], + "sampleMetadataNotExported" : ["AUNM", "BF1", "BYTORDP", "Computer", "File Path", "NC_proc", "NS", "O1", + "OFFSET", "OWNER", "P", "PROBHD", "PULPROG", "RG", "SF", "SFO1", "SI", "SW", "SW_p", + "TD", "XDIM", "Delta PPM", "ERETIC Integral","ERETIC Concentration (mM)", + "Line Width (Hz)", "Exclusion Details", "CalibrationFail", "LineWidthFail", + "WaterPeakFail", "SolventPeakFail", "BaselineFail", "Sample Base Name", "expno", + "Acqu Date", "Acqu Time", "Sample Type"], + "featureMetadataNotExported":["comment", "Exclusion Details"], "analyticalMeasurements":{"Study" : "categorical", "Instrument" : "categorical", "Re-Run" : "categorical", "Suplemental Injections" : "categorical", "Matrix" : "categorical", "Well" : "categorical", "Plate" : "categorical", "Batch" : "categorical", "Dilution" : "continuous", "Measurement Date" : "date", "Measurement Time" : "date", "Acquired Time" : "date", "Run Order" : "continuous", "Correction Batch" : "categorical", "Assay data name": "categorical", "Assay data location": "categorical", "Sample position": "categorical", "Sample batch": "categorical", "Acquisition batch": "categorical", "Plot Sample Type": "categorical", "AssayRole": "categorical", "SampleType": "categorical", "Exclusion Details": "categorical", "Skipped": "categorical", "Assay protocol": "categorical"}, "excludeFromPlotting":["Sample File Name", "Sample Base Name", "Batch Termini", "Study Reference", "Long-Term Reference", "Method Reference", "Dilution Series", "Skipped", "Study Sample", "File Path", "Exclusion Details", "Assay protocol", "Status", "Measurement Date", "Measurement Time", "Data Present", "LIMS Present", "LIMS Marked Missing", "Assay data name", "Assay data location", "AssayRole", "SampleType", "Sample ID", "Plot Sample Type", "SubjectInfoData", "Detector Unit", "TargetLynx Sample ID", "MassLynx Row ID"], "additionalQuantParamColumns":["LOD", "Lower Reference Percentile", "Lower Reference Value", "Upper Reference Percentile", "Upper Reference Value"] diff --git a/nPYc/StudyDesigns/SOP/BrukerQuant-UR.json b/nPYc/StudyDesigns/SOP/BrukerQuant-UR.json index 0a7b07d..edc05e6 100644 --- a/nPYc/StudyDesigns/SOP/BrukerQuant-UR.json +++ b/nPYc/StudyDesigns/SOP/BrukerQuant-UR.json @@ -3,8 +3,13 @@ "fileNamePattern":".*?urine_quant_report_b\\.xml$", "externalID":[], "rsdThreshold": 30, - "sampleMetadataNotExported":["Acqu Date", "Acqu Time", "Sample Type"], - "featureMetadataNotExported":["comment"], + "sampleMetadataNotExported" : ["AUNM", "BF1", "BYTORDP", "Computer", "File Path", "NC_proc", "NS", "O1", + "OFFSET", "OWNER", "P", "PROBHD", "PULPROG", "RG", "SF", "SFO1", "SI", "SW", "SW_p", + "TD", "XDIM", "Delta PPM", "ERETIC Integral","ERETIC Concentration (mM)", + "Line Width (Hz)", "Exclusion Details", "CalibrationFail", "LineWidthFail", + "WaterPeakFail", "SolventPeakFail", "BaselineFail", "Sample Base Name", "expno", + "Acqu Date", "Acqu Time", "Sample Type"], + "featureMetadataNotExported":["comment", "Exclusion Details"], "analyticalMeasurements":{"Study" : "categorical", "Instrument" : "categorical", "Re-Run" : "categorical", "Suplemental Injections" : "categorical", "Matrix" : "categorical", "Well" : "categorical", "Plate" : "categorical", "Batch" : "categorical", "Dilution" : "continuous", "Measurement Date" : "date", "Measurement Time" : "date", "Acquired Time" : "date", "Run Order" : "continuous", "Correction Batch" : "categorical", "Assay data name": "categorical", "Assay data location": "categorical", "Sample position": "categorical", "Sample batch": "categorical", "Acquisition batch": "categorical", "Plot Sample Type": "categorical", "AssayRole": "categorical", "SampleType": "categorical", "Exclusion Details": "categorical", "Skipped": "categorical", "Assay protocol": "categorical"}, "excludeFromPlotting":["Sample File Name", "Sample Base Name", "Batch Termini", "Study Reference", "Long-Term Reference", "Method Reference", "Dilution Series", "Skipped", "Study Sample", "File Path", "Exclusion Details", "Assay protocol", "Status", "Measurement Date", "Measurement Time", "Data Present", "LIMS Present", "LIMS Marked Missing", "Assay data name", "Assay data location", "AssayRole", "SampleType", "Sample ID", "Plot Sample Type", "SubjectInfoData", "Detector Unit", "TargetLynx Sample ID", "MassLynx Row ID"], "additionalQuantParamColumns":["LOD", "Lower Reference Percentile", "Lower Reference Value", "Upper Reference Percentile", "Upper Reference Value"] diff --git a/nPYc/StudyDesigns/SOP/GenericNMRurine.json b/nPYc/StudyDesigns/SOP/GenericNMRurine.json index 16458c2..0b5d473 100644 --- a/nPYc/StudyDesigns/SOP/GenericNMRurine.json +++ b/nPYc/StudyDesigns/SOP/GenericNMRurine.json @@ -29,9 +29,9 @@ "Long-Term Reference", "Study Sample", "Status", "Exclusion Details", "LIMS Present", "LIMS Marked Missing", "path", "Assay data name", "Assay data location", "Assay protocol", "titleFileContent", "SF"], "sampleMetadataNotExported" : ["AUNM", "BF1", "BYTORDP", "Computer", "File Path", "NC_proc", "NS", "O1", - "OFFSET", "OWNER", "P", "PROBHD", "PULPROG", "RG", "SF", "SFO1", "SI", "SW", "SW_p", + "OFFSET", "OWNER", "P", "PROBHD", "PULPROG", "RG", "SF", "SFO1", "SI", "SW", "SW_p", "TD", "XDIM", "Delta PPM", "ERETIC Integral","ERETIC Concentration (mM)", - "Line Width (Hz)", "Exclusion Details", "CalibrationFail", "LineWidthFail", - "WaterPeakFail", "BaselineFail", "Sample Base Name", "expno"], - "featureMetadataNotExported":[] + "Line Width (Hz)", "Exclusion Details", "CalibrationFail", "LineWidthFail", + "WaterPeakFail", "SolventPeakFail", "BaselineFail", "Sample Base Name", "expno"], + "featureMetadataNotExported": ["Exclusion Details"] } diff --git a/nPYc/reports/_finalReportPeakPantheR.py b/nPYc/reports/_finalReportPeakPantheR.py index bc7366d..3ded006 100644 --- a/nPYc/reports/_finalReportPeakPantheR.py +++ b/nPYc/reports/_finalReportPeakPantheR.py @@ -133,6 +133,10 @@ def _finalReportPeakPantheR(dataset, destinationPath=None): if hasattr(sampleSummary['Acquired'], 'Already Excluded'): sampleSummary['Acquired'].rename(columns={'Already Excluded': 'Excluded'}, inplace=True) + # Drop rows where no samples present for that datatype + sampleSummary['Acquired'].drop(sampleSummary['Acquired'].index[sampleSummary['Acquired']['Total'].values == 0], + axis=0, inplace=True) + sampleSummary['isFinalReport'] = True if 'StudySamples Exclusion Details' in sampleSummary: sampleSummary['studySamplesExcluded'] = True diff --git a/nPYc/reports/_generateReportMS.py b/nPYc/reports/_generateReportMS.py index 749dedb..86fedb6 100644 --- a/nPYc/reports/_generateReportMS.py +++ b/nPYc/reports/_generateReportMS.py @@ -188,6 +188,10 @@ def _finalReport(dataset, destinationPath=None, pcaModel=None, reportType='final # Tidy table for final report format sampleSummary['Acquired'].drop('Marked for Exclusion', inplace=True, axis=1) + # Drop rows where no samples present for that datatype + sampleSummary['Acquired'].drop(sampleSummary['Acquired'].index[sampleSummary['Acquired']['Total'].values == 0], + axis=0, inplace=True) + sampleSummary['isFinalReport'] = True if 'StudySamples Exclusion Details' in sampleSummary: sampleSummary['studySamplesExcluded'] = True diff --git a/nPYc/reports/_generateReportNMR.py b/nPYc/reports/_generateReportNMR.py index 4dc8222..384bb3a 100644 --- a/nPYc/reports/_generateReportNMR.py +++ b/nPYc/reports/_generateReportNMR.py @@ -263,6 +263,9 @@ def _finalReport(dataset, destinationPath=None, pcaModel=None): # Tidy table for final report format sampleSummary['Acquired'].drop('Marked for Exclusion', inplace=True, axis=1) + # Drop rows where no samples present for that datatype + sampleSummary['Acquired'].drop(sampleSummary['Acquired'].index[sampleSummary['Acquired']['Total'].values == 0], axis=0, inplace=True) + sampleSummary['isFinalReport'] = True if 'StudySamples Exclusion Details' in sampleSummary: sampleSummary['studySamplesExcluded'] = True diff --git a/nPYc/reports/_generateReportTargeted.py b/nPYc/reports/_generateReportTargeted.py index a76a0d1..a7c344c 100644 --- a/nPYc/reports/_generateReportTargeted.py +++ b/nPYc/reports/_generateReportTargeted.py @@ -601,6 +601,9 @@ def _finalReportMS(tData, item, destinationPath, pcaModel=None, withAccPrec=True # Tidy table for final report format sampleSummary['Acquired'].drop('Marked for Exclusion', inplace=True, axis=1) + # Drop rows where no samples present for that datatype + sampleSummary['Acquired'].drop(sampleSummary['Acquired'].index[sampleSummary['Acquired']['Total'].values == 0], axis=0, inplace=True) + sampleSummary['isFinalReport'] = True if 'StudySamples Exclusion Details' in sampleSummary: sampleSummary['studySamplesExcluded'] = True @@ -864,6 +867,9 @@ def _finalReportNMR(tData, item, destinationPath, pcaModel=None, withAccPrec=Tru # Tidy table for final report format sampleSummary['Acquired'].drop('Marked for Exclusion', inplace=True, axis=1) + # Drop rows where no samples present for that datatype + sampleSummary['Acquired'].drop(sampleSummary['Acquired'].index[sampleSummary['Acquired']['Total'].values == 0], axis=0, inplace=True) + sampleSummary['isFinalReport'] = True if 'StudySamples Exclusion Details' in sampleSummary: sampleSummary['studySamplesExcluded'] = True