diff --git a/core-domain/src/main/java/org/uniprot/core/uniparc/impl/UniParcCrossReferencePair.java b/core-domain/src/main/java/org/uniprot/core/uniparc/impl/UniParcCrossReferencePair.java index e69340d13..d4e62ae7e 100644 --- a/core-domain/src/main/java/org/uniprot/core/uniparc/impl/UniParcCrossReferencePair.java +++ b/core-domain/src/main/java/org/uniprot/core/uniparc/impl/UniParcCrossReferencePair.java @@ -13,7 +13,7 @@ public class UniParcCrossReferencePair implements Pair value; - + UniParcCrossReferencePair(){} public UniParcCrossReferencePair(String key, List value) { this.key = key; this.value = value; diff --git a/core-parser/src/main/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryLightValueMapper.java b/core-parser/src/main/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryLightValueMapper.java index 0792dc0e0..2a9252744 100644 --- a/core-parser/src/main/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryLightValueMapper.java +++ b/core-parser/src/main/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryLightValueMapper.java @@ -12,8 +12,6 @@ public class UniParcEntryLightValueMapper implements EntityValueMapper UNIPARC_FIELDS = List.of("upi", - "oldestCrossRefCreated", - "mostRecentCrossRefUpdated", "organism", "organism_id", "gene", @@ -54,57 +52,43 @@ private Map getSimpleAttributeValues(UniParcEntryLight entry, Li case "upi": map.put(UNIPARC_FIELDS.get(0), entry.getUniParcId()); break; - case "oldestCrossRefCreated": - map.put( - UNIPARC_FIELDS.get(1), - Optional.of(entry.getOldestCrossRefCreated()) - .map(LocalDate::toString) - .orElse("")); - break; - case "mostRecentCrossRefUpdated": - map.put( - UNIPARC_FIELDS.get(2), - Optional.of(entry.getMostRecentCrossRefUpdated()) - .map(LocalDate::toString) - .orElse("")); - break; case "organism": map.put( - UNIPARC_FIELDS.get(3), + UNIPARC_FIELDS.get(1), entry.getOrganisms().stream() .map(Organism::getScientificName) .collect(Collectors.joining(DELIMITER2))); break; case "organism_id": map.put( - UNIPARC_FIELDS.get(4), + UNIPARC_FIELDS.get(2), entry.getOrganisms().stream() .map(Organism::getTaxonId) .map(String::valueOf) .collect(Collectors.joining(DELIMITER2))); break; case "gene": - map.put(UNIPARC_FIELDS.get(5),String.join(DELIMITER2, entry.getGeneNames())); + map.put(UNIPARC_FIELDS.get(3),String.join(DELIMITER2, entry.getGeneNames())); break; case "protein": - map.put(UNIPARC_FIELDS.get(6),String.join(DELIMITER2, entry.getProteinNames())); + map.put(UNIPARC_FIELDS.get(4),String.join(DELIMITER2, entry.getProteinNames())); break; case "proteome": - map.put(UNIPARC_FIELDS.get(7),entry.getProteomes().stream().map(e -> e.getId()+":"+e.getComponent()).collect(Collectors.joining(DELIMITER2))); + map.put(UNIPARC_FIELDS.get(5),entry.getProteomes().stream().map(e -> e.getId()+":"+e.getComponent()).collect(Collectors.joining(DELIMITER2))); break; case "accession": - map.put(UNIPARC_FIELDS.get(8),String.join(DELIMITER2, entry.getUniProtKBAccessions())); + map.put(UNIPARC_FIELDS.get(6),String.join(DELIMITER2, entry.getUniProtKBAccessions())); break; case "first_seen": map.put( - UNIPARC_FIELDS.get(9), + UNIPARC_FIELDS.get(7), Optional.of(entry.getOldestCrossRefCreated()) .map(LocalDate::toString) .orElse("")); break; case "last_seen": map.put( - UNIPARC_FIELDS.get(10), + UNIPARC_FIELDS.get(8), Optional.of(entry.getMostRecentCrossRefUpdated()) .map(LocalDate::toString) .orElse("")); diff --git a/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcCrossReferenceMapTest.java b/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcCrossReferenceMapTest.java index 46b1d271d..69650d1fb 100644 --- a/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcCrossReferenceMapTest.java +++ b/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcCrossReferenceMapTest.java @@ -1,16 +1,17 @@ package org.uniprot.core.parser.tsv.uniparc; -import static org.junit.jupiter.api.Assertions.*; - -import java.time.LocalDate; -import java.util.*; - import org.junit.jupiter.api.Test; import org.uniprot.core.Property; import org.uniprot.core.uniparc.UniParcCrossReference; import org.uniprot.core.uniparc.UniParcDatabase; import org.uniprot.core.uniparc.impl.UniParcCrossReferenceBuilder; +import java.time.LocalDate; +import java.util.*; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + /** * @author jluo * @date: 24 Jun 2019 @@ -31,9 +32,7 @@ void testSimpleAttributeValues() { UniParcCrossReferenceMap xrefMap = new UniParcCrossReferenceMap(Collections.singletonList(xref)); Map result = xrefMap.attributeValues(); - assertEquals(13, result.size()); - assertEquals("2017-05-17", result.get("first_seen")); - assertEquals("2018-02-07", result.get("last_seen")); + assertEquals(11, result.size()); assertEquals("IDVALUE", result.get("EnsemblBacteria")); assertEquals("", result.get("gene")); assertEquals("", result.get("protein")); @@ -52,13 +51,11 @@ void testAttributeValues() { List xrefs = create(); UniParcCrossReferenceMap xrefMap = new UniParcCrossReferenceMap(xrefs); Map result = xrefMap.attributeValues(); - assertEquals(14, result.size()); + assertEquals(12, result.size()); assertEquals("geneValue", result.get("gene")); assertEquals("some pname;some pname2", result.get("protein")); assertEquals("P12345; P12347.2 (obsolete)", result.get("accession")); assertEquals("UP00000564:chromosome 1", result.get("proteome")); - assertEquals("2015-01-11", result.get("first_seen")); - assertEquals("2018-02-07", result.get("last_seen")); assertEquals("P12345", result.get("UniProtKB/Swiss-Prot")); assertEquals("P12347", result.get("UniProtKB/TrEMBL")); } @@ -72,8 +69,6 @@ void testFields() { "protein", "proteome", "accession", - "first_seen", - "last_seen", "database", "active", "ncbiGi", @@ -95,9 +90,7 @@ void testAttributeValuesWithoutDates() { List xrefs = createWithoutDates(); UniParcCrossReferenceMap xrefMap = new UniParcCrossReferenceMap(xrefs); Map result = xrefMap.attributeValues(); - assertEquals(14, result.size()); - assertTrue(result.get("first_seen").isEmpty()); - assertTrue(result.get("last_seen").isEmpty()); + assertEquals(12, result.size()); assertTrue(result.get("timeline").isEmpty()); } diff --git a/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryLightValueMapperTest.java b/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryLightValueMapperTest.java index baa554df0..e7d8b1445 100644 --- a/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryLightValueMapperTest.java +++ b/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryLightValueMapperTest.java @@ -1,7 +1,6 @@ package org.uniprot.core.parser.tsv.uniparc; import org.junit.jupiter.api.Test; -import org.uniprot.core.Location; import org.uniprot.core.Sequence; import org.uniprot.core.impl.SequenceBuilder; import org.uniprot.core.uniparc.*; @@ -10,9 +9,12 @@ import org.uniprot.core.uniprotkb.taxonomy.impl.OrganismBuilder; import java.time.LocalDate; -import java.util.*; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; class UniParcEntryLightValueMapperTest { @@ -78,16 +80,6 @@ void testGetSequenceFeature() { verify("sigId2", "PROSITE", result); } - @Test - void testGetDates() { - UniParcEntryLight entry = create(); - List fields = Arrays.asList("oldestCrossRefCreated", "mostRecentCrossRefUpdated"); - Map result = new UniParcEntryLightValueMapper().mapEntity(entry, fields); - assertEquals(2, result.size()); - verify("2017-02-12", "oldestCrossRefCreated", result); - verify("2020-10-25", "mostRecentCrossRefUpdated", result); - } - private void verify(String expected, String field, Map result) { assertEquals(expected, result.get(field)); } diff --git a/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryValueMapperTest.java b/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryValueMapperTest.java index 1bafde168..54a07bcda 100644 --- a/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryValueMapperTest.java +++ b/core-parser/src/test/java/org/uniprot/core/parser/tsv/uniparc/UniParcEntryValueMapperTest.java @@ -42,7 +42,7 @@ void testGetDataProteinGene() { UniParcEntry entry = create(); List fields = Arrays.asList("upi", "protein", "gene", "accession"); Map result = new UniParcEntryValueMapper().mapEntity(entry, fields); - assertEquals(15, result.size()); + assertEquals(13, result.size()); verify("UPI0000083A08", "upi", result); verify("some pname;some pname", "protein", result); verify("some gname", "gene", result); @@ -54,7 +54,7 @@ void testGetDate() { UniParcEntry entry = create(); List fields = Arrays.asList("upi", "first_seen", "last_seen"); Map result = new UniParcEntryValueMapper().mapEntity(entry, fields); - assertEquals(15, result.size()); + assertEquals(3, result.size()); verify("UPI0000083A08", "upi", result); verify("2017-02-12", "first_seen", result); verify("2017-04-23", "last_seen", result); @@ -88,11 +88,11 @@ void testGetSequenceFeature() { @Test void testGetDates() { UniParcEntry entry = create(); - List fields = Arrays.asList("oldestCrossRefCreated", "mostRecentCrossRefUpdated"); + List fields = Arrays.asList("first_seen", "last_seen"); Map result = new UniParcEntryValueMapper().mapEntity(entry, fields); assertEquals(2, result.size()); - verify("2017-02-12", "oldestCrossRefCreated", result); - verify("2017-04-23", "mostRecentCrossRefUpdated", result); + verify("2017-02-12", "first_seen", result); + verify("2017-04-23", "last_seen", result); } private void verify(String expected, String field, Map result) {