Skip to content

Commit a0d6f42

Browse files
committed
Add ChemOnt subtag
1 parent fbea5b6 commit a0d6f42

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/main/java/massbank/RecordParserDefinition.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,6 +1936,15 @@ private Result checkSemantic(Function<Context, Result> continuation, Context con
19361936
}
19371937
}
19381938

1939+
// validate the format of CH$LINK ChemOnt
1940+
if (record.CH_LINK().containsKey("ChemOnt")) {
1941+
String ChemOnt = record.CH_LINK().get("ChemOnt");
1942+
String regex = "^CHEMONTID:\\d+; (.+; )*.+$";
1943+
if (!ChemOnt.matches(regex)) {
1944+
return context.failure("Invalid format for CH$LINK ChemOnt: " + ChemOnt);
1945+
}
1946+
}
1947+
19391948
// validate the number of peaks in the peaklist
19401949
List<Triple<BigDecimal, BigDecimal, Integer>> pk_peak = record.PK_PEAK();
19411950
if (pk_peak.size() != record.PK_NUM_PEAK()) {

src/main/resources/recordformat/ch_link.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ LIPIDBANK
1515
LIPIDMAPS
1616
NIKKAJI
1717
PUBCHEM
18-
ZINC
18+
ZINC
19+
ChemOnt

0 commit comments

Comments
 (0)