-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathhomology_annot.sh
executable file
·68 lines (54 loc) · 1.72 KB
/
homology_annot.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
#!/bin/sh -l
SCRIPTS=$3
if [ ! -e $SCRIPTS/configs.cf ]
then
echo "$SCRIPTS/configs.cf not exist"
exit 1
fi
. $SCRIPTS/configs.cf
CHR_SEQ_DIR=$REF_DIR/$REF_NAME.seq
if [ ! -d "$REF_DIR" ]
then
echo "$REF_DIR not defined or in wrong path in ../configs.cf"
exit 1
fi
if [ -z "$REF_NAME" ]
then
echo "REF_NAME not assigned in ../configs.cf"
exit 1
fi
cur_dir=$1
seq_name=$2
annot_dir=$cur_dir/annot
mkdir -p $CHR_SEQ_DIR
mkdir -p $annot_dir
if [ ! -e $REF_DIR/$REF_NAME.size ]
then
if [ ! -e $REF_FASTA ]
then
echo "error: $REF_FASTA not exist or moved to other location"
fi
$axtChainNet/faSize $REF_FASTA -detailed > $REF_DIR/$REF_NAME.size
fi
mkdir -p $REF_DIR/chr_seq
for chr_name in `less "$REF_DIR/$REF_NAME.size" | awk '{print $1}'`
do
$BIN/pull_fasta_scaf $REF_FASTA $chr_name > $REF_DIR/chr_seq/$chr_name.fa
$axtChainNet/faSize $REF_DIR/chr_seq/$chr_name.fa -detailed > $REF_DIR/chr_seq/$chr_name.size
done
if [ ! -e "$cur_dir"/"$seq_name".scf.fasta ]
then
echo "$cur_dir/$seq_name.scf.fasta moved or not exist"
exit 1
fi
ln -s $cur_dir/$seq_name.scf.fasta $annot_dir/$seq_name.fasta
$SCRIPTS/ChainNet.sh $axtChainNet $seq_name $annot_dir $REF_DIR/chr_seq $REF_NAME $annot_dir/$seq_name.fasta $BIN #three result directories lav, chain, and net in $annot_dir/$REF_NAME.chain.net
$SCRIPTS/intervals.sh $seq_name $annot_dir $REF_DIR $REF_NAME $annot_dir/$REF_NAME.chain.net $BIN #$REF_DIR/intervals are created
rm -rf $annot_dir/$seq_name.codex
while read line
do
chr_name=`echo $line | awk '{print $1}'`
rm -rf $annot_dir/codex/$chr_name.codex
$SCRIPTS/infer-scaf-annot.sh $annot_dir $REF_DIR $REF_NAME $chr_name $BIN $SCRIPTS
cat $annot_dir/codex/$chr_name.codex >> $annot_dir/$seq_name.codex
done < $REF_DIR/$REF_NAME.size