Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add internal cross refs for publication #196

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public List<UniProtDatabaseDetail> getDBTypesByCategory(UniProtDatabaseCategory
.collect(Collectors.toList());
}

public List<UniProtDatabaseDetail> getInternalDatabaseDetails() {
return UniProtDatabaseTypes.INSTANCE.getAllDbTypes().stream()
.filter(dbDetail -> "internal".equals(dbDetail.getType()))
.collect(Collectors.toList());
}

private void init() {

String source =
Expand All @@ -72,6 +78,7 @@ private void init() {

String linkedReason = item.optString("linkedReason", null);
String idMappingName = item.optString("idMappingName", null);
String type = item.optString("type", null);

List<UniProtDatabaseAttribute> attributes = new ArrayList<>();
List<Property> properties = item.getProperties("attributes");
Expand All @@ -97,7 +104,8 @@ private void init() {
attributes,
isImplicit,
linkedReason,
idMappingName);
idMappingName,
type);
types.add(xdbType);
});
typeMap =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ void testFailedValidation() {
opType.getAttributes(),
false,
null,
null,
null);

// validate, the category should mismatch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,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(
Expand All @@ -301,7 +301,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);
Expand All @@ -314,13 +314,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(
Expand All @@ -331,6 +331,14 @@ void testDatabaseFieldSize() {
verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(PROTEOMES_DATABASES), 1);
}

@Test
void testInternalCrossRefs() {
List<UniProtDatabaseDetail> internalCrossRefs =
UniProtDatabaseTypes.INSTANCE.getInternalDatabaseDetails();

assertEquals(7, internalCrossRefs.size());
}

private void verifyGroupSize(List<UniProtDatabaseDetail> dbTypesByCategory, int size) {
assertEquals(size, dbTypesByCategory.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();
Expand All @@ -35,6 +36,28 @@ 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<UniProtDatabaseAttribute> attributes,
boolean implicit,
String linkedReason,
String idMappingName,
String type) {
super();
this.name = name;
this.displayName = displayName;
Expand All @@ -47,6 +70,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() {
Expand Down Expand Up @@ -81,6 +105,10 @@ public String getIdMappingName() {
return idMappingName;
}

public String getType() {
return this.type;
}

@Override
public int hashCode() {
return Objects.hash(
Expand All @@ -91,7 +119,8 @@ public int hashCode() {
this.uriLink,
this.implicit,
this.linkedReason,
this.idMappingName);
this.idMappingName,
this.type);
}

@Override
Expand All @@ -109,6 +138,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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class UniProtKBDatabaseDetailTest {
private String uriLink;
private List<UniProtDatabaseAttribute> attributes;
private String idMappingName;
private String type;

@BeforeEach
void setUp() {
Expand All @@ -34,6 +35,7 @@ void setUp() {
this.name, this.displayName, this.uriLink))
.collect(Collectors.toList());
this.idMappingName = "idMappingName-" + random;
this.type = "type-" + random;
}

@Test
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -109,6 +113,7 @@ private UniProtDatabaseDetail createUniProtDatabaseDetail(boolean passAttribute)
this.category,
this.uriLink,
this.attributes,
null,
null);
} else {
return createUniProtDatabaseDetail(
Expand All @@ -117,7 +122,8 @@ private UniProtDatabaseDetail createUniProtDatabaseDetail(boolean passAttribute)
this.category,
this.uriLink,
null,
this.idMappingName);
this.idMappingName,
this.type);
}
}

Expand All @@ -127,8 +133,9 @@ static UniProtDatabaseDetail createUniProtDatabaseDetail(
UniProtDatabaseCategory category,
String uriLink,
List<UniProtDatabaseAttribute> 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);
}
}