Skip to content

Commit

Permalink
Run pipeline once
Browse files Browse the repository at this point in the history
  • Loading branch information
KHajji committed Jul 11, 2022
1 parent 61b30ae commit 35c69ef
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 37 deletions.
10 changes: 5 additions & 5 deletions bin/chewbbaca_per_genus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ genus="$5"

# Make new variables
downloaded_scheme="${db_dir}/downloaded_schemes/${genus}"
prepared_scheme="${db_dir}/prepared_schemes/${genus}/scheme"
prepared_scheme="${db_dir}/prepared_schemes/${genus}"
script_path="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
prodigal_training_file="$script_path/../files/prodigal_training_files/${genus}.trn"
prodigal_training_file=$(realpath "$script_path/../files/prodigal_training_files/${genus}.trn")

echo "Deleting any previous results from old ChewBBACA runs if existing in ${output_dir}...\n"
rm -rf "results_*"

if [ ! -f "${prepared_scheme}_summary_stats.txt" ]; then
echo "\nPreparing scheme for running it with ChewBBACA...\n"
if [ ! -f "$db_dir/prepared_schemes/${genus}_summary_stats.txt" ]; then
echo "Preparing scheme for running it with ChewBBACA..."
chewBBACA.py PrepExternalSchema -i "$downloaded_scheme" \
--output-directory "$prepared_scheme" \
--cpu $threads \
Expand All @@ -35,7 +35,7 @@ chewBBACA.py AlleleCall --cpu ${threads} \
-i "${input_files}" \
-g "${prepared_scheme}" \
-o "." \
--ptf "$prodigal_training_file"
--ptf "$prodigal_training_file" \
--fr

find "." -type f -name "results_alleles.tsv" -exec cp {} "." \;
Expand Down
71 changes: 39 additions & 32 deletions run_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,6 @@ fi
# input_fastq="${input_dir}/clean_fastq"
# fi

case $PROJECT_NAME in

svstec)
GENUS_ALL="escherichia shigella stec"
;;
svshig)
GENUS_ALL="escherichia shigella"
;;
salm)
GENUS_ALL="salmonella"
;;
campy)
GENUS_ALL="campylobacter"
;;
svlismon)
GENUS_ALL="listeria listeria_optional"
;;
yers)
GENUS_ALL="yersinia"
;;
*)
GENUS_ALL="other"
;;
esac


#----------------------------------------------#
Expand Down Expand Up @@ -80,15 +56,46 @@ else
QUEUE="bio"
fi

for GENUS in $GENUS_ALL
do
case $PROJECT_NAME in
svstec)
GENUS_ALL="escherichia shigella stec"
GENUS="stec"
;;
svshig)
GENUS_ALL="escherichia shigella"
GENUS="shigella"
;;
salm)
GENUS_ALL="salmonella"
GENUS="salmonella"
;;
campy)
GENUS_ALL="campylobacter"
GENUS="campylobacter"
;;
svlismon)
GENUS_ALL="listeria listeria_optional"
GENUS="listeria"
;;
yers)
GENUS_ALL="yersinia"
GENUS="yersinia"
;;
*)
GENUS_ALL="other"
;;
esac

#----------------------------------------------#
# Copying database directory if it exists

echo -e "\nCopying the cgMLST schema from $GENUS..."
DB_DIR="schemes"
mkdir -p "$DB_DIR/prepared_schemes"
cp -r "/mnt/db/juno/cgmlst/prepared_schemes/$GENUS" "$DB_DIR/prepared_schemes/$GENUS"
for G in $GENUS_ALL
do
echo -e "\nCopying the cgMLST schema from /mnt/db/juno/cgmlst/prepared_schemes/$G..."
mkdir -p "$DB_DIR/prepared_schemes"
cp -r --no-preserve=mode,ownership "/mnt/db/juno/cgmlst/prepared_schemes/$G" "$DB_DIR/prepared_schemes/$G"
cp --no-preserve=mode,ownership /mnt/db/juno/cgmlst/prepared_schemes/${G}_{sum,inv}*.txt "$DB_DIR/prepared_schemes/"
done

#----------------------------------------------#
# Run the pipeline
Expand All @@ -100,8 +107,8 @@ python juno_cgmlst.py \
-o "$output_dir" \
-g "$GENUS" \
-d "$DB_DIR"
result=$((result > $? ? result : $?)) # Maximum of previous return value and result https://unix.stackexchange.com/a/186703
done

result=$?

#----------------------------------------------#
# Propagate metadata
Expand Down

0 comments on commit 35c69ef

Please sign in to comment.