use of org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch 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));
}
use of org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch in project nextprot-api by calipho-sib.
the class PepXServiceTest method shouldReturnAnEmptyArrayWhenThePeptideIsNotContainedInTheSequence.
@Test
public void shouldReturnAnEmptyArrayWhenThePeptideIsNotContainedInTheSequence() throws Exception {
String peptide = "GANAP";
boolean modeIsoleucine = true;
PepXIsoformMatch pepXIsoformMatch = new PepXIsoformMatch(ISO_ACCESSION);
@SuppressWarnings("unchecked") List<Annotation> annotations = mock(List.class);
Isoform isoform = mock(Isoform.class);
when(isoform.getIsoformAccession()).thenReturn(ISO_ACCESSION);
// Sequence does not
when(isoform.getSequence()).thenReturn("AAAAAA");
// contain the
// peptide
List<Isoform> isoforms = Arrays.asList(isoform);
List<Annotation> result = PepXServiceImpl.buildEntryWithVirtualAnnotations(peptide, modeIsoleucine, Arrays.asList(pepXIsoformMatch), annotations, isoforms);
assertTrue(result.isEmpty());
}
use of org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch in project nextprot-api by calipho-sib.
the class PepXServiceTest method shouldGiveAnAnnotationWithVariantWhenPresent.
/*
* Specification have changed now it should be empty look at:
* #shouldReturnAnEmptyArrayWhenThePeptideIsNotContainedInTheSequence
*
* @Test(expected=NextProtException.class) public void
* shouldThrowAnExceptionWhenThePeptideIsNotContainedInTheSequence() throws
* Exception {
*
* try { String peptide = "GANAP"; boolean modeIsoleucine = true;
*
* List<Pair<String, Integer>> isosAndPositions = Arrays.asList(new
* Pair<String, Integer>("Iso-1", null)); //not positional since there is no
* position
*
* @SuppressWarnings("unchecked") List<Annotation> annotations =
* mock(List.class); Isoform isoform = mock(Isoform.class);
* when(isoform.getIsoformAccession()).thenReturn("Iso-1");
* when(isoform.getSequence()).thenReturn("AAAAAA");//Sequence does not
* contain the peptide
*
* List<Isoform> isoforms = Arrays.asList(isoform);
*
* PepXServiceImpl.buildEntryWithVirtualAnnotations(peptide, modeIsoleucine,
* isosAndPositions, annotations, isoforms);
*
* }catch(NextProtException e){ if(e.getMessage().contains(
* "that is not in the current isoform in neXtProt")){ throw e; //success
* tests }else fail(); } }
*/
@Test
public void shouldGiveAnAnnotationWithVariantWhenPresent() throws Exception {
// Taking example NX_Q9H6T3
String peptide = "GANAP";
boolean modeIsoleucine = true;
String isoName = "NX_Q9H6T3-3";
Isoform isoform = mock(Isoform.class);
when(isoform.getIsoformAccession()).thenReturn(isoName);
// https://cdn.rawgit.com/calipho-sib/sequence-viewer/master/examples/simple.html
// (check that page to format the sequence)
// GANAL is present instead of GANAP
when(isoform.getSequence()).thenReturn("MDADPYNPVLPTNRASAYFRLKKFAVAESDCNLAVALNRSYTKAYSRRGAARFALQKLEEAKKDYERVLELEPNNFEATNELRKISQALASKENSYPKEADIVIKSTEGERKQIEAQQNKQQAISEKDRGNGFFKEGKYERAIECYTRGIAADGANALLPANRAMAYLKIQKYEEAEKDCTQAILLDGSYSKAFARRGTARTFLGKLNEAKQDFETVLLLEPGNKQAVTELSKIKKELIEKGHWDDVFLDSTQRQNVVKPIDNPPHPGSTKPLKKVIIEETGNLIQTIDVPDSTTAAAPENNPINLANVIAATGTTSKKNSSQDDLFPTSDTPRAKVLKIEEVSDTSSLQPQASLKQDVCQSYSEKMPIEIEQKPAQFATTVLPPIPANSFQLESDFRQLKSSPDMLYQYLKQIEPSLYPKLFQKNLDPDVFNQIVKILHDFYIEKEKPLLIFEILQRLSELKRFDMAVMFMSETEKKIARALFNHIDKSGLKDSSVEELKKRYGG");
PepXIsoformMatch pepXIsoformMatch = new PepXIsoformMatch(isoName, 154);
List<Annotation> annots = Arrays.asList(getMockedAnnotation("L", "P", 158, isoName, true));
List<Isoform> isoforms = Arrays.asList(isoform);
// empty
List<Annotation> pepxAnnots = PepXServiceImpl.buildEntryWithVirtualAnnotations(peptide, modeIsoleucine, Arrays.asList(pepXIsoformMatch), annots, isoforms);
// or
// null
// annotations
assertTrue(pepxAnnots.size() == 1);
assertTrue(pepxAnnots.get(0).getVariant().getOriginal().equals("L"));
assertTrue(pepxAnnots.get(0).getVariant().getVariant().equals("P"));
assertTrue(pepxAnnots.get(0).getStartPositionForIsoform(isoName) == 158);
assertTrue(pepxAnnots.get(0).getEndPositionForIsoform(isoName) == 158);
}
use of org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch in project nextprot-api by calipho-sib.
the class PepXServiceTest method shouldReturnAnEmptryListIfTheVariantIsNotConaintedInThePeptide.
@Test
public void shouldReturnAnEmptryListIfTheVariantIsNotConaintedInThePeptide() throws Exception {
// Taking example NX_Q9H6T3
String peptide = "GANAP";
boolean modeIsoleucine = true;
String isoName = "NX_Q9H6T3-3";
Isoform isoform = mock(Isoform.class);
when(isoform.getIsoformAccession()).thenReturn(isoName);
// https://cdn.rawgit.com/calipho-sib/sequence-viewer/master/examples/simple.html
// (check that page to format the sequence)
// GANAL is present instead of GANAP
when(isoform.getSequence()).thenReturn("MDADPYNPVLPTNRASAYFRLKKFAVAESDCNLAVALNRSYTKAYSRRGAARFALQKLEEAKKDYERVLELEPNNFEATNELRKISQALASKENSYPKEADIVIKSTEGERKQIEAQQNKQQAISEKDRGNGFFKEGKYERAIECYTRGIAADGANALLPANRAMAYLKIQKYEEAEKDCTQAILLDGSYSKAFARRGTARTFLGKLNEAKQDFETVLLLEPGNKQAVTELSKIKKELIEKGHWDDVFLDSTQRQNVVKPIDNPPHPGSTKPLKKVIIEETGNLIQTIDVPDSTTAAAPENNPINLANVIAATGTTSKKNSSQDDLFPTSDTPRAKVLKIEEVSDTSSLQPQASLKQDVCQSYSEKMPIEIEQKPAQFATTVLPPIPANSFQLESDFRQLKSSPDMLYQYLKQIEPSLYPKLFQKNLDPDVFNQIVKILHDFYIEKEKPLLIFEILQRLSELKRFDMAVMFMSETEKKIARALFNHIDKSGLKDSSVEELKKRYGG");
PepXIsoformMatch pepXIsoformMatch = new PepXIsoformMatch(isoName, 154);
List<Annotation> annots = Arrays.asList(getMockedAnnotation("L", "Z", 158, isoName, true));
List<Isoform> isoforms = Arrays.asList(isoform);
// empty
List<Annotation> result = PepXServiceImpl.buildEntryWithVirtualAnnotations(peptide, modeIsoleucine, Arrays.asList(pepXIsoformMatch), annots, isoforms);
// or
// null
// annotations
assertTrue(result.isEmpty());
}
use of org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch in project nextprot-api by calipho-sib.
the class PepXServiceTest method shouldGiveAnExceptionIfTheOriginalIsNotPresentOnTheSequence.
/*
* Specification has changed look at:
* shouldReturnAnEmptryListIfTheVariantIsNotConaintedInThePeptide
*
* @Test(expected=NextProtException.class) public void
* shouldGiveAnExceptionIfTheVariantIsNotConaintedInThePeptide() throws
* Exception { try {
*
* //Taking example NX_Q9H6T3 String peptide = "GANAP"; boolean
* modeIsoleucine = true; String isoName = "NX_Q9H6T3-3";
*
* Isoform isoform = mock(Isoform.class);
* when(isoform.getIsoformAccession()).thenReturn(isoName);
* //https://cdn.rawgit.com/calipho-sib/sequence-viewer/master/examples/
* simple.html (check that page to format the sequence) //GANAL is present
* instead of GANAP when(isoform.getSequence()).thenReturn(
* "MDADPYNPVLPTNRASAYFRLKKFAVAESDCNLAVALNRSYTKAYSRRGAARFALQKLEEAKKDYERVLELEPNNFEATNELRKISQALASKENSYPKEADIVIKSTEGERKQIEAQQNKQQAISEKDRGNGFFKEGKYERAIECYTRGIAADGANALLPANRAMAYLKIQKYEEAEKDCTQAILLDGSYSKAFARRGTARTFLGKLNEAKQDFETVLLLEPGNKQAVTELSKIKKELIEKGHWDDVFLDSTQRQNVVKPIDNPPHPGSTKPLKKVIIEETGNLIQTIDVPDSTTAAAPENNPINLANVIAATGTTSKKNSSQDDLFPTSDTPRAKVLKIEEVSDTSSLQPQASLKQDVCQSYSEKMPIEIEQKPAQFATTVLPPIPANSFQLESDFRQLKSSPDMLYQYLKQIEPSLYPKLFQKNLDPDVFNQIVKILHDFYIEKEKPLLIFEILQRLSELKRFDMAVMFMSETEKKIARALFNHIDKSGLKDSSVEELKKRYGG"
* );
*
* List<Pair<String, Integer>> isosAndPositions = Arrays.asList(new
* Pair<String, Integer>(isoName, 154)); //Position of the begin of peptide
* List<Annotation> annots = Arrays.asList(getMockedAnnotation("L", "Z",
* 158, isoName, true)); List<Isoform> isoforms = Arrays.asList(isoform);
*
* PepXServiceImpl.buildEntryWithVirtualAnnotations(peptide, modeIsoleucine,
* isosAndPositions, annots, isoforms); //empty or null annotations
* }catch(NextProtException e){ if(e.getMessage().contains(
* "No valid variants found for isoform ")){ throw e; //success tests }else
* fail(); }
*
* }
*/
// because we have variants in nextprot which do not have original aa is not equal to isoform aa at that variant position (inconsistency)
@Ignore
@Test(expected = NextProtException.class)
public void shouldGiveAnExceptionIfTheOriginalIsNotPresentOnTheSequence() throws Exception {
try {
// Taking example NX_Q9H6T3
String peptide = "GANAP";
boolean modeIsoleucine = true;
String isoName = "NX_Q9H6T3-3";
Isoform isoform = mock(Isoform.class);
when(isoform.getIsoformAccession()).thenReturn(isoName);
// https://cdn.rawgit.com/calipho-sib/sequence-viewer/master/examples/simple.html
// (check that page to format the sequence)
// GANAL is present instead of GANAP
when(isoform.getSequence()).thenReturn("MDADPYNPVLPTNRASAYFRLKKFAVAESDCNLAVALNRSYTKAYSRRGAARFALQKLEEAKKDYERVLELEPNNFEATNELRKISQALASKENSYPKEADIVIKSTEGERKQIEAQQNKQQAISEKDRGNGFFKEGKYERAIECYTRGIAADGANALLPANRAMAYLKIQKYEEAEKDCTQAILLDGSYSKAFARRGTARTFLGKLNEAKQDFETVLLLEPGNKQAVTELSKIKKELIEKGHWDDVFLDSTQRQNVVKPIDNPPHPGSTKPLKKVIIEETGNLIQTIDVPDSTTAAAPENNPINLANVIAATGTTSKKNSSQDDLFPTSDTPRAKVLKIEEVSDTSSLQPQASLKQDVCQSYSEKMPIEIEQKPAQFATTVLPPIPANSFQLESDFRQLKSSPDMLYQYLKQIEPSLYPKLFQKNLDPDVFNQIVKILHDFYIEKEKPLLIFEILQRLSELKRFDMAVMFMSETEKKIARALFNHIDKSGLKDSSVEELKKRYGG");
PepXIsoformMatch pepXIsoformMatch = new PepXIsoformMatch(isoName, 154);
// Original is not contained in the sequence, should be a L L->P
// (GANAL)
List<Annotation> annots = Arrays.asList(getMockedAnnotation("O", "P", 158, isoName, true));
List<Isoform> isoforms = Arrays.asList(isoform);
// empty
PepXServiceImpl.buildEntryWithVirtualAnnotations(peptide, modeIsoleucine, Arrays.asList(pepXIsoformMatch), annots, isoforms);
// or
// null
// annotations
} catch (NextProtException e) {
if (e.getMessage().contains("The amino acid")) {
// success tests
throw e;
} else
fail();
}
}
Aggregations