Esempio n. 1
0
  /** @return */
  private void readHits() {

    pbar.setProgressMode(ProgressBar.PROGRESSABLE_MODE, true);
    pbar.setMessage("Extracting hits");
    pbar.setMaxVal(maxHits);
    BufferedReader reader = null;
    int val = 0;
    RADSProtein p = null;
    proteins = new TreeSet<RADSProtein>();

    try {
      reader = read(results.getXdomUrl());
      String line = null;

      while ((line = reader.readLine()) != null) {

        if (line.substring(0, 1).equals(">")) {

          if ((maxHits != -1) && (val >= maxHits)) break;

          String[] fields = line.split("\\t");
          String pid = fields[0].replace(">", "");

          if (p != null) proteins.add(p);

          p = new RADSProtein(pid, Integer.valueOf(fields[1]));
          p.setRADSScore(radsScores.get(pid));
          if (query.isRampageRun()) p.setRAMPAGEScore(rampageScores.get(pid));
          val++;
          pbar.setCurrentVal(val);
        } else {
          String[] fields = line.split("\\t");
          RADSDomain d =
              new RADSDomain(fields[2], Integer.valueOf(fields[0]), Integer.valueOf(fields[1]));
          if (fields.length == 4) d.addEvalue(Double.valueOf(fields[3]));
          p.addDomain(d);
        }
      }
      proteins.add(p);
      val++;
      pbar.setCurrentVal(val);
      pbar.finish(true);

    } catch (MalformedURLException mue) {
      mue.printStackTrace();
    } catch (IOException ioe) {
      ioe.printStackTrace();
    }
  }
Esempio n. 2
0
  private void readScoreTable() {

    BufferedReader reader = null;
    String subject = null;
    String line = null;
    int radsScore = 0, rampageScore = 0;
    radsScores = new HashMap<String, Integer>();
    rampageScores = new HashMap<String, Integer>();

    pbar.setMessage("Reading score table");

    try {
      reader = read(results.getCrampageOut());

      while ((line = reader.readLine()) != null) {

        if (line.contains("QUERY")) {
          if (subject != null) {
            radsScores.put(subject, radsScore);
            rampageScores.put(subject, rampageScore);
          }
        } else if (line.contains("SUBJECT")) {
          String[] fields = line.split("\\s+");
          subject = fields[1];
        } else if (line.contains("RADS SCORE")) {
          String[] fields = line.split("\\s+");
          radsScore = Integer.valueOf(fields[2]);
        } else if (line.contains("RAMPAGE SCORE")) {
          String[] fields = line.split("\\s+");
          rampageScore = Integer.valueOf(fields[2]);
        }
      }
      if (subject != null) {
        radsScores.put(subject, radsScore);
        rampageScores.put(subject, rampageScore);
      }
    } catch (IOException ioe) {

    }
  }