#!/usr/bin/perl # convert talos prediction file (pred.tab) into phi and psi torsion restraints # for cns/xplor. The range of phi/psi angles are +/- the talos error OR # the inputed error, whichever is larger. print "input talos prediction file: "; $fname = ; print "minimum +/- error (30): "; $minerr = ; print "output cns/xplor restraint file: "; $outf = ; open(INFILE, $fname); open(OUT,">$outf"); $fac = 2.0; while () { chop; ($res,$aa,$phi,$psi,$phier,$psier,$dum,$dum,$ok) = split; if ($ok eq "Good") { $phier = $phier * $fac; $psier = $psier * $fac; $err = $minerr; if ($phier > $minerr) { $err = $phier; } printf OUT "! %s %-3i Phi Psi\n",$aa,$res; printf OUT "assign (resid %i and name C ) (resid %i and name N)\n", $res-1,$res; printf OUT " (resid %i and name CA) (resid %i and name C) 1.0 %7.2f %7.2f 2\n", $res,$res,$phi,$err; $err = $minerr; if ($psier > $minerr) { $err = $psier; } printf OUT "assign (resid %i and name N) (resid %i and name CA)\n", $res,$res; printf OUT " (resid %i and name C) (resid %i and name N) 1.0 %7.2f %7.2f 2\n", $res,$res+1,$psi,$err; } }