Skip to content

Commit

Permalink
Loads representative domains from entries.json
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasblum committed Aug 12, 2024
1 parent ccfab31 commit c47b15f
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -890,17 +890,28 @@ public void getDomainsMap() {
}

try {
File file = new File(this.getEntryKVPath() + "/domains.json");
File file = new File(this.getEntryKVPath() + "/entries.json");
FileInputStream is = new FileInputStream(file);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
Map<String, Integer> jsonMap;
jsonMap = mapper.readValue(is, new TypeReference<>() {});
domainsMap = new ConcurrentHashMap<> (jsonMap);
Map<String, Map<String, Object>> jsonMap = mapper.readValue(is, new TypeReference<>() {});
domainsMap = new ConcurrentHashMap<>();

for (Map.Entry<String, Map<String, Object>> entry : jsonMap.entrySet()) {
String accession = entry.getKey();
Map<String, Object> value = entry.getValue();

Map<String, Object> representative = (Map<String, Object>) value.get("representative");
String type = (String) representative.get("type");
Integer index = (Integer) representative.get("index");

if (type != null && type.equals("domain")) {
domainsMap.put(accession, index);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}

}

public Entry updateEntryXrefs(Entry entry) {
Expand Down

0 comments on commit c47b15f

Please sign in to comment.