Skip to content

Commit

Permalink
Fix featurecounts (#20)
Browse files Browse the repository at this point in the history
* check if junction counts file exists

* add test without junctions
  • Loading branch information
sainirmayi authored Feb 7, 2024
1 parent ae1956b commit 487c5d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/featurecounts/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,6 @@ featureCounts \

[[ ! -z "$par_counts" ]] && mv "$tmp_dir/output.txt" "$par_counts"
[[ ! -z "$par_summary" ]] && mv "$tmp_dir/output.txt.summary" "$par_summary"
[[ ! -z "$par_junctions" ]] && mv "$tmp_dir/output.txt.jcounts" "$par_junctions"
if [[ ! -z "$par_junctions" ]] && [[ -e "$tmp_dir/output.txt.jcounts" ]]; then
mv "$tmp_dir/output.txt.jcounts" "$par_junctions"
fi
26 changes: 25 additions & 1 deletion src/featurecounts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

dir_in="$meta_resources_dir/test_data"

echo "> Run featureCounts"
echo "> Run featureCounts (with junctions)"
"$meta_executable" \
--input "$dir_in/a.bam" \
--annotation "$dir_in/annotation.gtf" \
Expand Down Expand Up @@ -32,4 +32,28 @@ echo ">> Check if output is empty"
[ ! -s "junction_counts.txt" ] && echo "Output file junction_counts.txt is empty" && exit 1
[ ! -s "detailed_results/a.bam.featureCounts.sam" ] && echo "Output file detailed_results/a.bam.featureCounts.sam is empty" && exit 1

echo "> Run featureCounts (without junctions)"
"$meta_executable" \
--input "$dir_in/a.bam" \
--annotation "$dir_in/annotation.gtf" \
--counts "features.tsv" \
--summary "summary.tsv" \
--overlapping \
--frac_overlap 0.2 \
--paired \
--strand 0 \
--detailed_results detailed_results \
--detailed_results_format SAM

echo ">> Checking output"
[ ! -f "features.tsv" ] && echo "Output file features.tsv does not exist" && exit 1
[ ! -f "summary.tsv" ] && echo "Output file summary.tsv does not exist" && exit 1
[ ! -d "detailed_results" ] && echo "Output directory detailed_results does not exist" && exit 1
[ ! -f "detailed_results/a.bam.featureCounts.sam" ] && echo "Output file detailed_results/a.bam.featureCounts.sam does not exist" && exit 1

echo ">> Check if output is empty"
[ ! -s "features.tsv" ] && echo "Output file features.tsv is empty" && exit 1
[ ! -s "summary.tsv" ] && echo "Output file summary.tsv is empty" && exit 1
[ ! -s "detailed_results/a.bam.featureCounts.sam" ] && echo "Output file detailed_results/a.bam.featureCounts.sam is empty" && exit 1

echo "> Test successful"

0 comments on commit 487c5d2

Please sign in to comment.