-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkflow.sh
36 lines (25 loc) · 1.11 KB
/
workflow.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
INPUT=/data-shared/vcf_examples/luscinia_vars.vcf.gz
# Show DPs
#<$INPUT zcat | grep -v "#" | cut -f8 | grep -o "DP=[0-9]*;" | grep -o "[0-9]*" | less
# Make a new file for data for R script visualisation
mkdir -p data
## Make a temp directory for it:
TEMPDIR=$(mktemp -d)
## Prepare files
touch data/popdata.tsv $TEMPDIR/indels $TEMPDIR/indel_DP $TEMPDIR/SNPs $TEMPDIR/SNP_DP
## Header
echo "TYPE DP" > data/popdata.tsv
## Preparing files for paste to popdata.tsv
<$INPUT zcat | grep -v "#" | cut -f8 | grep -o "INDEL" >> $TEMPDIR/indels # 99537 lines
<$INPUT zcat | grep -v "#" | cut -f8 | grep "INDEL" | grep -o "DP=[0-9]*;" | grep -o "[0-9]*" >> $TEMPDIR/indel_DP
for i in $( seq $( <$INPUT zcat | grep -v "#" | cut -f8 | grep -v "INDEL" | wc -l ) )
do
echo "SNP" >> $TEMPDIR/SNPs # 354671 lines
done
<$INPUT zcat | grep -v "#" | cut -f8 | grep -v "INDEL" | grep -o "DP=[0-9]*;" | grep -o "[0-9]*" >> $TEMPDIR/SNP_DP
## Paste data for INDELs
paste $TEMPDIR/indels $TEMPDIR/indel_DP >> data/popdata.tsv
## Paste data for SNPs
paste $TEMPDIR/SNPs $TEMPDIR/SNP_DP >> data/popdata.tsv
## Clean temp directory:
rm -rf $TEMPDIR