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