1 |
duarte |
441 |
import java.io.BufferedReader; |
2 |
|
|
import java.io.File; |
3 |
|
|
import java.io.FileReader; |
4 |
|
|
import java.io.IOException; |
5 |
|
|
import java.sql.SQLException; |
6 |
|
|
|
7 |
duarte |
451 |
import actionTools.GetterError; |
8 |
|
|
|
9 |
duarte |
441 |
import proteinstructure.CiffilePdb; |
10 |
|
|
//import proteinstructure.MsdsdPdb; |
11 |
|
|
import proteinstructure.Pdb; |
12 |
|
|
import proteinstructure.PdbCodeNotFoundError; |
13 |
|
|
import proteinstructure.PdbLoadError; |
14 |
|
|
import proteinstructure.PdbasePdb; |
15 |
|
|
import proteinstructure.PdbfilePdb; |
16 |
|
|
import tools.MySQLConnection; |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
public class testGetChains { |
20 |
|
|
|
21 |
duarte |
451 |
public static void main(String[] args) throws IOException, SQLException, GetterError{ |
22 |
duarte |
441 |
|
23 |
|
|
String pdbFilesDir = "/project/StruPPi/BiO/DBd/PDB-REMEDIATED/data/structures/unzipped/all/pdb"; |
24 |
|
|
String cifFilesDir = "/project/StruPPi/BiO/DBd/PDB-REMEDIATED/data/structures/unzipped/all/mmCIF"; |
25 |
|
|
MySQLConnection conn = new MySQLConnection("white","duarte","nieve"); |
26 |
|
|
|
27 |
|
|
//String[] pdbCodes = {"12as", "3eca", "1bxy"} ; |
28 |
|
|
|
29 |
|
|
String listFile = "/project/StruPPi/jose/workspace/aglappe-jung/pdbcodes.testset"; |
30 |
|
|
BufferedReader fpdb = new BufferedReader(new FileReader(listFile)); |
31 |
|
|
String line; |
32 |
|
|
while ((line=fpdb.readLine())!=null) { |
33 |
|
|
String pdbCode = line.split("\t")[0].toLowerCase(); |
34 |
|
|
|
35 |
|
|
System.out.println("pdb "+pdbCode); |
36 |
|
|
|
37 |
|
|
try { |
38 |
|
|
Pdb pdbasepdb = new PdbasePdb(pdbCode, "pdbase", conn); |
39 |
|
|
String[] pdbasechains = pdbasepdb.getChains(); |
40 |
|
|
Integer[] pdbasemodels = pdbasepdb.getModels(); |
41 |
|
|
pdbasepdb.load(pdbasechains[0]); |
42 |
|
|
|
43 |
|
|
|
44 |
|
|
// Pdb msdsdpdb = new MsdsdPdb(pdbCode,"msdsd_00_07_a",conn); |
45 |
|
|
// String[] msdsdchains = msdsdpdb.getChains(); |
46 |
|
|
// Integer[] msdsdmodels = msdsdpdb.getModels(); |
47 |
|
|
// msdsdpdb.load(msdsdchains[0]); |
48 |
|
|
|
49 |
|
|
Pdb ciffilepdb = new CiffilePdb(new File(cifFilesDir,pdbCode+".cif")); |
50 |
|
|
String[] ciffilechains = ciffilepdb.getChains(); |
51 |
|
|
Integer[] ciffilemodels = ciffilepdb.getModels(); |
52 |
|
|
ciffilepdb.load(ciffilechains[0]); |
53 |
|
|
|
54 |
|
|
|
55 |
|
|
Pdb pdbfilepdb = new PdbfilePdb(pdbFilesDir+"/pdb"+pdbCode+".ent"); |
56 |
|
|
String[] pdbfilechains = pdbfilepdb.getChains(); |
57 |
|
|
Integer[] pdbfilemodels = pdbfilepdb.getModels(); |
58 |
|
|
pdbfilepdb.load(pdbfilechains[0]); |
59 |
|
|
|
60 |
|
|
|
61 |
|
|
// System.out.println("online cif file..."); |
62 |
|
|
// pdb = new CiffilePdb(pdbCode); |
63 |
|
|
// allChains = pdb.getChains(); |
64 |
|
|
// System.out.print("pdb: "+pdbCode+", chains: "); |
65 |
|
|
// for (String chain:allChains) { |
66 |
|
|
// System.out.print(chain+ " "); |
67 |
|
|
// } |
68 |
|
|
// System.out.println(); |
69 |
|
|
// pdb.load("A"); |
70 |
|
|
// System.out.println("length:" + pdb.getFullLength()); |
71 |
|
|
|
72 |
|
|
boolean chainsmatch = true; |
73 |
|
|
boolean modelsmatch = true; |
74 |
|
|
if (pdbasechains.length != ciffilechains.length || pdbasechains.length!= pdbfilechains.length ) { //|| pdbasechains.length!=msdsdchains.length) { |
75 |
|
|
System.out.println("different number of chains"); |
76 |
|
|
chainsmatch=false; |
77 |
|
|
} |
78 |
|
|
else { |
79 |
|
|
for (int i=0; i<pdbasechains.length;i++) { |
80 |
|
|
if (!pdbasechains[i].equals(ciffilechains[i]) || !pdbasechains[i].equals(pdbfilechains[i]) ){ // || !pdbasechains[i].equals(msdsdchains[i])){ |
81 |
|
|
System.out.println("chain differs: pdbase "+pdbasechains[i]+", ciffile "+ciffilechains[i]+", pdbfile "+pdbfilechains[i]);//+", msdsd "+msdsdchains[i]); |
82 |
|
|
chainsmatch=false; |
83 |
|
|
} |
84 |
|
|
} |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
if (chainsmatch) { |
88 |
|
|
for (String chain:pdbfilechains) { |
89 |
|
|
System.out.print(chain+ " "); |
90 |
|
|
} |
91 |
|
|
System.out.println(); |
92 |
|
|
|
93 |
|
|
if (pdbasepdb.getFullLength()!=ciffilepdb.getFullLength() || pdbasepdb.getFullLength()!=pdbfilepdb.getFullLength()){ // || pdbasepdb.getFullLength()!=msdsdpdb.getFullLength()) { |
94 |
|
|
System.out.println("length for chain "+pdbfilechains[0]+" differs"); |
95 |
|
|
} |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
if (pdbasemodels.length != ciffilemodels.length || pdbasemodels.length != pdbfilemodels.length ) {//|| pdbasemodels.length != msdsdmodels.length) { |
99 |
|
|
System.out.println("different number of models"); |
100 |
|
|
modelsmatch = false; |
101 |
|
|
} else { |
102 |
|
|
for (int i=0;i<pdbasemodels.length;i++){ |
103 |
|
|
if (pdbasemodels[i]!=ciffilemodels[i] || pdbasemodels[i]!=pdbfilemodels[i] ){ //|| pdbasemodels[i]!=msdsdmodels[i]){ |
104 |
|
|
System.out.println("model differs: pdbase "+pdbasemodels[i]+", ciffile "+ciffilemodels[i]+", pdbfile "+pdbfilemodels[i]);//+", msdsd "+msdsdmodels[i]); |
105 |
|
|
modelsmatch = false; |
106 |
|
|
} |
107 |
|
|
} |
108 |
|
|
} |
109 |
|
|
if (modelsmatch) { |
110 |
|
|
for (int model:pdbasemodels) { |
111 |
|
|
System.out.print(model+" "); |
112 |
|
|
} |
113 |
|
|
System.out.println(); |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
|
117 |
|
|
} catch (PdbCodeNotFoundError e) { |
118 |
|
|
System.err.println("pdb code was not found in pdbase"); |
119 |
|
|
} catch (PdbLoadError e) { |
120 |
|
|
System.err.println("couldn't load pdb data, specific error: "+e.getMessage()); |
121 |
|
|
} |
122 |
|
|
} |
123 |
|
|
fpdb.close(); |
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
} |
131 |
|
|
|
132 |
|
|
} |