cowcalf-rumen-metagenomic-p.../sample-classifier.sh

54 lines
1.6 KiB
Bash
Raw Normal View History

2019-05-17 05:25:37 +00:00
#!/bin/bash
2021-06-02 13:29:01 +00:00
#SBATCH --account=ACCOUNT
2019-05-17 05:25:37 +00:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G
# Fetch the category we're working with from upstream
CATEGORY=${1%}
# Save the folder name we will be saving everything into
FOLDERNAME="${CATEGORY}-classifier"
# Load the required modules
module restore system
module load swset
module load miniconda3
# Start up qiime
2019-05-21 16:28:18 +00:00
# This code creates errors if run through shellcheck because
# the shellcheck program doesn't understand miniconda:
# We'll add a directive to tell it to ignore this error
# shellcheck disable=SC1091
2019-05-17 05:25:37 +00:00
source activate qiime2
# Make sure we have a clean slate to work with
2019-05-21 16:28:18 +00:00
echo "--^-- X: Creating a classifier model for ${CATEGORY}"
2019-05-17 05:25:37 +00:00
echo "--^-- X: Clearing previous classifier results..."
rm -r "$FOLDERNAME"
echo "--^-- X: Clearing previous classifier results...Done!"
# Solve the model
echo "--^-- X: Constructing model..."
qiime sample-classifier classify-samples \
2019-05-21 16:28:18 +00:00
--i-table feature-table.qza \
--m-metadata-file metadata.tsv \
--m-metadata-column "$CATEGORY" \
--p-n-jobs 4 \
--p-missing-samples ignore \
--p-optimize-feature-selection \
--output-dir "$FOLDERNAME" \
--verbose
2019-05-17 05:25:37 +00:00
echo "--^-- X: Constructing model...Done!"
# Convert the model output into readable visualizations
echo "--^-- X: Making visualizations..."
qiime metadata tabulate \
2019-05-21 16:28:18 +00:00
--m-input-file "${FOLDERNAME}/feature_importance.qza" \
--o-visualization "${FOLDERNAME}/feature-importance.qzv"
2019-05-17 05:25:37 +00:00
qiime metadata tabulate \
2019-05-21 16:28:18 +00:00
--m-input-file "${FOLDERNAME}/predictions.qza" \
--m-input-file metadata.tsv \
--o-visualization "${FOLDERNAME}/predictions.qzv"
2019-05-17 05:25:37 +00:00
echo "--^-- X: Making visualizations...Done!"