#!/bin/bash

expPath=$1
expName=$2
expFormat=$3
expCompress=$4

outExpDir=$5

klen=$6
minab=$7
bfsize=$8

rmCompressed=$9
rmSource=${10}

cd ${outExpDir}

if [ "${expCompress}" == ".gz" ]; then
    gzip -dc ${expPath} > ${expName}${expFormat}
    howdesbt makebf K=${klen} --min=${minab} --bits=${bfsize} ${expName}${expFormat} --out=${expName}.bf
    if [ "${rmCompressed}" -eq "1" ]; then
        rm ${expPath}
    fi
    if [ "${rmSource}" -eq "1" ]; then
        rm ${expName}${expFormat}
    fi
else
    howdesbt makebf K=${klen} --min=${minab} --bits=${bfsize} ${expPath} --out=${expName}.bf
    if [ "${rmSource}" -eq "1" ]; then
        rm ${expPath}
    fi
fi
