コード例 #1
0
  /**
   * Test predict using the hivpredmanager
   *
   * @throws Xws4jException
   * @throws XmppException
   * @throws InterruptedException
   */
  @Test
  public void testPredictString() throws Xws4jException, XmppException, InterruptedException {
    String seq =
        "AAAALWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKMIGGIGGFIKVRQYDQILIEICGHKAIGTVLVGPTPVNIIGRNLLTQIGCTLNF";
    HIVPredOutputType res = hivdrc.predictPI(seq);
    assertNotNull(res);

    /*
    <?xml version="1.0" encoding="ASCII"?><hivpred:HIVPredOutput xmlns:hivpred="http://www.hivdrc.org/hivpred" errorMessage="">
       <hivpred:mutNotInDataset name="P1A"/>
       <hivpred:mutOutsideModelBoundaries name="Q2A"/>
       <hivpred:mutOutsideModelBoundaries name="I3A"/>
       <hivpred:result name="amprenavir" result="-9.344846031197962"/>
       <hivpred:result name="atazanavir" result="-8.081778845481008"/>
       <hivpred:result name="indinavir" result="-8.306376101045098"/>
       <hivpred:result name="lopinavir" result="-8.789871555954795"/>
       <hivpred:result name="nelfinavir" result="-7.661361493579009"/>
       <hivpred:result name="ritonavir" result="-8.108639981136413"/>
       <hivpred:result name="saquinanvir" result="-8.702355550536716"/>
    </hivpred:HIVPredOutput>
    */

    assertEquals("", res.getErrorMessage());
    assertEquals(1, res.getMutNotInDataset().size());
    assertEquals("P1A", res.getMutNotInDataset().get(0).getName());
    assertEquals(2, res.getMutOutsideModelBoundaries().size());
    assertEquals("Q2A", res.getMutOutsideModelBoundaries().get(0).getName());
    assertEquals("I3A", res.getMutOutsideModelBoundaries().get(1).getName());

    assertEquals(7, res.getResult().size());
    assertEquals("amprenavir", res.getResult().get(0).getName());
    assertEquals(-9.344846031197962, res.getResult().get(0).getResult(), EPSILON);
    assertEquals("atazanavir", res.getResult().get(1).getName());
    assertEquals(-8.081778845481008, res.getResult().get(1).getResult(), EPSILON);
    assertEquals("indinavir", res.getResult().get(2).getName());
    assertEquals(-8.306376101045098, res.getResult().get(2).getResult(), EPSILON);
    assertEquals("lopinavir", res.getResult().get(3).getName());
    assertEquals(-8.789871555954795, res.getResult().get(3).getResult(), EPSILON);
    assertEquals("nelfinavir", res.getResult().get(4).getName());
    assertEquals(-7.661361493579009, res.getResult().get(4).getResult(), EPSILON);
    assertEquals("ritonavir", res.getResult().get(5).getName());
    assertEquals(-8.108639981136413, res.getResult().get(5).getResult(), EPSILON);
    //      assertEquals("saquinavir", res.getResult().get(6).getName());
    // TODO: fix misspelling in sus7.jar class PredictionResult
    // saquinanvir -> saquinavir
    assertEquals(-8.702355550536716, res.getResult().get(6).getResult(), EPSILON);

    System.out.println(res);
  }
コード例 #2
0
  @Test
  public void testPredictFileWithSingleLine()
      throws Xws4jException, XmppException, InterruptedException, URISyntaxException,
          MalformedURLException, IOException {

    URI uri = getClass().getResource("/testFiles/single.seq").toURI();
    URL url = FileLocator.toFileURL(uri.toURL());
    String path = url.getFile();

    System.out.println("Trying to predict file: " + path);

    HIVPredOutputType res = hivdrc.predictPI(path);
    assertNotNull(res);

    // File contains same string as in testPredictString() method
    assertEquals("", res.getErrorMessage());
    assertEquals(1, res.getMutNotInDataset().size());
    assertEquals("P1A", res.getMutNotInDataset().get(0).getName());
    assertEquals(2, res.getMutOutsideModelBoundaries().size());
    assertEquals("Q2A", res.getMutOutsideModelBoundaries().get(0).getName());
    assertEquals("I3A", res.getMutOutsideModelBoundaries().get(1).getName());

    assertEquals(7, res.getResult().size());
    assertEquals("amprenavir", res.getResult().get(0).getName());
    assertEquals(-9.344846031197962, res.getResult().get(0).getResult(), EPSILON);
    assertEquals("atazanavir", res.getResult().get(1).getName());
    assertEquals(-8.081778845481008, res.getResult().get(1).getResult(), EPSILON);
    assertEquals("indinavir", res.getResult().get(2).getName());
    assertEquals(-8.306376101045098, res.getResult().get(2).getResult(), EPSILON);
    assertEquals("lopinavir", res.getResult().get(3).getName());
    assertEquals(-8.789871555954795, res.getResult().get(3).getResult(), EPSILON);
    assertEquals("nelfinavir", res.getResult().get(4).getName());
    assertEquals(-7.661361493579009, res.getResult().get(4).getResult(), EPSILON);
    assertEquals("ritonavir", res.getResult().get(5).getName());
    assertEquals(-8.108639981136413, res.getResult().get(5).getResult(), EPSILON);
    //      assertEquals("saquinavir", res.getResult().get(6).getName());
    // TODO: fix misspelling in sus7.jar class PredictionResult
    // saquinanvir -> saquinavir
    assertEquals(-8.702355550536716, res.getResult().get(6).getResult(), EPSILON);

    System.out.println(res);
  }