-
Notifications
You must be signed in to change notification settings - Fork 1
/
R_4_DADA2_process.sh
65 lines (59 loc) · 2.2 KB
/
R_4_DADA2_process.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
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# _ _
# /\ (_) | |
# / \ _ __ ___ ___ _ __ _ ___ | |_
# / /\ \ | '_ ` _ \ / _ \| '_ \| |/ _ \| __|
# / ____ \| | | | | | (_) | | | | | (_) | |_
# /_/ \_\_| |_| |_|\___/|_| |_| |\___/ \__|
# _/ |
# |__/
# 19/04/2021
#
BEFORE=$SECONDS
PATHCONDA=$(conda info | grep -i 'base environment' | awk -F" " '{print $4}')
source $PATHCONDA'/etc/profile.d/conda.sh'
conda activate REnv_Monjot_2023A
if [ $(echo $1 | grep "." |wc -l ) == 1 ]
then
inifile=$1
else
echo 'Enter initialization file path (.ini) : '
read inifile
fi
## Set variable
### DADA2 variables
INPUT=$(cat $inifile | grep "INPUT" | awk -F"\t" '{ print $2 }')
echo "Input file: "$INPUT
DATABASE=$(cat $inifile | grep "DATABASE" | awk -F"\t" '{ print $2 }')
echo "Database: "$DATABASE
RESULT=$(cat $inifile | grep "RESULT" | awk -F"\t" '{ print $2 }')
echo "Result: "$RESULT
MINLEN=$(cat $inifile | grep "MINLEN" | awk -F"\t" '{ print $2 }')
echo "minLen: "$MINLEN
MAXLEN=$(cat $inifile | grep "MAXLEN" | awk -F"\t" '{ print $2 }')
echo "maxLen: "$MAXLEN
MAXN=$(cat $inifile | grep "MAXN" | awk -F"\t" '{ print $2 }')
echo "maxN : "$MAXN
MINOVERLAP=$(cat $inifile | grep "MINOVERLAP" | awk -F"\t" '{ print $2 }')
echo "minOverlap : "$MINOVERLAP
MAXMISMATCH=$(cat $inifile | grep "MAXMISMATCH" | awk -F"\t" '{ print $2 }')
echo "maxMismatch : "$MAXMISMATCH
NTHREADS=$(cat $inifile | grep "NTHREADS" | awk -F"\t" '{ print $2 }')
echo "Number of threads : "$NTHREADS
FWD=$(cat $inifile | grep "FWD" | awk -F"\t" '{ print $2 }')
echo "Forward primer : "$FWD
REV=$(cat $inifile | grep "REV" | awk -F"\t" '{ print $2 }')
echo "Reverse primer : "$REV
CUTADAPT=$(which cutadapt)
echo "CUTADAPT locality : "$CUTADAPT
# set script directory
cd script/
## Launch DADA2 script
if [ $(ls ../dataDADA2/rawTable/ | grep $RESULT | wc -l) != 1 ]
then
echo "Start DADA2"
nohup Rscript 4_Dada2.R $INPUT $DATABASE $RESULT $MINLEN $MAXLEN $MAXN $MINOVERLAP $MAXMISMATCH $NTHREADS $FWD $REV $CUTADAPT >> Ranalyse.log
echo "DADA2 processing completed"
fi
ELAPSED=$((($SECONDS-$BEFORE)/60))
echo "R process finished and takes "$ELAPSED" minutes !"