From c7ea5cbafb2401c786621ca00d66c021a4f56474 Mon Sep 17 00:00:00 2001 From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu> Date: Tue, 14 Jan 2020 14:16:08 -0600 Subject: [PATCH] Add pytest for trim --- .gitlab-ci.yml | 5 ++++- workflow/tests/test_trimData.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 workflow/tests/test_trimData.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8491804..a83427a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,15 +22,18 @@ getData: - ln -sfn `readlink -e ./test_data/auth/cookies.txt` ~/.bdbag/deriva-cookies.txt - unzip ./test_data/bagit/Replicate_16-1ZX4 - singularity run 'docker://bicf/gudmaprbkfilexfer:1.3' sh ./workflow/scripts/bdbagFetch.sh Replicate_16-1ZX4 16-1ZX4 + - pytest -m getData trimData_se: stage: unit script: - if [ `nproc` -gt 8 ]; then ncore=8; else ncore=`nproc`; fi - singularity run 'docker://bicf/trimgalore:1.1' trim_galore --gzip -q 25 --illumina --length 35 --basename 16-1ZX4 -j ${ncore} ./test_data/fastq/16-1ZX4.R1.fastq.gz + - pytest -m trimData_se trimData_pe: stage: unit script: - if [ `nproc` -gt 8 ]; then ncore=8; else ncore=`nproc`; fi - - singularity run 'docker://bicf/trimgalore:1.1' trim_galore --gzip -q 25 --illumina --length 35 --paired --basename Q-Y5JA -j ${ncore} ./test_data/fastq/Q-Y5JA.R1.fastq.gz ./test_data/fastq/Q-Y5JA.R2.fastq.gz \ No newline at end of file + - singularity run 'docker://bicf/trimgalore:1.1' trim_galore --gzip -q 25 --illumina --length 35 --paired --basename Q-Y5JA -j ${ncore} ./test_data/fastq/Q-Y5JA.R1.fastq.gz ./test_data/fastq/Q-Y5JA.R2.fastq.gz + - pytest -m trimData_pe \ No newline at end of file diff --git a/workflow/tests/test_trimData.py b/workflow/tests/test_trimData.py new file mode 100644 index 0000000..8fda067 --- /dev/null +++ b/workflow/tests/test_trimData.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import pytest +import pandas as pd +from io import StringIO +import os + +test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ + '/../../' + +@pytest.mark.trimData_se +def test_trimData_se(): + assert os.path.exists(os.path.join(test_output_path, '16-1ZX4_trimmed.fq.gz')) + +@pytest.mark.trimData_pe +def test_trimData_pe(): + assert os.path.exists(os.path.join(test_output_path, 'Q-Y5JA_R1_val_1.fq.gz')) + assert os.path.exists(os.path.join(test_output_path, 'Q-Y5JA_R2_val_2.fq.gz')) \ No newline at end of file -- GitLab