Program: 38115
Project: 38115
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);
  System.out.println(Arrays.toString(parameters));
  if (fileDir.exists()) {
    if (checker.shouldRunBowTie()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      logString=runBowTie(rawFile1,rawFile_1_Name);
      checkBowTieFile("String_Node_Str" + dir + rawFile_1_Name+ "String_Node_Str",rawFile_1_Name);
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      if (inFiles.length == 2) {
        logString=logString + "String_Node_Str" + runBowTie(rawFile2,rawFile_2_Name);
        checkBowTieFile(remoteExecution + "String_Node_Str" + dir+ rawFile_2_Name+ "String_Node_Str",rawFile_2_Name);
        sortSamFile(rawFile_2_Name);
      }
      toBeRemoved.push(remoteExecution + "String_Node_Str" + dir);
      filesToBeMoved=sortedDirForFile;
      toBeRemoved.push(filesToBeMoved);
    }
    if (checker.shouldRunSortSam()) {
      try {
        Picard.runSortSam(dir + rawFile_1_Name + "String_Node_Str",dir + rawFile_1_Name + "String_Node_Str");
      }
 catch (      ValidateException e) {
        e.printStackTrace();
      }
catch (      InterruptedException e) {
        e.printStackTrace();
      }
catch (      IOException e) {
        e.printStackTrace();
      }
    }
    if (checker.shouldRunRemoveDuplicates()) {
      try {
        Picard.runRemoveDuplicates(dir + rawFile_1_Name + "String_Node_Str",dir + rawFile_1_Name + "String_Node_Str");
      }
 catch (      ValidateException e) {
        e.printStackTrace();
      }
catch (      IOException e) {
        e.printStackTrace();
      }
catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
    if (checker.shouldRunConvert()) {
      try {
        System.out.println("String_Node_Str" + dir);
        Pyicos.runConvert(dir + rawFile_1_Name + "String_Node_Str");
        filesToBeMoved=sortedDirForFile;
        toBeRemoved.push(filesToBeMoved);
      }
 catch (      ValidateException e) {
        e.printStackTrace();
      }
catch (      InterruptedException e) {
        e.printStackTrace();
      }
catch (      IOException e) {
        e.printStackTrace();
      }
    }
    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 {
      moveEndFiles(filesToBeMoved,outFilePath);
    }
 catch (    ProcessException e) {
      cleanUp(toBeRemoved);
      throw e;
    }
    cleanUp(toBeRemoved);
  }
 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);
      checkBowTieFile("String_Node_Str" + dir + rawFile_1_Name+ "String_Node_Str",rawFile_1_Name);
      toBeRemoved.push(remoteExecution + "String_Node_Str" + dir);
      filesToBeMoved=sortedDirForFile;
      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");
      }
    }
    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");
      }
    }
    if (checker.shouldRunConvert()) {
      ErrorLogger.log("String_Node_Str","String_Node_Str");
      try {
        Pyicos.runConvert(dir + rawFile_1_Name + "String_Node_Str");
        filesToBeMoved=sortedDirForFile;
        toBeRemoved.push(filesToBeMoved);
      }
 catch (      ValidateException e) {
        ErrorLogger.log("String_Node_Str","String_Node_Str");
      }
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 {
      moveEndFiles(filesToBeMoved,outFilePath);
    }
 catch (    ProcessException e) {
      cleanUp(toBeRemoved);
      throw e;
    }
    cleanUp(toBeRemoved);
  }
 else {
    logString=logString + "String_Node_Str" + "String_Node_Str"+ fileDir.toString();
  }
  return logString;
}