-
Notifications
You must be signed in to change notification settings - Fork 5
/
SRY_k
88 lines (71 loc) · 2.14 KB
/
SRY_k
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
#!/bin/bash
script_abs=$(readlink -f "$0")
script_dir=$(dirname $script_abs)
export PATH=$PATH:$script_dir/script
export LC_ALL=C
usageHelp="\nUsage: ./${0##*/} (parameters with * must be supplied!)\n\n-m <string>* Male (or female for W) short-read files with comma separated in sample and plus separated between samples\n-f <string>* Female (or male for W) short-read files with comma separated in sample and plus separated between samples\n-i <int> Minimum coverage of k-mers in each sample (default: 2)\n-a <int> Maximum coverage of k-mers in each sample (default: unlimit)\n-k <int> K-mer length (default: 21)\n-p <int> CPU number (default: 1)\n-h Help and exit."
printHelpAndExit() {
echo -e "$usageHelp"
exit;
}
while getopts "m:f:l:g:i:a:k:p:h" opt; do
case $opt in
m) MSREAD=$OPTARG ;;
f) FSREAD=$OPTARG ;;
i) COV=$OPTARG ;;
a) MCOV=$OPTARG ;;
k) KLEN=$OPTARG ;;
p) CPU=$OPTARG ;;
h) printHelpAndExit 0;;
esac
done
if [ -z "$MSREAD" ] || [ -z "$FSREAD" ];then
printHelpAndExit
exit
fi
if [ -z "$KLEN" ];then
KLEN=21
fi
if [ -z "$COV" ];then
COV=2
fi
if [ -z "$MCOV" ];then
MCOV=0
fi
if [ -z "$CPU" ];then
CPU=1
fi
if [ ! -d "output" ];then
mkdir output
fi
#judge if the softwares needed are installed.
if ! type kmc >/dev/null 2>&1; then
echo 'kmc is not installed!'
exit
fi
if ! type samtools >/dev/null 2>&1; then
echo 'samtools is not installed!'
exit
fi
if ! type seqtk >/dev/null 2>&1; then
echo 'seqtk is not installed!'
exit
fi
if ! type parallel >/dev/null 2>&1; then
echo 'parallel is not installed!'
exit
fi
#obtain specific-Y kmers
echo "***********************************Preparation*************************************"
if [[ $MCOV == 0 ]]
then
echo "Min coverage:$COV;max coverage:unlimit"
else
echo "Min coverage:$COV;max coverage:$MCOV"
fi
call_kmc.pl $MSREAD $FSREAD $KLEN $COV $MCOV
parallel -j $CPU <output/kmer.sh
parallel -j 2 <output/ft.sh
KMER="output/SRY_kmer.txt"
filterx -k s -1 'cnt=1' output/Male_kmer.dat.gz:req=Y output/Female_kmer.dat.gz |cut -f 1 > $KMER
rm -r tmp_* output/M.kmer output/F.kmer