Skip to content

Commit 15f3cd8

Browse files
committed
Fixing biojava#289
1 parent f1ec2e1 commit 15f3cd8

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,33 +1150,31 @@ private void compndValueSetter(String field, String value) {
11501150
*/
11511151
private void pdb_SOURCE_Handler(String line) {
11521152
// works in the same way as the pdb_COMPND_Handler.
1153-
boolean sourceDebug = false;
1154-
11551153
String continuationNr = line.substring(9, 10).trim();
11561154

1157-
if (sourceDebug) {
1158-
System.out.println("current continuationNo is "
1159-
+ continuationNr);
1160-
System.out.println("previousContinuationField is "
1161-
+ previousContinuationField);
1162-
System.out.println("current continuationField is "
1163-
+ continuationField);
1164-
System.out.println("current continuationString is "
1165-
+ continuationString);
1166-
System.out.println("current compound is "
1167-
+ current_compound);
1168-
}
1155+
1156+
1157+
logger.debug("current continuationNo is "
1158+
+ continuationNr);
1159+
logger.debug("previousContinuationField is "
1160+
+ previousContinuationField);
1161+
logger.debug("current continuationField is "
1162+
+ continuationField);
1163+
logger.debug("current continuationString is "
1164+
+ continuationString);
1165+
logger.debug("current compound is "
1166+
+ current_compound);
11691167

1170-
// in some PDB files the line ends with the PDB code and a serial number, chop those off!
1171-
if (line.length() > 72) {
1172-
line = line.substring(0, 72);
1168+
1169+
// following the docs, the last valid character should be 79, chop off the rest
1170+
if (line.length() > 79) {
1171+
line = line.substring(0, 79);
11731172
}
11741173

11751174
line = line.substring(10, line.length());
11761175

1177-
if (sourceDebug) {
1178-
System.out.println("LINE: >" + line + "<");
1179-
}
1176+
logger.debug("LINE: >" + line + "<");
1177+
11801178
String[] fieldList = line.split("\\s+");
11811179

11821180
if (!fieldList[0].equals("")
@@ -1196,9 +1194,9 @@ private void pdb_SOURCE_Handler(String line) {
11961194

11971195
} else {
11981196
if (continuationNr.equals("")) {
1199-
if (sourceDebug) {
1200-
System.out.println("looks like an old PDB file");
1201-
}
1197+
1198+
logger.debug("looks like an old PDB file");
1199+
12021200
continuationField = "MOLECULE:";
12031201
if (previousContinuationField.equals("")) {
12041202
previousContinuationField = continuationField;
@@ -1223,12 +1221,12 @@ private void pdb_SOURCE_Handler(String line) {
12231221

12241222
if (previousContinuationField.equals(continuationField)
12251223
&& sourceFieldValues.contains(continuationField)) {
1226-
if (sourceDebug)
1227-
System.out.println("Still in field " + continuationField);
1224+
1225+
logger.debug("Still in field " + continuationField);
12281226

12291227
continuationString = continuationString.concat(token + " ");
1230-
if (sourceDebug)
1231-
System.out.println("continuationString = "
1228+
1229+
logger.debug("continuationString = "
12321230
+ continuationString);
12331231
}
12341232
if (!continuationField.equals(previousContinuationField)) {

biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestTitleParsing.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
/**
3434
* Testing for title parsing in PDB and mmCIF files
35-
* especially mult-line titles in PDB
35+
* especially multi-line titles in PDB
3636
*
3737
* @author duarte_j
3838
*
@@ -71,5 +71,7 @@ public void test2W6E() throws IOException, StructureException {
7171

7272

7373
}
74+
75+
7476

7577
}

0 commit comments

Comments
 (0)