@Override
        public void safeActionPerformed(ActionEvent e) throws Exception {

          String fileName;
          fileName = study.getStudyName() + "_consensus_matrix";
          File currentDirectory = new File(studyFile.getParent());
          currentDirectory.mkdir();

          JFileChooser fileChooser = new JFileChooser();
          fileChooser.setFileFilter(new FileNameExtensionFilter("Comma-Separated Values", "csv"));
          fileChooser.setCurrentDirectory(currentDirectory);
          fileChooser.setSelectedFile(new File(fileName + ".csv"));
          fileChooser.setDialogTitle("Save Consensus Matrix (CSV)");
          fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

          int returnValue = JFileChooser.APPROVE_OPTION;
          while (returnValue == JFileChooser.APPROVE_OPTION) {
            returnValue = fileChooser.showSaveDialog(parent);
            File dataFile = fileChooser.getSelectedFile();
            try {
              if (dataFile != null && !dataFile.isDirectory()) {
                String path = dataFile.getAbsolutePath();
                if (!path.endsWith(".csv")) {
                  path += ".csv";
                  dataFile = new File(path);
                }
                Integer missingAllowed = 2;
                String missingString =
                    (String)
                        JOptionPane.showInputDialog(
                            self,
                            "How many alters can a reporter not report on?"
                                + "\n    (Enter a number)",
                            "Allowed missing values - filled in randomly",
                            JOptionPane.PLAIN_MESSAGE,
                            null,
                            null,
                            missingAllowed + "");
                try {
                  missingAllowed = Integer.parseInt(missingString);
                } catch (Exception ex) {
                  JOptionPane.showMessageDialog(
                      self,
                      "Didn't understand how many alters a reporter is allowed to not report on."
                          + "\nFalling back on default value of "
                          + missingAllowed
                          + ".");
                }
                String msg = new ConsensusDataWriter(net, missingAllowed).writeToFile(dataFile);
                JOptionPane.showMessageDialog(self, msg);
              }
            } catch (Exception e1) {
              throw new RuntimeException(e1);
            }
            break;
          }
        }
        @Override
        public void safeActionPerformed(ActionEvent e) throws Exception {

          String fileName;
          fileName = study.getStudyName() + "_wholenetwork_edgelist";
          File currentDirectory = new File(studyFile.getParent() + "/Graphs");
          currentDirectory.mkdir();

          JFileChooser fileChooser = new JFileChooser();
          fileChooser.setFileFilter(new FileNameExtensionFilter("Comma-Separated Values", "csv"));
          fileChooser.setCurrentDirectory(currentDirectory);
          fileChooser.setSelectedFile(new File(fileName + ".csv"));
          fileChooser.setDialogTitle("Save Whole Network Adjacency Matrix (CSV)");
          fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

          int returnValue = JFileChooser.APPROVE_OPTION;
          while (returnValue == JFileChooser.APPROVE_OPTION) {
            returnValue = fileChooser.showSaveDialog(parent);
            File dataFile = fileChooser.getSelectedFile();
            try {
              if (dataFile != null && !dataFile.isDirectory()) {
                String path = dataFile.getAbsolutePath();
                if (!path.endsWith(".csv")) {
                  path += ".csv";
                  dataFile = new File(path);
                }
                AdjacencyWriter fw = new AdjacencyWriter(dataFile);
                Pair<String[], int[][]> p = net.getAdjacencyMatrix();
                fw.writeAdjacency(p.getFirst(), p.getSecond());
                fw.close();
              }
            } catch (Exception e1) {
              throw new RuntimeException(e1);
            }
            break;
          }
        }
        @Override
        public void safeActionPerformed(ActionEvent e) throws Exception {

          String fileName;
          fileName = study.getStudyName() + "_wholenetwork_nodes";
          File currentDirectory = new File(studyFile.getParent() + "/Graphs");
          currentDirectory.mkdir();

          JFileChooser fileChooser = new JFileChooser();
          fileChooser.setFileFilter(new FileNameExtensionFilter("Comma-Separated Values", "csv"));
          fileChooser.setCurrentDirectory(currentDirectory);
          fileChooser.setSelectedFile(new File(fileName + ".csv"));
          fileChooser.setDialogTitle("Save Alter Attributes (CSV)");
          fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

          int returnValue = JFileChooser.APPROVE_OPTION;
          while (returnValue == JFileChooser.APPROVE_OPTION) {
            returnValue = fileChooser.showSaveDialog(parent);
            File dataFile = fileChooser.getSelectedFile();
            try {
              if (dataFile != null && !dataFile.isDirectory()) {
                String path = dataFile.getAbsolutePath();
                if (!path.endsWith(".csv")) {
                  path += ".csv";
                  dataFile = new File(path);
                }

                FileWriter fw = new FileWriter(dataFile);
                CSVWriter csv = new CSVWriter(fw);

                Set<String> questionSet = Sets.newHashSet();
                for (WholeNetworkAlter alter : net.getWholeNetworkAlters().values()) {
                  questionSet.addAll(alter.getAttributes().keySet());
                }
                List<String> questionList = new ArrayList<String>(questionSet);

                List<String> heading = Lists.newArrayList("MappingId", "Name");
                heading.addAll(questionList);
                csv.writeNext(heading.toArray(new String[] {}));

                for (WholeNetworkAlter alter : net.getWholeNetworkAlters().values()) {
                  ArrayList<String> row =
                      Lists.newArrayList(
                          alter.getId() + "",
                          alter
                              .getOccurences()
                              .get(0)
                              .toString()
                              .replaceAll("[^a-zA-Z_\\-0-9]+", "_"));
                  Map<String, String> answers = alter.getAttributes();
                  for (String question : questionList) {
                    String value = answers.get(question);
                    row.add(value == null ? "" : value);
                  }
                  csv.writeNext(row.toArray(new String[] {}));
                }

                csv.flush();
                fw.close();
              }
            } catch (Exception e1) {
              throw new RuntimeException(e1);
            }
            break;
          }
        }