Skip to content

Merge the Command Line version to master#44

Merged
WilliamKMLai merged 45 commits intomasterfrom
build-cli
Dec 8, 2020
Merged

Merge the Command Line version to master#44
WilliamKMLai merged 45 commits intomasterfrom
build-cli

Conversation

@owlang
Copy link
Copy Markdown
Collaborator

@owlang owlang commented Sep 29, 2020

most of the tools have a command line version built out in the build-cli branch. This commit merges the CLI version tools into the master branch.

Outlining the empty classes for building the command line version.
Although the jar file should build sucessfully, the command line
version isn't working and the tools just print the tool name for now.

build.gradle
	-change version name to reflect that its devCLI
	-add Picocli to the libraries to build with
src/main/ScriptManagerGUI
	-moved most of the code from old ScriptManager class to here as
		the GUI application class
src/main/ScriptManager
	-new main class to call GUI version or CLI version depending on
		input parameters
	-multiple classes defined for each tool group based on a generic
		abstract toolgroup class (SubcommandCLI) that is also
		defined here
	-the abstract class prints the usage message for the tool group
		if the tool name subcommand is not given by the user.
src/objects/ToolDescriptions
	-store tool descriptions in a separate object so the GUI and CLI
		versions are pulling from the same text--so its easier
		if we ever want to adjust the text
src/cli/*
	-all classes named to reflect organization of window_interface
		and scripts files
	-each implements Callable and contains relevant Picocli imports
	-each contains an empty `validateInput()` method where parameter
		formatting and validation will be carried out
	-executing will just print its class name for now until it is
		updated to execute its respective tool script
One of the redundant checks in validateInput() methods of the CLI will
be to strip the extension off a file name to build default output
filenames. The method takes a File object and returns a String object of
the file's name without the extension.
This wrapper class wraps the GUI's TextArea output object such that the
GUI components are hidden from the CLI version to avoid exceptions being
thrown when there is no way of displaying GUI components.

Since some of the GUI tools output to a TextArea GUI object, running a
CLI version on the terminal of a remote server without adjusting the
script object would throw an exception. By wrapping the TextArea in this
object, CLI won't know that it contains a GUI object unless this object
is instantiated. By writing code to avoid instantiating the object if
running as CLI, we've created a workaround for the GUI text components.

The class extends OutputStream and takes the TextArea object and saves
it in its constructor. The write() method is overriden with the code
that uses the TextArea append() method.
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/BAMtoBEDOutput class
while the calculations are kept in the src/scripts/*/BAMtoBED class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/BAMtobedGraphOutput
class while the calculations are kept in the src/scripts/*/BAMtobedGraph
class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename base and not just directory
script/*
	-strip out JFrame objects
	-use output basename as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/BAMtoGFFOutput class
while the calculations are kept in the src/scripts/*/BAMtoGFF class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/BAMtoscIDXOutput class
while the calculations are kept in the src/scripts/*/BAMtoscIDX class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
The prior method for stripping extensions from filenames would throw a
java.lang.StringIndexOutOfBoundsException if the File object input had a
name without any periods in it. This method for stripping off the
extension avoids this.
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/FilterforPIPseqOutput
class while the calculations are kept in the
src/scripts/*/FilterforPIPseq class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool was originally written as a wrapper for an existing CLI tool
so this commit just writes up the help message if a user attempts to
execute this tool from the command line. The help message will redirect
the user to the `samtools index` command.
This tool was originally written as a wrapper for an existing CLI tool
so this commit just writes up the help message if a user attempts to
execute this tool from the command line. The help message will redirect
the user to Picard's MarkDuplicates tool.
This tool was originally written as a wrapper for an existing CLI tool
so this commit just writes up the help message if a user attempts to
execute this tool from the command line. The help message will redirect
the user to Picard's MergeSamFiles tool
This tool was originally written as a wrapper for an existing CLI tool
so this commit just writes up the help message if a user attempts to
execute this tool from the command line. The help message will redirect
the user to the `samtools sort` command
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/SEStatOutput class
while the calculations are kept in the src/scripts/*/SEStats class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This method was added to be used by BAM_Statistics/PEStat to save the
duplication graph output as a PNG if a non-null filename is indicated.
This is for the CLI implementation of saving the duplication figures
shown in the GUI version.
LineChart, a general util class was updated with fixes that are relevant
to the bam-statistic's PEStat CLI version. This pulls those updates into
bam-statistics so I can finish the PEStat update.
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/PEStatsOutput class
while the calculations are kept in the src/scripts/*/PEStats class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the
src/window_interface/*/BAMGenomeCorrelationOutput class while the
calculations are kept in the src/scripts/*/BAMGenomeCorrelation class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
charts/HeatMap
	-createCorrelationHeatmap updated to take a File object for
		saving the chart when executing the CLI version
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/DNAShapefromBEDOutput
class while the calculations are kept in the
src/scripts/*/DNAShapefromBED class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full file basename and not just directory
script/*
	-strip out JFrame objects
	-use output as file basename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/DNAShapefromFASTAOutput
class while the calculations are kept in the
src/scripts/*/DNAShapefromFASTA class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full file basename and not just directory
script/*
	-strip out JFrame objects
	-use output as file basename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/FASTAExtractOutput
class while the calculations are kept in the src/scripts/*/FASTAExtract
class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
RandomizeFASTAOutput class. As a result, fewer files were affected:

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/SearchMotifOutput class
while the calculations are kept in the src/scripts/*/SearchMotif class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
I meant to replace this class with the RandomizeFASTA class for
consistent naming but I forgot to add it to the RandomizeFASTA command
line interface commit.
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/AggregateDataOutput
class while the calculations are kept in the src/scripts/*/AggregateData
class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
ScaleMatrixOutput class. As a result, fewer files were affected:

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/ScalingFactorOutput
class while the calculations are kept in the src/scripts/*/ScalingFactor
class.

Note this tool's NCIS method may need deeper testing for other cases
that would break the CLI.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool's command line development has been skipped to reflect the GUI
deactivation of the tool. I also commented out its execution in the main
ScriptManager subcommand to mimic the GUI.
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/TagPileupOutput class
while the calculations are kept in the src/scripts/*/TagPileup class.

This monster of a tool (at least compared to the others) has extra files
to update and they are described following the first few files that
relate to the general edit structure for tools so far.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
objects/PileupParameters
	-reorganized methods to put get next to set methods
	-added comments to annotate vars with details about what each
		variable is for
	-renamed a couple methods to be more descriptive by appending
		'get' to the front of the method name
	-added a method that would spit out all parameters as a command
		line execution String. Although unused for now, it may
		be useful for future features.
This tool did not implement JFrame elements in the script class so with
no adjustments to so the script or window classes, this tool was
straightforward in implementing a CLI version.

cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-skipped validateInput() method for this tool.
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
FourColorPlotOutput class. As a result, only the cli/* file was
affected. The script is a public static void method so super easy to
implement.

cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/HeatMapOutput class
while the calculations are kept in the src/scripts/*/HeatMapPlot class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/MergeHeatMapOutput
class while the calculations are kept in the src/scripts/*/MergeHeatMap
class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool is unlike the others in that there is no GUI version. It's a
straightforward tool to plot the composite output of TagPileup that uses
the existing chart/CompositePlot class as the script object. Because the
GUI version outputs a composite plot, I created this to retain that
functionality so that when this tool is used with the CLI TagPileup, it
can do the same things as the GUI version.

cli/Figure_Generation/
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
charts/CompositePlot
	-createCompositePlot() method updated to reduce redundancy
	-createChart(3params) was made public so that this tool could
		take advantage of it, instead of just being an internal
		helper method
	-createChart(4params) was updated to optionally include a legend
		(CLI makes it an optional user-specified value)
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/BEDPeakAligntoRefOutput
class while the calculations are kept in the
src/scripts/*/BEDPeakAligntoRef class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/
FilterBEDbyProximityOutput class while the calculations are kept in the
src/scripts/*/FilterBEDbyProximity class.

window_interface/*Window
	-adjust import to call *Output class
window_interface/*Output
	-adjust import to call script class
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-strip out JFrame objects
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
RandomCoordinateOutput class. As a result, no need to create an Output
window class so fewer edits to be made:

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
TileGenomeOutput class. As a result, just the following files were
affected:

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-use output as filename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
ExpandBEDOutput class. As a result, fewer files were affected:

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-use output as filename rather than directory name
	-add capability to  print to STDOUT
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
ExpandGFFOutput class. As a result, fewer files were affected:

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-use output as filename rather than directory name
	-add capability to  print to STDOUT
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
BEDtoGFFOutput class. As a result, fewer files were affected:

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-use output as filename rather than directory name
	-add capability to  print to STDOUT
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
GFFtoBEDOutput class. As a result, fewer files were affected:

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
script/*
	-use output as filename rather than directory name
	-add capability to  print to STDOUT
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
This tool did not implement JFrame elements in the script class so the
CLI implementation did not need to create an src/window_interface/*/
SortGFFOutput class.

There is a quirk with the BEDtoGFF tool that adds a semicolon to the end
of the last column with the feature ID. To make this tool compatible
with the GFF output, I split the last GFF column on the semicolon and
took the first token as the ID.

I also moved the parseCDT method originally in the window_interface/
Coordinate_Manipulation/*/Sort* classes to the util/CDTUtilities class.
The parseCDT method is used to get the number of items in a row of the
input CDT file and to check the formatting for consistent row sizes.
Since both the SortBED and SortGFF tools use the same method, this
commit merges them into the same copy that can be referenced from a
general utilities class. This will make updates easier if this method
needs to be adjusted in the future.

util/CDTUtilities
	-move parseCDT method from SortGFFWindow class to the
		CDTUtilities class
	-add properties to the class to save information on consistent
		row sizes
	-add methods to retrieve these values
	NOTE: static methods of this class appear to be unused or copied
		into another class, consider retiring
window_interface/*Window
	-adjust output argument when initializing script class to be
		full file basename and not just directory
	-lots of differences in this commit are a matter of entabbing
	-rename BED related variable names to be consistent with GFF
		variable naming
	-update CDT file loading to use CDTUtilities validation method
	-remove parseCDT() method since using CDTUtilities version
script/*
	-use output as file basename rather than directory name
	-temporary fix using String's split() method on the semicolon
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
	-import CDTUtilities and parse CDT input to check consistent
		rows as a part of validateInput()
Before, this tool was implemented with a JFrame script object so this
commit separates out the JFrame elements for CLI implementation. JFrame
elements are saved to the src/window_interface/*/SortBEDOutput class
while the calculations are kept in the src/scripts/*/SortBED class.

window_interface/*Window
	-adjust output argument when initializing script class to be
		full filename and not just directory
	-lots of differences in this commit are a matter of entabbing
	-rename BED related variable names to be consistent with GFF
		variable naming
	-update CDT file loading to use CDTUtilities validation method
	-remove parseCDT() method since using CDTUtilities version
script/*
	-use output as file basename rather than directory name
cli/*
	-call appropriate script class
	-write up picocli parsing objects
	-write up validateInput() method to check inputs and write
		messages for the user
	-import CDTUtilities and parse CDT input to check consistent
		rows as a part of validateInput()
@WilliamKMLai WilliamKMLai merged commit 0fedaa3 into master Dec 8, 2020
@WilliamKMLai WilliamKMLai deleted the build-cli branch December 8, 2020 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants