-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample-regression.sh
54 lines (46 loc) · 1.62 KB
/
sample-regression.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
#SBATCH --account=ACCOUNT
#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}-regression"
# Load the required modules
module restore system
module load swset
module load miniconda3
# Start up qiime
# 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
source activate qiime2
# Make sure we have a clean slate to work with
echo "--^-- X: Creating regression model for ${CATEGORY}"
echo "--^-- X: Clearing previous regression results..."
rm -r "$FOLDERNAME"
echo "--^-- X: Clearing previous regression results...Done!"
# Solve the model
echo "--^-- X: Constructing model..."
qiime sample-classifier regress-samples \
--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
echo "--^-- X: Constructing model...Done!"
# Convert the model output into readable visualizations
echo "--^-- X: Making visualizations..."
qiime metadata tabulate \
--m-input-file "${FOLDERNAME}/feature_importance.qza" \
--o-visualization "${FOLDERNAME}/feature-importance.qzv"
qiime metadata tabulate \
--m-input-file "${FOLDERNAME}/predictions.qza" \
--m-input-file metadata.tsv \
--o-visualization "${FOLDERNAME}/predictions.qzv"
echo "--^-- X: Making visualizations...Done!"