Skip to content

Commit

Permalink
functional test, adjustements to scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
emmarousseau committed Aug 21, 2024
1 parent 2918fb4 commit c584b93
Show file tree
Hide file tree
Showing 17 changed files with 308 additions and 1,246,396 deletions.
16 changes: 14 additions & 2 deletions src/rsem/rsem_calculate_expression/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ trap clean_up EXIT

tmpdir=$(mktemp -d "$meta_temp_dir/$meta_functionality_name-XXXXXXXX")

if [ $par_strandedness == 'forward' ]; then
if [ "$par_strandedness" == 'forward' ]; then
strandedness='--strandedness forward'
elif [ $par_strandedness == 'reverse' ]; then
elif [ "$par_strandedness" == 'reverse' ]; then
strandedness="--strandedness reverse"
else
strandedness=''
Expand All @@ -24,6 +24,18 @@ IFS=";" read -ra input <<< $par_input

INDEX=$(find -L $meta_resources_dir/$par_index -name "*.grp" | sed 's/\.grp$//')

unset_if_false=( par_paired par_quiet par_no_bam_output par_sampling_for_bam par_no_qualities
par_alignments par_bowtie2 par_star par_hisat2_hca par_append_names
par_single_cell_prior par_calc_pme par_calc_ci par_phred64_quals
par_solexa_quals par_star_gzipped_read_file par_star_bzipped_read_file
par_star_output_genome_bam par_estimate_rspd par_keep_intermediate_files
par_time par_run_pRSEM par_cap_stacked_chipseq_reads par_sort_bam_by_read_name )

for par in ${unset_if_false[@]}; do
test_val="${!par}"
[[ "$test_val" == "false" ]] && unset $par
done

rsem-calculate-expression \
${par_quiet:+-q} \
${par_no_bam_output:+--no-bam-output} \
Expand Down
60 changes: 22 additions & 38 deletions src/rsem/rsem_calculate_expression/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,37 @@
echo ">>> Testing $meta_executable"

test_dir="${meta_resources_dir}/test_data"
gunzip -k $test_dir/index.tar.gz
tar -xf $test_dir/index.tar

wget https://raw.githubusercontent.com/nf-core/test-datasets/rnaseq3/reference/rsem.tar.gz
gunzip -k rsem.tar.gz
tar -xf rsem.tar

mv $test_dir/rsem $meta_resources_dir

echo ">>> Test 1: Paired-end reads using STAR to align reads"
"$meta_executable" \
--id mmliver \
--strandedness reverse \
--paired \
--input "${test_dir}/mmliver_1.fq.gz;${test_dir}/mmliver_2.fq.gz" \
--index index \
--star --star_output_genome_bam --star_gzipped_read_file --estimate_rspd --seed 1 \
--quiet
--star \
--star_gzipped_read_file \
--paired \
--input "$test_dir/SRR6357070_1.fastq.gz;$test_dir/SRR6357070_2.fastq.gz" \
--index rsem \
--id WT_REP1 \
--seed 1 \
--quiet

echo ">>> Checking whether output exists"
[ ! -f "WT_REP1.genes.results" ] && echo "Gene level expression counts file does not exist!" && exit 1
[ ! -s "WT_REP1.genes.results" ] && echo "Gene level expression counts file is empty!" && exit 1
[ ! -f "WT_REP1.isoforms.results" ] && echo "Transcript level expression counts file does not exist!" && exit 1
[ ! -s "WT_REP1.isoforms.results" ] && echo "Transcript level expression counts file is empty!" && exit 1
[ ! -f "WT_REP1.stat" ] && echo "Stats file does not exist!" && exit 1
[ ! -s "WT_REP1.stat" ] && echo "Stats file is empty!" && exit 1
[ ! -f "WT_REP1.log" ] && echo "Log file does not exist!" && exit 1
[ ! -s "WT_REP1.log" ] && echo "Log file is empty!" && exit 1


####################################################################################################

# echo ">>> Test 2: Single-end reads without quality scores"
# "$meta_executable" \
# --phred64-quals \
# --append-names \
# --output-genome-bam \
# --input /$test_dir/mmliver_1.fq \
# --index index \
# --id mmliver_single_quals

# ####################################################################################################

# echo ">>> Test 3: Paired-end reads with quality scores, using STAR to align reads"
# "$meta_executable" \
# --phred64-quals \
# --fragment-length-mean 150.0 \
# --fragment-length-sd 35.0 \
# --output-genome-bam \
# --calc-ci \
# --input /$test_dir/mmliver.fq \
# --index index \
# --id mmliver_single_quals
[ ! -d "WT_REP1.stat" ] && echo "Stats file does not exist!" && exit 1

echo ">>> Check wheter output is correct"
diff $test_dir/ref.genes.results WT_REP1.genes.results || { echo "Gene level expression counts file is incorrect!"; exit 1; }
diff $test_dir/ref.isoforms.results WT_REP1.isoforms.results || { echo "Transcript level expression counts file is incorrect!"; exit 1; }
diff $test_dir/ref.cnt WT_REP1.stat/WT_REP1.cnt || { echo "Stats file is incorrect!"; exit 1; }

#####################################################################################################

echo "All tests succeeded!"
exit 0
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit c584b93

Please sign in to comment.