From de4d2b8bd28459bbb9ef1b41800cf5bcb918c6a2 Mon Sep 17 00:00:00 2001
From: s181706 <jonathan.gesell@utsouthwestern.edu>
Date: Fri, 24 Jan 2020 12:13:27 -0600
Subject: [PATCH] Updated test scripts.

---
 .gitlab-ci.yml               | 20 ++++++++++++++++----
 workflow/tests/test_align.py |  4 ++++
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd792d6..7335a82 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -38,11 +38,23 @@ parseMetadata:
 trimData:
   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
-  - 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
+  - singularity run 'docker://bicf/trimgalore:1.1' trim_galore --gzip -q 25 --illumina --length 35 --basename 16-1ZX4 -j `nproc` ./test_data/fastq/16-1ZX4.R1.fastq.gz
+  - singularity run 'docker://bicf/trimgalore:1.1' trim_galore --gzip -q 25 --illumina --length 35 --paired --basename Q-Y5JA -j `nproc` ./test_data/fastq/Q-Y5JA.R1.fastq.gz ./test_data/fastq/Q-Y5JA.R2.fastq.gz
   - pytest -m trimData
 
+alignReads:
+  stage: unit
+  script:
+  - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' hisat2 -p `nproc` --add-chrname --un-gz Q-Y5JA.unal.gz -S Q-Y5JA.sam -x /project/BICF/BICF_Core/shared/gudmap/references/GRCh38.p12/hisat2/genome --rna-strandness FR --no-mixed --no-discordant -1 Q-Y5JA_R1_val_1.fq.gz -2 Q-Y5JA_R2_val_2.fq.gz 1>Q-Y5JA.align.out 2>Q-Y5JA.align.err
+  - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' samtools view -1 -@ `nproc` -F 4 -F 8 -F 256 -o Q-Y5JA.bam Q-Y5JA.sam 1>>Q-Y5JA.align.out 2>>Q-Y5JA.align.err
+  - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' samtools sort -@ `nproc` -O BAM -o Q-Y5JA.sorted.bam Q-Y5JA.bam 1>>Q-Y5JA.align.out 2>>Q-Y5JA.align.err
+  - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' samtools index -@ `nproc` -b Q-Y5JA.sorted.bam Q-Y5JA.sorted.bai 1>>Q-Y5JA.align.out 2>>Q-Y5JA.align.err
+  - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' hisat2 -p `nproc` --add-chrname --un-gz 16-1ZX4.unal.gz -S 16-1ZX4.sam -x /project/BICF/BICF_Core/shared/gudmap/references/GRCh38.p12/hisat2/genome --rna-strandness FR -U 16-1ZX4_trimmed.fq.gz 1>16-1ZX4.align.out 2>16-1ZX4.align.err
+  - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' samtools view -1 -@ `nproc` -F 4 -F 8 -F 256 -o 16-1ZX4.bam 16-1ZX4.sam 1>>16-1ZX4.align.out 2>>16-1ZX4.align.err
+  - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' samtools sort -@ `nproc` -O BAM -o 16-1ZX4.sorted.bam 16-1ZX4.bam 1>>16-1ZX4.align.out 2>>16-1ZX4.align.err
+  - singularity run 'docker://bicf/gudmaprbkaligner:2.0.0' samtools index -@ `nproc` -b 16-1ZX4.sorted.bam 16-1ZX4.sorted.bai 1>>16-1ZX4.align.out 2>>16-1ZX4.align.err
+  - pytest -m alignReads
+
 integration_se:
   stage: integration
   script:
@@ -51,4 +63,4 @@ integration_se:
 integration_pe:
   stage: integration
   script:
-  - nextflow run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID Q-Y5JA
\ No newline at end of file
+  - nextflow run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID Q-Y5JA
diff --git a/workflow/tests/test_align.py b/workflow/tests/test_align.py
index dcbeceb..889ee05 100644
--- a/workflow/tests/test_align.py
+++ b/workflow/tests/test_align.py
@@ -18,6 +18,7 @@ def test_alignData_se():
 	assert utils.count_lines(os.path.join(data_output_path, 'Q-Y5JA.sorted.bam')) == 5805611
 	assert os.path.exists(os.path.join(data_output_path, 'Q-Y5JA.sorted.bai'))
 	assert utils.count_lines(os.path.join(data_output_path, 'Q-Y5JA.sorted.bai')) == 12824
+
 def test_alignData_pe():
 	assert os.path.exists(os.path.join(data_output_path, 'Q-Y5JA.unal.gz'))
 	assert utils.count_lines(os.path.join(data_output_path, 'Q-Y5JA.unal.gz')) == 0
@@ -25,6 +26,8 @@ def test_alignData_pe():
 	assert utils.count_lines(os.path.join(data_output_path, 'Q-Y5JA.sorted.bam')) == 5805611
 	assert os.path.exists(os.path.join(data_output_path, 'Q-Y5JA.sorted.bai'))
 	assert utils.count_lines(os.path.join(data_output_path, 'Q-Y5JA.sorted.bai')) == 12824
+
+
 @pytest.mark.alignLogs
 def test_alignLogs_se():
 	assert os.path.exists(os.path.join(logs_output_path, '16-1ZX4.align.err'))
@@ -32,6 +35,7 @@ def test_alignLogs_se():
 	assert '34497376 reads; of these:' in open(os.path.join(logs_output_path, '16-1ZX4.align.err')).readlines()[0]
 	assert os.path.exists(os.path.join(logs_output_path, '16-1ZX4.align.out'))
 	assert utils.count_lines(os.path.join(logs_output_path, '16-1ZX4.align.out')) == 0
+
 def test_alignLogs_pe():
 	assert os.path.exists(os.path.join(logs_output_path, 'Q-Y5JA.align.err'))
 	assert utils.count_lines(os.path.join(logs_output_path, 'Q-Y5JA.align.err')) == 7
-- 
GitLab