Skip to content

Commit 1bf0202

Browse files
committed
Minor javadoc & warnings fixes
1 parent 7b072a0 commit 1bf0202

2 files changed

Lines changed: 13 additions & 22 deletions

File tree

biojava-structure/src/main/java/org/biojava/nbio/structure/Structure.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public interface Structure extends Cloneable {
415415
* @param authId name of a chain that should be returned
416416
* @return Chain the requested chain
417417
* @throws StructureException
418-
* @Deprecated use {@link #getPolyChainsByPDB(String)} or {@link #getNonPolyChainsByPDB(String)} instead
418+
* @Deprecated use {@link #getPolyChainByPDB(String)} or {@link #getNonPolyChainsByPDB(String)} instead
419419
*/
420420
@Deprecated
421421
Chain findChain(String authId) throws StructureException;
@@ -426,7 +426,7 @@ public interface Structure extends Cloneable {
426426
* @param modelnr the number of the model to use
427427
* @return Chain the requested chain
428428
* @throws StructureException
429-
* @Deprecated use {@link #getPolyChainsByPDB(String, int)} or {@link #getNonPolyChainsByPDB(String, int)} instead
429+
* @Deprecated use {@link #getPolyChainByPDB(String, int)} or {@link #getNonPolyChainsByPDB(String, int)} instead
430430
*/
431431
@Deprecated
432432
Chain findChain(String authId, int modelnr) throws StructureException;
@@ -489,7 +489,7 @@ public interface Structure extends Cloneable {
489489
* @param authId the author id (chainName, public chain id)
490490
* @return the Chain that matches the authId
491491
* @throws StructureException if chain can't be found
492-
* @deprecated use {@link #getPolyChainsByPDB(String)} instead
492+
* @deprecated use {@link #getPolyChainByPDB(String)} instead
493493
*/
494494
@Deprecated
495495
Chain getChainByPDB(String authId) throws StructureException;
@@ -504,7 +504,7 @@ public interface Structure extends Cloneable {
504504
* @param modelIdx the index of the required model (0-based)
505505
* @return the Chain that matches the authId in the model
506506
* @throws StructureException if chain can't be found
507-
* @deprecated use {@link #getPolyChainsByPDB(String,int)} instead
507+
* @deprecated use {@link #getPolyChainByPDB(String,int)} instead
508508
*/
509509
@Deprecated
510510
Chain getChainByPDB(String authId, int modelIdx) throws StructureException;

biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)