From dd89f35e47140af7b05399771063085b499e4cc3 Mon Sep 17 00:00:00 2001 From: emmarousseau Date: Mon, 2 Sep 2024 11:35:45 +0200 Subject: [PATCH] functional tests, changelog, remove defaults from config --- CHANGELOG.md | 2 ++ src/fq_subsample/config.vsh.yaml | 6 ++---- src/fq_subsample/test.sh | 14 +++++++------- src/fq_subsample/test_data/a.1.fastq | 21 --------------------- src/fq_subsample/test_data/a.2.fastq | 20 -------------------- src/fq_subsample/test_data/a.3.fastq.gz | Bin 0 -> 292 bytes src/fq_subsample/test_data/a.4.fastq.gz | Bin 0 -> 301 bytes 7 files changed, 11 insertions(+), 52 deletions(-) delete mode 100644 src/fq_subsample/test_data/a.1.fastq delete mode 100644 src/fq_subsample/test_data/a.2.fastq create mode 100644 src/fq_subsample/test_data/a.3.fastq.gz create mode 100644 src/fq_subsample/test_data/a.4.fastq.gz diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e9f40fc..f088f0ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -131,6 +131,8 @@ - `bedtools_getfasta`: extract sequences from a FASTA file for each of the intervals defined in a BED/GFF/VCF file (PR #59). +* `fq_subsample`: Sample a subset of records from single or paired FASTQ files (PR #147). + ## MINOR CHANGES * Uniformize component metadata (PR #23). diff --git a/src/fq_subsample/config.vsh.yaml b/src/fq_subsample/config.vsh.yaml index ea07d342..6628b1be 100644 --- a/src/fq_subsample/config.vsh.yaml +++ b/src/fq_subsample/config.vsh.yaml @@ -23,12 +23,10 @@ argument_groups: - name: "--output_1" type: file direction: output - default: $id.read_1.subsampled.fastq description: Sampled read 1 fastq files. Output will be gzipped if ends in `.gz`. - name: "--output_2" type: file direction: output - default: $id.read_2.subsampled.fastq description: Sampled read 2 fastq files. Output will be gzipped if ends in `.gz`. - name: "Options" @@ -58,14 +56,14 @@ engines: setup: - type: docker env: - - TZ Europe/Brussels + - TZ=Europe/Brussels run: | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \ apt-get update && \ apt-get install -y --no-install-recommends build-essential git-all curl && \ curl https://sh.rustup.rs -sSf | sh -s -- -y && \ . "$HOME/.cargo/env" && \ - git clone --depth 1 --branch v0.11.0 https://github.com/stjude-rust-labs/fq.git && \ + git clone --depth 1 --branch v0.12.0 https://github.com/stjude-rust-labs/fq.git && \ mv fq /usr/local/ && cd /usr/local/fq && \ cargo install --locked --path . && \ mv /usr/local/fq/target/release/fq /usr/local/bin/ diff --git a/src/fq_subsample/test.sh b/src/fq_subsample/test.sh index fd8545e8..1de48e95 100644 --- a/src/fq_subsample/test.sh +++ b/src/fq_subsample/test.sh @@ -4,8 +4,8 @@ echo ">>> Testing $meta_executable" echo ">>> Testing for paired-end reads" "$meta_executable" \ - --input_1 $meta_resources_dir/test_data/a.1.fastq \ - --input_2 $meta_resources_dir/test_data/a.1.fastq \ + --input_1 $meta_resources_dir/test_data/a.3.fastq.gz \ + --input_2 $meta_resources_dir/test_data/a.4.fastq.gz \ --record_count 3 \ --seed 1 \ --output_1 a.1.subsampled.fastq \ @@ -13,23 +13,23 @@ echo ">>> Testing for paired-end reads" echo ">> Checking if the correct files are present" [ ! -f "a.1.subsampled.fastq" ] && echo "Subsampled FASTQ file for read 1 is missing!" && exit 1 -[ ! -s "a.1.subsampled.fastq" ] && echo "Subsampled FASTQ file is empty!" && exit 1 +[ $(wc -l < a.1.subsampled.fastq) -ne 12 ] && echo "Subsampled FASTQ file for read 1 does not contain the expected number of records" && exit 1 [ ! -f "a.2.subsampled.fastq" ] && echo "Subsampled FASTQ file for read 2 is missing" && exit 1 -[ ! -s "a.2.subsampled.fastq" ] && echo "Subsampled FASTQ file is empty" && exit 1 +[ $(wc -l < a.2.subsampled.fastq) -ne 12 ] && echo "Subsampled FASTQ file for read 2 does not contain the expected number of records" && exit 1 rm a.1.subsampled.fastq a.2.subsampled.fastq echo ">>> Testing for single-end reads" "$meta_executable" \ - --input_1 $meta_resources_dir/test_data/a.1.fastq \ - --input_2 $meta_resources_dir/test_data/a.1.fastq \ + --input_1 $meta_resources_dir/test_data/a.3.fastq.gz \ --record_count 3 \ --seed 1 \ --output_1 a.1.subsampled.fastq + echo ">> Checking if the correct files are present" [ ! -f "a.1.subsampled.fastq" ] && echo "Subsampled FASTQ file is missing" && exit 1 -[ ! -s "a.1.subsampled.fastq" ] && echo "Subsampled FASTQ file is empty" && exit 1 +[ $(wc -l < a.1.subsampled.fastq) -ne 12 ] && echo "Subsampled FASTQ file does not contain the expected number of records" && exit 1 echo ">>> Tests finished successfully" exit 0 diff --git a/src/fq_subsample/test_data/a.1.fastq b/src/fq_subsample/test_data/a.1.fastq deleted file mode 100644 index 4cd6d866..00000000 --- a/src/fq_subsample/test_data/a.1.fastq +++ /dev/null @@ -1,21 +0,0 @@ -@1 -ACGGCAT -+ -!!!!!!! -@2 -TACGGCA -+ -!!!!!!! -@3 -ATACGGC -+ -!!!!!!! -@4 -CATACGG -+ -!!!!!!! -@5 -GCATACG -+ -!!!!!!! - diff --git a/src/fq_subsample/test_data/a.2.fastq b/src/fq_subsample/test_data/a.2.fastq deleted file mode 100644 index f9fa80de..00000000 --- a/src/fq_subsample/test_data/a.2.fastq +++ /dev/null @@ -1,20 +0,0 @@ -@1 -ACGGCAT -+ -!!!!!!! -@2 -TACGGCA -+ -!!!!!!! -@3 -ATACGGC -+ -!!!!!!! -@4 -CATACGG -+ -!!!!!!! -@5 -GCATACG -+ -!!!!!!! \ No newline at end of file diff --git a/src/fq_subsample/test_data/a.3.fastq.gz b/src/fq_subsample/test_data/a.3.fastq.gz new file mode 100644 index 0000000000000000000000000000000000000000..3e38d06dc5213e2b60cf8feab54214ef6ae72095 GIT binary patch literal 292 zcmV+<0o(o`iwFopgw{AqTPku(#7Qf5avvPnFZM+Apx**Oa!?txr3QV-KZjV->mD8KoHv7#-z3Z4r{+?NKtIv%ALBp1?Z)Zpi_@6{>nZp{l zpnEW6Vuo5f3k)_CS+Enz@c0PCa|geeO1hrf6{+00VDfRbahk2}!7qJ+#!w%N%nT$& q=?+h;4lV-+mG4KNiZN0-nItN^Op$ogq>5BhG3pb)YY7nG0ssKu1BeL# literal 0 HcmV?d00001 diff --git a/src/fq_subsample/test_data/a.4.fastq.gz b/src/fq_subsample/test_data/a.4.fastq.gz new file mode 100644 index 0000000000000000000000000000000000000000..3164c6148650e36532545b7946efa9a16055db5d GIT binary patch literal 301 zcmV+|0n+{-iwFpdgVkmL17R*SE@okKba4QclD}%iFbs$HJcai{?fi98G@K%^_p4su zpdHG=4W&beK793aE?fgCy*k8_6@xxLe!66TNB^7^ZV)idU^Ud zeZIYXbyM3^!osXsSp}(z+L2i-5vyb?=8QX%SyifsYQ{=`tlNd^@PlcHb+G8JahHhM z8WtRM#0J7;1BHM|@mewSy+pUQA?nAj9oxxW<1dbKR7_YiGA zZiwo>i^DWVwk#hC~KOM9F)iI44T9dZJXoXJ35-@igEx-~s>uZ@7@Z literal 0 HcmV?d00001