use of org.nextprot.api.web.domain.PepXResponse.PepXMatch in project nextprot-api by calipho-sib.
the class PepXServiceTest method shouldParsePep.
@Test
public void shouldParsePep() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("org/nextprot/api/pepx/pepxResponse.json").getFile());
Scanner scanner = new Scanner(file, "UTF-8");
String content = scanner.useDelimiter("\\A").next();
scanner.close();
PepXResponse pepXResponse = PepxUtils.parsePepxResponse(content);
// System.out.println(pepXResponse.getEntriesNames().size());
// assertTrue(pepXResponse.getEntriesNames().size() == 20);
assertTrue(((Integer) pepXResponse.getParams().get("modeIL")) == 1);
assertTrue((pepXResponse.getParams().get("peplist")).equals("TKMGLYYSYFK,TKMGL"));
assertTrue((pepXResponse.getPeptideMatch("TKMGLYYSYFK").getEntryMatches().size() == 3));
assertTrue((pepXResponse.getPeptideMatch("TKMGL").getEntryMatches().size() == 17));
PepXMatch pepXMatch = pepXResponse.getPeptideMatch("TKMGL");
// Test entry names
List<String> names = pepXMatch.getEntryNamesMatches();
assertTrue(names.size() == 17);
assertTrue(names.contains("Q6NUT2"));
assertTrue(names.contains("Q2PZI1"));
assertTrue(names.contains("Q9UKT4"));
assertTrue(names.contains("Q6NXN4"));
{
PepXEntryMatch pepXEntryMatch = pepXMatch.getPepxMatchesForEntry("Q6NUT2");
assertTrue(pepXEntryMatch.getIsoforms().get(0).getPosition().equals(148));
}
{
PepXEntryMatch pepXEntryMatch2 = pepXMatch.getPepxMatchesForEntry("O00327");
assertTrue(pepXEntryMatch2.getIsoforms().get(1).getPosition() == null);
}
}
Aggregations