Search in sources :

Example 1 with TargetIsoformSet

use of org.nextprot.commons.statements.TargetIsoformSet in project nextprot-api by calipho-sib.

the class EntryAnnotationBuilderTest method shouldReturnOneSingleAnnotationIfTheInfoIsTheSameAndItIsComingFromDifferentSources.

@Test
public void shouldReturnOneSingleAnnotationIfTheInfoIsTheSameAndItIsComingFromDifferentSources() {
    Statement sb1 = StatementBuilder.createNew().addCompulsaryFields("NX_P01308", "NX_P01308", "go-cellular-component", QualityQualifier.GOLD).addCvTerm("go-xxx", "nucleus", "go-cellular-component-cv").addField(StatementField.REFERENCE_DATABASE, "PubMed").addField(StatementField.REFERENCE_ACCESSION, "123").addTargetIsoformsField(new TargetIsoformSet()).addField(StatementField.EVIDENCE_CODE, "ECO:00001").addField(StatementField.ASSIGNED_BY, "TUTU").addSourceInfo("CAVA-VP0920190912", "BioEditor").buildWithAnnotationHash(AnnotationType.ENTRY);
    Statement sb2 = StatementBuilder.createNew().addCompulsaryFields("NX_P01308", "NX_P01308", "go-cellular-component", QualityQualifier.GOLD).addField(StatementField.REFERENCE_DATABASE, "PubMed").addField(StatementField.REFERENCE_ACCESSION, "123").addTargetIsoformsField(new TargetIsoformSet()).addCvTerm("go-xxx", "nucleus", "go-cellular-component-cv").addField(StatementField.EVIDENCE_CODE, "ECO:00001").addField(StatementField.ASSIGNED_BY, "TOTO").addSourceInfo("HPA2222", "HPA").buildWithAnnotationHash(AnnotationType.ENTRY);
    List<Statement> statements = Arrays.asList(sb1, sb2);
    Annotation annotation = newAnnotationBuilder().buildAnnotation("NX_P01308", statements);
    Assert.assertEquals(annotation.getAPICategory(), AnnotationCategory.GO_CELLULAR_COMPONENT);
    Assert.assertEquals(annotation.getEvidences().size(), 2);
    Assert.assertEquals(annotation.getEvidences().get(0).getEvidenceCodeName(), "eco-name-1");
}
Also used : Statement(org.nextprot.commons.statements.Statement) TargetIsoformSet(org.nextprot.commons.statements.TargetIsoformSet) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 2 with TargetIsoformSet

use of org.nextprot.commons.statements.TargetIsoformSet in project nextprot-api by calipho-sib.

the class TargetIsoformSerializerTest method serializeToJsonString.

@Test
public void serializeToJsonString() {
    TargetIsoformStatementPosition tis = new TargetIsoformStatementPosition("iso-1", 6, 7, IsoTargetSpecificity.BY_DEFAULT.name(), null);
    String json = new TargetIsoformSet(new HashSet<>(Arrays.asList(tis))).serializeToJsonString();
    Set<TargetIsoformStatementPosition> tis2 = TargetIsoformSet.deSerializeFromJsonString(json);
    Assert.assertEquals(tis2.iterator().next().getBegin(), Integer.valueOf(6));
    Assert.assertEquals(tis2.iterator().next().getEnd(), Integer.valueOf(7));
}
Also used : TargetIsoformSet(org.nextprot.commons.statements.TargetIsoformSet) TargetIsoformStatementPosition(org.nextprot.commons.statements.TargetIsoformStatementPosition) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with TargetIsoformSet

use of org.nextprot.commons.statements.TargetIsoformSet in project nextprot-api by calipho-sib.

the class EntryAnnotationBuilderTest method shouldReturnCorrectEcoName.

@Test
public void shouldReturnCorrectEcoName() {
    Statement sb1 = StatementBuilder.createNew().addCompulsaryFields("NX_P01308", "NX_P01308-1", "go-cellular-component", QualityQualifier.GOLD).addField(StatementField.EVIDENCE_CODE, "ECO:00001").addField(StatementField.REFERENCE_DATABASE, "PubMed").addField(StatementField.REFERENCE_ACCESSION, "123").addTargetIsoformsField(new TargetIsoformSet()).buildWithAnnotationHash(AnnotationType.ENTRY);
    List<Statement> statements = Arrays.asList(sb1);
    Annotation annotation = newAnnotationBuilder().buildAnnotation("NX_P01308-1", statements);
    Assert.assertEquals(annotation.getAPICategory(), AnnotationCategory.GO_CELLULAR_COMPONENT);
    Assert.assertEquals(annotation.getEvidences().size(), 1);
    Assert.assertEquals("eco-name-1", annotation.getEvidences().get(0).getEvidenceCodeName());
}
Also used : Statement(org.nextprot.commons.statements.Statement) TargetIsoformSet(org.nextprot.commons.statements.TargetIsoformSet) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 4 with TargetIsoformSet

use of org.nextprot.commons.statements.TargetIsoformSet in project nextprot-api by calipho-sib.

the class EntryAnnotationBuilderTest method shouldReturnAnExceptionIf2AnnotationsAreExpectedInsteadOfOne.

@Test(expected = NextProtException.class)
public void shouldReturnAnExceptionIf2AnnotationsAreExpectedInsteadOfOne() {
    Statement sb1 = StatementBuilder.createNew().addCompulsaryFields("NX_P01308", "NX_P01308", "go-cellular-component", QualityQualifier.GOLD).addField(StatementField.REFERENCE_DATABASE, "PubMed").addField(StatementField.REFERENCE_ACCESSION, "123").addTargetIsoformsField(new TargetIsoformSet()).buildWithAnnotationHash(AnnotationType.ENTRY);
    Statement sb2 = StatementBuilder.createNew().addCompulsaryFields("NX_P99999", "NX_P99999", "go-cellular-component", QualityQualifier.GOLD).addField(StatementField.REFERENCE_DATABASE, "PubMed").addField(StatementField.REFERENCE_ACCESSION, "123").addTargetIsoformsField(new TargetIsoformSet()).buildWithAnnotationHash(AnnotationType.ENTRY);
    List<Statement> statements = Arrays.asList(sb1, sb2);
    newAnnotationBuilder().buildAnnotation("NX_P01308", statements);
}
Also used : Statement(org.nextprot.commons.statements.Statement) TargetIsoformSet(org.nextprot.commons.statements.TargetIsoformSet) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 TargetIsoformSet (org.nextprot.commons.statements.TargetIsoformSet)4 Statement (org.nextprot.commons.statements.Statement)3 Annotation (org.nextprot.api.core.domain.annotation.Annotation)2 HashSet (java.util.HashSet)1 TargetIsoformStatementPosition (org.nextprot.commons.statements.TargetIsoformStatementPosition)1