From a28ab7897197a7a13e7fe87dbcdb42acb1592855 Mon Sep 17 00:00:00 2001 From: s181706 <jonathan.gesell@utsouthwestern.edu> Date: Thu, 30 Jan 2020 10:24:46 -0600 Subject: [PATCH] Added unit testing --- .gitlab-ci.yml | 6 ++++++ workflow/tests/test_dedupReads.py | 33 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 workflow/tests/test_dedupReads.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6ea53a7..d6f9e17 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,12 @@ alignReads: - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' samtools index -@ `nproc` -b 16-1ZX4.sorted.bam 16-1ZX4.sorted.bai - pytest -m alignData +dedupReads: + stage: unit + script: + - singularity run 'docker://bicf/picard2.21.7:2.0.0' java -jar /picard/build/libs/picard.jar MarkDuplicates I=${sortedBam} O=${repRID}.deduped.bam M=${repRID}.deduped.Metrics.txt REMOVE_DUPLICATES=true + - pytest -m dedupData + integration_se: stage: integration script: diff --git a/workflow/tests/test_dedupReads.py b/workflow/tests/test_dedupReads.py new file mode 100644 index 0000000..a2d7e5e --- /dev/null +++ b/workflow/tests/test_dedupReads.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +import pytest +import pandas as pd +import os +import utils + +data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ + '/../../' +logs_output_path = os.path.dirname(os.path.abspath(__file__)) + \ + '/../../' + + +@pytest.mark.dedupData +def test_dedupData_se(): + assert os.path.exists(os.path.join(data_output_path, '16-1ZX4.deduped.bm')) + assert os.path.exists(os.path.join(data_output_path, '16-1ZX4.deduped.Metrics.txt')) + +@pytest.mark.dedupData +def test_dedupData_pe(): + assert os.path.exists(os.path.join(data_output_path, 'Q-Y5JA.deduped.bm')) + assert os.path.exists(os.path.join(data_output_path, 'Q-Y5JA.deduped.Metrics.txt')) + + +@pytest.mark.dedupLogs +def test_dedupLogs_se(): + assert os.path.exists(os.path.join(logs_output_path, '16-1ZX4.dedup.err')) + assert os.path.exists(os.path.join(logs_output_path, '16-1ZX4.dedup.out')) + +@pytest.mark.dedupLogs +def test_dedupLogs_pe(): + assert os.path.exists(os.path.join(logs_output_path, 'Q-Y5JA.dedup.err')) + assert os.path.exists(os.path.join(logs_output_path, 'Q-Y5JA.dedup.out')) -- GitLab