use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class IsoformSequencePositionMapperIntegrationTest method getExpectedPosForEachIsoform.
private Map<String, Integer> getExpectedPosForEachIsoform(Entry entry, Annotation a) {
Map<String, Integer> isoExpectedPos = new HashMap<String, Integer>();
for (Isoform isoform : entry.getIsoforms()) {
String isoname = isoform.getUniqueName();
AnnotationIsoformSpecificity spec = a.getTargetingIsoformsMap().get(isoname);
// store variant pos on isoform (default is null)
isoExpectedPos.put(isoname, null);
// if variant maps on isoform
if (spec != null) {
int p1 = spec.getFirstPosition();
// store variant position on isoform
isoExpectedPos.put(isoname, new Integer(p1));
}
}
return isoExpectedPos;
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class IsoformSequencePositionMapperIntegrationTest method testSingleVariantWithInvalidNucleotideIndice.
@Test
public void testSingleVariantWithInvalidNucleotideIndice() throws Exception {
String entry_ac = "NX_O00115";
String iso_ac = "NX_O00115-1";
String variant_ac = "AN_O00115_000472";
Entry entry = entryBuilderService.build(EntryConfig.newConfig(entry_ac).withTargetIsoforms().withAnnotations());
for (Annotation a : entry.getAnnotations()) {
if (a.getUniqueName().equals(variant_ac)) {
int pos = a.getTargetingIsoformsMap().get(iso_ac).getFirstPosition();
Isoform iso = IsoformUtils.getIsoformByName(entry, iso_ac);
GeneMasterCodonPosition nuPos = IsoformSequencePositionMapper.getCodonPositionsOnMaster(pos, iso);
for (Isoform iso2 : entry.getIsoforms()) {
if (!iso2.equals(iso)) {
CodonNucleotideIndices nuIdx = IsoformSequencePositionMapper.getCodonNucleotideIndices(nuPos, iso2);
// cannot be projected to iso2
Assert.assertEquals(false, nuIdx.has3Nucleotides());
Assert.assertEquals(false, nuIdx.areConsecutive());
Assert.assertEquals(false, nuIdx.areInFrame());
Assert.assertNull(nuIdx.getAminoAcidPosition());
}
}
return;
}
}
Assert.assertTrue(false);
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class PepXServiceImpl method computePeptideUnicityStatus.
/**
* Computes a unicity value for each peptide: UNIQUE, PSEUDO_UNIQUE, NON_UNIQUE
* based on the response returned by pepx (a list of peptide - isoform matches)
* by using the PeptideUnicityService
* @param entries
* @param withVariants
* @return a map with key = peptide sequence, value = unicity value
*/
private Map<String, PeptideUnicity> computePeptideUnicityStatus(List<Entry> entries, boolean withVariants) {
Map<String, Set<String>> pepIsoSetMap = new HashMap<>();
entries.forEach(e -> {
e.getAnnotationsByCategory(AnnotationCategory.PEPX_VIRTUAL_ANNOTATION).stream().filter(a -> a.getVariant() == null || withVariants).forEach(a -> {
String pep = a.getCvTermName();
if (!pepIsoSetMap.containsKey(pep))
pepIsoSetMap.put(pep, new TreeSet<String>());
a.getTargetingIsoformsMap().values().forEach(i -> {
pepIsoSetMap.get(pep).add(i.getIsoformAccession());
});
});
});
Map<String, PeptideUnicity> pepUnicityMap = new HashMap<>();
pepIsoSetMap.entrySet().forEach(e -> {
String pep = e.getKey();
PeptideUnicity pu = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(e.getValue());
pepUnicityMap.put(pep, pu);
});
return pepUnicityMap;
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class IsoformConverter method marshal.
public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
Isoform isoform = (Isoform) value;
writer.startNode("sequence");
writer.addAttribute("value", isoform.getSequence());
writer.endNode();
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class PepXServiceTest method shouldBuildAnEntryWithVirtualAnnotations.
@Test
public void shouldBuildAnEntryWithVirtualAnnotations() throws Exception {
String peptide = "GANAP";
boolean modeIsoleucine = true;
PepXIsoformMatch pepXIsoformMatch = new PepXIsoformMatch();
pepXIsoformMatch.setIsoformAccession(ISO_ACCESSION);
@SuppressWarnings("unchecked") List<Annotation> annotations = mock(List.class);
Isoform isoform = mock(Isoform.class);
when(isoform.getIsoformAccession()).thenReturn(ISO_ACCESSION);
when(isoform.getSequence()).thenReturn("AGANAPA");
List<Isoform> isoforms = Arrays.asList(isoform);
List<Annotation> virtualAnnotations = PepXServiceImpl.buildEntryWithVirtualAnnotations(peptide, modeIsoleucine, Arrays.asList(pepXIsoformMatch), annotations, isoforms);
Annotation annot = virtualAnnotations.get(0);
assertTrue(annot.getCategory().equals("pepx-virtual-annotation"));
assertTrue(annot.getVariant() == null);
assertTrue(annot.getTargetingIsoformsMap().keySet().contains(ISO_ACCESSION));
}
Aggregations