Skip to content

Commit

Permalink
remove test data
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Feb 26, 2024
1 parent 0da7b0b commit 49d8d08
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 73 deletions.
1 change: 0 additions & 1 deletion src/star/star_align/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ resources:
test_resources:
- type: bash_script
path: test.sh
- path: test_data
engines:
- type: docker
image: python:3.12-slim
Expand Down
86 changes: 45 additions & 41 deletions src/star/star_align/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ meta_executable="target/docker/star/star_align/star_align"
meta_resources_dir="src/star/star_align"
## VIASH END

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

# helper functions
assert_file_exists() {
[ -f "$1" ] || (echo "File '$1' does not exist" && exit 1)
Expand All @@ -34,7 +35,7 @@ assert_file_not_contains_regex() {
grep -q -E "$2" "$1" && (echo "File '$1' contains '$2' but shouldn't" && exit 1)
}

#############################################
#########################################################################################
echo "> Prepare test data"

cat > reads_R1.fastq <<'EOF'
Expand Down Expand Up @@ -81,6 +82,7 @@ STAR \
--genomeSAindexNbases 2

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

mkdir star_align_se
cd star_align_se

Expand All @@ -92,11 +94,11 @@ echo "> Run star_align on SE"
--log "log.txt" \
--outReadsUnmapped "Fastx" \
--unmapped "unmapped.sam" \
${meta_cpus:+---cpus $meta_cpus} \
--quantMode "TranscriptomeSAM;GeneCounts" \
--reads_per_gene "reads_per_gene.tsv" \
--outSJtype Standard \
--splice_junctions "splice_junctions.tsv"
--splice_junctions "splice_junctions.tsv" \
${meta_cpus:+---cpus $meta_cpus}

# TODO: Test data doesn't contain any chimeric reads yet
# --chimOutType "Junctions" \
Expand Down Expand Up @@ -130,40 +132,42 @@ assert_file_contains "unmapped.sam" "ACCCGCAAGATTAGGCTCCGTACAC"

cd ..

# #########################################################################################
# mkdir star_align_pe_minimal
# cd star_align_pe_minimal

# echo ">> Run star_align on PE"
# "$meta_executable" \
# --input "$meta_resources_dir/test_data/a_R1.1.fastq" \
# --input "$meta_resources_dir/test_data/a_R1.2.fastq" \
# --input_r2 "$meta_resources_dir/test_data/a_R2.1.fastq" \
# --input_r2 "$meta_resources_dir/test_data/a_R2.2.fastq" \
# --genomeDir "../index/" \
# --aligned_reads "output.sam" \
# --log "log.txt" \
# --outReadsUnmapped "Fastx" \
# --unmapped "unmapped.bam" \
# --unmapped_r2 "unmapped_r2.bam" \
# ${meta_cpus:+---cpus $meta_cpus}

# echo ">> Check if output exists"
# [ ! -f "output.sam" ] && echo ">> output.sam does not exist" && exit 1
# [ ! -f "log.txt" ] && echo ">> log.txt does not exist" && exit 1
# [ ! -f "unmapped.bam" ] && echo ">> unmapped.bam does not exist" && exit 1
# [ ! -f "unmapped_r2.bam" ] && echo ">> unmapped_r2.bam does not exist" && exit 1

# cd ..
# #########################################################################################

# # TODO: check whether optional outputs work:
# # - quantMode "TranscriptomeSAM;GeneCounts"
# # - reads_per_gene "reads_per_gene.tsv"
# # - chimOutType "Junctions"
# # - chimeric_junctions "chimeric_junctions.tsv"
# # - outSJtype Standard
# # - splice_junctions "splice_junctions.tsv"
# # TODO: check whether output contents are correct

# echo "> Test successful"
#########################################################################################

mkdir star_align_pe_minimal
cd star_align_pe_minimal

echo ">> Run star_align on PE"
"$meta_executable" \
--input ../reads_R1.fastq \
--input_r2 ../reads_R2.fastq \
--genomeDir ../index/ \
--aligned_reads output.bam \
--log log.txt \
--outReadsUnmapped Fastx \
--unmapped unmapped_r1.bam \
--unmapped_r2 unmapped_r2.bam \
${meta_cpus:+---cpus $meta_cpus}

echo ">> Check if output exists"
assert_file_exists "output.bam"
assert_file_exists "log.txt"
assert_file_exists "unmapped_r1.bam"
assert_file_exists "unmapped_r2.bam"

echo ">> Check if output contents are not empty"
assert_file_not_empty "output.bam"
assert_file_not_empty "log.txt"
assert_file_not_empty "unmapped_r1.bam"
assert_file_not_empty "unmapped_r2.bam"

echo ">> Check if output contents are correct"
assert_file_contains "log.txt" "Number of input reads \\| 2"
assert_file_contains "log.txt" "Number of reads unmapped: too short \\| 1"
assert_file_contains "log.txt" "Uniquely mapped reads number \\| 1"

cd ..

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

echo "> Test successful"
4 changes: 0 additions & 4 deletions src/star/star_align/test_data/a_R1.1.fastq

This file was deleted.

4 changes: 0 additions & 4 deletions src/star/star_align/test_data/a_R1.2.fastq

This file was deleted.

4 changes: 0 additions & 4 deletions src/star/star_align/test_data/a_R2.1.fastq

This file was deleted.

4 changes: 0 additions & 4 deletions src/star/star_align/test_data/a_R2.2.fastq

This file was deleted.

2 changes: 0 additions & 2 deletions src/star/star_align/test_data/genome.fasta

This file was deleted.

13 changes: 0 additions & 13 deletions src/star/star_align/test_data/script.sh

This file was deleted.

0 comments on commit 49d8d08

Please sign in to comment.