1 |
duarte |
957 |
import java.io.File; |
2 |
|
|
|
3 |
|
|
import proteinstructure.Pdb; |
4 |
|
|
import proteinstructure.PdbfilePdb; |
5 |
|
|
import proteinstructure.Residue; |
6 |
|
|
|
7 |
|
|
/** |
8 |
|
|
* Executable class to check the chirality of amino acids of a given PDB file |
9 |
|
|
* @author duarte |
10 |
|
|
* |
11 |
|
|
*/ |
12 |
|
|
public class checkChirality { |
13 |
|
|
|
14 |
|
|
public static void main(String[] args) throws Exception { |
15 |
|
|
if (args.length==0) { |
16 |
|
|
System.err.println("Usage: checkChirality <pdb_file_name>"); |
17 |
|
|
System.exit(1); |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
File file = new File(args[0]); |
21 |
|
|
Pdb pdb = new PdbfilePdb(file.getAbsolutePath()); |
22 |
|
|
String[] chains = pdb.getChains(); |
23 |
|
|
|
24 |
|
|
for (String chain:chains) { |
25 |
|
|
System.out.println("Chain "+chain+". D-form residues:"); |
26 |
|
|
pdb.load(chain); |
27 |
|
|
int dcount=0; |
28 |
|
|
int lcount=0; |
29 |
|
|
int ucount=0; |
30 |
|
|
for (int resser:pdb.getAllSortedResSerials()) { |
31 |
|
|
Residue res = pdb.getResidue(resser); |
32 |
|
|
Residue.Chirality chir = res.getChirality(); |
33 |
|
|
if (chir == Residue.Chirality.D) { |
34 |
|
|
//System.out.println(res+" "+chir.getAbbrev()); |
35 |
|
|
dcount++; |
36 |
|
|
} else if (chir == Residue.Chirality.L) { |
37 |
|
|
lcount++; |
38 |
|
|
} else if (chir == Residue.Chirality.U) { |
39 |
|
|
ucount++; |
40 |
|
|
} |
41 |
|
|
} |
42 |
|
|
System.out.println("L-form: "+lcount+" D-form: "+dcount+" Undetermined: "+ucount); |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
} |