Difference between revisions of "Automated Evaluation of Homoloy Models"
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | The call of TMS is wrong which slighty changes the values or did you do that on purpose? (Benny) |
||
− | =Source code for Eval.java= |
||
+ | You call<br> |
||
− | Do not rely on the calculation of the ALL RMSD of the Fe-Binding-Site. |
||
+ | <code>TMS <NATIVE> <MODEL></code> |
||
+ | |||
+ | but the help states <br> |
||
+ | <code>TMS <MODEL> <NATIVE></code> |
||
+ | |||
+ | |||
+ | =Source code for Eval.java= |
||
<code> |
<code> |
||
Line 48: | Line 55: | ||
System.out.println("TM: "+Eval.calcTM(reference, model));<br> |
System.out.println("TM: "+Eval.calcTM(reference, model));<br> |
||
System.out.println("ALL RMSD: "+Eval.calcFeRMSD(reference, model));<br> |
System.out.println("ALL RMSD: "+Eval.calcFeRMSD(reference, model));<br> |
||
+ | System.out.println();<br> |
||
}<br> |
}<br> |
||
}<br> |
}<br> |
||
Line 75: | Line 83: | ||
} <br> |
} <br> |
||
catch (IOException e) <br> |
catch (IOException e) <br> |
||
− | {<br> |
||
− | e.printStackTrace();<br> |
||
− | }<br> |
||
− | <br> |
||
− | return res;<br> |
||
− | }<br> |
||
− | <br> |
||
− | public static String calcAllRMSD(File reference, File model)<br> |
||
− | {<br> |
||
− | String res = "";<br> |
||
− | <br> |
||
− | try <br> |
||
− | {<br> |
||
− | Process p = Runtime.getRuntime().exec("rms.pl -out all "+reference.getAbsolutePath()+" "+model.getAbsolutePath());<br> |
||
− | p.waitFor();<br> |
||
− | <br> |
||
− | BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));<br> |
||
− | <br> |
||
− | String line;<br> |
||
− | while((line = in.readLine()) != null)<br> |
||
− | {<br> |
||
− | res = line.replaceAll(" all", "");<br> |
||
− | res = res.replaceAll(" ", "");<br> |
||
− | }<br> |
||
− | <br> |
||
− | in.close();<br> |
||
− | } <br> |
||
− | catch (IOException e) <br> |
||
− | {<br> |
||
− | e.printStackTrace();<br> |
||
− | } <br> |
||
− | catch (InterruptedException e) <br> |
||
{<br> |
{<br> |
||
e.printStackTrace();<br> |
e.printStackTrace();<br> |
||
Line 143: | Line 119: | ||
try <br> |
try <br> |
||
{<br> |
{<br> |
||
− | File |
+ | File script = Eval.writePythonScript(reference, model);<br> |
− | reftemp.deleteOnExit();<br> |
||
− | File modtemp = File.createTempFile("modtemp", ".pdb");<br> |
||
− | modtemp.deleteOnExit();<br> |
||
− | <br> |
||
− | File script = Eval.writePythonScript(reference, model, reftemp, modtemp);<br> |
||
<br> |
<br> |
||
Process p = Runtime.getRuntime().exec("pymol "+script.getAbsolutePath());<br> |
Process p = Runtime.getRuntime().exec("pymol "+script.getAbsolutePath());<br> |
||
p.waitFor();<br> |
p.waitFor();<br> |
||
<br> |
<br> |
||
+ | BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));<br> |
||
− | res = Eval.calcAllRMSD(reftemp, modtemp);<br> |
||
+ | String line;<br> |
||
+ | <br> |
||
+ | while((line = in.readLine()) != null)<br> |
||
+ | {<br> |
||
+ | if(line.startsWith(" Executive: RMS ="))<br> |
||
+ | {<br> |
||
+ | res = line.substring(line.indexOf("=")+1, line.indexOf("("));<br> |
||
+ | res = res.replaceAll(" ", "");<br> |
||
+ | }<br> |
||
+ | }<br> |
||
}<br> |
}<br> |
||
catch (IOException e) <br> |
catch (IOException e) <br> |
||
Line 167: | Line 148: | ||
}<br> |
}<br> |
||
<br> |
<br> |
||
− | public static File writePythonScript(File reference, File model |
+ | public static File writePythonScript(File reference, File model)<br> |
{<br> |
{<br> |
||
File script = null;<br> |
File script = null;<br> |
||
Line 181: | Line 162: | ||
out.write("select fe, name fe\n");<br> |
out.write("select fe, name fe\n");<br> |
||
out.write("align mod, reference\n");<br> |
out.write("align mod, reference\n");<br> |
||
− | out.write("select near_7, fe around 7\n");<br> |
||
out.write("select ref_near_7, (fe around 7) and reference\n");<br> |
out.write("select ref_near_7, (fe around 7) and reference\n");<br> |
||
− | out.write(" |
+ | out.write("select ref_near_7, byres ref_near_7\n");<br> |
out.write("select mod_near_7, (fe around 7) and mod\n");<br> |
out.write("select mod_near_7, (fe around 7) and mod\n");<br> |
||
− | out.write(" |
+ | out.write("select mod_near_7, byres mod_near_7\n");<br> |
+ | out.write("align mod_near_7, ref_near_7\n");<br> |
||
out.write("quit\n");<br> |
out.write("quit\n");<br> |
||
<br> |
<br> |
||
Line 231: | Line 212: | ||
return ids;<br> |
return ids;<br> |
||
}<br> |
}<br> |
||
+ | } |
||
− | }<br> |
||
</code> |
</code> |
Latest revision as of 18:47, 14 June 2011
The call of TMS is wrong which slighty changes the values or did you do that on purpose? (Benny)
You call
TMS <NATIVE> <MODEL>
but the help states
TMS <MODEL> <NATIVE>
Source code for Eval.java
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Eval
{
public static String USAGE = "java -jar Eval.jar <modelContainer> <modelDir> <refContainer> <refDir>" +
"\n\t <modelContainer> contains in each line one id of the used models (the filename before the .pdb)" +
"\n\t <modelDir> the directory where the model-files lie" +
"\n\t <refContainer> contains in each line one id of the used reference structures (the filename before the .pdb)" +
"\n\t <refDir> the directory where the model-files lie";
public static void main(String[] args)
{
if(args.length != 4)
{
System.out.println(Eval.USAGE);
System.exit(1);
}
File modelContainer = new File(args[0]);
File modelDir = new File(args[1]);
File refContainer = new File(args[2]);
File refDir = new File(args[3]);
ArrayList <String> modelIds = Eval.readContainer(modelContainer);
ArrayList <String> refIds = Eval.readContainer(refContainer);
for(String modelId : modelIds)
{
File model = Eval.getPDB(modelDir, modelId);
for(String refId : refIds)
{
System.out.println(modelId+" vs. " +refId);
File reference = Eval.getPDB(refDir, refId);
System.out.println("RMSD: "+Eval.calcRMSD(reference, model));
System.out.println("TM: "+Eval.calcTM(reference, model));
System.out.println("ALL RMSD: "+Eval.calcFeRMSD(reference, model));
System.out.println();
}
}
}
public static String calcRMSD(File reference, File model)
{
String res = "";
try
{
Process p = Runtime.getRuntime().exec("sap "+reference.getAbsolutePath()+" "+model.getAbsolutePath());
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while((line = in.readLine()) != null)
{
if(line.startsWith("Un-weighted RMSd ="))
{
int off = line.indexOf("over all matched atoms");
if(off != -1)
{
res = line.substring(18, off);
res.replaceAll(" ", "");
}
}
}
}
catch (IOException e)
{
e.printStackTrace();
}
return res;
}
public static String calcTM(File reference, File model)
{
String res = "";
try
{
Process p = Runtime.getRuntime().exec("TMS "+reference.getAbsolutePath()+" "+model.getAbsolutePath());
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while((line = in.readLine()) != null)
{
res = line.substring(5);
}
}
catch (IOException e)
{
e.printStackTrace();
}
return res;
}
public static String calcFeRMSD(File reference, File model)
{
String res = "";
try
{
File script = Eval.writePythonScript(reference, model);
Process p = Runtime.getRuntime().exec("pymol "+script.getAbsolutePath());
p.waitFor();
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while((line = in.readLine()) != null)
{
if(line.startsWith(" Executive: RMS ="))
{
res = line.substring(line.indexOf("=")+1, line.indexOf("("));
res = res.replaceAll(" ", "");
}
}
}
catch (IOException e)
{
e.printStackTrace();
}
catch (InterruptedException e)
{
e.printStackTrace();
}
return res;
}
public static File writePythonScript(File reference, File model)
{
File script = null;
try
{
script = File.createTempFile("fesel", ".pml");
script.deleteOnExit();
BufferedWriter out = new BufferedWriter(new FileWriter(script));
out.write("load "+reference.getAbsolutePath()+", reference\n");
out.write("load "+model.getAbsolutePath()+", mod\n");
out.write("select fe, name fe\n");
out.write("align mod, reference\n");
out.write("select ref_near_7, (fe around 7) and reference\n");
out.write("select ref_near_7, byres ref_near_7\n");
out.write("select mod_near_7, (fe around 7) and mod\n");
out.write("select mod_near_7, byres mod_near_7\n");
out.write("align mod_near_7, ref_near_7\n");
out.write("quit\n");
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
return script;
}
public static File getPDB(File dir, String name)
{
return new File(dir, name+".pdb");
}
public static ArrayList<String> readContainer(File f)
{
ArrayList <String> ids = new ArrayList<String>();
try
{
BufferedReader in = new BufferedReader(new FileReader(f));
String line;
while((line = in.readLine()) != null)
{
ids.add(line);
}
in.close();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
return ids;
}
}