forked from akahanaton/multiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eonSpe1.vs.pteAle.align.sh
executable file
·85 lines (78 loc) · 4.65 KB
/
eonSpe1.vs.pteAle.align.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
#--------------------------------------------------
# for queryDir in `ls -d batsGenome/[[:lower:]]*[[:upper:]]*`
#--------------------------------------------------
for queryDir in `ls -d batsGenome/eonSpe`
do
queryID="`basename $queryDir`1"
queryDone="$queryDone$queryID"
echo $queryDone
genomic=`basename $queryDir/$queryID.fa`
nibQueryDir="$queryDir/$queryID.nib1"
#--------------------------------------------------
# for targetDir in `ls -d batsGenome/[[:lower:]]*[[:upper:]]* ucsc/hg38`
#--------------------------------------------------
for targetDir in `ls -d batsGenome/pteAle`
do
targetID=`basename $targetDir`
if [ $targetID != "hg38" ]; then
targetID=$targetID"1"
fi
#--------------------------------------------------
# ls $queryDir/$genomic
#--------------------------------------------------
if [[ $queryID == $targetID || $queryDone == *"$targetID"* ]]; then
continue
fi
echo $queryID.vs.$targetID
nibTargetDir="$targetDir/$targetID.nib1"
lavQueryDir="$queryDir/$queryID.$targetID.lav2"
pslQueryDir="$queryDir/$queryID.$targetID.psl2"
chainQueryDir="$queryDir/$queryID.$targetID.chain2"
lavCmdDir="cmdLav2.$queryID.$targetID"
netCmdDir="cmdNet2.$queryID.$targetID"
if [ ! -e $lavQueryDir ]; then mkdir $lavQueryDir; fi
if [ ! -e $pslQueryDir ]; then mkdir $pslQueryDir; fi
if [ ! -e $chainQueryDir ]; then mkdir $chainQueryDir; fi
rm -rf $lavCmdDir
if [ ! -e $lavCmdDir ]; then mkdir $lavCmdDir; fi
for queryNib in $nibQueryDir/*.nib
do
queryChr=`basename $queryNib .nib`
bashFile=$lavCmdDir/$queryID.$targetID.$queryChr.sh
echo "#!/bin/bash" > $bashFile
echo "for targetNib in $nibTargetDir/*.nib; do" >> $bashFile
echo " targetChr=\`basename \$targetNib .nib\`;" >> $bashFile
echo " lav=$lavQueryDir/$queryID.$targetID.$queryChr.\$targetChr.lav" >> $bashFile
echo " psl=\`echo \$lav | sed 's/lav/psl/g'\`" >> $bashFile
echo " chain=\`echo \$lav | sed 's/lav/chain/g'\`" >> $bashFile
#--------------------------------------------------
# echo " lastz \$targetNib $queryNib --inner=2000 --ydrop=3400 --gappedthresh=3000 --hspthresh=3000 --notransition --step=4 --scores=HaploMerger_20120810/project_template/scoreMatrix.q > \$lav;" >> $bashFile
#--------------------------------------------------
echo " lastz \$targetNib $queryNib --inner=2000 --ydrop=3400 --gappedthresh=3000 --hspthresh=3000 --notransition --step=4 > \$lav;" >> $bashFile
echo ' lavToPsl $lav $psl' >> $bashFile
echo " axtChain -linearGap=loose -psl \$psl $nibTargetDir $nibQueryDir \$chain" >> $bashFile
echo "done" >> $bashFile
echo "" >> $bashFile
qsub -q "all.q@compute-9-*" -o $lavCmdDir -N `basename $bashFile` bash $bashFile
done
# pre chain
if [ ! -e $netCmdDir ]; then mkdir $netCmdDir; fi
echo '#!/bin/bash' > $netCmdDir/a.chainNet.sh
echo "chainMergeSort -tempDir=$chainQueryDir/ $chainQueryDir/*.chain > $queryDir/$queryID.$targetID.all.chain" >> $netCmdDir/a.chainNet.sh
echo "chainPreNet $queryDir/$queryID.$targetID.all.chain $targetDir/$targetID.chrom.sizes $queryDir/$queryID.chrom.sizes $queryDir/$queryID.$targetID.pre.chain" >> $netCmdDir/a.chainNet.sh
echo "chainNet $queryDir/$queryID.$targetID.pre.chain -minSpace=1 $targetDir/$targetID.chrom.sizes $queryDir/$queryID.chrom.sizes stdout $queryDir/$queryID.$targetID.chainNet.err | netSyntenic stdin $queryDir/$queryID.$targetID.noClass.net" >> $netCmdDir/a.chainNet.sh
#--------------------------------------------------
# qsub -o $netCmdDir -N "a.chainNet" bash $netCmdDir/a.chainNet.sh
#--------------------------------------------------
# net
echo 'cd $PBS_O_WORKDIR' > $netCmdDir/b.netClass.sh
echo "netClass -noAr $queryDir/$queryID.$targetID.noClass.net $targetID $queryID $queryDir/$queryID.$targetID.net" >> $netCmdDir/b.netClass.sh
echo "qsub -o $netCmdDir -e $netCmdDir -j oe -N 'b.netClass' $netCmdDir/b.netClass.sh"
# maf
echo '#!/bin/bash' > $netCmdDir/c.maf.sh
echo "netToAxt $queryDir/$queryID.$targetID.net $queryDir/$queryID.$targetID.pre.chain $targetDir/$targetID.2bit $queryDir/$queryID.2bit stdout | axtSort stdin $queryDir/$queryID.$targetID.axt" >> $netCmdDir/c.maf.sh
echo "axtToMaf $queryDir/$queryID.$targetID.axt $targetDir/$targetID.chrom.sizes $queryDir/$queryID.chrom.sizes $queryDir/$queryID.$targetID.maf -tPrefix=$targetID. -qPrefix=$queryID." >> $netCmdDir/c.maf.sh
# qsub -o $netCmdDir -N "c.maf" bash $netCmdDir/c.maf.sh
#--------------------------------------------------
done
done