diff --git a/Project.toml b/Project.toml index 0be1fff..9c8974f 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,7 @@ authors = ["Thomas A. Christensen II <25492070+MillironX@users.noreply.github.co version = "0.3.0" [deps] +ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/beefblup b/beefblup index 3f0c21f..46e66c6 100755 --- a/beefblup +++ b/beefblup @@ -2,5 +2,51 @@ #= exec julia --project="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" "${BASH_SOURCE[0]}" "$@" =# +# beefblup cli +# Provides a convenient CLI for using beefblup +# cSpell:includeRegExp #.* +# cSpell:includeRegExp ("""|''')[^\1]*\1 + +# Import packages using BeefBLUP -BeefBLUP.beefblup() +using ArgParse + +# If this is run without arguments, catch that before parsing +if isempty(ARGS) + BeefBLUP.beefblup() + return +end + +# Setup the argument table +argsettings = ArgParseSettings() +@add_arg_table argsettings begin + "datafile" + help = "datasheet containing the pedigree, fixed effects, and response trait formatted in CSV" + required = true + arg_type = String + "resultsfile" + help = "filename for storing the results of the analysis" + required = false + arg_type = String + "--heritability", "-t" + help = "heritability of the response trait being analyzed" + required = true + arg_type = Float64 +end + +arguments = parse_args(argsettings) + +println("Parsed args:") +for (arg,val) in arguments + println(" $arg => $val") +end + +h2 = arguments["heritability"] + +if isnothing(arguments["resultsfile"]) + BeefBLUP.beefblup(arguments["datafile"], h2) + exit() +end + +print(arguments["datafile"], arguments["resultsfile"], string(h2)) +BeefBLUP.beefblup(arguments["datafile"], arguments["resultsfile"], h2)