Hi all,
I need to do a translation using 2D arrays for my Superposition algorithm.
Translation:
I plan to use the CA as my invariant point which is usually the 2nd line in the pdb.txt file. So how go about doing that? Must I use an orthogonal matrix? Or can I just subtract the coordinates of file1 from file 2 for X, Y & Z to get the rest of the ATOMS to move by that difference? You help is greatly appreciated! :) This program is in JAVA.
while ((text1 = br1.readLine()) != null) { //Read File Line By Line
if(text1.trim().startsWith("ATOM")) {
StringTokenizer s1 = new StringTokenizer(text1," ");
int counter1=0;
String line1="";
while(s1.hasMoreTokens()) {
String ss1 = s1.nextToken();
counter1++;
if(counter1 == 3){
line1 += ss1;
arrayM1[i] = ss1;
}
}
coordinates1[i][0]= Double.parseDouble(text1.substring(30,38));//X
coordinates1[i][1]= Double.parseDouble(text1.substring(38,46));//Y
coordinates1[i][2]= Double.parseDouble(text1.substring(46,56));//Z
i+=1;
}//end of if
} //end of while.
1 answer
I suggest using an existing PDB parser. The PDB format is quite complex, and doing one from scratch takes a considerable amount of effort. Just parsing ATOM lines will generally not do in the general case, though it might for your case. Existing PDB parser for Java include the one in Jmol and, of course, the one in BioJava.
Log in to answer this question.