diff --git a/core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParser.java b/core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcEntryLightFastaParser.java similarity index 65% rename from core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParser.java rename to core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcEntryLightFastaParser.java index 898752dda..36d76b553 100644 --- a/core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParser.java +++ b/core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcEntryLightFastaParser.java @@ -1,8 +1,6 @@ -package org.uniprot.core.parser.fasta; +package org.uniprot.core.parser.fasta.uniparc; import org.uniprot.core.Sequence; -import org.uniprot.core.uniparc.UniParcCrossReference; -import org.uniprot.core.uniparc.UniParcEntry; import org.uniprot.core.uniparc.UniParcEntryLight; import static org.uniprot.core.uniparc.impl.UniParcEntryLightBuilder.HAS_ACTIVE_CROSS_REF; @@ -11,19 +9,8 @@ * @author jluo * @date: 24 Jun 2019 */ -public class UniParcFastaParser { - private UniParcFastaParser(){} - - public static String toFasta(UniParcEntry entry) { - String status = "active"; - boolean isActive = entry.getUniParcCrossReferences() - .stream() - .anyMatch(UniParcCrossReference::isActive); - if (!isActive) { - status = "inactive"; - } - return getFastaString(entry.getUniParcId().getValue(), status, entry.getSequence()); - } +public class UniParcEntryLightFastaParser { + private UniParcEntryLightFastaParser(){} public static String toFasta(UniParcEntryLight entry) { String status = "active"; diff --git a/core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcProteomeFastaParser.java b/core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcProteomeFastaParser.java index 25025789d..d8863d473 100644 --- a/core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcProteomeFastaParser.java +++ b/core-parser/src/main/java/org/uniprot/core/parser/fasta/uniparc/UniParcProteomeFastaParser.java @@ -110,7 +110,7 @@ private static StringBuilder getFastaHeader(List xrefs, b if(!sourceIds.isEmpty()){ sb.append(" SS=").append(String.join("|", sourceIds)); } - sb.append(" UP=").append(proteomeId); + sb.append(" PC=").append(proteomeId); if(!component.isEmpty()){ sb.append(":").append(String.join("|", component)); } diff --git a/core-parser/src/test/java/org/uniprot/core/parser/fasta/UniParcFastaParserTest.java b/core-parser/src/test/java/org/uniprot/core/parser/fasta/UniParcFastaParserTest.java deleted file mode 100644 index 9b14a50f7..000000000 --- a/core-parser/src/test/java/org/uniprot/core/parser/fasta/UniParcFastaParserTest.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.uniprot.core.parser.fasta; - -import org.junit.jupiter.api.Test; -import org.uniprot.core.Property; -import org.uniprot.core.Sequence; -import org.uniprot.core.impl.SequenceBuilder; -import org.uniprot.core.uniparc.*; -import org.uniprot.core.uniparc.impl.*; -import org.uniprot.core.uniprotkb.taxonomy.Organism; -import org.uniprot.core.uniprotkb.taxonomy.impl.OrganismBuilder; - -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.uniprot.core.uniparc.impl.UniParcEntryLightBuilder.HAS_ACTIVE_CROSS_REF; - -/** - * @author jluo - * @date: 24 Jun 2019 - */ -class UniParcFastaParserTest { - - public static final String EXPECTED_FASTA_RESULT = """ - >UPI0000083A08 status=active - MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT - LLRAIDWFRDNGYFNA"""; - public static final String EXPECTED_FASTA_RESULT_INACTIVE = """ - >UPI0000083A08 status=inactive - MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT - LLRAIDWFRDNGYFNA"""; - @Test - void testUniParcEntryToFasta() { - UniParcEntry entry = create(); - String fasta = UniParcFastaParser.toFasta(entry); - assertEquals(EXPECTED_FASTA_RESULT, fasta); - } - - @Test - void testUniParcEntryLightToFasta() { - UniParcEntryLight entry = createEntryLight(); - String fasta = UniParcFastaParser.toFasta(entry); - assertEquals(EXPECTED_FASTA_RESULT, fasta); - } - - @Test - void testUniParcEntryLightToFastaInactive() { - UniParcEntryLight entry = createEntryLight(); - entry = UniParcEntryLightBuilder.from(entry).extraAttributesAdd(HAS_ACTIVE_CROSS_REF, false).build(); - String fasta = UniParcFastaParser.toFasta(entry); - assertEquals(EXPECTED_FASTA_RESULT_INACTIVE, fasta); - } - - private UniParcEntry create() { - Sequence sequence = getSequence(); - List xrefs = getXrefs(); - List seqFeatures = getSeqFeatures(); - UniParcEntry entry = - new UniParcEntryBuilder() - .uniParcId(new UniParcIdBuilder("UPI0000083A08").build()) - .uniParcCrossReferencesSet(xrefs) - .sequence(sequence) - .sequenceFeaturesSet(seqFeatures) - .build(); - return entry; - } - - private UniParcEntryLight createEntryLight() { - return new UniParcEntryLightBuilder() - .uniParcId("UPI0000083A08") - .sequence(getSequence()) - .build(); - } - - private static Sequence getSequence() { - String seq = - "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT" + "LLRAIDWFRDNGYFNA"; - Sequence sequence = new SequenceBuilder(seq).build(); - return sequence; - } - - private List getSeqFeatures() { - List locations = Arrays.asList(new SequenceFeatureLocationBuilder().range(12, 23).alignment("55M").build(), new SequenceFeatureLocationBuilder().range(45, 89).build()); - InterProGroup domain = new InterProGroupBuilder().name("name1").id("id1").build(); - SequenceFeature sf = - new SequenceFeatureBuilder() - .interproGroup(domain) - .signatureDbType(SignatureDbType.PFAM) - .signatureDbId("sigId2") - .locationsSet(locations) - .build(); - SequenceFeature sf3 = - SequenceFeatureBuilder.from(sf).signatureDbType(SignatureDbType.PROSITE).build(); - return Arrays.asList(sf, sf3); - } - - private List getXrefs() { - Organism taxonomy = - new OrganismBuilder().taxonId(9606).scientificName("Homo sapiens").build(); - List properties = new ArrayList<>(); - properties.add(new Property("prop1", "pvalue")); - UniParcCrossReference xref = - new UniParcCrossReferenceBuilder() - .versionI(3) - .database(UniParcDatabase.SWISSPROT) - .id("P12345") - .version(7) - .active(true) - .created(LocalDate.of(2017, 5, 17)) - .lastUpdated(LocalDate.of(2017, 2, 27)) - .propertiesSet(properties) - .organism(taxonomy) - .proteinName("some pname") - .geneName("some gname") - .build(); - - List properties2 = new ArrayList<>(); - properties.add(new Property("prop2", "pvalue2")); - Organism taxonomy2 = new OrganismBuilder().taxonId(10090).scientificName("MOUSE").build(); - - UniParcCrossReference xref2 = - new UniParcCrossReferenceBuilder() - .versionI(1) - .database(UniParcDatabase.TREMBL) - .id("P52346") - .version(7) - .active(true) - .created(LocalDate.of(2017, 2, 12)) - .lastUpdated(LocalDate.of(2017, 4, 23)) - .propertiesSet(properties2) - .organism(taxonomy2) - .proteinName("some pname") - .proteomeId("UP00000564") - .component("chromosome 1") - .build(); - - return Arrays.asList(xref, xref2); - } -} diff --git a/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcEntryLightFastaParserTest.java b/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcEntryLightFastaParserTest.java new file mode 100644 index 000000000..0efdeb8a4 --- /dev/null +++ b/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcEntryLightFastaParserTest.java @@ -0,0 +1,49 @@ +package org.uniprot.core.parser.fasta.uniparc; + +import static org.junit.jupiter.api.Assertions.*; +import static org.uniprot.core.parser.fasta.uniparc.UniParcFastaParserTestUtils.*; +import static org.uniprot.core.uniparc.impl.UniParcEntryLightBuilder.HAS_ACTIVE_CROSS_REF; + +import org.junit.jupiter.api.Test; +import org.uniprot.core.uniparc.*; +import org.uniprot.core.uniparc.impl.UniParcEntryLightBuilder; + +/** + * @author jluo + * @date: 24 Jun 2019 + */ +class UniParcEntryLightFastaParserTest { + + public static final String EXPECTED_FASTA_RESULT = """ + >UPI0000083A08 status=active + MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT + LLRAIDWFRDNGYFNA"""; + public static final String EXPECTED_FASTA_RESULT_INACTIVE = """ + >UPI0000083A08 status=inactive + MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT + LLRAIDWFRDNGYFNA"""; + + + @Test + void testUniParcEntryLightToFasta() { + UniParcEntryLight entry = createEntryLight(); + String fasta = UniParcEntryLightFastaParser.toFasta(entry); + assertEquals(EXPECTED_FASTA_RESULT, fasta); + } + + @Test + void testUniParcEntryLightToFastaInactive() { + UniParcEntryLight entry = createEntryLight(); + entry = UniParcEntryLightBuilder.from(entry).extraAttributesAdd(HAS_ACTIVE_CROSS_REF, false).build(); + String fasta = UniParcEntryLightFastaParser.toFasta(entry); + assertEquals(EXPECTED_FASTA_RESULT_INACTIVE, fasta); + } + + private UniParcEntryLight createEntryLight() { + return new UniParcEntryLightBuilder() + .uniParcId("UPI0000083A08") + .sequence(getSequence()) + .build(); + } + +} diff --git a/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParserTest.java b/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParserTest.java deleted file mode 100644 index dd48848fc..000000000 --- a/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParserTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.uniprot.core.parser.fasta.uniparc; - -import static org.junit.jupiter.api.Assertions.*; -import static org.uniprot.core.parser.fasta.uniparc.UniParcFastaParserTestUtils.*; - -import org.junit.jupiter.api.Test; -import org.uniprot.core.parser.fasta.UniParcFastaParser; -import org.uniprot.core.uniparc.*; -import org.uniprot.core.uniparc.impl.UniParcEntryBuilder; -import org.uniprot.core.uniparc.impl.UniParcIdBuilder; - -/** - * @author jluo - * @date: 24 Jun 2019 - */ -class UniParcFastaParserTest { - - @Test - void testToFastaActive() { - UniParcEntry entry = create(); - String fasta = UniParcFastaParser.toFasta(entry); - String expected = - ">UPI0000083A08 status=active\n" - + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" - + "LLRAIDWFRDNGYFNA"; - assertEquals(expected, fasta); - } - - @Test - void testToFastaInactive() { - UniParcEntry entry = - new UniParcEntryBuilder() - .uniParcId(new UniParcIdBuilder("UPI0000083A08").build()) - .uniParcCrossReferencesSet(getUniProtXrefs(false)) - .sequence(getSequence()) - .build(); - String fasta = UniParcFastaParser.toFasta(entry); - String expected = - ">UPI0000083A08 status=inactive\n" - + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" - + "LLRAIDWFRDNGYFNA"; - assertEquals(expected, fasta); - } - -} diff --git a/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParserTestUtils.java b/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParserTestUtils.java index 32ad2428d..fa410e84e 100644 --- a/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParserTestUtils.java +++ b/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcFastaParserTestUtils.java @@ -1,5 +1,6 @@ package org.uniprot.core.parser.fasta.uniparc; +import org.uniprot.core.Property; import org.uniprot.core.Sequence; import org.uniprot.core.impl.SequenceBuilder; import org.uniprot.core.uniparc.*; @@ -33,7 +34,7 @@ static List getUniProtXrefs(boolean active) { List result = new ArrayList<>(); Organism human = getOrganism(9606, "Homo sapiens"); - result.add(getXref(UniParcDatabase.SWISSPROT, "P12345", active, human, null, null, "Protein Name One", "Gene Name One")); + result.add(getXref(UniParcDatabase.SWISSPROT, "P12345", active, human, null, null, "Protein Name One", "Gene Name One", new Property(UniParcCrossReference.PROPERTY_SOURCES, "ABC01415:UP000005640:Chromosome 1"))); return result; } @@ -47,10 +48,14 @@ static UniParcCrossReference getXref(UniParcDatabase database, String id, boolea } static UniParcCrossReference getXref(UniParcDatabase database, String id, boolean active, Organism organism, String proteomeId, String component) { - return getXref(database,id, active, organism, proteomeId, component, null, null); + return getXref(database,id, active, organism, proteomeId, component, null, null,null); } - static UniParcCrossReference getXref(UniParcDatabase database, String id, boolean active, Organism organism, String proteomeId, String component, String proteinName, String geneName) { + static UniParcCrossReference getXref(UniParcDatabase database, String id, boolean active, Organism organism, String geneName, String proteinName, Property property) { + return getXref(database,id, active, organism, null, null, proteinName, geneName, property); + } + + static UniParcCrossReference getXref(UniParcDatabase database, String id, boolean active, Organism organism, String proteomeId, String component, String proteinName, String geneName, Property property) { return new UniParcCrossReferenceBuilder() .database(database) .id(id) @@ -60,6 +65,7 @@ static UniParcCrossReference getXref(UniParcDatabase database, String id, boolea .geneName(geneName) .proteomeId(proteomeId) .component(component) + .propertiesAdd(property) .build(); } } diff --git a/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcProteomeFastaParserTest.java b/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcProteomeFastaParserTest.java index b9a115d32..a51686d1e 100644 --- a/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcProteomeFastaParserTest.java +++ b/core-parser/src/test/java/org/uniprot/core/parser/fasta/uniparc/UniParcProteomeFastaParserTest.java @@ -1,6 +1,7 @@ package org.uniprot.core.parser.fasta.uniparc; 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.UniParcEntry; @@ -17,12 +18,16 @@ class UniParcProteomeFastaParserTest { + private static final Property source1 = new Property(UniParcCrossReference.PROPERTY_SOURCES, "ABC01416:UP000005640:Chromosome 1"); + private static final Property source2 = new Property(UniParcCrossReference.PROPERTY_SOURCES, "ABC01417:UP000005640:Chromosome 2"); + private static final Organism humanOrganism = getOrganism(9606L, "Homo Sapiens"); + @Test void toFastaFullSingleValues() { UniParcEntry entry = create(); String fasta = UniParcProteomeFastaParser.toFasta(entry); String expected = - ">UPI0000083A08|EMBL:CQR81549 UP=UP000005640:Chromosome 1 OX=9606 OS=Homo Sapiens AC=P12345\n" + + ">UPI0000083A08 Protein Name One OS=Homo sapiens OX=9606 GN=Gene Name One AC=P12345 SS=ABC01415 PC=UP000005640:Chromosome 1\n" + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" + "LLRAIDWFRDNGYFNA"; assertEquals(expected, fasta); @@ -33,10 +38,9 @@ void toFastaFullMultiValues() { String proteomeId = "UP000005640"; Organism organism = getOrganism(9606L, "Homo Sapiens"); List xrefs = new ArrayList<>(); - xrefs.add(getXref(UniParcDatabase.SWISSPROT, "P21802", true, organism, null, null, "Protein Name 1", "Gene Name1")); - xrefs.add(getXref(UniParcDatabase.TREMBL, "P12345", true, organism, null, null, "Protein Name 2", "Gene Name2")); + xrefs.add(getXref(UniParcDatabase.SWISSPROT, "P21802", true, organism, null, null, "Protein Name 1", "Gene Name1", source1 )); + xrefs.add(getXref(UniParcDatabase.TREMBL, "P12345", true, organism, null, null, "Protein Name 2", "Gene Name2", source2)); xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, organism, proteomeId, "C1")); - xrefs.add(getXref(UniParcDatabase.EMBL_TPA, "XP54321", true, organism, proteomeId, "C2")); UniParcEntry entry = new UniParcEntryBuilder() .uniParcId(new UniParcIdBuilder("UPI0000083A09").build()) .uniParcCrossReferencesSet(xrefs) @@ -44,18 +48,19 @@ void toFastaFullMultiValues() { .build(); String fasta = UniParcProteomeFastaParser.toFasta(entry); String expected = - ">UPI0000083A09|EMBL_CON:XP12345|EMBL_TPA:XP54321 UP=UP000005640:C1|C2 OX=9606 OS=Homo Sapiens AC=P21802|P12345\n" + + ">UPI0000083A09 Protein Name 1|Protein Name 2 OS=Homo Sapiens OX=9606 GN=Gene Name1|Gene Name2 AC=P21802|P12345 SS=ABC01416|ABC01417 PC=UP000005640:Chromosome 1|Chromosome 2\n" + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" + "LLRAIDWFRDNGYFNA"; assertEquals(expected, fasta); } @Test - void toFastaWithoutAccessions() { + void toFastaFullAccessionActiveOnly() { String proteomeId = "UP000005640"; Organism organism = getOrganism(9606L, "Homo Sapiens"); List xrefs = new ArrayList<>(); - xrefs.add(getXref(UniParcDatabase.SWISSPROT_VARSPLIC, "P21802-1", true, organism)); + xrefs.add(getXref(UniParcDatabase.SWISSPROT, "P21802", true, organism, null, null, "Protein Name 1", "Gene Name1", source1 )); + xrefs.add(getXref(UniParcDatabase.TREMBL, "P12345", false, organism, null, null, "Protein Name 2", "Gene Name2", source2)); xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, organism, proteomeId, "C1")); UniParcEntry entry = new UniParcEntryBuilder() .uniParcId(new UniParcIdBuilder("UPI0000083A09").build()) @@ -64,18 +69,17 @@ void toFastaWithoutAccessions() { .build(); String fasta = UniParcProteomeFastaParser.toFasta(entry); String expected = - ">UPI0000083A09|EMBL_CON:XP12345 UP=UP000005640:C1 OX=9606 OS=Homo Sapiens\n" + + ">UPI0000083A09 Protein Name 1 OS=Homo Sapiens OX=9606 GN=Gene Name1 AC=P21802 SS=ABC01416 PC=UP000005640:Chromosome 1\n" + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" + "LLRAIDWFRDNGYFNA"; assertEquals(expected, fasta); } @Test - void toFastaWithoutComponent() { + void toFastaWithoutAccessions() { String proteomeId = "UP000005640"; - Organism organism = getOrganism(9606L, "Homo Sapiens"); List xrefs = new ArrayList<>(); - xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, organism, proteomeId, null)); + xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, humanOrganism, proteomeId, "C1")); UniParcEntry entry = new UniParcEntryBuilder() .uniParcId(new UniParcIdBuilder("UPI0000083A09").build()) .uniParcCrossReferencesSet(xrefs) @@ -83,17 +87,17 @@ void toFastaWithoutComponent() { .build(); String fasta = UniParcProteomeFastaParser.toFasta(entry); String expected = - ">UPI0000083A09|EMBL_CON:XP12345 UP=UP000005640 OX=9606 OS=Homo Sapiens\n" + + ">UPI0000083A09 OS=Homo Sapiens OX=9606 SS=XP12345 PC=UP000005640:C1\n" + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" + "LLRAIDWFRDNGYFNA"; assertEquals(expected, fasta); } @Test - void toFastaWithoutOrganism() { + void toFastaWithoutComponent() { String proteomeId = "UP000005640"; List xrefs = new ArrayList<>(); - xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, null, proteomeId, "C8")); + xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, humanOrganism, proteomeId, null)); UniParcEntry entry = new UniParcEntryBuilder() .uniParcId(new UniParcIdBuilder("UPI0000083A09").build()) .uniParcCrossReferencesSet(xrefs) @@ -101,17 +105,17 @@ void toFastaWithoutOrganism() { .build(); String fasta = UniParcProteomeFastaParser.toFasta(entry); String expected = - ">UPI0000083A09|EMBL_CON:XP12345 UP=UP000005640:C8\n" + + ">UPI0000083A09 OS=Homo Sapiens OX=9606 SS=XP12345 PC=UP000005640\n" + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" + "LLRAIDWFRDNGYFNA"; assertEquals(expected, fasta); } @Test - void toFastaWithoutSource() { + void toFastaWithoutOrganism() { String proteomeId = "UP000005640"; List xrefs = new ArrayList<>(); - xrefs.add(getXref(UniParcDatabase.PDB, "PDB12345", true, null, proteomeId, "C9")); + xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, null, proteomeId, "C8")); UniParcEntry entry = new UniParcEntryBuilder() .uniParcId(new UniParcIdBuilder("UPI0000083A09").build()) .uniParcCrossReferencesSet(xrefs) @@ -119,17 +123,17 @@ void toFastaWithoutSource() { .build(); String fasta = UniParcProteomeFastaParser.toFasta(entry); String expected = - ">UPI0000083A09 UP=UP000005640:C9\n" + + ">UPI0000083A09 SS=XP12345 PC=UP000005640:C8\n" + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" + "LLRAIDWFRDNGYFNA"; assertEquals(expected, fasta); } @Test - void toFastaFilterInactiveSources() { + void toFastaActiveOnlySources() { String proteomeId = "UP000005640"; List xrefs = new ArrayList<>(); - xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, null, proteomeId, "C5")); + xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP12345", true, humanOrganism, proteomeId, "C5")); xrefs.add(getXref(UniParcDatabase.EMBL_CON, "XP54321", false, null, proteomeId, "C3")); UniParcEntry entry = new UniParcEntryBuilder() .uniParcId(new UniParcIdBuilder("UPI0000083A09").build()) @@ -138,7 +142,7 @@ void toFastaFilterInactiveSources() { .build(); String fasta = UniParcProteomeFastaParser.toFasta(entry); String expected = - ">UPI0000083A09|EMBL_CON:XP12345 UP=UP000005640:C5\n" + + ">UPI0000083A09 OS=Homo Sapiens OX=9606 SS=XP12345 PC=UP000005640:C5\n" + "MSMAMARALATLGRLRYRVSGQLPLLDETAIEVMAGGQFLDGRKAREELGFFSTTALDDT\n" + "LLRAIDWFRDNGYFNA"; assertEquals(expected, fasta);