@@ -0,0 +1,2699 @@
+package com.github.sparkcaller;%0A%0Aimport picard.vcf.MergeVcfs;%0A%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.lang.reflect.Array;%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.Properties;%0A%0Apublic class Utils %7B%0A    /*%0A    Get all the files in the folder 'pathToFolder' ending with 'fileExtension', and return them as an ArrayList.%0A    */%0A    public static ArrayList%3CFile%3E getFilesInFolder(String pathToFolder, String fileExtension) %7B%0A        File folder = new File(pathToFolder);%0A        File%5B%5D listOfFiles = folder.listFiles();%0A%0A        if (listOfFiles != null) %7B%0A            ArrayList%3CFile%3E bamFiles = new ArrayList%3CFile%3E();%0A%0A            for (File file : listOfFiles) %7B%0A                if (file.isFile() && file.getName().endsWith(fileExtension)) %7B%0A                    bamFiles.add(file);%0A                %7D%0A            %7D%0A            return bamFiles;%0A        %7D%0A%0A        System.err.println(String.format(%22The folder: %25s is either empty or was not found!%22, folder.getName()));%0A        return null;%0A    %7D%0A%0A    public static String removeExtenstion(String filepath, String ext) %7B%0A        return filepath.substring(0, filepath.length() - (ext.length()+1));%0A    %7D%0A%0A    /*%0A    Merges all the VCF files specified in the list 'vcfFiles' and returns the filename of the output file.%0A    */%0A    public static String mergeVCFFiles(List%3CFile%3E vcfFiles, String outputFileName) %7B%0A        MergeVcfs mergeEngine = new MergeVcfs();%0A        mergeEngine.INPUT = vcfFiles;%0A%0A        // Only pass the output file as an argument,%0A        // as it is more efficient to set the input files directly in the object.%0A        String outputArgs%5B%5D = %7B%22O=%22 + outputFileName%7D;%0A%0A        mergeEngine.instanceMain(outputArgs);%0A        return outputFileName;%0A    %7D%0A%0A    public static Properties loadConfigFile(String configFilepath) %7B%0A        Properties prop = new Properties();%0A        InputStream input = null;%0A%0A        try %7B%0A            input = new FileInputStream(configFilepath);%0A            prop.load(input);%0A        %7D catch (IOException ex) %7B%0A            ex.printStackTrace();%0A        %7D finally %7B%0A            if (input != null) %7B%0A                try %7B%0A                    input.close();%0A                %7D catch (IOException e) %7B%0A                    e.printStackTrace();%0A                %7D%0A            %7D%0A        %7D%0A%0A        return prop;%0A    %7D%0A%0A    public static ArrayList%3CString%3E possibleStringToArgs(String maybeString) %7B%0A        if (maybeString == null) %7B%0A            return null;%0A        %7D%0A%0A        String%5B%5D args = maybeString.split(%22%5C%5Cs+%22);%0A        return new ArrayList%3CString%3E(Arrays.asList(args));%0A    %7D%0A%7D%0A

Create a class containing some file related utilities commonly used in this project.