-
Notifications
You must be signed in to change notification settings - Fork 0
/
qc_final.sh
141 lines (117 loc) · 3.22 KB
/
qc_final.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
#!/bin/bash
##cov based breaking, mito trimming, etc is done
datadir=/pym/Data/Nanopore/projects/prolificans
dbxdir=~/Dropbox/timplab_data/prolificans
if [ $1 == trimmed_asmstats ] ; then
mkdir -p $dbxdir/qc
touch $dbxdir/qc/asmstats_trimmed.csv
for i in st31 st90853 st5317 ;
do
for asm in $datadir/$i/genomes_mitotrim/*fasta ;
do
prefix=`basename $asm .fasta`
python ~/Code/utils/qc/asm_assess.py \
-i $asm \
-p $prefix >> $dbxdir/qc/asmstats_trimmed.csv
done
done
fi
if [ $1 == align ] ; then
for i in st31 st90853 st5317 ;
do
mkdir -p $datadir/$i/align
fq=$datadir/$i/reads/ont/${i}_long.fastq.gz
for asm in $datadir/$i/genomes_mitotrim/*fasta ;
do
prefix=`basename $asm .fasta`
minimap2 -t 54 -ax map-ont $asm $fq |\
samtools view -@ 54 -b |\
samtools sort -@ 54 -o $datadir/$i/align/$prefix.sorted.bam
samtools index $datadir/$i/align/$prefix.sorted.bam
done
done
fi
if [ $1 == align_illumina ] ; then
for i in st31 st90853 st5317 ;
do
mkdir -p $datadir/$i/align
r1=$datadir/$i/reads/illumina/${i}_fwd_paired.fq.gz
r2=$datadir/$i/reads/illumina/${i}_rev_paired.fq.gz
for asm in $datadir/$i/genomes_mitotrim/*fasta ;
do
prefix=`basename $asm .fasta`
bowtie2-build -q $asm $datadir/$i/genomes_mitotrim/$prefix
bowtie2 -p 54 \
-x $datadir/$i/genomes_mitotrim/$prefix \
-1 $r1 \
-2 $r2 |\
samtools view -@ 54 -b |\
samtools sort -@ 54 -o $datadir/$i/align/$prefix.illumina.sorted.bam
samtools index $datadir/$i/align/$prefix.illumina.sorted.bam
done
done
fi
if [ $1 == coverage ] ;then
for i in st31 st90853 st5317 ;
do
mkdir -p $datadir/$i/cov
for align in $datadir/$i/align/*mitotrim*.sorted.bam ;
do
prefix=`basename $align .sorted.bam`
refprefix=`echo $prefix | cut -d . -f 1,2,3`
echo $refprefix
ref=$datadir/$i/genomes_mitotrim/$refprefix.fasta
samtools faidx $ref
awk 'BEGIN {FS="\t"}; {print $1 FS "0" FS $2}' $ref.fai > $ref.bed
bedtools coverage -d \
-a $ref.bed \
-b $align > $datadir/$i/cov/$prefix.cov
done
done
fi
if [ $1 == make_final ] ; then
Rscript qc_final.R
fi
if [ $1 == final_stats ] ; then
mkdir -p $dbxdir/qc
touch $dbxdir/qc/asmstats_final.csv
for i in st31 st90853 st5317 ;
do
for asm in $datadir/$i/genomes_final/*fasta ;
do
prefix=`basename $asm .fasta`
python ~/Code/utils/qc/asm_assess.py \
-i $asm \
-p $prefix >> $dbxdir/qc/asmstats_final.csv
done
done
fi
if [ $1 == busco ] ; then
for i in st31 st90853 st5317 ;
do
mkdir -p $datadir/$i/busco
for asm in $datadir/$i/final/*final2.fasta ;
do
prefix=`basename $asm .final2.fasta`
mkdir -p $datadir/$i/busco/$prefix
busco \
-m genome \
-l sordariomycetes_odb10 \
-i $asm \
-o $prefix \
--out_path $datadir/$i/busco/$prefix \
-c 36 \
-f
done
done
fi
if [ $1 == ref_busco ] ; then
busco \
-m genome \
-l sordariomycetes_odb10 \
-i $datadir/ref/LProlificans_v1.0.fa \
-o LProlificans_v1.0 \
--out_path $datadir/ref/busco_LProlificans_v1.0 \
-c 36 \
-f
fi