-
Notifications
You must be signed in to change notification settings - Fork 5
/
trinity.sbat
71 lines (54 loc) · 1.41 KB
/
trinity.sbat
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
#!/bin/bash
#### preamble
#SBATCH --job-name=trinity
#SBATCH --nodes=1
#SBATCH --tasks-per-node=1
#SBATCH --cpus-per-task=4
#SBATCH --time=1:00:00
#SBATCH --account=training
#### End preamble
# Put your job commands here:
WDIR=$(pwd)
# Create temporary directory, which is removed at end of run
TEMP=$(mktemp -d)
if [ $? -ne 0 ]; then
echo "can't create $TEMP ... exit"
exit 1
fi
trap '/bin/rm -rf $TEMP; exit' EXIT
# Copy data to $TEMP
echo "Copying to $TEMP ..."
if ! cp reads.right.fq.gz reads.left.fq.gz $TEMP; then
echo "can't copy reads.right/.left to $TEMP ... exit"
exit 1
fi
if ! cd $TEMP; then
echo "can't chdir to $TEMP ... exit"
exit 1
fi
if [ -e reads.right.fq.gz ] && [ ! -e reads.right.fq ]; then
echo "Unzipping reads.right ..."
gunzip -c reads.right.fq.gz > reads.right.fq
fi
if [ -e reads.left.fq.gz ] && [ ! -e reads.left.fq ]; then
echo "Unzipping reads.left ..."
gunzip -c reads.left.fq.gz > reads.left.fq
fi
# Run Trinity
echo "Running Trinity ..."
OUTFILE=trinity_out_dir.$(date +%F-%T)
mkdir $OUTFILE
echo + Trinity --seqType fq --max_memory 2G \
--left reads.left.fq.gz \
--right reads.right.fq.gz \
--SS_lib_type RF \
--output $OUTFILE \
--CPU ${SLURM_CPUS_PER_TASK:-1}
# Save results
echo "Saving results from $TEMP/$OUTFILE to $WDIR ..."
if ! cp -ar $TEMP/$OUTFILE $WDIR; then
echo "can't copy results to $WDIR ... exit"
exit 1
fi
# Clean up /tmp
/bin/rm -rf $TEMP