/**
  * This method is called to execute the action that the StepInstance must perform.
  *
  * @param stepInstance containing the parameters for executing.
  * @param temporaryFileDirectory
  * @throws Exception could be anything thrown by the execute method.
  */
 @Override
 public void execute(StepInstance stepInstance, String temporaryFileDirectory) {
   // Retrieve raw results for protein range.
   Map<String, RawProtein<PfamHmmer3RawMatch>> rawMatches =
       rawMatchDAO.getRawMatchesForProteinIdsInRange(
           stepInstance.getBottomProtein(),
           stepInstance.getTopProtein(),
           getSignatureLibraryRelease());
   if (LOGGER.isDebugEnabled()) {
     LOGGER.debug("PfamA: Retrieved " + rawMatches.size() + " proteins to post-process.");
     int matchCount = 0;
     for (final RawProtein rawProtein : rawMatches.values()) {
       matchCount += rawProtein.getMatches().size();
     }
     LOGGER.debug("PfamA: A total of " + matchCount + " raw matches.");
   }
   // Post process
   try {
     Map<String, RawProtein<PfamHmmer3RawMatch>> filteredMatches =
         getPostProcessor().process(rawMatches);
     if (LOGGER.isDebugEnabled()) {
       LOGGER.debug(
           "PfamA: " + filteredMatches.size() + " proteins passed through post processing.");
       int matchCount = 0;
       for (final RawProtein rawProtein : filteredMatches.values()) {
         matchCount += rawProtein.getMatches().size();
       }
       LOGGER.debug("PfamA: A total of " + matchCount + " matches PASSED.");
     }
     filteredMatchDAO.persist(filteredMatches.values());
   } catch (IOException e) {
     throw new IllegalStateException(
         "IOException thrown when attempting to post process filtered matches.", e);
   }
 }
  /**
   * @param stepInstance containing the parameters for executing.
   * @param temporaryFileDirectory is the relative path in which files are stored.
   * @return
   */
  @Override
  protected List<String> createCommand(StepInstance stepInstance, String temporaryFileDirectory) {
    final String fastaFilePathName =
        stepInstance.buildFullyQualifiedFilePath(
            temporaryFileDirectory, this.getFastaFileNameTemplate());
    final String statsFilePathName =
        stepInstance.buildFullyQualifiedFilePath(
            temporaryFileDirectory, this.getStatsFileNameTemplate());
    final String fileNameTblout =
        stepInstance.buildFullyQualifiedFilePath(
            temporaryFileDirectory, outputFileNameTbloutTemplate);
    final String outputFileName =
        stepInstance.buildFullyQualifiedFilePath(temporaryFileDirectory, outputFileTemplate);

    List<String> command = new ArrayList<String>();
    if (this.getFullPathToPython().trim().isEmpty()) {
      command.add("python");
    } else {
      command.add(this.getFullPathToPython());
    }

    command.add(this.fullPathToPfsearchWrapper);
    command.add(fileNameTblout);
    command.add(fastaFilePathName);
    command.add(statsFilePathName);
    command.add(outputFileName);
    command.add(this.getModelDir());
    command.add(this.getFullPathToPFsearch());
    command.addAll(this.getBinarySwitchesAsList());

    //        command.add(fastaFilePathName);
    LOGGER.debug("binary command: " + command.toString());
    return command;
  }