2424import org .biojava .nbio .structure .Group ;
2525import org .biojava .nbio .structure .GroupIterator ;
2626import org .biojava .nbio .structure .Structure ;
27+ import org .biojava .nbio .structure .StructureException ;
2728import org .biojava .nbio .structure .align .util .AtomCache ;
2829import org .biojava .nbio .structure .scop .ScopDatabase ;
2930import org .biojava .nbio .structure .scop .ScopDomain ;
3031import org .biojava .nbio .structure .scop .ScopFactory ;
3132import org .biojava .nbio .structure .scop .ScopInstallation ;
3233import org .junit .Test ;
3334
35+ import java .io .IOException ;
3436import java .util .List ;
3537
3638import static org .junit .Assert .*;
@@ -44,7 +46,7 @@ public class ScopTest {
4446 boolean debug = false ;
4547
4648 @ Test
47- public void testLocalScop (){
49+ public void testLocalScop () throws IOException , StructureException {
4850
4951 if ( debug ){
5052 System .out .println ("local" );
@@ -90,7 +92,7 @@ public void testRemoteScop(){
9092 }
9193
9294
93- private void runSCOPTests (){
95+ private void runSCOPTests () throws IOException , StructureException {
9496
9597 ScopDatabase scop = ScopFactory .getSCOP (ScopFactory .VERSION_1_75 );
9698
@@ -121,49 +123,42 @@ private void runSCOPTests(){
121123 ScopDomain d2 = domains1cdg .get (0 );
122124 assertEquals ("Wrong SCOP Id" , "d1cdga1" , d2 .getScopId ());
123125 AtomCache cache = new AtomCache ();
124- try {
125- Structure s = cache .getStructureForDomain (d2 );
126- /*
126+
127+ Structure s = cache .getStructureForDomain (d2 );
128+ /*
127129 The actual SCOP description is A:496-581.
128130 HET MAL A 688 23
129131 HET MAL A 689 23
130132 HET MAL A 690 23
131133 HET CA A 691 1
132134 HET CA A 692 1
133135 Thus, the two hetero-atoms are out of range.
134- */
135- // t
136- //checkRange(s,"A:496-581");
137- // now with ligands!
138- checkRange (s ,"A:496-692" );
136+ */
137+ // t
138+ //checkRange(s,"A:496-581");
139+ // now with ligands!
140+ checkRange (s ,"A:496-692" );
141+
139142
140143
141144
142- } catch (Exception e ){
143- e .printStackTrace ();
144- fail (e .getMessage ());
145- }
146145
147146
148147 // check a domain with multiple ranges
149148 List <ScopDomain > domains1xzp = scop .getDomainsForPDB ("1xzp" );
150149 assertTrue (domains1xzp .size () ==4 );
151150
152151
153- try {
152+
154153
154+ s = cache .getStructureForDomain (domains1xzp .get (0 ));
155155
156- Structure s = cache . getStructureForDomain ( domains1xzp . get ( 0 ) );
156+ Chain a = s . getPolyChainByPDB ( "A" );
157157
158- Chain a = s .getChainByPDB ("A" );
158+ // since biojava 5.0, there's no ligands in the polymer chains: thus we substract 3 SO4 molecules present in chain A
159+ assertEquals (176 -3 ,a .getAtomGroups ().size ());
159160
160- // now with ligands...
161- assertEquals (176 ,a .getAtomGroups ().size ());
162-
163- }catch (Exception e ){
164- e .printStackTrace ();
165- fail (e .getMessage ());
166- }
161+
167162
168163 // check insertion codes
169164
@@ -172,17 +167,13 @@ private void runSCOPTests(){
172167 ScopDomain target = scop .getDomainByScopID ("d2bq6a1" );
173168
174169 assertNotNull (target );
175- try {
176- Structure s = cache .getStructureForDomain (target );
170+
171+ s = cache .getStructureForDomain (target );
177172
178- Chain a = s .getChainByPDB ("A" );
179- assertEquals (a .getAtomGroups ().size (),52 );
180- checkRange (s ,"A:1A-49" );
173+ a = s .getPolyChainByPDB ("A" );
174+ assertEquals (a .getAtomGroups ().size (),52 );
175+ checkRange (s ,"A:1A-49" );
181176
182- }catch (Exception e ){
183- e .printStackTrace ();
184- fail (e .getMessage ());
185- }
186177 }
187178
188179 private void checkRange (Structure s , String range ) {
@@ -194,7 +185,7 @@ private void checkRange(Structure s, String range) {
194185 }
195186 assertNotNull (g1 );
196187 assertNotNull (g2 );
197- String chainId = g1 .getChain ().getChainID ();
188+ String chainId = g1 .getChain ().getName ();
198189 String rangeTest = chainId + ":" + g1 .getResidueNumber ().toString ()+"-" + g2 .getResidueNumber ().toString ();
199190
200191 assertEquals ("The expected range and the detected range don't match!" , range , rangeTest );
0 commit comments