Skip to content

Commit

Permalink
Does count the unique records in the database, instead of iterating o…
Browse files Browse the repository at this point in the history
…ver all identifiers
  • Loading branch information
egonw committed Aug 7, 2023
1 parent a4d8ea4 commit 259ef67
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions org.bridgedb.tools.qc/src/org/bridgedb/tools/qc/BridgeQC.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,23 +383,8 @@ private void summarizeOverallStats(SimpleGdb gdb, String oldNew) throws IDMapper
boolean isSchemaUpdated = (schema.next() && schema.getInt("schemaversion") >= 4);
if (isSchemaUpdated) {
for (DataSource ds : gdb.getCapabilities().getSupportedSrcDataSources()) {
countOfPrimary = 0;
countofSecondary = 0;
Connection con2 = gdb.getConnection();
Statement st1 = con2.createStatement();
for (Xref xref : gdb.getIterator(ds)) {
String sql = "SELECT isPrimary FROM datanode WHERE datanode.id = '" + xref.getId() + "'AND datanode.code = '" + ds.getSystemCode() + "'";
ResultSet rs = st1.executeQuery(sql);
while (rs.next()) {
if (rs.getBoolean("isPrimary")) {
countOfPrimary++;
} else {
countofSecondary++;
}
}
}
this.out.println("INFO: " + oldNew + " database data source " + ds.getFullName() + " has " + countOfPrimary + " primary ids");
this.out.println("INFO: " + oldNew + " database data source " + ds.getFullName() + " has " + countofSecondary + " secondary ids");
this.out.println("INFO: " + oldNew + " database data source " + ds.getFullName() + " has " + gdb.getPrimaryIDCount(ds) + " primary ids");
this.out.println("INFO: " + oldNew + " database data source " + ds.getFullName() + " has " + (gdb.getGeneCount(ds) - gdb.getPrimaryIDCount(ds)) + " secondary ids");
}
} else {
this.out.println("INFO: " + oldNew + " database has Schema Version is less than 4, and we cannot calculate Primary and Secondary identifier counts");
Expand Down

0 comments on commit 259ef67

Please sign in to comment.