@@ -35,7 +35,7 @@ public class TestContactCalc {
3535 @ Test
3636 public void testIntraChainContacts () throws StructureException , IOException {
3737
38- String [][] cts = {null , {"CA " } , {"CB" }};
38+ String [][] cts = {null , {" CA " } , {"CB" }};
3939 double [] cutoffs = { 5.0 , 8.0 , 8.0 };
4040
4141 int [] allCMsizes = new int [INTRACHAIN_TESTSET .length ];
@@ -77,7 +77,7 @@ public void testIntraChainContacts() throws StructureException, IOException {
7777 contacts .size ()<allCMsizes [idx ]);
7878
7979 // since the CB contact map will have no contacts for GLYs then the maps should be smaller than the CA
80- if (cts [i ]!=null && cts [i ][0 ].equals ("CA " ))
80+ if (cts [i ]!=null && cts [i ][0 ].equals (" CA " ))
8181 assertTrue ("size for CA contact map (" +contacts .size ()+") should be larger than for CB contact map (" +cbCMsizes [idx ]+")" ,
8282 contacts .size ()>cbCMsizes [idx ]);
8383 }
@@ -121,37 +121,59 @@ public void testInterChainContacts3HBX() throws StructureException, IOException
121121
122122 @ Test
123123 public void testIntraChainContactsVsDistMatrix1SMT () throws IOException , StructureException {
124-
125- double cutoff = 8 ;
124+
125+ double cutoff = 5 ;
126126
127127 Structure structure = StructureIO .getStructure ("1smt" );
128128
129129 Chain chain = structure .getChainByPDB ("A" );
130- String [] atomNames = {"CA" };
131130
132- checkContactsVsDistMatrix (chain , atomNames , cutoff );
131+ System .out .println ("Intra-chain contacts calculation vs distance matrix for 1smtA" );
132+
133+ checkContactsVsDistMatrix (chain , cutoff );
133134 }
134135
135136 @ Test
136137 public void testIntraChainContactsVsDistMatrix2TRX () throws IOException , StructureException {
137138
138- double cutoff = 8 ;
139+ double cutoff = 5 ;
139140
140141 Structure structure = StructureIO .getStructure ("2trx" );
141142
142143 Chain chain = structure .getChainByPDB ("A" );
143- String [] atomNames = {"CA" };
144144
145- checkContactsVsDistMatrix (chain , atomNames , cutoff );
145+ System .out .println ("Intra-chain contacts calculation vs distance matrix for 2trxA" );
146+
147+ checkContactsVsDistMatrix (chain , cutoff );
146148 }
147149
150+ @ Test
151+ public void testIntraChainContactsVsDistMatrix1SU4 () throws IOException , StructureException {
152+
153+ double cutoff = 5 ;
154+
155+ Structure structure = StructureIO .getStructure ("1su4" );
156+
157+ Chain chain = structure .getChainByPDB ("A" );
158+
159+ System .out .println ("Intra-chain contacts calculation vs distance matrix for 1su4A" );
160+
161+ checkContactsVsDistMatrix (chain , cutoff );
162+ }
148163
149- private void checkContactsVsDistMatrix (Chain chain , String [] atomNames , double cutoff ) {
150- AtomContactSet atomContacts = StructureTools .getAtomsInContact (chain , atomNames , cutoff );
164+ private void checkContactsVsDistMatrix (Chain chain , double cutoff ) {
165+ long start = System .currentTimeMillis ();
166+ AtomContactSet atomContacts = StructureTools .getAtomsInContact (chain , cutoff );
167+ long end = System .currentTimeMillis ();
168+ System .out .printf ("Calculated contacts in %.3f s\n " ,((end -start )/1000.0 ));
151169
152- Atom [] atoms = StructureTools .getAtomArray (chain , atomNames );
170+ start = System .currentTimeMillis ();
171+ Atom [] atoms = StructureTools .getAllNonHAtomArray (chain ,false );
172+ double [][] distMatrix = calcDistanceMatrix (atoms );
173+ end = System .currentTimeMillis ();
174+ System .out .printf ("Calculated distance matrix in %.3f s\n " ,((end -start )/1000.0 ));
153175
154- double [][] distMatrix = calcDistanceMatrix ( atoms );
176+ System . out . println ( "(number of atoms: " + atoms . length + ")" );
155177
156178 for (int i =0 ;i <atoms .length ;i ++) {
157179 for (int j =i +1 ;j <atoms .length ;j ++) {
@@ -172,20 +194,28 @@ private void checkContactsVsDistMatrix(Chain chain, String[] atomNames, double c
172194 @ Test
173195 public void testInterChainContactsVsDistMatrix2TRX () throws IOException , StructureException {
174196
175- double cutoff = 8 ;
197+ double cutoff = 5 ;
176198
177199 Structure structure = StructureIO .getStructure ("2trx" );
178200
201+ System .out .println ("Inter-chain contacts calculation vs distance matrix for 2trx A-B" );
202+
179203 Chain chain1 = structure .getChainByPDB ("A" );
180204 Chain chain2 = structure .getChainByPDB ("B" );
181- String [] atomNames = {"CA" };
182-
183- AtomContactSet atomContacts = StructureTools .getAtomsInContact (chain1 , chain2 , atomNames , cutoff );
184205
185- Atom [] atoms1 = StructureTools .getAtomArray (chain1 , atomNames );
186- Atom [] atoms2 = StructureTools .getAtomArray (chain2 , atomNames );
206+ long start = System .currentTimeMillis ();
207+ AtomContactSet atomContacts = StructureTools .getAtomsInContact (chain1 , chain2 , cutoff );
208+ long end = System .currentTimeMillis ();
209+ System .out .printf ("Calculated contacts in %.3f s\n " ,((end -start )/1000.0 ));
187210
211+ start = System .currentTimeMillis ();
212+ Atom [] atoms1 = StructureTools .getAllNonHAtomArray (chain1 ,false );
213+ Atom [] atoms2 = StructureTools .getAllNonHAtomArray (chain2 ,false );
188214 double [][] distMatrix = calcDistanceMatrix (atoms1 , atoms2 );
215+ end = System .currentTimeMillis ();
216+ System .out .printf ("Calculated distance matrix in %.3f s\n " ,((end -start )/1000.0 ));
217+
218+ System .out .println ("(number of atoms: " +atoms1 .length +", " +atoms2 .length +")" );
189219
190220 for (int i =0 ;i <atoms1 .length ;i ++) {
191221 for (int j =0 ;j <atoms2 .length ;j ++) {
0 commit comments