Esempio n. 1
0
      @Override
      public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub

        int l = selectedSets.size();

        if (l != 0) {

          ArrayList<Protein> temp = new ArrayList<Protein>();

          for (Protein p : sortResults.get(curalg)) {

            if (p.getSelectGroups() != null && p.getSelectGroups().size() >= l) {
              if (p.getSelectGroups().containsAll(selectedSets)) {
                temp.add(p);
              }
            }
          }

          if (!temp.isEmpty()) {

            clearB.doClick();
            sproteins.clear();
            sproteins.addAll(temp);
            pUtil.sortVertex(sproteins, curalg);
            pUtil.getResultPanel(id).browserPanel.updateTable(null);
            curSetName = "Overlapping Nodes";
          } else {

          }

        } else {

        }
      }
Esempio n. 2
0
  public void updateNet(String curalg, String curSetName) {
    HashSet<CyNode> nodes = new HashSet<CyNode>();

    for (Protein p : sproteins) {
      nodes.add(p.getN());
    }

    pg = pUtil.createGraph(network, nodes);
    //	selectProteins(pg.getSubNetwork());
    this.pUtil.setSelected(nodes, network);
    this.curalg = curalg;
    this.curSetName = curSetName;
  }
Esempio n. 3
0
        public void listIt(List<Protein> sproteins) {

          this.data = new Object[sproteins.size()][this.columnNames.length];

          int i = 0, j;
          for (Protein p : sproteins) {

            data[i][0] = i + 1;
            data[i][1] = p.getName();
            j = 0;
            for (String s : sortResults.keySet()) {
              data[i][2 + j * 5] = p.getPara(s);
              j++;
            }
            i++;
          }
          j = 0;
          for (String s : sortResults.keySet()) {

            List<Protein> rankedResult = sortResults.get(s);
            int length = rankedResult.size();
            DecimalFormat df = new DecimalFormat("#.####");

            double max = rankedResult.get(0).getPara(s);
            double min = rankedResult.get(length - 1).getPara(s);
            double avg = 0;
            for (Protein p : rankedResult) {
              avg += p.getPara(s);
            }
            avg = avg / (double) length;
            i = 0;
            for (Protein p : sproteins) {
              data[i][3 + j * 5] = rankedResult.indexOf(p) + 1;
              if (s == ParameterSet.IC) df = new DecimalFormat("#.####E0");

              data[i][4 + j * 5] = df.format(avg);
              data[i][5 + j * 5] = df.format(max);
              data[i][6 + j * 5] = df.format(min);

              i++;
            }

            j++;
          }
        }
Esempio n. 4
0
      @Override
      public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub
        if (pUtil.modifiedNetworkSet != null
            && !pUtil.modifiedNetworkSet.contains(network.getSUID())) {
          for (Protein p : sortResults.get(curalg)) {
            if (p.getSelectGroups() != null && !p.getSelectGroups().isEmpty()) {
              networkView
                  .getNodeView(p.getN())
                  .setVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, p.getOriginColor());
              networkView
                  .getNodeView(p.getN())
                  .setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, "");
              p.getSelectGroups().clear();
            }
          }
        } else {
          for (Protein p : sortResults.get(curalg)) {
            if (network.containsNode(p.getN())
                && p.getSelectGroups() != null
                && !p.getSelectGroups().isEmpty()) {
              networkView
                  .getNodeView(p.getN())
                  .setVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, p.getOriginColor());
              networkView
                  .getNodeView(p.getN())
                  .setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, "");
              p.getSelectGroups().clear();
            }
          }
        }

        SetColorMap.clear();
        selectedSets.clear();
        labelPanel.removeAll();
        labelPanel.repaint();
        networkView.updateView();
        SETINDEX = 0;
      }
Esempio n. 5
0
      @Override
      public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub
        Color mixc = null, currentc = null;
        HashMap<String, Color> mixColors = new HashMap<String, Color>();

        JColorChooser jc = new JColorChooser();
        currentc = jc.showDialog(null, "Please choose one color", Color.red);

        if (currentc != null) {
          pUtil.setSelected(null, network);
          if (pUtil.modifiedNetworkSet != null
              && !pUtil.modifiedNetworkSet.contains(network.getSUID())) {
            for (Protein p : sproteins) {
              CyNode n = p.getN();
              SetColorMap.put(curSetName, currentc);
              if (p.getSelectGroups() == null || p.getSelectGroups().isEmpty()) {

                p.setOriginColor(
                    networkView
                        .getNodeView(n)
                        .getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));

                p.setSelectGroups(new ArrayList<String>());
                p.getSelectGroups().add(curSetName);
                networkView
                    .getNodeView(n)
                    .setVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, currentc);
                networkView
                    .getNodeView(n)
                    .setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, curSetName);

              } else {

                if (ismixcolor) {
                  p.getSelectGroups().add(curSetName);
                  String mixname = "";
                  double blue = 0, red = 0, green = 0, s = p.getSelectGroups().size();
                  int r, g, b;
                  int i = 0;
                  for (String set : p.getSelectGroups()) {
                    blue += SetColorMap.get(set).getBlue();
                    red += SetColorMap.get(set).getRed();
                    green += SetColorMap.get(set).getGreen();
                    if (i == 0) mixname += set;
                    else mixname += " + " + set;
                    i++;
                  }
                  r = (int) Math.round(red / s);
                  g = (int) Math.round(green / s);
                  b = (int) Math.round(blue / s);
                  mixc = new Color(r, g, b);

                  networkView
                      .getNodeView(n)
                      .setVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, mixc);
                  networkView
                      .getNodeView(n)
                      .setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, mixname);
                  mixColors.put(mixname, mixc);
                } else {

                  //	p.setOriginColor(networkView.getNodeView(n).getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));

                  p.getSelectGroups().add(curSetName);
                  networkView
                      .getNodeView(n)
                      .setVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, currentc);
                  networkView
                      .getNodeView(n)
                      .setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, curSetName);
                }
              }
            }
          } else {
            for (Protein p : sproteins) {
              CyNode n = p.getN();
              if (!network.containsNode(n)) {
                continue;
              }
              SetColorMap.put(curSetName, currentc);
              if (p.getSelectGroups() == null || p.getSelectGroups().isEmpty()) {

                p.setOriginColor(
                    networkView
                        .getNodeView(n)
                        .getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));

                p.setSelectGroups(new ArrayList<String>());
                p.getSelectGroups().add(curSetName);
                networkView
                    .getNodeView(n)
                    .setVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, currentc);
                networkView
                    .getNodeView(n)
                    .setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, curSetName);

              } else {

                if (ismixcolor) {
                  p.getSelectGroups().add(curSetName);
                  String mixname = "";
                  double blue = 0, red = 0, green = 0, s = p.getSelectGroups().size();
                  int r, g, b;
                  int i = 0;
                  for (String set : p.getSelectGroups()) {
                    blue += SetColorMap.get(set).getBlue();
                    red += SetColorMap.get(set).getRed();
                    green += SetColorMap.get(set).getGreen();
                    if (i == 0) mixname += set;
                    else mixname += " + " + set;
                    i++;
                  }
                  r = (int) Math.round(red / s);
                  g = (int) Math.round(green / s);
                  b = (int) Math.round(blue / s);
                  mixc = new Color(r, g, b);

                  networkView
                      .getNodeView(n)
                      .setVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, mixc);
                  networkView
                      .getNodeView(n)
                      .setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, mixname);
                  mixColors.put(mixname, mixc);
                } else {
                  //	p.setOriginColor(networkView.getNodeView(n).getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
                  p.getSelectGroups().add(curSetName);
                  networkView
                      .getNodeView(n)
                      .setVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, currentc);
                  networkView
                      .getNodeView(n)
                      .setVisualProperty(BasicVisualLexicon.NODE_TOOLTIP, curSetName);
                }
              }
            }
          }

          JPanel jp = new JPanel();
          jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));

          jp.add(new JLabel(curSetName + "  ", createColorIcon(currentc), SwingConstants.LEFT));

          JCheckBox temp = new JCheckBox();
          temp.addActionListener(new ChooseSetsAction());

          jp.add(temp);
          jp.setBorder(BorderFactory.createTitledBorder(""));
          jp.setBounds(10, Ylocation, 300, 25);
          Ylocation += 30;
          labelPanel.add(jp);

          JPanel jj = new JPanel();
          jj.setLayout(new BoxLayout(jj, BoxLayout.Y_AXIS));
          jj.setAlignmentX(Component.LEFT_ALIGNMENT);
          if (!mixColors.isEmpty()) {

            for (Entry<String, Color> mix : mixColors.entrySet()) {
              jj.add(
                  new JLabel(mix.getKey(), createColorIcon(mix.getValue()), SwingConstants.LEFT));
              jj.setBounds(10, Ylocation, 300, 25);
              Ylocation += 30;
              labelPanel.add(jj);
            }
          }

          labelPanel.repaint();
        }
      }
Esempio n. 6
0
      @Override
      public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub
        List<Protein> temp = new ArrayList<Protein>();
        int lastLineIndex = namesT.getLineCount() - 1;
        int nameNum = lastLineIndex + 1;
        int duplicateNum = 0;
        try {
          for (int i = 0; i < lastLineIndex; i++) {
            if (namesT.getLineEndOffset(i) - namesT.getLineStartOffset(i) == 1) {
              nameNum--;
              continue;
            }
            String name =
                namesT.getText(
                    namesT.getLineStartOffset(i),
                    namesT.getLineEndOffset(i) - namesT.getLineStartOffset(i) - 1);
            for (Protein p : sortResults.get(curalg)) {
              if (p.getName().equals(name)) {
                if (temp.contains(p)) {
                  duplicateNum++;
                } else {
                  temp.add(p);
                }
                break;
              }
            }
          }

          if (namesT.getLineStartOffset(lastLineIndex) == namesT.getLineEndOffset(lastLineIndex)) {
            nameNum--;
          } else {
            String name =
                namesT.getText(
                    namesT.getLineStartOffset(lastLineIndex),
                    namesT.getLineEndOffset(lastLineIndex)
                        - namesT.getLineStartOffset(lastLineIndex));
            for (Protein p : sortResults.get(curalg)) {
              if (p.getName().equals(name)) {
                temp.add(p);
                break;
              }
            }
          }
        } catch (BadLocationException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
        if (!temp.isEmpty()) {
          sproteins.clear();
          sproteins.addAll(temp);
          pUtil.sortVertex(sproteins, curalg);
          pUtil.getResultPanel(id).browserPanel.updateTable(null);
          pUtil.getResultPanel(id).browserPanel.changeSortingRange(false);
          curSetName = "Self-select proteins (No. " + ++SETINDEX + ")";
        }
        JOptionPane.showMessageDialog(
            null,
            nameNum
                + " node names have been uploaded, "
                + duplicateNum
                + " duplicated values, "
                + temp.size()
                + " nodes have been selected.",
            "Result",
            JOptionPane.WARNING_MESSAGE);
      }