Skip to content

Commit b7074de

Browse files
committed
Fix modDate
In case there is only one revision (release), set the modDate to that value.
1 parent 1f4998e commit b7074de

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@ private void triggerEndFileChecks(){
28772877

28782878
if (! depositionDate.equals(modDate)){
28792879
// depDate is 0000-00-00
2880-
pdbHeader.setDepDate(depositionDate);
2880+
pdbHeader.setModDate(depositionDate);
28812881
}
28822882

28832883
}

biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,17 +614,21 @@ private Date convert(LocalDate localDate) {
614614
public void consumeDatabasePDBRev(DatabasePDBRev databasePDBrev) {
615615
logger.debug("got a database revision:" + databasePDBrev);
616616

617+
Date modDate = null;
617618
for (int rowIndex = 0; rowIndex < databasePDBrev.getRowCount(); rowIndex++) {
618619
if (databasePDBrev.getNum().get(rowIndex) == 1) {
619620
String dateOriginal = databasePDBrev.getDateOriginal().get(rowIndex);
620621
pdbHeader.setDepDate(convert(LocalDate.parse(dateOriginal, DATE_FORMAT)));
621622

622623
String date = databasePDBrev.getDate().get(rowIndex);
623-
pdbHeader.setRelDate(convert(LocalDate.parse(date, DATE_FORMAT)));
624+
final Date relDate = convert(LocalDate.parse(date, DATE_FORMAT));
625+
pdbHeader.setRelDate(relDate);
626+
modDate = relDate;
624627
} else {
625628
String dbrev = databasePDBrev.getDate().get(rowIndex);
626-
pdbHeader.setModDate(convert(LocalDate.parse(dbrev, DATE_FORMAT)));
629+
modDate = convert(LocalDate.parse(dbrev, DATE_FORMAT));
627630
}
631+
pdbHeader.setModDate(modDate);
628632
}
629633
}
630634

@@ -733,18 +737,21 @@ public void consumeExptl(Exptl exptl) {
733737

734738
@Override
735739
public void consumePdbxAuditRevisionHistory(PdbxAuditRevisionHistory pdbxAuditRevisionHistory) {
740+
Date date = null;
736741
for (int rowIndex = 0; rowIndex < pdbxAuditRevisionHistory.getRowCount(); rowIndex++) {
737742
// first entry in revision history is the release date
738743
if (pdbxAuditRevisionHistory.getOrdinal().get(rowIndex) == 1) {
739744
String release = pdbxAuditRevisionHistory.getRevisionDate().get(rowIndex);
740-
pdbHeader.setRelDate(convert(LocalDate.parse(release, DATE_FORMAT)));
745+
date = convert(LocalDate.parse(release, DATE_FORMAT));
746+
pdbHeader.setRelDate(date);
741747
} else {
742748
// all other dates are revision dates;
743749
// since this method may be called multiple times,
744750
// the last revision date will "stick"
745751
String revision = pdbxAuditRevisionHistory.getRevisionDate().get(rowIndex);
746-
pdbHeader.setModDate(convert(LocalDate.parse(revision, DATE_FORMAT)));
752+
date = convert(LocalDate.parse(revision, DATE_FORMAT));
747753
}
754+
pdbHeader.setModDate(date);
748755
}
749756
}
750757

0 commit comments

Comments
 (0)