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");
}
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));
}
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());
}
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);
}
Aggregations