Skip to content

Commit

Permalink
Merge branch 'main' into TRM-30823-REDUNDANT-FASTA_TST
Browse files Browse the repository at this point in the history
# Conflicts:
#	xml-parser/src/main/java/org/uniprot/core/xml/uniparc/UniParcDBCrossReferenceConverter.java
  • Loading branch information
LeonardoGonzales committed Nov 25, 2024
2 parents 335954d + 3ec7203 commit 97d68a9
Show file tree
Hide file tree
Showing 41 changed files with 766 additions and 260 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@
"name": "DisGeNET",
"displayName": "DisGeNET",
"category": "ORG",
"uriLink": "https://www.disgenetplus.com/examples?view=GENES&idents=%id&source=ALL&tab=GDA&newSearch=false"
"uriLink": "https://www.disgenet.com/search?view=GENES&idents=%id&source=ALL&tab=GDA"
},
{
"name": "EchoBASE",
Expand Down Expand Up @@ -1500,6 +1500,17 @@
}
]
},
{
"name": "AntiFam",
"displayName": "AntiFam",
"category": "FMD",
"uriLink": "https://www.ebi.ac.uk/interpro/entry/antifam/%id",
"attributes": [
{ "name": "EntryName",
"xmlTag":"entry name"
}
]
},
{
"name": "CDD",
"displayName": "CDD",
Expand All @@ -1514,6 +1525,20 @@
}
]
},
{
"name": "FunFam",
"displayName": "FunFam",
"category": "FMD",
"uriLink": "https://www.cathdb.info/version/latest/superfamily/%id",
"attributes": [
{ "name": "EntryName",
"xmlTag":"entry name"
},
{ "name": "MatchStatus",
"xmlTag":"match status"
}
]
},
{
"name": "Gene3D",
"displayName": "Gene3D",
Expand Down Expand Up @@ -1845,7 +1870,7 @@
"name":"IC4R",
"displayName":"IC4R",
"category":"ORG",
"uriLink":"http://ic4r.org/osGene/%id",
"uriLink":"https://ngdc.cncb.ac.cn/ic4r/osGene/%id",
"type":"internal"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Optional;
import java.util.Set;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.uniprot.cv.xdb.validator.CrossReferenceReader;
import org.uniprot.cv.xdb.validator.CrossReferenceValidator;
Expand All @@ -24,7 +25,7 @@ class CrossReferenceReaderIT {
"DB-0072", "DB-0078", "DB-0090", "DB-0099", "DB-0106", "DB-0047",
"DB-0236", "DB-0237", "DB-0244", "DB-0259", "DB-0261"));

@Test
@Disabled
void testReadAll() throws IOException {
int count = 0;
String ftpUrl =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ void testDatabaseFieldSize() {
UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(GENE_EXPRESSION_DATABASES), 4);
verifyGroupSize(
UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(FAMILY_AND_DOMAIN_DATABASES),
16);
18);
verifyGroupSize(
UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(GENE_ONTOLOGY_DATABASES), 1);
verifyGroupSize(UniProtDatabaseTypes.INSTANCE.getDBTypesByCategory(PROTEOMES_DATABASES), 1);
Expand Down
46 changes: 23 additions & 23 deletions core-common/src/test/java/org/uniprot/core/util/UtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,71 +191,71 @@ void nonEmpty_shouldAlwaysReturnFalse() {
class unmodifiableList {
@Test
void passingNullReturnEmptyList() {
List l = Utils.unmodifiableList(null);
assertTrue(l.isEmpty());
List<Object> unmodifiableList = Utils.unmodifiableList(null);
assertTrue(unmodifiableList.isEmpty());
}

@Test
void passing_emptyList_returnEmptyList() {
List l = Utils.unmodifiableList(new ArrayList<>());
assertTrue(l.isEmpty());
List<Object> unmodifiableList = Utils.unmodifiableList(new ArrayList<>());
assertTrue(unmodifiableList.isEmpty());
}

@Test
void passingNullReturnEmptyList_unmodifiable() {
List<String> l = Utils.unmodifiableList(null);
assertThrows(UnsupportedOperationException.class, () -> l.add("abc"));
List<String> unmodifiableList = Utils.unmodifiableList(null);
assertThrows(UnsupportedOperationException.class, () -> unmodifiableList.add("abc"));
}

@Test
void passing_emptyList_returnEmptyList_unmodifiable() {
List<String> l = Utils.unmodifiableList(new ArrayList<>());
assertThrows(UnsupportedOperationException.class, () -> l.add("abc"));
List<String> unmodifiableList = Utils.unmodifiableList(new ArrayList<>());
assertThrows(UnsupportedOperationException.class, () -> unmodifiableList.add("abc"));
}

@Test
void passingList_returnUnmodifiable() {
List<String> list = new ArrayList<>();
list.add("a");
list.add("b");
List<String> l = Utils.unmodifiableList(list);
assertThrows(UnsupportedOperationException.class, () -> l.add("c"));
List<String> unmodifiableList = Utils.unmodifiableList(list);
assertThrows(UnsupportedOperationException.class, () -> unmodifiableList.add("c"));
}
}

@Nested
class unmodifiableSet {
@Test
void passingNullReturnEmptySet() {
Set l = Utils.unmodifiableSet(null);
assertTrue(l.isEmpty());
Set<Object> unmodifiableSet = Utils.unmodifiableSet(null);
assertTrue(unmodifiableSet.isEmpty());
}

@Test
void passing_emptySet_returnEmptySet() {
Set l = Utils.unmodifiableSet(new HashSet<>());
assertTrue(l.isEmpty());
Set<String> unmodifiableSet = Utils.unmodifiableSet(new HashSet<>());
assertTrue(unmodifiableSet.isEmpty());
}

@Test
void passingNullReturnEmptySet_unmodifiable() {
Set<String> l = Utils.unmodifiableSet(null);
assertThrows(UnsupportedOperationException.class, () -> l.add("abc"));
Set<String> unmodifiableSet = Utils.unmodifiableSet(null);
assertThrows(UnsupportedOperationException.class, () -> unmodifiableSet.add("abc"));
}

@Test
void passing_emptySet_returnEmptySet_unmodifiable() {
Set<String> l = Utils.unmodifiableSet(new HashSet<>());
assertThrows(UnsupportedOperationException.class, () -> l.add("abc"));
Set<String> unmodifiableSet = Utils.unmodifiableSet(new HashSet<>());
assertThrows(UnsupportedOperationException.class, () -> unmodifiableSet.add("abc"));
}

@Test
void passingSet_returnUnmodifiable() {
Set<String> list = new HashSet<>();
list.add("a");
list.add("b");
Set<String> l = Utils.unmodifiableSet(list);
assertThrows(UnsupportedOperationException.class, () -> l.add("c"));
Set<String> set = new HashSet<>();
set.add("a");
set.add("b");
Set<String> unmodifiableSet = Utils.unmodifiableSet(set);
assertThrows(UnsupportedOperationException.class, () -> unmodifiableSet.add("c"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public enum ExclusionReason implements EnumDisplay {
NOT_USED_AS_TYPE("not used as type"),
UNVERIFIED_HOST_ORGANISM("unverified host organism"),
SUPERSEDED_BY_NEWER_ASSEMBLY_FOR_SPECIES("superseded by newer assembly for species"),
INCOMPLETE_METAGENOME("incomplete metagenome"),
INCOMPLETE_METAGENOME_ASSEMBLED_GENOME("incomplete metagenome-assembled genome"),
LOW_QUALITY_PROTEOME("low quality proteome"),
PROTEOME_IN_UNIPARC("proteome in uniparc"),
OVER_REPRESENTED_PROTEOME("over-represented proteome"),
SEQUENCE_DUPLICATIONS("sequence duplications"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.uniprot.core.publication;

import org.uniprot.core.util.Utils;

import java.io.Serializable;
import java.time.LocalDate;

/**
* Created 02/12/2020
Expand All @@ -15,4 +18,6 @@ public interface CommunityAnnotation extends Serializable {
String getDisease();

String getComment();

LocalDate getSubmissionDate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.uniprot.core.Builder;
import org.uniprot.core.publication.CommunityAnnotation;

import java.time.LocalDate;

/**
* Created 02/12/2020
*
Expand All @@ -15,6 +17,7 @@ public class CommunityAnnotationBuilder implements Builder<CommunityAnnotation>
private String function;
private String disease;
private String comment;
private LocalDate submissionDate;

public CommunityAnnotationBuilder proteinOrGene(String proteinOrGene) {
this.proteinOrGene = proteinOrGene;
Expand All @@ -36,17 +39,28 @@ public CommunityAnnotationBuilder comment(String comment) {
return this;
}

public CommunityAnnotationBuilder submissionDate(String submissionDate) {
this.submissionDate = LocalDate.parse(submissionDate);
return this;
}

public CommunityAnnotationBuilder submissionDate(LocalDate submissionDate) {
this.submissionDate = submissionDate;
return this;
}

@Nonnull
@Override
public CommunityAnnotation build() {
return new CommunityAnnotationImpl(proteinOrGene, function, disease, comment);
return new CommunityAnnotationImpl(proteinOrGene, function, disease, comment, submissionDate);
}

public static CommunityAnnotationBuilder from(@Nonnull CommunityAnnotation instance) {
return new CommunityAnnotationBuilder()
.function(instance.getFunction())
.disease(instance.getDisease())
.comment(instance.getComment())
.proteinOrGene(instance.getProteinOrGene());
.proteinOrGene(instance.getProteinOrGene())
.submissionDate(instance.getSubmissionDate());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.uniprot.core.publication.impl;

import java.time.LocalDate;
import java.util.Objects;

import org.uniprot.core.publication.CommunityAnnotation;
Expand All @@ -10,23 +11,25 @@
* @author Edd
*/
public class CommunityAnnotationImpl implements CommunityAnnotation {
private static final long serialVersionUID = 6579256221026737892L;
private static final long serialVersionUID = 8368111594497409648L;

private final String proteinOrGene;
private final String function;
private final String disease;
private final String comment;
private final LocalDate submissionDate;

public CommunityAnnotationImpl() {
this(null, null, null, null);
this(null, null, null, null, null);
}

public CommunityAnnotationImpl(
String proteinOrGene, String function, String disease, String comment) {
String proteinOrGene, String function, String disease, String comment, LocalDate submissionDate) {
this.proteinOrGene = proteinOrGene;
this.function = function;
this.disease = disease;
this.comment = comment;
this.submissionDate = submissionDate;
}

@Override
Expand All @@ -49,6 +52,11 @@ public String getComment() {
return comment;
}

@Override
public LocalDate getSubmissionDate() {
return submissionDate;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -57,12 +65,13 @@ public boolean equals(Object o) {
return Objects.equals(proteinOrGene, that.proteinOrGene)
&& Objects.equals(function, that.function)
&& Objects.equals(disease, that.disease)
&& Objects.equals(comment, that.comment);
&& Objects.equals(comment, that.comment)
&& Objects.equals(submissionDate, that.submissionDate);
}

@Override
public int hashCode() {
return Objects.hash(proteinOrGene, function, disease, comment);
return Objects.hash(proteinOrGene, function, disease, comment, submissionDate);
}

@Override
Expand All @@ -80,6 +89,9 @@ public String toString() {
+ ", comment='"
+ comment
+ '\''
+ ", submissionDate='"
+ submissionDate
+ '\''
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
public interface CommonOrganism extends Serializable {
String getTopLevel();
String getCommonTaxon();
Long getCommonTaxonId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ public class CommonOrganismBuilder implements Builder<CommonOrganism> {
private String topLevel;
private String commonTaxon;

private Long commonTaxonId;

@Nonnull
@Override
public CommonOrganism build() {
return new CommonOrganismImpl(topLevel, commonTaxon);
return new CommonOrganismImpl(topLevel, commonTaxon, commonTaxonId);
}

public CommonOrganismBuilder topLevel(String topLevel) {
Expand All @@ -27,10 +29,16 @@ public CommonOrganismBuilder commonTaxon(String commonTaxon) {
return this;
}

public CommonOrganismBuilder commonTaxonId(Long commonTaxonId) {
this.commonTaxonId = commonTaxonId;
return this;
}

public static @Nonnull CommonOrganismBuilder from(@Nonnull CommonOrganism instance) {
CommonOrganismBuilder builder = new CommonOrganismBuilder()
.topLevel(instance.getTopLevel())
.commonTaxon(instance.getCommonTaxon());
.commonTaxon(instance.getCommonTaxon())
.commonTaxonId(instance.getCommonTaxonId());
return builder;
}
}
Loading

0 comments on commit 97d68a9

Please sign in to comment.