Ejemplo n.º 1
0
  /*.................................................................................................................*/
  public void fillNameTranslation(DNAData editedData, int it, int numReads) {
    Associable as = editedData.getTaxaInfo(false);
    if (as == null) return;
    String[] fileNames =
        ChromaseqUtil.getStringsAssociated(as, ChromaseqUtil.origReadFileNamesRef, it);
    String[] primerNames =
        ChromaseqUtil.getStringsAssociated(as, ChromaseqUtil.primerForEachReadNamesRef, it);
    String[] sampleCodes =
        ChromaseqUtil.getStringsAssociated(as, ChromaseqUtil.sampleCodeNamesRef, it);

    for (int i = 0; i < numReads; i++) {

      if (fileNames == null) {
        if (i == 0)
          MesquiteMessage.warnProgrammer(
              "fileNames NULL in AceDirectoryProcess.fileNameTranslation");
      } else if (i * 2 + 1 < fileNames.length) {
        fileNameTranslation[0][i] = fileNames[i * 2];
        fileNameTranslation[1][i] = fileNames[i * 2 + 1];
      } else
        MesquiteMessage.warnProgrammer(
            "fileNames.length too small in AceDirectoryProcess.fileNameTranslation: fileNames.length = "
                + fileNames.length
                + ", numReads: "
                + numReads);

      if (primerNames == null) {
        if (i == 0)
          MesquiteMessage.warnProgrammer(
              "primerNames NULL in AceDirectoryProcess.fileNameTranslation");
      } else if (i * 2 + 1 < primerNames.length) fileNameTranslation[2][i] = primerNames[i * 2 + 1];
      else
        MesquiteMessage.warnProgrammer(
            "primerNames.length too small in AceDirectoryProcess.fileNameTranslation: primerNames.length = "
                + primerNames.length
                + ", numReads: "
                + numReads);

      if (sampleCodes == null) {
        if (i == 0)
          MesquiteMessage.warnProgrammer(
              "sampleCodes NULL in AceDirectoryProcess.fileNameTranslation");
      } else if (i * 3 + 2 < sampleCodes.length) {
        fileNameTranslation[3][i] = sampleCodes[i * 3 + 1];
        fileNameTranslation[4][i] = sampleCodes[i * 3 + 2];
      } else
        MesquiteMessage.warnProgrammer(
            "sampleCodes.length too small in AceDirectoryProcess.fileNameTranslation: sampleCodes.length = "
                + sampleCodes.length
                + ", numReads: "
                + numReads);
    }
  }
Ejemplo n.º 2
0
  /**
   * executes a shell script at "scriptPath". If runningFilePath is not blank and not null, then
   * Mesquite will create a file there that will serve as a flag to Mesquite that the script is
   * running.
   */
  public boolean executeInShell() {
    proc = null;
    try {
      ShellScriptUtil.setScriptFileToBeExecutable(scriptPath);
      if (!StringUtil.blank(runningFilePath)) {
        if (StringUtil.blank(runningFileMessage))
          MesquiteFile.putFileContents(runningFilePath, "Script running...", true);
        else MesquiteFile.putFileContents(runningFilePath, runningFileMessage, true);
        if (appendRemoveCommand && MesquiteFile.fileExists(runningFilePath))
          MesquiteFile.appendFileContents(
              scriptPath,
              StringUtil.lineEnding() + ShellScriptUtil.getRemoveCommand(runningFilePath),
              true); // append remove command to guarantee that the runningFile is deleted
        // +StringUtil.lineEnding()+ShellScriptUtil.getExitCommand()
      }
      proc = ShellScriptUtil.executeScript(scriptPath, visibleTerminal);

    } catch (IOException e) {
      MesquiteMessage.warnProgrammer("IOException in shell script executed by " + name);
      return false;
    }
    return true;
  }