-
Notifications
You must be signed in to change notification settings - Fork 0
/
miRNA_prediction.sh
executable file
·168 lines (158 loc) · 6.47 KB
/
miRNA_prediction.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
genomefile=/bios-store1/chenyc/Reference_Source/Arabidopsis_Reference/ath_chr_bowtie_index/Arabidopsis_thaliana.TAIR10.dna.toplevel.fa
loci_file=/bios-store1/chenyc/scripts/sRNA-seq_Analysis_Pipeline/loci/ath_hairpin.loci
input=$1
output=$2
list=$(cat $3)
tag=fastq.gz
#rawdata qc
if [ ! -d "$output/rawdata_qc/" ]; then
echo
echo
echo "[`date`] rawdata QC"
echo '-----------------------------------------------'
mkdir -p $output/rawdata_qc
fastqc -t 16 --nogroup -o $output/rawdata_qc $input/*."$tag"
multiqc $output/rawdata_qc -o $output/rawdata_qc/multiqc_result/
echo "[`date`] Run complete"
echo '-----------------------------------------------'
fi
# read -p "Please check multiqc results and Provide the 3' apapter sequence: " sequence
# wait
sequence=AGATCGGAAGAG
#remove the 3' adapter with cutadapt
if [ ! -d "$output/remove_adapter_3/" ]; then
echo
echo
echo "[`date`] Remove the 3' adapter with cutadapt"
echo '-----------------------------------------------'
mkdir -p $output/remove_adapter_3
myvar=0
for i in ${list}
do
echo "cutadapt -j 24 -a "$sequence" --discard-untrimmed -m 20 -M 24 -o $output/remove_adapter_3/{$i}_trimmed.fq $input/${i}.${tag}"
cutadapt -j 24 -a "$sequence" --discard-untrimmed -m 20 -M 24 -o $output/remove_adapter_3/"$i"_trimmed.fq $input/"$i"*."$tag" &
#trim_galore -j 24 -q 20 --length 15 --trim-n --dont_gzip $input/"$i"."$tag" -o $output/remove_adapter_3/ &
myvar=$(($myvar + 1 ))
if [ "$myvar" = "6" ]
then
myvar=0
wait
fi
done
wait
echo "[`date`] Run complete"
echo '-----------------------------------------------'
fi
#remove the 5' adapter with cutadapt
# if [ ! -d "$output/remove_adapter_5/" ]; then
# echo
# echo
# echo "[`date`] Remove the 5' adapter with cutadapt"
# echo '-----------------------------------------------'
# mkdir -p $output/remove_adapter_5
# myvar=0
# for i in ${list}
# do
# echo "cutadapt -j 24 -g ${g} --discard-untrimmed -m 15 -o $output/remove_adapter_5/{$i}_trimmed.fq $input/${i}.${tag}"
# cutadapt -j 24 -g "$g" --discard-untrimmed -m 15 -o $output/remove_adapter_5/"$i"_trimmed.fq $input/"$i"."$tag" &
# myvar=$(($myvar + 1 ))
# if [ "$myvar" = "6" ]
# then
# myvar=0
# wait
# fi
# done
# wait
# echo "[`date`] Run complete"
# echo '-----------------------------------------------'
# fi
#discard low quality reads
if [ ! -d "$output/filter_lq_reads/" ]; then
echo
echo
echo "[`date`] Discard low quality reads with FASTX-Toolkit"
echo '-----------------------------------------------'
mkdir -p $output/filter_lq_reads
myvar=0
for i in ${list}
do
echo "fastq_quality_filter -q 20 -p 85 -Q 33 -v -i $output/remove_adapter_3/${i}_trimmed.fq -o $output/filter_lq_reads/${i}_filter.fq"
fastq_quality_filter -q 20 -p 85 -Q 33 -v -i $output/remove_adapter_3/"$i"_trimmed.fq -o $output/filter_lq_reads/"$i"_filter.fq &
myvar=$(($myvar + 1 ))
if [ "$myvar" = "6" ]
then
myvar=0
wait
fi
done
wait
fastqc -t 16 --nogroup -o $output/filter_lq_reads/*_filter.fq
multiqc $output/filter_lq_reads -o $output/filter_lq_reads/multiqc_result/
echo "[`date`] Run complete"
echo '-----------------------------------------------'
fi
#Aligned to the genome
if [ ! -d "$output/map2genome/" ]; then
echo
echo
echo "[`date`] Aligned to the genome with ShortStack"
echo '-----------------------------------------------'
mkdir -p $output/map2genome
myvar=0
for i in ${list}
do
ShortStack --genomefile $genomefile --outdir $output/map2genome/"$i" --mismatches 0 --align_only --nohp --keep_quals --mmap u --bowtie_m 50 --bowtie_cores 24 --readfile $output/filter_lq_reads/"$i"_filter.fq &
myvar=$(($myvar + 1 ))
if [ "$myvar" = "2" ]
then
myvar=0
wait
fi
done
wait
echo "[`date`] Run complete"
echo '-----------------------------------------------'
fi
if [ ! -d "$output/denovo_identification/" ]; then
echo
echo
echo "[ `date` ] Clusters of sRNAs were de novo identified in each library with ShortStack"
echo '-----------------------------------------------'
mkdir -p $output/denovo_identification
myvar=0
for i in ${list}
do
ShortStack --genomefile $genomefile --outdir $output/denovo_identification/"$i" --mismatches 0 --keep_quals --mincov 2rpm --bowtie_cores 24 --bamfile $output/map2genome/"$i"/"$i"_filter.bam &
myvar=$(($myvar + 1 ))
if [ "$myvar" = "2" ]
then
myvar=0
wait
fi
done
wait
echo "[ `date` ] Run complete"
echo '-----------------------------------------------'
fi
if [ ! -d "$output/loci_drived/" ]; then
echo
echo
echo "[ `date` ] Clusters of sRNAs were identified by known-loci file in each library with ShortStack"
echo '-----------------------------------------------'
mkdir -p $output/loci_drived
myvar=0
for i in ${list}
do
ShortStack --genomefile $genomefile --locifile $loci_file --outdir $output/loci_drived/"$i" --mismatches 0 --keep_quals --mincov 2rpm --bowtie_cores 24 --bamfile $output/map2genome/"$i"/"$i"_filter.bam &
myvar=$(($myvar + 1 ))
if [ "$myvar" = "2" ]
then
myvar=0
wait
fi
done
wait
echo "[ `date` ] Run complete"
echo '-----------------------------------------------'
fi