#!/usr/bin/env bash
#SBATCH
#SBATCH --job-name=metaWRAP
#SBATCH --partition=lrgmem
#SBATCH --time=72:0:0
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=48
#SBATCH --cpus-per-task=1
#SBATCH --mem=800G
##############################################################################################################################################################
# Master metaWRAP script that calls on individual modules/pipelines
##############################################################################################################################################################
help_message () {
echo""
echo "Usage: metaWRAP [module]"
echo "Options:"
echo ""
echo " read_qc Raw read QC module (read trimming and contamination removal)"
echo " assembly Assembly module (metagenomic assembly)"
echo " kraken KRAKEN module (taxonomy annotation of reads and assemblies)"
echo " blobology Blobology module (GC vs Abund plots of contigs and bins)"
echo ""
echo " binning Binning module (metabat, maxbin, or concoct)"
echo " bin_refinement Refinement of bins from binning module"
echo " reassemble_bins Reassemble bins using metagenomic reads"
echo " quant_bins Quantify the abundance of each bin across samples"
echo " classify_bins Assign taxonomy to genomic bins"
echo " annotate_bins Functional annotation of draft genomes"
echo ""
echo " --help | -h show this help message"
echo " --version | -v show metaWRAP version"
echo " --show-config show where the metawrap configuration files are stored"
echo "";}
config_file=$(which config-metawrap)
source $config_file
if [[ $? -ne 0 ]]; then
echo "cannot find config-metawrap file - something went wrong with the installation!"
exit 1
fi
comm () { ${SOFT}/print_comment.py "$1" "-"; }
########################################################################################################
######################## LOADING IN THE PARAMETERS AND RUNNING MODULE ########################
########################################################################################################
# setting scripts, pipelines, and databases locations from config file (should be in same folder as main script)
if [ "$1" = assembly ]; then
echo metawrap assembly ${@:2}
time ${PIPES}/assembly.sh ${@:2}
exit 0
elif [ "$1" = phylosift ]; then
#echo phylosift.sh ${@:2}
#${PIPES}/phylosift.sh ${@:2}
echo "The PHYLOSIFT module of metaWRAP is disabled in this version of metaWRAP"
exit 0
elif [ "$1" = read_qc ]; then
echo metawrap read_qc ${@:2}
time ${PIPES}/read_qc.sh ${@:2}
exit 0
elif [ "$1" = binning ]; then
echo metawrap binning ${@:2}
time ${PIPES}/binning.sh ${@:2}
exit 0
elif [ "$1" = blobology ]; then
echo metawrap blobology ${@:2}
time ${PIPES}/blobology.sh ${@:2}
exit 0
elif [ "$1" = kraken ]; then
echo metawrap kraken ${@:2}
time ${PIPES}/kraken.sh ${@:2}
exit 0
elif [ "$1" = all ]; then
#echo all.sh ${@:2}
#${PIPES}/all.sh ${@:2}
echo "ALL module of metaWRAP is disabled in this version of metaWRAP"
exit 0
elif [ "$1" = bin_refinement ]; then
echo metawrap bin_refinement ${@:2}
time ${PIPES}/bin_refinement.sh ${@:2}
exit 0
elif [ "$1" = reassemble_bins ]; then
echo metawrap reassemble_bins ${@:2}
time ${PIPES}/reassemble_bins.sh ${@:2}
exit 0
elif [ "$1" = quant_bins ]; then
echo metawrap quant_bins ${@:2}
time ${PIPES}/quant_bins.sh ${@:2}
exit 0
elif [ "$1" = classify_bins ]; then
echo metawrap classify_bins ${@:2}
time ${PIPES}/classify_bins.sh ${@:2}
exit 0
elif [ "$1" = annotate_bins ]; then
echo metawrap annotate_bins ${@:2}
time ${PIPES}/annotate_bins.sh ${@:2}
exit 0
elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
help_message
exit 0
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
echo ""
echo "metaWRAP v=1.0"
echo ""
exit 0
elif [ "$1" = "--show-config" ]; then
comm "MetaWRAP script found in $(which metawrap) and config-metawrap file was found in $(which config-metawrap). Please make sure these paths are consistent with each other."
comm "Here are the contents of config-metawrap:"
cat $(which config-metawrap)
exit 0
else
comm "Please select a proper module of metaWRAP."
help_message
exit 1
fi
########################################################################################################
######################## END OF METAWRAP PIPELINE ########################
########################################################################################################