Skip to content

Commit ae8ca43

Browse files
committed
More ECOD format changes
All files now have the proper 14-field format
1 parent 97924c5 commit ae8ca43

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/domain/EcodInstallationTest.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@
3535
import java.util.concurrent.Future;
3636
import java.util.concurrent.TimeUnit;
3737
import java.util.concurrent.TimeoutException;
38+
import java.util.regex.Matcher;
39+
import java.util.regex.Pattern;
3840

3941
import org.biojava.nbio.core.util.ConcurrencyTools;
4042
import org.biojava.nbio.structure.ecod.EcodDatabase;
4143
import org.biojava.nbio.structure.ecod.EcodDomain;
4244
import org.biojava.nbio.structure.ecod.EcodFactory;
4345
import org.biojava.nbio.structure.ecod.EcodInstallation;
46+
import org.junit.Ignore;
4447
import org.junit.Rule;
4548
import org.junit.Test;
4649
import org.junit.rules.TemporaryFolder;
@@ -123,7 +126,7 @@ public void testParsing() throws IOException {
123126
domain = ecod.getDomainsById(ecodId);
124127
expected = new EcodDomain(
125128
// Long uid, String domainId, Boolean manual,
126-
20669l, "e1lyw.1", null,
129+
20669l, "e1lyw.1", false,
127130
// Integer xGroup, Integer hGroup, Integer tGroup, Integer fGroup, String pdbId,
128131
1,1,1,2,"1lyw",
129132
// String chainId, String range, String architectureName,
@@ -224,17 +227,33 @@ public void testVersion() throws IOException {
224227
assertNotNull(version);
225228
assertNotEquals("latest", version);
226229
}
227-
230+
231+
/**
232+
* Parses all known versions. Only fails due to exceptions, so manually check for warnings.
233+
* Hierarchical field warnings are expected for versions prior to develop68.
234+
* @throws IOException
235+
*/
236+
//@Ignore
228237
@Test
229238
public void testAllVersions() throws IOException {
239+
// Fetch latest version
240+
EcodDatabase latest = EcodFactory.getEcodDatabase("latest");
241+
String latestVersionStr = latest.getVersion();
242+
int latestVersion = 0;
243+
Matcher match = Pattern.compile("develop([0-9]+)",Pattern.CASE_INSENSITIVE).matcher(latestVersionStr);
244+
if(match.matches())
245+
latestVersion = Integer.parseInt(match.group(1));
246+
247+
// List all versions
230248
int firstVersion = 45;
231-
int lastVersion = 78;
249+
int lastVersion = Math.max(78,latestVersion);
232250
List<String> versions = new ArrayList<String>();
233-
251+
versions.add("latest");
234252
for(int version = firstVersion; version<= lastVersion;version++) {
235253
versions.add("develop"+version);
236254
}
237-
versions.add("latest");
255+
256+
// Parse all versions
238257
for(String version : versions) {
239258
EcodInstallation ecod = (EcodInstallation)EcodFactory.getEcodDatabase(version);
240259
ecod.getAllDomains();

biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ private void parse(BufferedReader in) throws IOException {
506506
// prevent too many warnings; negative numbers print all warnings
507507
int warnIsDomainAssembly = 1;
508508
int warnHierarchicalFormat = 5;
509+
int warnNumberOfFields = 10;
509510

510511
String line = in.readLine();
511512
int lineNum = 1;
@@ -604,7 +605,13 @@ private void parse(BufferedReader in) throws IOException {
604605
logger.warn("Error in ECOD parsing at line "+lineNum,e);
605606
}
606607
} else {
607-
logger.warn("Unexpected number of fields in line {}",lineNum);
608+
if(warnNumberOfFields > 1) {
609+
logger.warn("Unexpected number of fields in line {}.",lineNum);
610+
warnNumberOfFields--;
611+
} else if(warnNumberOfFields == 0) {
612+
logger.warn("Unexpected number of fields in line {}. Not printing future similar warnings",lineNum);
613+
warnIsDomainAssembly--;
614+
}
608615
}
609616
}
610617
}

0 commit comments

Comments
 (0)