From 101740ec0ee3ecd00139e65277522405fe839454 Mon Sep 17 00:00:00 2001 From: Michael Gatzen Date: Tue, 17 Sep 2024 14:54:46 -0400 Subject: [PATCH] fix checkqc --- GlimpseImputationPipeline/Glimpse2CheckQC.wdl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GlimpseImputationPipeline/Glimpse2CheckQC.wdl b/GlimpseImputationPipeline/Glimpse2CheckQC.wdl index ea513febd..57c6e6067 100644 --- a/GlimpseImputationPipeline/Glimpse2CheckQC.wdl +++ b/GlimpseImputationPipeline/Glimpse2CheckQC.wdl @@ -52,11 +52,11 @@ import pandas as pd data = pd.read_csv('~{qc_metrics}', sep='\t') qc_metric_thresholds = pd.read_csv('~{qc_metrics_thresholds}', sep='\t') -data = data.melt(id_vars=['s'], var_name='metric', value_name='value', value_vars=qc_metric_thresholds.metric) +data = data.melt(id_vars=['sample_id'], var_name='metric', value_name='value', value_vars=qc_metric_thresholds.metric) data = data.merge(qc_metric_thresholds, on=['metric']) -samples_out_of_spec = data.loc[(data['value'] < data['min']) | (data['value'] > data['max'])].sort_values(['s', 'metric']) -samples_out_of_spec.rename(columns={'s': 'sample_id'}).to_csv('~{output_basename}.qc_failures.tsv', sep='\t', index=False) +samples_out_of_spec = data.loc[(data['value'] < data['min']) | (data['value'] > data['max'])].sort_values(['sample_id', 'metric']) +samples_out_of_spec.to_csv('~{output_basename}.qc_failures.tsv', sep='\t', index=False) with open('~{output_basename}.qc_passed.txt', 'w') as qc_passed: qc_passed.write('true\n' if len(samples_out_of_spec) == 0 else 'false\n')