-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_diann_auto_lib_or_fasta_2.sbatch
More file actions
125 lines (112 loc) · 3.19 KB
/
Copy pathrun_diann_auto_lib_or_fasta_2.sbatch
File metadata and controls
125 lines (112 loc) · 3.19 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash -l
#SBATCH --job-name=diann_multi_fasta
#SBATCH --cpus-per-task=64
#SBATCH --mem=512G
#SBATCH -o diann.%j.out
#SBATCH -e diann.%j.err
#SBATCH --account=genome-center-grp
#SBATCH --time=12:00:00
#SBATCH --partition=high
# -------------------- USER PATHS --------------------
# use the directory where the job is launched as the working directory
WORKDIR=$(pwd)
IMG=$WORKDIR/diann2.3.0.sif
DATA_DIR=$WORKDIR/data
FASTA_DIR=$WORKDIR/fasta
LIB_DIR=$WORKDIR/lib
OUTDIR=$WORKDIR/out
mkdir -p "$OUTDIR"
module load apptainer
# -------------------- BUILD RUN FILE LIST --------------------
RUN_ARGS=""
for f in "$DATA_DIR"/*.d "$DATA_DIR"/*.raw "$DATA_DIR"/*.mzML; do
[ -e "$f" ] || continue
RUN_ARGS+=" --f /work/data/$(basename "$f")"
done
if [ -z "$RUN_ARGS" ]; then
echo "No MS files found in $DATA_DIR"
exit 1
fi
# ----- BUILD FASTA LIST (used by both library and library-free modes) -----
FASTA_ARGS=""
OUT_LIB_BASENAME=""
for fa in "$FASTA_DIR"/*.fasta "$FASTA_DIR"/*.fa; do
[ -e "$fa" ] || continue
FASTA_ARGS+=" --fasta /work/fasta/$(basename "$fa")"
base=$(basename "$fa")
name_without_ext=${base%.*}
if [ -z "$OUT_LIB_BASENAME" ]; then
OUT_LIB_BASENAME="$name_without_ext"
else
OUT_LIB_BASENAME="${OUT_LIB_BASENAME}_$name_without_ext"
fi
done
# if there were no FASTAs, fall back to a default name
if [ -z "$OUT_LIB_BASENAME" ]; then
OUT_LIB_BASENAME="report-lib"
fi
OUT_LIB_PATH="$OUTDIR/${OUT_LIB_BASENAME}.parquet"
# -------------------- DETECT SPECTRAL LIBRARY --------------------
SPECLIB_FILE=$(ls "$LIB_DIR"/*.speclib 2>/dev/null | head -n 1)
# -------------------- IF SPECTRAL LIBRARY FOUND --------------------
if [ -n "$SPECLIB_FILE" ]; then
echo "Spectral library detected: $SPECLIB_FILE"
echo "Running DIA-NN in library mode..."
apptainer exec --bind $WORKDIR:/work $IMG /diann-2.3.0/diann-linux \
$RUN_ARGS \
$FASTA_ARGS \
--lib /work/lib/$(basename "$SPECLIB_FILE") \
--threads 64 \
--verbose 1 \
--out $OUTDIR/no_norm_report.parquet \
--qvalue 0.01 \
--matrices \
--out-lib $OUT_LIB_PATH \
--gen-spec-lib \
--xic \
--unimod4 \
--var-mods 1 \
--window 6 \
--mass-acc 14 \
--mass-acc-ms1 14 \
--peptidoforms \
--reanalyse \
--rt-profiling \
--use-quant
# -------------------- ELSE RUN FASTA SEARCH --------------------
else
echo "No spectral library found. Running library-free FASTA search..."
if [ -z "$FASTA_ARGS" ]; then
echo "No FASTA files found in $FASTA_DIR"
exit 1
fi
apptainer exec --bind $WORKDIR:/work $IMG /diann-2.3.0/diann-linux \
$RUN_ARGS \
$FASTA_ARGS \
--out $OUTDIR/report.parquet \
--out-lib $OUT_LIB_PATH \
--matrices \
--fasta-search \
--qvalue 0.01 \
--gen-spec-lib \
--predictor \
--relaxed-prot-inf \
--library-coverage 1 \
--peak-centroid \
--smart-profiling \
--mass-acc-fr 14 \
--gg-disable \
--max-pr-charge 4 \
--min-fr-mz 200 \
--max-fr-mz 1200 \
--cut K*,R* \
--missed-cleavages 1 \
--unimod4 \
--var-mods 1 \
--window 6 \
--mass-acc 14 \
--mass-acc-ms1 14 \
--reanalyse \
--rt-profiling
fi
echo "DIA-NN analysis complete. Results saved in $OUTDIR"