Skip to content

Commit

Permalink
fix checkqc
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgatzen committed Sep 17, 2024
1 parent 67dbba2 commit 101740e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions GlimpseImputationPipeline/Glimpse2CheckQC.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 101740e

Please sign in to comment.