コード例 #1
0
  /**
   * Creates the list of interaction partners displayed in the top part of the {@link RegIntTab}
   *
   * @param parent The {@link JScrollPane} containing either the regulators or the targets of the
   *     selected element
   * @param map The map of interaction partners, either regulators or targets, also found in results
   * @param results The entire {@link ResultsObj}. Must have map as either its regulator or target
   *     map
   * @param builder The {@link PanelBuilder} that will include this pathway
   * @return the list of interaction partners (in pathway form for expression visualization)
   */
  private VPathwaySwing createPathway(
      JScrollPane parent, Map<Xref, Interaction> map, ResultsObj results, PanelBuilder builder) {
    VPathwaySwing vPathwaySwing = new VPathwaySwing(parent);
    VPathway vPathway = vPathwaySwing.createVPathway();
    vPathway.setEditMode(false);
    Pathway sourcePw = new Pathway();
    Map<Xref, Interaction> sorted = sortXrefs(map);
    x = 0;
    for (Xref xref : sorted.keySet()) {
      PathwayElement pwe = createPathwayELement(xref);
      sourcePw.add(pwe);

      JLabel linkout = new JLabel(icon);
      JPanel linkoutPane = new JPanel();
      linkout.addMouseListener(new InfoButtonListener(xref, results, plugin));
      linkoutPane.add(linkout);
      linkoutPane.setCursor(new Cursor(Cursor.HAND_CURSOR));
      linkoutPane.setVisible(true);

      List<File> uniqueFiles = new ArrayList<File>();
      for (File intFile : sorted.get(xref).getFiles()) {
        if (!uniqueFiles.contains(intFile)
            && RegIntPreferences.getPreferences().getSelectedIntFiles().contains(intFile)) {
          uniqueFiles.add(intFile);
        }
      }
      builder.addLabel(
          uniqueFiles.size()
              + "/"
              + RegIntPreferences.getPreferences().getSelectedIntFiles().size(),
          cc.xy(6, y));

      builder.add(linkoutPane, cc.xy(4, y));
      y = y + 2;
      x++;
    }
    vPathway.fromModel(sourcePw);
    vPathway.setSelectionEnabled(false);
    vPathway.addVPathwayListener(plugin.getDesktop().getVisualizationManager());
    return vPathwaySwing;
  }
コード例 #2
0
  /**
   * Sorts the list of interaction partners. Alphabetical sorting is the default, but can be set to
   * sort by number of occurrences in {@link PreferenceDialog}.
   *
   * @param map The interactions to sort
   * @return The sorted interactions
   */
  private Map<Xref, Interaction> sortXrefs(Map<Xref, Interaction> map) {
    Map<Xref, Interaction> sorted = new LinkedHashMap<Xref, Interaction>();
    if (RegIntPreferences.getPreferences().getSort()
        == RegIntPreferences.BY_NUMBER_OF_OCCURRENCES) {
      List<ObjectsToSort> list = new ArrayList<ObjectsToSort>();

      for (Xref xref : map.keySet()) {
        ObjectsToSort obj = new ObjectsToSort(xref, map.get(xref).getFiles().size());
        list.add(obj);
      }

      Collections.sort(list);

      for (ObjectsToSort obj : list) {
        sorted.put(obj.getXref(), map.get(obj.getXref()));
      }
    } else {
      sorted = new TreeMap<Xref, Interaction>(map); // alphabetical sorting
      // as default
    }
    return sorted;
  }