• Keine Ergebnisse gefunden

#! /usr/bin/awk -f BEGIN{

Output="mars.log"

NULL=""

checkTime=1

# Check starting time.

if(checkTime){

Day1 = strftime("%d") Hour1 = strftime("%H") Min1 = strftime("%M") Sec1 = strftime("%S")

print strftime("%a %b %d %H:%M:%S %Z %Y") > "mars.log"

}

printf "\n" > "mars.log"

close("mars.log")

# Initialization Sol_num=50 reli_diff_num=0

}close(ARGV[1])

printf "---\n" >> "mars.log"

printf "\n" >> "mars.log"

close("mars.log")

OK_num=0 reli_numP=0

# Remove CheckpointMars before running MARS com=sprintf("(rm -f CheckpointMars)") print | com

close(com)

# Clear a screen

com=sprintf("(clear)") print | com

close(com)

# Run runmars_noIter

com=sprintf("($MARSHOME/runmars_noIter %s %s %s 1)",ARGV[1],ARGV[2],ARGV[3]) print | com

close(com) OK_num++

# Check whether runmars_noIter has been finished successfully or not.

if(getline < "CheckpointMars" <=0){

exit

}close("CheckpointMars")

# Run making_stati.awk.

com=sprintf("(awk -f $MARSHOME/making_stati.awk >> mars.log)") print | com

close(com)

printf "\n" >> "mars.log"

close("mars.log")

# AC is the number of AA.

# RC is the number of correct reliable assignment.

# RW is the number of wrong reliable assignment.

printf "\n AC RC RW\n" >> "mars.log"

printf "---\n" >> "mars.log"

close("mars.log")

# Write the assignment results in mars.log file.

com=sprintf("($MARSHOME/result.awk)") print | com

close(com)

printf "---\n" >> "mars.log"

close("mars.log")

# Make mars_C_format.inp to run mars

while(getline < "mars_C_format.inp" >0) if ($1=="DipCoup:"){

st=$2

}close("mars_C_format.inp")

### Run mars with adding 1.0 noisy to the CSs.

OK_run=1

while(OK_run==1 && OK_num<=Sol_num){

# Copy ana_reliable_assignment.txt to ana_reliable_assignment.txt_prev.

# It is to use to compare previous and current the number of reliable assignments.

com=sprintf("(cp ana_reliable_assignment.txt ana_reliable_assignment.txt_prev)") print | com

close(com)

# Make fixed connectivity table for mars

com=sprintf("(awk -v tablename=%s -f $MARSHOME/making_fixConn.awk)",fix_conn) print | com

close(com)

# Check the number of fixed connectivities in the fixed_conn_by_Mars.tab.

Is_fixed_conn=0

while(getline < "fixed_conn_by_Mars.tab" >0){

Is_fixed_conn++

}close("fixed_conn_by_Mars.tab")

B.1 runmars 135

# Make fixed assignment table for mars

com=sprintf("(awk -f $MARSHOME/making_fixAssi.awk %s)",ARGV[1]) print | com

close(com)

# Check the number of fixed assignments in the fixed_assi_by_Mars.tab.

Is_fixed_assi=0

while(getline < "fixed_assi_by_Mars.tab" >0){

Is_fixed_assi++

}close("fixed_assi_by_Mars.tab")

# Make mars_C_format_i.inp.

# The mars_C_format_i.inp has information of size of noise,

# the number of fixed assignments and connectivities.

printf "" > "mars_C_format_i.inp"

while(getline < "mars_C_format.inp" >0){

if($5!="shift:" && $2!="connectivity:" && $2!="assignment:") print >> "mars_C_format_i.inp"

if($5=="shift:")

printf "Diviations for disturbing chemical shift: %10.3f\n",1.0 >> "mars_C_format_i.inp"

if($2=="connectivity:" && Is_fixed_conn>0)

printf "Fix connectivity: fixed_conn_by_Mars.tab\n" >> "mars_C_format_i.inp"

if($2=="connectivity:" && Is_fixed_conn==0)

printf "Fix connectivity: NO\n" >> "mars_C_format_i.inp"

if($2=="assignment:" && Is_fixed_assi>0)

printf "Fix assignment: fixed_assi_by_Mars.tab\n" >> "mars_C_format_i.inp"

if($2=="assignment:" && Is_fixed_assi==0)

printf "Fix assignment: NO\n" >> "mars_C_format_i.inp"

}close("mars_C_format.inp") close("mars_C_format_i.inp") com=sprintf("(clear)") print | com

close(com)

# If a structure and RDCs are available, then do it.

if (st==1){

com=sprintf("($MARSHOME/mars mars_C_format_i.inp anneal st %d)",OK_num+1) print | com

close(com) OK_num++

}

# If a structure and RDCs are not available, then do it.

if (st==0){

com=sprintf("($MARSHOME/mars mars_C_format_i.inp anneal nost %d)",OK_num+1) print | com

# Check the number of current reliable assignment.

reli_num=0

while(getline < "ana_reliable_assignment.txt" >0) reli_num++

close("ana_reliable_assignment.txt")

# Compare the number of previous and current reliable assignments.

# If the number of current reliable assignments hasn’t been increased,

# then escape the loop, otherwise go to the beginning of the loop.

if(reli_num - reli_numP <= reli_diff_num) OK_run=0

### Run mars with adding 0.5 noisy to the CSs.

OK_run=1

while(OK_run==1 && OK_num<=Sol_num){

# Copy ana_reliable_assignment.txt to ana_reliable_assignment.txt_prev.

# It is to use to compare previous and current the number of reliable assignments.

com=sprintf("(cp ana_reliable_assignment.txt ana_reliable_assignment.txt_prev)") print | com

close(com)

# Make fixed connectivity table for mars

com=sprintf("(awk -v tablename=%s -f $MARSHOME/making_fixConn.awk)",fix_conn) print | com

close(com)

# Check the number of fixed connectivities in the fixed_conn_by_Mars.tab.

Is_fixed_conn=0

while(getline < "fixed_conn_by_Mars.tab" >0){

Is_fixed_conn++

}close("fixed_conn_by_Mars.tab")

# Make fixed assignment table for mars

com=sprintf("(awk -f $MARSHOME/making_fixAssi.awk %s)",ARGV[1]) print | com

close(com)

# Check the number of fixed assignments in the fixed_assi_by_Mars.tab.

Is_fixed_assi=0

while(getline < "fixed_assi_by_Mars.tab" >0){

Is_fixed_assi++

}close("fixed_assi_by_Mars.tab")

# Make mars_C_format_i.inp.

# The mars_C_format_i.inp has information of size of noise,

# the number of fixed assignments and connectivities.

printf "" > "mars_C_format_i.inp"

while(getline < "mars_C_format.inp" >0){

if($5!="shift:" && $2!="connectivity:" && $2!="assignment:") print >> "mars_C_format_i.inp"

if($5=="shift:")

printf "Diviations for disturbing chemical shift: %10.3f\n",0.5 >> "mars_C_format_i.inp"

if($2=="connectivity:" && Is_fixed_conn>0)

printf "Fix connectivity: fixed_conn_by_Mars.tab\n" >> "mars_C_format_i.inp"

if($2=="connectivity:" && Is_fixed_conn==0)

printf "Fix connectivity: NO\n" >> "mars_C_format_i.inp"

if($2=="assignment:" && Is_fixed_assi>0)

printf "Fix assignment: fixed_assi_by_Mars.tab\n" >> "mars_C_format_i.inp"

if($2=="assignment:" && Is_fixed_assi==0)

printf "Fix assignment: NO\n" >> "mars_C_format_i.inp"

B.1 runmars 137

# If a structure and RDCs are available, then do it.

if (st==1){

com=sprintf("($MARSHOME/mars mars_C_format_i.inp anneal st %d)",OK_num+1) print | com

close(com) OK_num++

}

# If a structure and RDCs are not available, then do it.

if (st==0){

com=sprintf("($MARSHOME/mars mars_C_format_i.inp anneal nost %d)",OK_num+1) print | com

# Check the number of current reliable assignment.

reli_num=0

while(getline < "ana_reliable_assignment.txt" >0) reli_num++

close("ana_reliable_assignment.txt")

# Compare the number of previous and current reliable assignments.

# If the number of current reliable assignments hasn’t been increased,

# then escape the loop, otherwise go to the beginning of the loop.

if(reli_num - reli_numP <= reli_diff_num){

OK_run=0

Min2 = strftime("%M")

# Make sparky format files

com=sprintf("(awk -f $MARSHOME/making_sparkyAll.awk > sparky_all.out)") print | com

close(com)

close("sparky_all.out")

# Make sparky format files

com=sprintf("(awk -f $MARSHOME/making_sparky.awk)") print | com

close(com)

# Remove all dummy files.

if(all_output==NULL){

com=sprintf("(rm -f assignment.log mars_C_format_grid_cs.inp mars_C_format.inp mars_C_format_i.inp mars_C_format_cs_temp.inp mars_C_format_cs.inp)")

com=sprintf("(rm -f fixed_assi_by_Mars.tab fixed_type_by_Mars.tab fixed_conn_by_Mars.tab mars_PR_ID.tab CheckpointMars PeaksProTuermchen fixed_conn_marsFormat.tab)")

print | com close(com) }

printf "MARS has been successfully finished !!\n\n" > "/dev/stderr"

}