Skip to content

Commit

Permalink
Merge pull request #16 from eipm/bio-389-rename-bam
Browse files Browse the repository at this point in the history
adding the option to specify the full output name
  • Loading branch information
alexsigaras authored Jan 5, 2021
2 parents 1104dae + d089c24 commit 010d349
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions transformBAM.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fi
PROGRAM=$0

usage() {
echo -e "Usage:\tbash $PROGRAM [-i|--file-in] [-o|--dir-out] [-p|--pm-in] [-r|--pm-out]"
echo -e "Usage:\tbash $PROGRAM [-i|--file-in] [-o|--dir-out] -p|--pm-in] [-r|--pm-out] [-f|--file-out]"
}
cleanUp() {
if [[ -e BAM.new.header.sam.txt ]];then
Expand All @@ -25,7 +25,7 @@ logMsg() {
fi
}

if [[ $# -ne 8 ]];then
if [[ $# -lt 8 ]];then
usage
cleanUp 127
fi
Expand All @@ -44,6 +44,9 @@ while [ "$1" != "" ]; do
-r | --pm-out ) shift
PM_OUT=$1
;;
-f | --file-out ) shift
FILE_NAME_OUT=$1
;;
* ) usage
cleanUp 0
esac
Expand All @@ -62,7 +65,7 @@ if [[ ! -e "$DIR_OUT" ]];then
mkdir -p $DIR_OUT
fi
logMsg "DEBUG" "Directory Out: ($DIR_OUT)"
FILE_OUT=$(basename $FILE_IN | sed "s%$PM_IN%$PM_OUT%g")
[[ -z "$FILE_NAME_OUT" ]] && FILE_OUT=$(basename $FILE_IN | sed "s%$PM_IN%$PM_OUT%g") || FILE_OUT="$FILE_NAME_OUT"
logMsg "DEBUG" "File Name Out: ($FILE_OUT)"

cd "$DIR_OUT"
Expand Down

0 comments on commit 010d349

Please sign in to comment.