forked from Schlicklab/RAG-IF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforForna_NuPACK.sh
executable file
·91 lines (48 loc) · 2.01 KB
/
forForna_NuPACK.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
86
87
88
89
90
91
#!/bin/bash
# This script is made to create inputs for "forna"
##
#cp Top1.bpseq.bak Top1.bpseq
##
filename=`basename ${1} .bpseq`
#echo $filename
cp ${filename}.bpseq ${filename}.bpseq.bak
#sed -i '1s/^/#This is comment line\n/' $1
ex -sc '1i|#This is comment line' -cx $1
# insert a first line
#module load python/2
rm -rf ${filename}.dotbracket
rm -rf ${filename}.fa
rm -rf ${filename}.in
#python /Users/yt34/NYU_Drive_Google/Work/RNA-projects/myOwnScripts/bp2dotfa/bpseq2dotfa.py $1
python /Users/sj78/Documents/labwork/MutationsForDesign/RAG-IF_Code/bpseq2dotfa.py $1
#~/nupack/bin/mfe -material rna
tail -n +2 ${filename}.fa > ${filename}.in
/opt/nupack3.2.2/bin/mfe -material rna ${filename}
# output file is ${filename}.mfe
cp ${filename}.fa ${filename}.nupack.fa
#sed -i "1 s|$|-nupack|" ${filename}.nupack.fa
#
sed ' 1 s/.*/&-nupack/' ${filename}.nupack.fa > tmp1
mv tmp1 ${filename}.nupack.fa
answer1=`grep -q "\.\." ${filename}.mfe ; echo $?`
answer2=`grep -q "((" ${filename}.mfe ; echo $?`
answer3=`grep -q "))" ${filename}.mfe ; echo $?`
if [ $answer1 = 0 ]; then
grep "\.\." ${filename}.mfe > ${filename}.nupack.dotbracket
fi
if [ $answer2 = 0 ]; then
grep "((" ${filename}.mfe > ${filename}.nupack.dotbracket
fi
if [ $answer3 = 0 ]; then
grep "))" ${filename}.mfe > ${filename}.nupack.dotbracket
fi
# convert Fasta + Dot-Bracket to bpseq for nupack
#python /Users/yt34/NYU_Drive_Google/Work/RNA-projects/myOwnScripts/dotfa2bp/dotfa2bpseq.py ${filename}.nupack.fa ${filename}.nupack.dotbracket
python /Users/sj78/Documents/labwork/MutationsForDesign/RAG-IF_Code/dotfa2bpseq.py ${filename}.nupack.fa ${filename}.nupack.dotbracket
# generate input for Forna
cat ${filename}.nupack.fa ${filename}.nupack.dotbracket ${filename}.fa ${filename}.dotbracket > ${filename}.forna
# generate
# Clean-up
rm -rf ${filename}.in ${filename}.fa ${filename}.dotbracket ${filename}.nupack.fa ${filename}.nupack.dotbracket ${filename}.mfe
#
mv ${filename}.bpseq.bak ${filename}.bpseq