Search in sources :

Example 1 with PepXMatch

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);
    }
}
Also used : PepXMatch(org.nextprot.api.web.domain.PepXResponse.PepXMatch) Scanner(java.util.Scanner) PepXResponse(org.nextprot.api.web.domain.PepXResponse) File(java.io.File) PepXEntryMatch(org.nextprot.api.web.domain.PepXResponse.PepXEntryMatch) WebUnitBaseTest(org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest) Test(org.junit.Test)

Aggregations

File (java.io.File)1 Scanner (java.util.Scanner)1 Test (org.junit.Test)1 WebUnitBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest)1 PepXResponse (org.nextprot.api.web.domain.PepXResponse)1 PepXEntryMatch (org.nextprot.api.web.domain.PepXResponse.PepXEntryMatch)1 PepXMatch (org.nextprot.api.web.domain.PepXResponse.PepXMatch)1