Exemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  protected void saveInternals(final File internDir, final ExecutionMonitor exec)
      throws IOException, CanceledExecutionException {

    // save m_muscle_map...
    ModelContent modelContent = new ModelContent("muscle-internals.model");
    String[] keys = m_muscle_map.keySet().toArray(new String[0]);
    modelContent.addStringArray("internal-muscle-map-keys", keys);
    ModelContentWO subkey = modelContent.addModelContent("internal-muscle-map");
    for (String key : keys) {
      subkey.addDataCell(key, m_muscle_map.get(key));
    }
    // create the XML file alongside the rest of the node data (same folder)
    File file = new File(internDir, "muscle-internals.xml");
    FileOutputStream fos = new FileOutputStream(file);
    modelContent.saveToXML(fos);
  }
Exemplo n.º 2
0
  /** {@inheritDoc} */
  @Override
  protected void loadInternals(final File internDir, final ExecutionMonitor exec)
      throws IOException, CanceledExecutionException {

    File file = new File(internDir, "muscle-internals.xml");
    FileInputStream fis = new FileInputStream(file);
    ModelContentRO modelContent = ModelContent.loadFromXML(fis);
    try {
      String[] keys = modelContent.getStringArray("internal-muscle-map-keys");
      m_muscle_map.clear();
      ModelContentRO subkey = modelContent.getModelContent("internal-muscle-map");
      for (String key : keys) {
        DataCell dc = subkey.getDataCell(key);
        if (dc instanceof MultiAlignmentCell) {
          m_muscle_map.put(key, (MultiAlignmentCell) dc);
        }
      }
      fis.close();
    } catch (InvalidSettingsException e) {
      throw new IOException(e.getMessage());
    }
  }