Search in sources :

Example 1 with TargetIsoformStatementPosition

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

the class StatementETLServiceUnitTest method shouldComputeCorrectTargetIsoformsForVariants.

@Test
public void shouldComputeCorrectTargetIsoformsForVariants() throws Exception {
    Set<Statement> subjectStatements = new HashSet<>(Arrays.asList(StatementBuilder.createNew().addField(StatementField.ENTRY_ACCESSION, "NX_Q15858").addField(StatementField.ANNOTATION_NAME, "SCN9A-iso3-p.Ile848Thr").build()));
    List<Statement> variantOnEntry = StatementTransformationUtil.getPropagatedStatementsForEntry(isoformMappingServiceMocked, subjectStatements, "NX_Q15858");
    // It should return only one statement with target isoforms
    Assert.assertTrue(variantOnEntry.size() == 1);
    String targetIsoformsString = variantOnEntry.iterator().next().getValue(StatementField.TARGET_ISOFORMS);
    Set<TargetIsoformStatementPosition> targetIsoforms = TargetIsoformSet.deSerializeFromJsonString(targetIsoformsString);
    Assert.assertEquals(targetIsoforms.size(), 4);
    TargetIsoformStatementPosition pos1 = targetIsoforms.stream().filter(ti -> ti.getIsoformAccession().equals("NX_Q15858-1")).collect(Collectors.toList()).get(0);
    Assert.assertTrue(pos1.getBegin().equals(859));
    Assert.assertTrue(pos1.getName().equals("SCN9A-iso1-p.Ile859Thr"));
}
Also used : Statement(org.nextprot.commons.statements.Statement) TargetIsoformStatementPosition(org.nextprot.commons.statements.TargetIsoformStatementPosition) HashSet(java.util.HashSet) Test(org.junit.Test) StatementETLBaseUnitTest(org.nextprot.api.etl.statement.StatementETLBaseUnitTest)

Example 2 with TargetIsoformStatementPosition

use of org.nextprot.commons.statements.TargetIsoformStatementPosition 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 TargetIsoformStatementPosition

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

the class StatementEntryAnnotationBuilder method setIsoformTargeting.

@Override
void setIsoformTargeting(Annotation annotation, Statement statement) {
    List<AnnotationIsoformSpecificity> targetingIsoforms = new ArrayList<AnnotationIsoformSpecificity>();
    Set<TargetIsoformStatementPosition> tispSet = TargetIsoformSet.deSerializeFromJsonString(statement.getValue(StatementField.TARGET_ISOFORMS));
    for (TargetIsoformStatementPosition tisp : tispSet) {
        AnnotationIsoformSpecificity ais = new AnnotationIsoformSpecificity();
        String isoAc = tisp.getIsoformAccession();
        ais.setIsoformAccession(isoAc);
        ais.setFirstPosition(tisp.getBegin());
        ais.setLastPosition(tisp.getEnd());
        ais.setSpecificity(tisp.getSpecificity());
        ais.setName(tisp.getName());
        targetingIsoforms.add(ais);
    }
    annotation.addTargetingIsoforms(targetingIsoforms);
}
Also used : ArrayList(java.util.ArrayList) AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) TargetIsoformStatementPosition(org.nextprot.commons.statements.TargetIsoformStatementPosition)

Aggregations

TargetIsoformStatementPosition (org.nextprot.commons.statements.TargetIsoformStatementPosition)3 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 AnnotationIsoformSpecificity (org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity)1 StatementETLBaseUnitTest (org.nextprot.api.etl.statement.StatementETLBaseUnitTest)1 Statement (org.nextprot.commons.statements.Statement)1 TargetIsoformSet (org.nextprot.commons.statements.TargetIsoformSet)1