public class BioLockJUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
INTERNAL_PIPELINE_INPUT_TYPES
Internal
Config String property: "internal.pipelineInputTypes"This value is set after parsing the input files from Config property:
"input.dirPaths" in the method: getPipelineInputFiles(). |
static String |
PIPELINE_HUMANN2_COUNT_TABLE_INPUT_TYPE
Pipeline input file type indicating the file is Humann2 generated
|
static String |
PIPELINE_LOG_NORMAL_TAXA_COUNT_TABLE_INPUT_TYPE
Internal
Config String property: "taxa_count_log_norm"Set as the value of "internal.pipelineInputTypes" for log-normalized taxa count files that meet the file requirements to pass TaxaUtil.isLogNormalizedTaxaFile(File). |
static String |
PIPELINE_NORMAL_TAXA_COUNT_TABLE_INPUT_TYPE
Internal
Config String property: "taxa_count_norm"Set as the value of "internal.pipelineInputTypes" for normalized taxa count files that meet the file requirements to pass TaxaUtil.isNormalizedTaxaFile(File). |
static String |
PIPELINE_OTU_COUNT_TABLE_INPUT_TYPE
Internal
Config String property: "otu_count"Set as the value of "internal.pipelineInputTypes" for OTU count files that meet the file requirements to pass OtuUtil.isOtuFile(File). |
static String |
PIPELINE_PAIRED_READS_INPUT_TYPE
Internal
Config String property: "paired"Set as the value of "internal.pipelineInputTypes" for paired sequence input files. |
static String |
PIPELINE_PARSER_INPUT_TYPE
Internal
Config String property: "classifier_output"Set as the value of "internal.pipelineInputTypes" for classifier output files. |
static String |
PIPELINE_R_INPUT_TYPE
Internal
Config String property: "R"Set as the value of "internal.pipelineInputTypes" if input files are some type of count table merged with the metadata such as those output by AddMetadataToTaxaTables. |
static String |
PIPELINE_SEQ_INPUT_TYPE
Internal
Config String property: "seq"Set as the value of "internal.pipelineInputTypes" for sequence input files. |
static String |
PIPELINE_STATS_TABLE_INPUT_TYPE
Internal
Config String property: "stats"Set as the value of "internal.pipelineInputTypes" if input files are tables of statistics such as those output by R_CalculateStats. |
static String |
PIPELINE_TAXA_COUNT_TABLE_INPUT_TYPE
Internal
Config String property: "taxa_count"Set as the value of "internal.pipelineInputTypes" for taxa count files that meet the file requirements to pass TaxaUtil.isTaxaFile(File). |
static String |
RETURN
Return character constant *backslash-n*
|
| Constructor and Description |
|---|
BioLockJUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
addLeadingSpaces(String val,
int length)
Add leading spaces until the val is padded to given length
|
static String |
addTrailingSpaces(String val,
int length)
Add trailing spaces until the val is padded to given length
|
static void |
checkVersion() |
static boolean |
copyInputFiles()
Copy input files into an internal folder within the pipeline root direction named "input"
|
static File |
createFile(String path)
Used to save status files for modules and the pipeline.
|
static String |
fileExt(File file)
Return the file extension - but ignore ".gz".
|
static String |
formatDigits(Integer input,
Integer numDigits)
This method formats the input number to have a length of at least numDigits.
Simply add leading zeros until numDigits is reached. |
static String |
formatNumericOutput(Long input,
boolean addCommas)
This method formats the input number by adding commas.
|
static String |
formatPercentage(long num,
long denom)
Build the percentage display string for the num/denom ratio as "##.##%"
|
static File |
getBljDir()
Get the program source (either the jar path or main class biolockj.BioLockJ);
|
static List<String> |
getClassNames(Collection<?> objs)
Return an ordered list of the class names from the input collection.
|
static String |
getCollectionAsString(Collection<?> data)
Concatenate data and return as a comma separated String.
|
static File |
getCommonParent(File f1,
File f2)
Compare files to return a common parent directory (if any)
|
static String |
getDateString()
Get todays date represented as YEARmonDA.
|
static List<String> |
getFilePaths(Collection<File> files)
Return an ordered list of absolute file paths from the input collection.
|
static BufferedReader |
getFileReader(File file)
Get a
BufferedReader for standard text file or GZIPInputStream for gzipped files ending in ".gz" |
static List<File> |
getInputDirs()
Get the list of input directories for the pipeline.
|
static List<InputDataModule> |
getInputModules() |
static Collection<File> |
getPipelineInputFiles()
Basic input files may be sequences, or any other file type acceptable in a pipeline module.
|
static File |
getSource()
Get the source of the java runtime classes ( /bin directory or JAR file ).
|
static File |
getUserProfile()
Deprecated.
|
static String |
getVersion()
Method returns the current version of BioLockJ without Git build info
|
static String |
getVersion(boolean getBuildId)
Method returns the current version of BioLockJ - or undefined message.
|
static boolean |
hasNullOrEmptyVal(Collection<Object> vals)
Check collection vals for null or empty toString() values
|
static void |
ignoreFile(File file)
Method used to add a file to the ignore file list property.
|
static void |
initPipelineInput()
Basic input files may be sequences, or any other file type acceptable in a pipeline module.
|
static boolean |
isDirectMode()
Return TRUE if runtime parameters indicate attempt to run in direct mode
|
static String |
join(Collection<?> collection)
Merge the collection into a String with 1 space between each element.toString() value.
|
static int |
millisToMinutes(long milliseconds)
Convert milliseconds to minutes - useful to convert Java millisecond output rounded to the nearest minute.
|
static long |
minutesToMillis(int minutes)
Convert minutes to milliseconds - useful to convert Config props measure in minutes to milliseconds since many
Java functions have milliseconds args.
|
static List<List<String>> |
parseCountTable(File file)
Read in BioLockJ count table, each inner lists represents 1 line from the file.
Each cell in the tab delimited file is stored as 1 element in the inner lists. |
static boolean |
pipelineInputType(String type)
Convenience method to check pipeline input file type.
|
static File |
pipelineInternalInputDir()
Return the pipeline input directory
|
static String |
printLongFormList(Collection<?> data)
Print collection one item per line.
|
static List<File> |
removeIgnoredAndEmptyFiles(Collection<File> files)
Remove ignored and empty files from the input files.
|
static String |
removeOuterQuotes(String value)
Remove the outer single or double quotes of the given value.
Quotes are only removed if quotes are found as very 1st and last characters. |
static String |
removeQuotes(String value)
Remove all single and double quotation marks found in value.
|
static void |
showInfo(String[] args)
Print basic version or help info if requested.
Called by 1st line BioLockJ.java main() method |
public static final String INTERNAL_PIPELINE_INPUT_TYPES
Config String property: "internal.pipelineInputTypes"Config property:
"input.dirPaths" in the method: getPipelineInputFiles(). The primary purpose of
storing this value is to determine if BioModule.getPreRequisiteModules() are appropriate
to add during pipeline initialization.BioModule.getPreRequisiteModules() are add dependent modules if missing from the
Config. This ensures the current module will have the correct input files and is a convenient
way to manage the size and readability of Config files. Prerequisite modules are always
appropriate for full pipelines with sequence input file, however if the output from a prerequisite module is used
as the input for a new pipeline via "input.dirPaths", adding the prerequisite module will
cause FATAL pipeline errors.public static final String PIPELINE_HUMANN2_COUNT_TABLE_INPUT_TYPE
public static final String PIPELINE_LOG_NORMAL_TAXA_COUNT_TABLE_INPUT_TYPE
Config String property: "taxa_count_log_norm"TaxaUtil.isLogNormalizedTaxaFile(File).public static final String PIPELINE_NORMAL_TAXA_COUNT_TABLE_INPUT_TYPE
Config String property: "taxa_count_norm"TaxaUtil.isNormalizedTaxaFile(File).public static final String PIPELINE_OTU_COUNT_TABLE_INPUT_TYPE
Config String property: "otu_count"OtuUtil.isOtuFile(File).public static final String PIPELINE_PARSER_INPUT_TYPE
Config String property: "classifier_output"public static final String PIPELINE_R_INPUT_TYPE
Config String property: "R"AddMetadataToTaxaTables. These
files can be input into any R_Module.public static final String PIPELINE_SEQ_INPUT_TYPE
Config String property: "seq"public static final String PIPELINE_PAIRED_READS_INPUT_TYPE
Config String property: "paired"public static final String PIPELINE_STATS_TABLE_INPUT_TYPE
Config String property: "stats"R_CalculateStats.public static final String PIPELINE_TAXA_COUNT_TABLE_INPUT_TYPE
Config String property: "taxa_count"TaxaUtil.isTaxaFile(File).public static final String RETURN
public static String addLeadingSpaces(String val, int length)
val - Value to add spaceslength - Total length of val with spacespublic static String addTrailingSpaces(String val, int length)
val - Value to add spaceslength - Total length of val with spacespublic static boolean copyInputFiles()
throws ConfigNotFoundException,
ConfigFormatException
ConfigNotFoundException - if "input.dirPaths" or
"pipeline.copyInput" property is undefinedConfigFormatException - if "pipeline.copyInput" does not have a boolean "Y" or
"N" valuepublic static File createFile(String path) throws BioLockJStatusException, IOException
path - Target dir pathBioLockJStatusExceptionIOExceptionException - if errors occur attempting to save the filepublic static String fileExt(File file)
file - Filepublic static String formatDigits(Integer input, Integer numDigits)
input - Integer valuenumDigits - Number of digits return value should containpublic static String formatNumericOutput(Long input, boolean addCommas)
input - Long valueaddCommas - boolean if numeric output should be displayed using commaspublic static String formatPercentage(long num, long denom)
num - Numeratordenom - Denominatorpublic static File getBljDir() throws ConfigPathException
ConfigPathException - if unable to determine $BLJ sourcepublic static List<String> getClassNames(Collection<?> objs)
objs - Objectspublic static String getCollectionAsString(Collection<?> data)
data - Collection of datapublic static File getCommonParent(File f1, File f2)
f1 - File 1f2 - File 2public static List<String> getFilePaths(Collection<File> files)
files - Filespublic static BufferedReader getFileReader(File file) throws FileNotFoundException, IOException
BufferedReader for standard text file or GZIPInputStream for gzipped files ending in ".gz"file - to be readBufferedReader or GZIPInputStream if file is gzippedFileNotFoundException - if file does not existIOException - if unable to read or write the filepublic static List<File> getInputDirs() throws Exception
Exceptionpublic static Collection<File> getPipelineInputFiles()
public static File getSource() throws URISyntaxException
URISyntaxException - if unable to locate the Java source@Deprecated public static File getUserProfile()
public static String getVersion()
public static String getVersion(boolean getBuildId)
getBuildId - boolean - If enabled, print git revision hashpublic static void checkVersion()
public static boolean hasNullOrEmptyVal(Collection<Object> vals)
vals - Collection of objectspublic static void ignoreFile(File file) throws DockerVolCreationException
file - File to ignoreDockerVolCreationExceptionpublic static void initPipelineInput()
throws Exception
Exceptionpublic static List<InputDataModule> getInputModules() throws Exception
Exceptionpublic static boolean isDirectMode()
public static String join(Collection<?> collection)
collection - Collection of objectspublic static int millisToMinutes(long milliseconds)
milliseconds - number of millisecondspublic static long minutesToMillis(int minutes)
minutes - number of minutespublic static List<List<String>> parseCountTable(File file) throws FileNotFoundException, IOException
file - Path abundance fileIOException - if errors occur reading path abundance fileFileNotFoundException - if path abundance file not foundpublic static boolean pipelineInputType(String type) throws ConfigNotFoundException
type - Pipeline input file typeConfig."internal.pipelineInputTypes"ConfigNotFoundException - if "internal.pipelineInputTypes" is undefinedpublic static String getDateString()
public static File pipelineInternalInputDir()
public static String printLongFormList(Collection<?> data)
data - Collection of datapublic static List<File> removeIgnoredAndEmptyFiles(Collection<File> files)
files - Collection of filespublic static String removeOuterQuotes(String value)
value - Possibly quoted valuepublic static String removeQuotes(String value)
value - Possibly quoted valuepublic static void showInfo(String[] args)
args - BioLockJ.java main() runtime args