Skip to content

Commit

Permalink
Support for changing output directory (#7)
Browse files Browse the repository at this point in the history
* Added support for changing output directory

* Update src/main/docker/RNApeg.sh

Co-authored-by: Andrew Thrasher <adthrasher@gmail.com>

* Extending functionality for selecting output directory including a default

* Update src/main/docker/RNApeg.sh

LGTM

Co-authored-by: Andrew Thrasher <adthrasher@gmail.com>

Co-authored-by: Andrew Thrasher <adthrasher@gmail.com>
  • Loading branch information
jordan-rash and adthrasher authored Mar 26, 2021
1 parent cd006e0 commit 2bfca08
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/docker/RNApeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ REFFLAT=""
REFGENE=""
# optional refFlat for final gene annotation step only, if not specified REFFLAT
# will be used.
OUTPUT_DIR=/results
OUTPUT_DIR=""

usage() {
echo "RNApeg.sh [-h] -b bamfile -f fasta -r refflat [-rg refflat]"
echo "RNApeg.sh [-h] -b bamfile -f fasta -r refflat [-rg refflat] [-O output_dir]"
}

while [ ! -z "$1" ]; do
Expand All @@ -23,6 +23,7 @@ while [ ! -z "$1" ]; do
-b) BAMFILE=$2; shift;;
-r) REFFLAT=$2; shift;;
-f) FASTA=$2; shift;;
-O) OUTPUT_DIR=$2; shift;;
-rg) REFGENE=$2; shift;;
-version) echo 20191119; exit 1;;
*) echo "ERROR: unrecognized parameter $1"; usage; exit 1; shift;;
Expand Down Expand Up @@ -54,10 +55,6 @@ elif [[ ! -f $FASTA.fai ]]; then
>&2 echo "ERROR: FASTA index file '$FASTA.fai' DNE; see samtools faidx command"
usage
exit 1
elif [[ ! -d "$OUTPUT_DIR" ]]; then
usage
>&2 echo "ERROR: Output directory '$OUTPUT_DIR' does not exist; need mountpoint?"
exit 1
fi

if [[ -z "$REFGENE" ]]; then
Expand All @@ -78,6 +75,9 @@ fi
##################

echo "[*] Running junction_extraction_wrapper.pl"
junction_extraction_wrapper.pl -no-config -bam $BAMFILE -o $OUTPUT_DIR -fasta $FASTA -refflat $REFFLAT -refgene $REFGENE -now


output_arg=
if [[ -n "$OUTPUT_DIR" ]]; then
mkdir -p $OUTPUT_DIR
output_arg="-o $OUTPUT_DIR"
fi
junction_extraction_wrapper.pl -no-config -bam $BAMFILE -fasta $FASTA -refflat $REFFLAT -refgene $REFGENE -now ${output_arg}

0 comments on commit 2bfca08

Please sign in to comment.