@@ -222,26 +222,21 @@ public Structure reduce(Structure s) throws StructureException {
222222 if (s .size () != 1 ) {
223223 // SCOP 1.71 uses this for some proteins with multiple chains
224224 // Print a warning in this ambiguous case
225- logger .warn ("Multiple possible chains match '_'. Using chain {}" ,chain .getChainID ());
225+ logger .warn ("Multiple possible chains match '_'. Using chain {}" ,chain .getId ());
226226 }
227227 } else {
228228 // Explicit chain
229- try {
230- chain = s .getChainByPDB (chainId ,modelNr );
231- } catch (StructureException e ) {
229+ chain = s .getPolyChainByPDB (chainId ,modelNr );
230+ if ( chain == null ) {
232231 // Chain not found
233232 // Maybe it was a chain index, masquerading as a chainName?
234233 try {
235234 int chainNum = Integer .parseInt (chainId );
236- try {
237- chain = s .getChainByIndex (modelNr , chainNum );
238- logger .warn ("No chain found for {}. Interpretting it as an index, using chain {} instead" ,chainId ,chain .getChainID ());
239- } catch (Exception e2 ) { //we don't care what gets thrown here -sbliven
240- throw e ; // Nope, not an index. Throw the original exception
241- }
235+ chain = s .getChainByIndex (modelNr , chainNum );
236+ logger .warn ("No chain found for {}. Interpretting it as an index, using chain {} instead" ,chainId ,chain .getId ());
242237 } catch (NumberFormatException e3 ) {
243238 // Not an index. Throw the original exception
244- throw e ;
239+ throw new StructureException ( String . format ( "Unrecognized chain %s in %s" , chainId , getIdentifier ())) ;
245240 }
246241 }
247242 }
@@ -267,13 +262,9 @@ public Structure reduce(Structure s) throws StructureException {
267262
268263 // Reuse prevChain
269264 if ( prevChainId != null && prevChainId .equals (chain .getName ())) {
270- c = newS .getChainByPDB (prevChainId ,modelNr );
265+ c = newS .getPolyChainByPDB (prevChainId ,modelNr );
271266 } else {
272- try {
273- c = newS .getChainByPDB (chain .getName (),modelNr );
274- } catch (StructureException e ){
275- // chain not in structure yet...
276- }
267+ c = newS .getPolyChainByPDB (chain .getName (),modelNr );
277268 }
278269 // Create new chain
279270 if ( c == null ) {
@@ -291,7 +282,7 @@ public Structure reduce(Structure s) throws StructureException {
291282 c .addGroup (g );
292283 }
293284
294- prevChainId = c .getChainID ();
285+ prevChainId = c .getId ();
295286 } // end range
296287 }
297288 } // end modelNr
0 commit comments