public CachedProbe(AffyProbe ap, Vector<AffyExperiment> expts) {
   probe = ap;
   min = max = 0.0;
   color = Color.lightGray;
   stroke = new BasicStroke((float) 2.0);
   values = new Vector<Double>();
   for (AffyExperiment e : expts) {
     AffyMeasurement am = e.getMeasurement(probe);
     if (am != null) {
       values.add(am.getValue());
       min = Math.min(am.getValue(), min);
       max = Math.max(am.getValue(), max);
     } else {
       values.add(null);
     }
   }
 }
  public void paintProbe(Graphics2D g2, int x1, int y1, int x2, int y2, double tmin, double tmax) {
    g2.setStroke(stroke);
    g2.setColor(color);

    int ppx = -1, ppy = -1;
    for (int i = 0; i < values.size(); i++) {
      Double v = values.get(i);
      if (v != null && tmax - tmin > 0.0) {
        double frac = (v - tmin) / (tmax - tmin);
        int pixY = y2 - (int) Math.round(frac * (y2 - y1));
        int pixX = x1 + (int) Math.floor((double) (i + 1) / (double) (values.size() + 2));

        if (ppx != -1) {
          g2.drawLine(ppx, ppy, pixX, pixY);
        }

        ppx = pixX;
        ppy = pixY;

      } else {
        ppx = ppy = -1;
      }
    }
  }
Esempio n. 3
0
  public Collection<Experiment> findExpts(CellLine cells, ExptCondition cond) throws SQLException {

    LinkedList<Integer> dbids = new LinkedList<Integer>();

    String tables = "experiment e";
    if (genome != null) {
      tables += ", probe_platform_to_genome p2g";
    }

    String query = "select e.id from " + tables;

    Vector<String> conds = new Vector<String>();

    if (genome != null) {
      int gid = genome.getDBID();
      conds.add("e.platform=p2g.platform and p2g.genome=" + gid);
    }

    if (cells != null) {
      conds.add("e.cells=" + cells.getDBID());
    }

    if (cond != null) {
      conds.add("e.condition=" + cond.getDBID());
    }

    for (int i = 0; i < conds.size(); i++) {
      if (i == 0) {
        query += " where ";
      } else {
        query += " and ";
      }
      query += conds.get(i);
    }

    System.out.println("Final Query: \"" + query + "\"");

    java.sql.Connection cxn = loader.getConnection();
    Statement s = cxn.createStatement();
    ResultSet rs = s.executeQuery(query);

    while (rs.next()) {
      int dbid = rs.getInt(1);
      dbids.addLast(dbid);
    }

    rs.close();
    s.close();

    Collection<Experiment> expts = loader.loadExperiments(dbids);
    return expts;
  }
 public void addAffyProbe(AffyProbe ap) {
   if (!probes.contains(ap)) {
     probes.add(ap);
   }
 }