use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class StatementTransformationUtil method computeTargetIsoformsForProteoformAnnotation.
public static TargetIsoformSet computeTargetIsoformsForProteoformAnnotation(Statement proteoformStatement, IsoformMappingService isoformMappingService, List<Statement> subjectsForThisProteoform, boolean isIsoSpecific, String isoSpecificAccession, List<String> isoformAccessions) {
List<String> isoformsToBeConsidered = new ArrayList<>();
if (isIsoSpecific) {
isoformsToBeConsidered.add(isoSpecificAccession);
} else {
isoformsToBeConsidered.addAll(isoformAccessions);
}
Set<TargetIsoformStatementPosition> result = new TreeSet<>();
for (String isoformAccession : isoformsToBeConsidered) {
String name = null;
boolean allOk = true;
for (Statement s : subjectsForThisProteoform) {
TargetIsoformSet targetIsoforms = TargetIsoformSet.deSerializeFromJsonString(s.getValue(StatementField.TARGET_ISOFORMS));
List<TargetIsoformStatementPosition> targetIsoformsFiltered = targetIsoforms.stream().filter(ti -> ti.getIsoformAccession().equals(isoformAccession)).collect(Collectors.toList());
if (targetIsoformsFiltered.isEmpty()) {
LOGGER.debug("(skip) Could not map to isoform " + isoformAccession);
allOk = false;
break;
} else if (targetIsoformsFiltered.size() > 1) {
throw new NextProtException("Something got wrong. Found more than one target isoform for same accession" + isoformAccession);
}
TargetIsoformStatementPosition tisp = targetIsoformsFiltered.iterator().next();
if (name == null) {
name = tisp.getName();
} else {
name += (" + " + tisp.getName());
}
}
if (name != null && allOk) {
if (isIsoSpecific) {
result.add(new TargetIsoformStatementPosition(isoformAccession, IsoTargetSpecificity.SPECIFIC.name(), name));
} else {
result.add(new TargetIsoformStatementPosition(isoformAccession, IsoTargetSpecificity.UNKNOWN.name(), name));
}
}
}
return new TargetIsoformSet(result);
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class SequenceVariantTest method mockIsoform.
public static Isoform mockIsoform(String accession, String name, boolean canonical, String sequence) {
Isoform isoform = mockIsoform(accession, name, canonical);
when(isoform.getSequence()).thenReturn(sequence);
return isoform;
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class SequenceVariantTest method testFormatIsoformSpecifiqueFeatureTypeIso.
@Test
public void testFormatIsoformSpecifiqueFeatureTypeIso() throws Exception {
SequenceVariant variant = new SequenceVariant("SCN11A-p.Leu1158Pro");
Isoform iso = mockIsoform("whatever", "Iso 1", true);
Assert.assertEquals("iso1", variant.formatIsoformFeatureName(iso));
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class SequenceVariantTest method testIsospecFeature.
@Test
public void testIsospecFeature() throws Exception {
SequenceVariant variant = new SequenceVariant("WT1-p.Phe154Ser");
Isoform isoform = mockIsoform("NX_P19544", "Iso 1", true);
Assert.assertEquals("WT1-iso1-p.Phe154Ser", variant.formatIsoSpecificFeature(isoform, 154, 154));
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class SequenceVariantTest method testFormatIsoformSpecifiqueFeatureTypeNonIso.
@Test
public void testFormatIsoformSpecifiqueFeatureTypeNonIso() throws Exception {
SequenceVariant variant = new SequenceVariant("ABL1-p.Ser439Gly");
Isoform iso = mockIsoform("whatever", "IA", true);
Assert.assertEquals("isoIA", variant.formatIsoformFeatureName(iso));
}
Aggregations