From 762a1968048235bd0ef18417337ca911ba5d9858 Mon Sep 17 00:00:00 2001 From: Shadab Ahmad Date: Wed, 27 Sep 2023 17:12:12 +0100 Subject: [PATCH] add internal cross refs for publication --- .../uniprot/cv/xdb/UniProtDatabaseTypes.java | 9 +++- .../META-INF/drlineconfiguration.json | 51 ++++++++++++++++++- .../cv/xdb/CrossReferenceValidatorIT.java | 2 +- .../cv/xdb/UniProtKBDatabaseTypesTest.java | 16 ++++-- .../core/cv/xdb/UniProtDatabaseDetail.java | 24 ++++++++- .../uniprot/core/UniProtKBDatabaseMock.java | 4 +- .../cv/xdb/UniProtKBDatabaseDetailTest.java | 13 +++-- 7 files changed, 104 insertions(+), 15 deletions(-) diff --git a/controlled-vocabulary/src/main/java/org/uniprot/cv/xdb/UniProtDatabaseTypes.java b/controlled-vocabulary/src/main/java/org/uniprot/cv/xdb/UniProtDatabaseTypes.java index d3dba33c2..3e10a366f 100644 --- a/controlled-vocabulary/src/main/java/org/uniprot/cv/xdb/UniProtDatabaseTypes.java +++ b/controlled-vocabulary/src/main/java/org/uniprot/cv/xdb/UniProtDatabaseTypes.java @@ -50,6 +50,11 @@ public List getDBTypesByCategory(UniProtDatabaseCategory .collect(Collectors.toList()); } + public List getInternalDatabaseDetails(){ + return UniProtDatabaseTypes.INSTANCE.getAllDbTypes().stream() + .filter(dbDetail -> "internal".equals(dbDetail.getType())).collect(Collectors.toList()); + } + private void init() { String source = @@ -72,6 +77,7 @@ private void init() { String linkedReason = item.optString("linkedReason", null); String idMappingName = item.optString("idMappingName", null); + String type = item.optString("type", null); List attributes = new ArrayList<>(); List properties = item.getProperties("attributes"); @@ -97,7 +103,8 @@ private void init() { attributes, isImplicit, linkedReason, - idMappingName); + idMappingName, + type); types.add(xdbType); }); typeMap = diff --git a/controlled-vocabulary/src/main/resources/META-INF/drlineconfiguration.json b/controlled-vocabulary/src/main/resources/META-INF/drlineconfiguration.json index 57ac1265a..82a60efec 100644 --- a/controlled-vocabulary/src/main/resources/META-INF/drlineconfiguration.json +++ b/controlled-vocabulary/src/main/resources/META-INF/drlineconfiguration.json @@ -1898,5 +1898,54 @@ "displayName": "AlphaFoldDB", "category": "3DS", "uriLink": "https://alphafold.ebi.ac.uk/entry/%id" - } + }, + { + "name": "eMIND", + "displayName": "eMIND", + "category": "MISC", + "uriLink": "https://research.bioinformatics.udel.edu/itextmine/integrate/doc/emind/medline/%id", + "type": "internal" + }, + { + "name":"PGenN", + "displayName":"PGenN", + "category":"MISC", + "uriLink":"https://research.bioinformatics.udel.edu/itextmine/pgenn/doc/pgenn/medline/%id", + "type":"internal" + }, + { + "name":"Alzforum", + "displayName":"Alzforum", + "category":"GVD", + "uriLink":"https://www.alzforum.org/node/%id", + "type":"internal" + }, + { + "name":"GeneRIF", + "displayName":"GeneRIF", + "category":"SEQ", + "uriLink":"https://www.ncbi.nlm.nih.gov/gene?Db=gene&Cmd=DetailsSearch&Term=%id", + "type":"internal" + }, + { + "name":"IC4R", + "displayName":"IC4R", + "category":"ORG", + "uriLink":"http://ic4r.org/osGene/%id", + "type":"internal" + }, + { + "name":"ORCID", + "displayName":"ORCID", + "category":"MISC", + "uriLink":"https://orcid.org/%id", + "type":"internal" + }, + { + "name":"PubTator", + "displayName":"PubTator", + "category":"MISC", + "uriLink":"https://www.ncbi.nlm.nih.gov/research/pubtator/?query=%id", + "type":"internal" + } ] \ No newline at end of file diff --git a/controlled-vocabulary/src/test/java/org/uniprot/cv/xdb/CrossReferenceValidatorIT.java b/controlled-vocabulary/src/test/java/org/uniprot/cv/xdb/CrossReferenceValidatorIT.java index 10ac978de..f18a7cf67 100644 --- a/controlled-vocabulary/src/test/java/org/uniprot/cv/xdb/CrossReferenceValidatorIT.java +++ b/controlled-vocabulary/src/test/java/org/uniprot/cv/xdb/CrossReferenceValidatorIT.java @@ -69,7 +69,7 @@ void testFailedValidation() { opType.getAttributes(), false, null, - null); + null, null); // validate, the category should mismatch List> mismatches = CrossReferenceValidator.validate(actualOpType); diff --git a/controlled-vocabulary/src/test/java/org/uniprot/cv/xdb/UniProtKBDatabaseTypesTest.java b/controlled-vocabulary/src/test/java/org/uniprot/cv/xdb/UniProtKBDatabaseTypesTest.java index 87c0b2034..58a633d99 100644 --- a/controlled-vocabulary/src/test/java/org/uniprot/cv/xdb/UniProtKBDatabaseTypesTest.java +++ b/controlled-vocabulary/src/test/java/org/uniprot/cv/xdb/UniProtKBDatabaseTypesTest.java @@ -6,6 +6,7 @@ import static org.uniprot.core.cv.xdb.UniProtDatabaseCategory.*; import java.util.List; +import java.util.stream.Collectors; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -288,7 +289,7 @@ void testProteomesType() { @Test void testDatabaseFieldSize() { - verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(SEQUENCE_DATABASES), 6); + verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(SEQUENCE_DATABASES), 7); verifyGroupSize( UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(D3_STRUCTURE_DATABASES), 12); verifyGroupSize( @@ -301,7 +302,7 @@ void testDatabaseFieldSize() { 13); verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(PTM_DATABASES), 10); verifyGroupSize( - UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(GENERIC_VARIATION_DATABASES), 5); + UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(GENERIC_VARIATION_DATABASES), 6); verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(D2_GEL_DATABASES), 7); verifyGroupSize( UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(PROTEOMIC_DATABASES), 11); @@ -314,13 +315,13 @@ void testDatabaseFieldSize() { 15); verifyGroupSize( UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(ORGANISM_SPECIFIC_DATABASES), - 40); + 41); verifyGroupSize( UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(PHYLOGENOMIC_DATABASES), 9); verifyGroupSize( UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(ENZYME_AND_PATHWAY_DATABASES), 10); - verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(MISCELLANEOUS), 11); + verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(MISCELLANEOUS), 15); verifyGroupSize( UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(GENE_EXPRESSION_DATABASES), 5); verifyGroupSize( @@ -331,6 +332,13 @@ void testDatabaseFieldSize() { verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(PROTEOMES_DATABASES), 1); } + @Test + void testInternalCrossRefs(){ + List internalCrossRefs = UniProtDatabaseTypes.INSTANCE.getInternalDatabaseDetails(); + + assertEquals(7, internalCrossRefs.size()); + } + private void verifyGroupSize(List dbTypesByCategory, int size) { assertEquals(size, dbTypesByCategory.size()); } diff --git a/core-domain/src/main/java/org/uniprot/core/cv/xdb/UniProtDatabaseDetail.java b/core-domain/src/main/java/org/uniprot/core/cv/xdb/UniProtDatabaseDetail.java index dfc77def5..409daedef 100644 --- a/core-domain/src/main/java/org/uniprot/core/cv/xdb/UniProtDatabaseDetail.java +++ b/core-domain/src/main/java/org/uniprot/core/cv/xdb/UniProtDatabaseDetail.java @@ -20,6 +20,7 @@ public class UniProtDatabaseDetail implements Serializable { private boolean implicit = false; private String linkedReason = null; private String idMappingName; + private String type; UniProtDatabaseDetail() { this.attributes = new ArrayList<>(); @@ -35,6 +36,18 @@ public UniProtDatabaseDetail( boolean implicit, String linkedReason, String idMappingName) { + this(name, displayName, category, uriLink, attributes, implicit, linkedReason, idMappingName, null); + } + public UniProtDatabaseDetail( + String name, + String displayName, + UniProtDatabaseCategory category, + String uriLink, + List attributes, + boolean implicit, + String linkedReason, + String idMappingName, + String type) { super(); this.name = name; this.displayName = displayName; @@ -47,6 +60,7 @@ public UniProtDatabaseDetail( if ((attributes != null) && !attributes.isEmpty()) this.attributes.addAll(attributes); else this.attributes.add(DEFAULT_ATTRIBUTE); this.idMappingName = idMappingName; + this.type = type; } public String getName() { @@ -81,6 +95,10 @@ public String getIdMappingName() { return idMappingName; } + public String getType(){ + return this.type; + } + @Override public int hashCode() { return Objects.hash( @@ -91,7 +109,8 @@ public int hashCode() { this.uriLink, this.implicit, this.linkedReason, - this.idMappingName); + this.idMappingName, + this.type); } @Override @@ -109,6 +128,7 @@ public boolean equals(Object obj) { && Objects.equals(this.uriLink, other.uriLink) && Objects.equals(this.implicit, other.implicit) && Objects.equals(this.linkedReason, other.linkedReason) - && Objects.equals(this.idMappingName, other.idMappingName); + && Objects.equals(this.idMappingName, other.idMappingName) + && Objects.equals(this.type, other.type); } } diff --git a/core-domain/src/test/java/org/uniprot/core/UniProtKBDatabaseMock.java b/core-domain/src/test/java/org/uniprot/core/UniProtKBDatabaseMock.java index e14fb20ea..432cadd35 100644 --- a/core-domain/src/test/java/org/uniprot/core/UniProtKBDatabaseMock.java +++ b/core-domain/src/test/java/org/uniprot/core/UniProtKBDatabaseMock.java @@ -20,10 +20,10 @@ public UniProtKBDatabaseMock(String name) { public @Nonnull UniProtDatabaseDetail getUniProtDatabaseDetail() { if (Utils.notNullNotEmpty(this.name)) { return new UniProtDatabaseDetail( - this.name, this.name, null, null, null, false, null, null); + this.name, this.name, null, null, null, false, null, null, null); } else { return new UniProtDatabaseDetail( - "dummy", "dummyName", null, null, null, false, null, null); + "dummy", "dummyName", null, null, null, false, null, null, null); } } diff --git a/core-domain/src/test/java/org/uniprot/core/cv/xdb/UniProtKBDatabaseDetailTest.java b/core-domain/src/test/java/org/uniprot/core/cv/xdb/UniProtKBDatabaseDetailTest.java index fd6ee19f4..9b2031e76 100644 --- a/core-domain/src/test/java/org/uniprot/core/cv/xdb/UniProtKBDatabaseDetailTest.java +++ b/core-domain/src/test/java/org/uniprot/core/cv/xdb/UniProtKBDatabaseDetailTest.java @@ -18,6 +18,7 @@ class UniProtKBDatabaseDetailTest { private String uriLink; private List attributes; private String idMappingName; + private String type; @BeforeEach void setUp() { @@ -34,6 +35,7 @@ void setUp() { this.name, this.displayName, this.uriLink)) .collect(Collectors.toList()); this.idMappingName = "idMappingName-" + random; + this.type = "type-" + random; } @Test @@ -49,6 +51,7 @@ void testCreateObject() { assertEquals("description", dbType.getAttributes().get(0).getXmlTag()); Assertions.assertNull(dbType.getAttributes().get(0).getUriLink()); assertEquals(this.idMappingName, dbType.getIdMappingName()); + assertEquals(this.type, dbType.getType()); } @Test @@ -99,6 +102,7 @@ void needDefaultConstructorForJsonDeserialization() { assertEquals(1, obj.getAttributes().size()); assertNull(obj.getLinkedReason()); assertFalse(obj.isImplicit()); + assertNull(obj.getType()); } private UniProtDatabaseDetail createUniProtDatabaseDetail(boolean passAttribute) { @@ -109,7 +113,7 @@ private UniProtDatabaseDetail createUniProtDatabaseDetail(boolean passAttribute) this.category, this.uriLink, this.attributes, - null); + null, null); } else { return createUniProtDatabaseDetail( this.name, @@ -117,7 +121,8 @@ private UniProtDatabaseDetail createUniProtDatabaseDetail(boolean passAttribute) this.category, this.uriLink, null, - this.idMappingName); + this.idMappingName, + this.type); } } @@ -127,8 +132,8 @@ static UniProtDatabaseDetail createUniProtDatabaseDetail( UniProtDatabaseCategory category, String uriLink, List attributes, - String idMappingName) { + String idMappingName, String type) { return new UniProtDatabaseDetail( - name, displayName, category, uriLink, attributes, false, null, idMappingName); + name, displayName, category, uriLink, attributes, false, null, idMappingName, type); } }