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

tsv changes #243

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -1,6 +1,7 @@
package org.uniprot.core.parser.tsv.uniparc;

import org.uniprot.core.parser.tsv.EntityValueMapper;
import org.uniprot.core.uniparc.CommonOrganism;
import org.uniprot.core.uniparc.UniParcEntryLight;
import org.uniprot.core.uniprotkb.taxonomy.Organism;

Expand All @@ -19,7 +20,8 @@ public class UniParcEntryLightValueMapper implements EntityValueMapper<UniParcEn
"proteome",
"accession",
"first_seen",
"last_seen");
"last_seen",
"common_taxons");
private static final String DELIMITER2 = "; ";

@Override
Expand Down Expand Up @@ -93,6 +95,13 @@ private Map<String, String> getSimpleAttributeValues(UniParcEntryLight entry, Li
.map(LocalDate::toString)
.orElse(""));
break;
case "common_taxons":
map.put(
UNIPARC_FIELDS.get(9),
Optional.of(entry.getCommonTaxons())
.map(ct -> ct.stream().map(CommonOrganism::getCommonTaxon).collect(Collectors.joining("; ")))
.orElse(""));
break;
supun-ebi marked this conversation as resolved.
Show resolved Hide resolved
default:
// do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class UniParcEntryLightValueMapperTest {
@Test
void testGetDataOrganism() {
UniParcEntryLight entry = create();
List<String> fields = Arrays.asList("upi", "organism", "organism_id", "proteome");
List<String> fields = Arrays.asList("upi", "organism", "organism_id", "proteome", "common_taxons");

Map<String, String> result = new UniParcEntryLightValueMapper().mapEntity(entry, fields);

Expand All @@ -30,6 +30,7 @@ void testGetDataOrganism() {
verify("Homo sapiens; MOUSE", "organism", result);
verify("9606; 10090", "organism_id", result);
verify("UP000005640:C1; UP000002494:C2", "proteome", result);
verify("Bacteroides; Enterococcus", "common_taxons", result);
}

@Test
supun-ebi marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -95,6 +96,7 @@ private UniParcEntryLight create() {

LinkedHashSet<String> proteinNames = new LinkedHashSet<>(List.of("protein1", "protein2"));
LinkedHashSet<String> geneNames = new LinkedHashSet<>(List.of("gene1", "gene2"));
List<CommonOrganism> commonTaxons = List.of(new CommonOrganismBuilder().commonTaxon("Bacteroides").build(),new CommonOrganismBuilder().commonTaxon("Enterococcus").build());
LinkedHashSet<Proteome> proteomes = new LinkedHashSet<>(List.of(new ProteomeBuilder().id("UP000005640").component("C1").build(), new ProteomeBuilder().id("UP000002494").component("C2").build()));

return new UniParcEntryLightBuilder()
Expand All @@ -103,6 +105,7 @@ private UniParcEntryLight create() {
.organismsSet(organisms)
.proteomesSet(proteomes)
.geneNamesSet(geneNames)
.commonTaxonsSet(commonTaxons)
.proteinNamesSet(proteinNames)
.mostRecentCrossRefUpdated(LocalDate.of(2020, 10, 25))
.oldestCrossRefCreated(LocalDate.of(2017, 2, 12))
Expand Down
Loading