Program: 38109
Project: 38109
Buggy source:
/** 
 * 1. runs the bowtie program to get a .sam file. 2. runs a linux shell command to sort the sam file. 3. runs a perl script that creates a .ggf file from the sam file. 4. runs a perl script that creates a .sgr file from the .gff file. 6. runs a converted method of the smoothing and stepping scripts. 7. runs a perl script that converts the .sgr file to .wig file. 8. runs a perl script that does ratio calculation on the files, also runs smoothing on these files. All these steps have to be run in order but the clients can specify how many steps they want to run by sending parameters for the steps they want to run.
 * @param parameters String array with execution parameters
 * @param inFolder The filepath to the file to create a wig from
 * @param outFilePath Filepath to where the .wig file should be placed.
 * @throws ProcessException
 */
public String procedure(String[] parameters,String inFolder,String outFilePath) throws ProcessException {
  File[] inFiles=initiateProcedure(parameters,inFolder,outFilePath);
  ErrorLogger.log("String_Node_Str",Arrays.toString(parameters));
  if (fileDir.exists()) {
    if (checker.shouldRunBowTie()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      logString=runBowTie(rawFile1,rawFile_1_Name);
      ErrorLogger.log("String_Node_Str","String_Node_Str" + logString);
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      checkBowTieFile("String_Node_Str" + dir + rawFile_1_Name+ "String_Node_Str",rawFile_1_Name);
      toBeRemoved.push(remoteExecution + "String_Node_Str" + dir);
      filesToBeMoved=dir;
      toBeRemoved.push(filesToBeMoved);
    }
    if (checker.shouldRunSortSam()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      try {
        Picard.runSortSam(dir + rawFile_1_Name + "String_Node_Str",dir + rawFile_1_Name + "String_Node_Str");
      }
 catch (      ValidateException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
      }
catch (      InterruptedException|IOException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
        ErrorLogger.log("String_Node_Str",e.getMessage());
      }
    }
    if (checker.shouldRunRemoveDuplicates()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      try {
        Picard.runRemoveDuplicates(dir + rawFile_1_Name + "String_Node_Str",dir + rawFile_1_Name + "String_Node_Str");
      }
 catch (      ValidateException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
      }
catch (      IOException|InterruptedException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
        ErrorLogger.log("String_Node_Str",e.getMessage());
      }
    }
    if (checker.shouldRunConvert()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      try {
        Pyicos.runConvert(dir + rawFile_1_Name + "String_Node_Str");
        filesToBeMoved=dir;
        toBeRemoved.push(filesToBeMoved);
      }
 catch (      ValidateException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
        ErrorLogger.log("String_Node_Str",e.getMessage());
      }
catch (      InterruptedException|IOException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
      }
    }
    if (checker.shouldRunSamToGff()) {
      runSamToGff();
    }
    if (checker.shouldRunGffToAllnusgr()) {
      runGffToAllnusgr();
    }
    if (checker.shouldRunSmoothing()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      runSmoothing(parameters,false);
      filesToBeMoved=sortedDirForFile + "String_Node_Str";
      toBeRemoved.push(filesToBeMoved);
    }
    if (checker.shouldRunRatioCalc()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      doRatioCalculation(sortedDirForCommands + "String_Node_Str",parameters);
      runSmoothing(parameters,true);
      toBeRemoved.push(sortedDirForFile + "String_Node_Str");
      filesToBeMoved=sortedDirForFile + "String_Node_Str";
      toBeRemoved.push(filesToBeMoved);
    }
    try {
      ErrorLogger.log("String_Node_Str","String_Node_Str" + filesToBeMoved + "String_Node_Str");
      ErrorLogger.log("String_Node_Str","String_Node_Str" + outFilePath + "String_Node_Str");
      moveEndFiles("String_Node_Str" + filesToBeMoved,outFilePath);
    }
 catch (    ProcessException e) {
      cleanUp(toBeRemoved);
      throw e;
    }
  }
 else {
    logString=logString + "String_Node_Str" + "String_Node_Str"+ fileDir.toString();
  }
  return logString;
}

Fixed version (ground truth):
/** 
 * 1. runs the bowtie program to get a .sam file. 2. runs a linux shell command to sort the sam file. 3. runs a perl script that creates a .ggf file from the sam file. 4. runs a perl script that creates a .sgr file from the .gff file. 6. runs a converted method of the smoothing and stepping scripts. 7. runs a perl script that converts the .sgr file to .wig file. 8. runs a perl script that does ratio calculation on the files, also runs smoothing on these files. All these steps have to be run in order but the clients can specify how many steps they want to run by sending parameters for the steps they want to run.
 * @param parameters String array with execution parameters
 * @param inFolder The filepath to the file to create a wig from
 * @param outFilePath Filepath to where the .wig file should be placed.
 * @throws ProcessException
 */
public String procedure(String[] parameters,String inFolder,String outFilePath) throws ProcessException {
  File[] inFiles=initiateProcedure(parameters,inFolder,outFilePath);
  ErrorLogger.log("String_Node_Str",Arrays.toString(parameters));
  if (fileDir.exists()) {
    if (checker.shouldRunBowTie()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      logString=runBowTie(rawFile1,rawFile_1_Name);
      ErrorLogger.log("String_Node_Str","String_Node_Str" + logString);
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      checkBowTieFile(dir + rawFile_1_Name + "String_Node_Str",rawFile_1_Name);
      toBeRemoved.push(remoteExecution + "String_Node_Str" + dir);
      filesToBeMoved=dir;
      toBeRemoved.push(filesToBeMoved);
    }
    if (checker.shouldRunSortSam()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      try {
        Picard.runSortSam(dir + rawFile_1_Name + "String_Node_Str",dir + rawFile_1_Name + "String_Node_Str");
      }
 catch (      ValidateException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
      }
catch (      InterruptedException|IOException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
        ErrorLogger.log("String_Node_Str",e.getMessage());
      }
    }
    if (checker.shouldRunRemoveDuplicates()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      try {
        Picard.runRemoveDuplicates(dir + rawFile_1_Name + "String_Node_Str",dir + rawFile_1_Name + "String_Node_Str");
      }
 catch (      ValidateException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
      }
catch (      IOException|InterruptedException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
        ErrorLogger.log("String_Node_Str",e.getMessage());
      }
    }
    if (checker.shouldRunConvert()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      try {
        Pyicos.runConvert(dir + rawFile_1_Name + "String_Node_Str");
        filesToBeMoved=dir;
        toBeRemoved.push(filesToBeMoved);
      }
 catch (      ValidateException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
        ErrorLogger.log("String_Node_Str",e.getMessage());
      }
catch (      InterruptedException|IOException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
      }
    }
    if (checker.shouldRunSamToGff()) {
      runSamToGff();
    }
    if (checker.shouldRunGffToAllnusgr()) {
      runGffToAllnusgr();
    }
    if (checker.shouldRunSmoothing()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      runSmoothing(parameters,false);
      filesToBeMoved=sortedDirForFile + "String_Node_Str";
      toBeRemoved.push(filesToBeMoved);
    }
    if (checker.shouldRunRatioCalc()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      doRatioCalculation(sortedDirForCommands + "String_Node_Str",parameters);
      runSmoothing(parameters,true);
      toBeRemoved.push(sortedDirForFile + "String_Node_Str");
      filesToBeMoved=sortedDirForFile + "String_Node_Str";
      toBeRemoved.push(filesToBeMoved);
    }
    try {
      ErrorLogger.log("String_Node_Str","String_Node_Str" + filesToBeMoved + "String_Node_Str");
      ErrorLogger.log("String_Node_Str","String_Node_Str" + outFilePath + "String_Node_Str");
      moveEndFiles(filesToBeMoved,outFilePath);
    }
 catch (    ProcessException e) {
      cleanUp(toBeRemoved);
      throw e;
    }
  }
 else {
    logString=logString + "String_Node_Str" + "String_Node_Str"+ fileDir.toString();
  }
  return logString;
}