-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun_test.sh
76 lines (60 loc) · 2.03 KB
/
run_test.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
#!/bin/bash
#if this script has every error, exit
set -e
#set path of minimap2
export PATH='/home/raymond/devel/miniasm/minimap2/':$PATH
#############################################################
#the path of long-reads, reads can be fastq(fq), fasta(fa), gzip or not, such as /path/long-read.fa
reads='testData/reads.fa'
#the path of chloroplast genome, chloroplast genome should be in fasta format, not gzip, such as /path/genome.fa. The chloroplast genome file should only have three sequences, named as 'lsc', 'ssc' and 'ir' (see testData/Epau.format.fa as an example). It doesn't matter which oritentation is for lsc, ssc and ir.
chloroplastGenome='testData/Epau.format.fa'
#the path of output dir, such as /path/summary
outputDir='test'
#read type, 'PacBio' or 'ONT' only, such as ONT
readType=ONT
#how many threads you want to use, such as 10
threads=20
#############################################################
#check argument
if [ $readType != 'PacBio' -a $readType != 'ONT' ]
then
echo "ERROR: readType must be PacBio or ONT."
exit 1
elif [ $readType == 'PacBio' ]
then
#require for minimap2
readType='map-pb'
elif [ $readType == 'ONT' ]
then
#require for minimap2
readType='map-ont'
fi
mkdir -p $outputDir
#minimap2 output
minimapOutput=$outputDir/$(basename $reads).paf
#combinations of different directions of single copy
reference=$outputDir/dir_directions_$(basename $chloroplastGenome)
#final output result
outputFile=$outputDir/result_$(basename $chloroplastGenome)_$(basename $reads)
#get combinations of different direction of single copy
echo "creating different references"
python scripts/getDifferentDirectionCombine.py \
$chloroplastGenome \
$reference
#run minimap2
echo "mapping long-reads to reference using minimap2"
minimap2 \
-x $readType \
--secondary=no \
-t $threads \
-L \
-c \
$reference \
$reads > $minimapOutput
#check orientation ratio
echo "parsing result"
python scripts/parse.py \
$chloroplastGenome \
$outputFile \
$minimapOutput \
1000