Files
biobox/src/star/star_genome_generate/test.sh
CI 7645430e58 Build branch v0.1 with version v0.1.0 (b84b297)
Build pipeline: viash-hub.biobox.v0.1-8mh8l

Source commit: b84b29747d

Source message: Bump version to v0.1.0
2024-06-24 09:29:14 +00:00

49 lines
1.9 KiB
Bash

#!/bin/bash
set -e
## VIASH START
## VIASH END
#########################################################################################
echo "> Prepare test data"
cat > genome.fasta <<'EOF'
>chr1
TGGCATGAGCCAACGAACGCTGCCTCATAAGCCTCACACATCCGCGCCTATGTTGTGACTCTCTGTGAGCGTTCGTGGG
GCTCGTCACCACTATGGTTGGCCGGTTAGTAGTGTGACTCCTGGTTTTCTGGAGCTTCTTTAAACCGTAGTCCAGTCAA
TGCGAATGGCACTTCACGACGGACTGTCCTTAGCTCAGGGGA
EOF
cat > genes.gtf <<'EOF'
chr1 example_source gene 0 50 . + . gene_id "gene1"; transcript_id "transcript1";
chr1 example_source exon 20 40 . + . gene_id "gene1"; transcript_id "transcript1";
EOF
#########################################################################################
echo "> Generate index"
"$meta_executable" \
${meta_cpus:+---cpus $meta_cpus} \
--index "star_index/" \
--genomeFastaFiles "genome.fasta" \
--sjdbGTFfile "genes.gtf" \
--genomeSAindexNbases 2
files=("Genome" "Log.out" "SA" "SAindex" "chrLength.txt" "chrName.txt" "chrNameLength.txt" "chrStart.txt" "exonGeTrInfo.tab" "exonInfo.tab" "geneInfo.tab" "genomeParameters.txt" "sjdbInfo.txt" "sjdbList.fromGTF.out.tab" "sjdbList.out.tab" "transcriptInfo.tab")
echo ">> Check if output exists"
[ ! -d "star_index" ] && echo "Directory 'star_index' does not exist!" && exit 1
for file in "${files[@]}"; do
[ ! -f "star_index/$file" ] && echo "File '$file' does not exist in 'star_index'." && exit 1
done
echo ">> Check contents of output files"
grep -q "200" "star_index/chrLength.txt" || (echo "Chromosome length in file 'chrLength.txt' is incorrect! " && exit 1)
grep -q "chr1" "star_index/chrName.txt" || (echo "Chromosome name in file 'chrName.txt' is incorrect! " && exit 1)
grep -q "chr1 200" "star_index/chrNameLength.txt" || (echo "Chromosome name in file 'chrNameLength.txt' is incorrect! " && exit 1)
echo ">>> Test finished successfully"
exit 0