Commit 563946ea authored by Sander Bollen's avatar Sander Bollen
Browse files

Merge branch 'fix-issue-29' into 'master'

explicitly put output of bc -l in variable.

Closes #29

See merge request !7
parents a5ddaabe 64b2275a
#!/usr/bin/env bash
set -e
set -ex
set -o pipefail
count_json=${1}
......@@ -7,21 +7,22 @@ input_fastq=${2}
output_fastq=${3}
max_bases=${4}
if [[ $max_bases -eq 'None' ]]; then
ln -s $input_fastq $output_fastq
if [[ ${max_bases} -eq 'None' ]]; then
ln -s ${input_fastq} ${output_fastq}
exit 0
fi
if [[ -z $max_bases ]]; then
ln -s $input_fastq $output_fastq
ln -s ${input_fastq} ${output_fastq}
exit 0
fi
bases=$(jq '.bases' $count_json)
frac=$(jq -n "$max_bases / $bases" | sed -e "s:e:E:g")
echo $frac
if (( $(echo "$frac > 1" | bc -l) )); then
ln -s $input_fastq $output_fastq
frac_higher_than_one=$(echo "${frac} > 1" | bc )
if [[ ${frac_higher_than_one} -eq 1 ]]; then
ln -s ${input_fastq} ${output_fastq}
else
seqtk sample -s100 $frac $input_fastq | gzip -c > $output_fastq
seqtk sample -s100 ${input_fastq} ${frac} | gzip -c > ${output_fastq}
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment