/usr/bin/RunRapMap.sh is in rapmap 0.5.0+dfsg-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/bin/bash
cmd="$@"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bam_out=`echo $cmd | sed -n 's/.*--bamOut\s\+\(\S\+\)\s*.*/\1/p'`
bam_compress_threads=`echo $cmd | sed -n 's/.*--bamThreads\s\+\([[:digit:]]\+\)\s*.*/\1/p'`
if [ -z "$bam_out" ]
then
#Run normally in this branch
$DIR/rapmap ${@}
else
# from: http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
if command -v samtools >/dev/null; then
new_cmd=`echo $cmd | sed 's/--bamOut\s\+\(\S\+\)\s*//'`
execmd=""
if [ -z "$bam_compress_threads" ]
then
execmd="${new_cmd} -o | samtools view -Sb - > ${bam_out}"
else
execmd="${new_cmd} -o | samtools view -Sb -@ ${bam_compress_threads} > ${bam_out}"
fi
echo "Running command [$DIR/rapmap ${execmd}]"
$DIR/rapmap ${execmd}
else
echo >&2 "samtools is required to convert to BAM, but it's not installed. Aborting.";
exit 1;
fi
fi
|