Skip to content

Commit

Permalink
Merge pull request #22 from TARGENE/argparse
Browse files Browse the repository at this point in the history
Argparse
  • Loading branch information
olivierlabayle authored Feb 5, 2024
2 parents af7f4fd + 43a215c commit 19462d3
Show file tree
Hide file tree
Showing 77 changed files with 2,245 additions and 1,790 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,31 @@ jobs:
fail-fast: false
matrix:
version:
- '1.9'
- '1'
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
- 'x64'
steps:
- uses: actions/checkout@v2
- name: Install curl
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: 4.2.3
- name: Install R dependencies
run: |
install.packages("devtools", repos="http://cran.us.r-project.org", dependecies=TRUE)
require(devtools)
install_version("hal9001", version = "0.4.1", repos = "http://cran.us.r-project.org")
shell: Rscript {0}
- name: Set R_HOME
run: echo "R_HOME=$(R RHOME)" >> $GITHUB_ENV
- name: Set LD_LIBRARY
run: echo "LD_LIBRARY_PATH=$R_HOME/lib" >> $GITHUB_ENV
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v2
with:
files: lcov.info
- uses: julia-actions/julia-processcoverage@v1
# - name: Build App
# run: julia --project --startup-file=no deps/build_app.jl
# - uses: actions/upload-artifact@v4
# with:
# name: tmle-${{ matrix.os }}-${{ matrix.arch }}
# path: tmle
docs:
name: Documentation
runs-on: ubuntu-latest
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ deps/build.log
deps/downloads/
deps/usr/
deps/src/
tmle/

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/
docs/Manifest.toml

test/Manifest.toml
sysimage/Manifest.toml

Manifest.toml

build/
25 changes: 16 additions & 9 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name = "TargetedEstimation"
uuid = "2573d147-4098-46ba-9db2-8608d210ccac"
authors = ["Olivier Labayle"]
version = "0.7.4"
version = "0.8.0"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Configurations = "5218b696-f38b-4ac9-8b61-a12ec717816d"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
EvoTrees = "f6006082-12f8-11e9-0c9c-0d5d367ab1e5"
GLMNet = "8d5ece8b-de18-5317-b113-243142960cc6"
HighlyAdaptiveLasso = "c5dac772-1445-43c4-b698-9440de7877f6"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
MKL = "33e6dc65-8f57-5167-99aa-e5a354878fb2"
MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
Expand All @@ -24,31 +26,36 @@ MLJXGBoostInterface = "54119dfa-1dab-4055-a167-80440f4f7a91"
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
MultipleTesting = "f8716d33-7c4a-5097-896f-ce0ecbd3ef6b"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
TMLE = "8afdd2fb-6e73-43df-8b62-b1650cd9c8cf"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"

[compat]
PackageCompiler = "2.1.16"
ArgParse = "1.1.4"
Arrow = "2.5.2"
CSV = "0.10"
CategoricalArrays = "0.10"
Combinatorics = "1.0.2"
Configurations = "0.17.6"
DataFrames = "1.3.4"
EvoTrees = "0.16"
EvoTrees = "0.16.5"
GLMNet = "0.7"
HighlyAdaptiveLasso = "0.2.0"
JLD2 = "0.4.22"
JSON = "0.21.4"
MKL = "0.6"
MLJ = "0.19"
MLJBase = "0.21"
MLJLinearModels = "0.9"
MLJ = "0.20.0"
MLJBase = "1.0.1"
MLJLinearModels = "0.10.0"
MLJModelInterface = "1.8.0"
MLJModels = "0.16"
MLJXGBoostInterface = "0.3.4"
MultipleTesting = "0.5.1"
MultipleTesting = "0.6.0"
Optim = "1.7"
TMLE = "0.11.4"
TMLE = "0.14.0"
Tables = "1.10.1"
YAML = "0.4.9"
julia = "1.7, 1"
101 changes: 101 additions & 0 deletions data/sample_dataset.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
T,W_1,W_2,Y
false,0.18102554215580358,0.5450806703063027,2.9940372099784027
false,0.3674899461902501,0.6384329204193084,3.6556468914971756
false,0.6690584311411027,0.43792082835867485,3.6566892558262984
false,0.04273056581197765,0.7757285573916282,3.4160794440612667
false,0.4379909608992427,0.3047310991183463,2.789125420976082
true,0.4832901297478609,0.7451730217771686,1.5859557539740305
false,0.7639737291557767,0.8904601966212045,5.188296343573969
true,0.9244830959536434,0.13974660123511873,0.4982270316308855
false,0.5150451217580685,0.6374757520926937,3.935855162247756
false,0.49504171746863457,0.8565155620522915,4.561765097844799
false,0.7013399928855184,0.8136974906450547,4.829305702798148
false,0.6935693200259092,0.7770630474285287,4.708377370910661
false,0.8762727975157072,0.6985801341473621,4.853277788606795
true,0.9442193089864095,0.152194194900529,4.037983372295075
false,0.7392125921999604,0.15113069121626244,2.928937148645259
false,0.5595446681103335,0.32420235015472953,3.0840500870314176
true,0.5068756305502102,0.7933086736255439,4.003336818622111
true,0.6460238520948196,0.09241238685905295,1.8598644023282838
false,0.26637285700482627,0.32928469720586406,2.5254756391406956
true,0.25314126112406954,0.005639780239579784,2.0525644282124227
false,0.3516179276178317,0.562947511861783,3.3891190015292962
true,0.5273890936851706,0.5791653992166597,2.236487556841665
true,0.7210925534616786,0.0815702398426259,3.0907289031725105
false,0.18851150251759496,0.4507062485489093,2.7103706395089318
false,0.637996251650204,0.2796408144910678,3.1179620782873023
false,0.42784339776115243,0.05608349255807643,2.021998670506748
false,0.36344680674044993,0.8176529855849277,4.187058502288485
false,0.5776470899697952,0.5038402847145775,3.664411058533266
false,0.4552051132605446,0.80168727438732,4.324422128772599
true,0.16582015869838074,0.6517102569667845,3.4493844928436257
true,0.3485177133589714,0.6950429952352082,3.6465473336626584
false,0.7370786697973803,0.38967172496607816,3.634455876824883
false,0.8097943410644535,0.30785356657086305,3.5631085002530503
true,0.17116662327378251,0.38189260775289746,1.4561452308524758
true,0.2239059463776638,0.37754440958420843,2.9358196480011927
false,0.8482049921559374,0.7931999164105743,5.073800536916948
false,0.6129496106778634,0.5582656110841486,3.9006286335176275
false,0.9525421237374148,0.7075371298070849,5.027958774493786
false,0.329471340006501,0.8244276908646733,4.133141608706676
true,0.9183731870724761,0.5155924027190455,2.1766450039509775
true,0.5406318800132754,0.7964424508760488,4.684487622068989
false,0.820474440393214,0.3278374872665033,3.6201478925383053
false,0.22304578643880224,0.15454141257308707,1.9141989300490125
true,0.5987759444612732,0.8176931599179378,4.883829492724324
true,0.5391280234619427,0.0800996880924989,-0.15332305595018275
true,0.6195348270893413,0.04758713076380294,1.5044413418755769
false,0.4197760589260566,0.6919387484370496,3.913552132910235
false,0.45325909384306007,0.8196586617380355,4.361479188698554
false,0.458012070794656,0.16787410906435518,2.3890361585879396
false,0.8360692316060747,0.12572716005598905,3.0494749469842053
false,0.68704221750134,0.9336977783694771,5.162792856806991
false,0.3539590866764071,0.4938068514848526,3.201878898498728
false,0.15146985093210463,0.9318499781184257,4.0825781392628055
true,0.7036713552821277,0.3110022402796051,4.247461621524256
false,0.7858058549340399,0.7913869099880062,4.9487597218140555
false,0.5516353577049822,0.7651183843708445,4.394357280603648
false,0.33689370624999193,0.8200595760169511,4.122787054444181
false,0.7103550345192344,0.5218538906399544,3.9851980589961844
false,0.3437537135972244,0.7082383555963896,3.8223674411348094
true,0.40543796744015514,0.07340489667656125,-0.44867162036508734
false,0.418787685820859,0.9537197956213714,4.671368501348916
false,0.3461876693258523,0.17116028512837467,2.196479242014222
false,0.256693308150987,0.7535261803886308,3.7658816939059676
false,0.15717578481324845,0.9086295629550201,4.041940493212971
false,0.06397027012871725,0.748570362698747,3.3694111418545805
true,0.5960710257852946,0.6663504027833114,3.367016019904959
true,0.3313524247810329,0.6591751071404244,1.591879202485502
true,0.09653466861970061,0.6363397790684187,2.9197943852934563
false,0.2444274100956212,0.2098958139673206,2.1388072276125003
true,0.128071302925437,0.2212452403166849,0.2377448923043096
true,0.42570257768498054,0.19674477205988938,1.387006507647053
true,0.9265378351770237,0.2414821377114318,3.7979295737435383
false,0.49186280724413045,0.12746729440853555,2.384783686379066
false,0.13454928219280093,0.4781845302027954,2.710629287272798
true,0.7767793160877585,0.524392439209832,2.5943698653629785
false,0.5975255336244989,0.390410633670742,3.3711308436058625
true,0.36037123968128437,0.08296139972284933,-0.759956439158037
false,0.0346420282305675,0.0617778348993705,1.2471920828108296
false,0.002639461613289207,0.7009785602029246,3.0993420302705896
false,0.6043418433725678,0.6486688636856162,4.156769560508067
false,0.34013328112005636,0.1345850741469954,2.08159579861953
false,0.08884383382645145,0.3088038486943412,2.1056178972765487
false,0.27042373335313585,0.006888583580566321,1.556777817484051
false,0.2906905645217257,0.541835309258762,3.2236471704885887
false,0.1159966466957052,0.5135297293779133,2.783128796238891
true,0.8470732321945746,0.42816797170836707,2.0301351712154556
true,0.8139519778944555,0.24560986612792113,1.7245624951948406
false,0.060180250784984235,0.49673727324525174,2.622413005826214
true,0.42137186429269047,0.16330846948665134,0.8216594084825344
true,0.6798160152993227,0.5456659244000286,2.8674322144135957
false,0.7229464588051613,0.43577650941532386,3.7550371808310166
false,0.7375979790215319,0.9110656955098189,5.216039115140225
false,0.5523948722167735,0.9189451331877909,4.858501050384263
false,0.970875486702566,0.06627679288609234,3.143553167360774
true,0.7978957981860126,0.16648221966941223,0.3279875381813927
false,0.6832983780571866,0.6493963093415174,4.318015004991571
false,0.523122205661108,0.05689713675107577,2.230304870061633
false,0.8553411083874956,0.7608458973060162,4.992917779986071
false,0.2884613639525233,0.40667243126317154,2.79960851563243
true,0.4312330027658198,0.24848292057152732,2.172648627086597
6 changes: 6 additions & 0 deletions deps/build_app.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using PackageCompiler
PackageCompiler.create_app(".", "tmle",
executables = ["tmle" => "julia_main"],
precompile_execution_file="deps/execute.jl",
include_lazy_artifacts=true
)
7 changes: 7 additions & 0 deletions deps/build_sysimage.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using PackageCompiler
PackageCompiler.create_sysimage(
["TargetedEstimation"],
cpu_target="generic",
sysimage_path="TMLESysimage.so",
precompile_execution_file="deps/execute.jl",
)
5 changes: 3 additions & 2 deletions sysimage/precompile_exec_file.jl → deps/execute.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import TargetedEstimation
using TargetedEstimation

@info "Running precompilation script."
# Run workload
TEST_DIR = joinpath(pkgdir(TargetedEstimation), "test")
push!(LOAD_PATH, TEST_DIR)
cd(TEST_DIR)
include(joinpath(TEST_DIR, "runtests.jl"))
43 changes: 12 additions & 31 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,28 @@
FROM julia:1.9.0-bullseye
FROM julia:1.10-bullseye

ARG DEBIAN_FRONTEND=noninteractive

ENV TZ=Europe/Amsterdam

ENV JULIA_DEPOT_PATH=/opt

RUN apt-get update && apt-get install -y wget unzip procps
RUN apt-get update && \
apt-get -y install gcc mono-mcs vim procps wget lsb-release software-properties-common gnupg && \
rm -rf /var/lib/apt/lists/*

# Install R and hal9001
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"

RUN apt-get install -y r-base \
r-base-core \
r-recommended \
r-base-dev

RUN apt-get install -y libssl-dev \
libxml2-dev \
libcurl4-openssl-dev \
libgit2-dev \
libharfbuzz-dev \
libfribidi-dev \
libfontconfig1-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev

RUN R -e "install.packages('devtools', repos='http://cran.us.r-project.org', dependecies=TRUE); \
require(devtools);\
install_version('hal9001', version = '0.4.1', repos = 'http://cran.us.r-project.org')"

# Import project, build and precompile
# Import the project

COPY . /TargetedEstimation.jl

WORKDIR /TargetedEstimation.jl

# Precompile project
RUN julia -q --project -e'using Pkg; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile()'
# Precompile the project
RUN julia --project -e'using Pkg; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile()'

# Precompile Sysimage project
RUN julia -q --project=/TargetedEstimation.jl/sysimage -e'using Pkg;Pkg.instantiate(); Pkg.resolve(); Pkg.precompile()'
# Build CLI
RUN julia --project --startup-file=no deps/build_sysimage.jl

# Build Sysimage
RUN julia --project -t auto --startup-file=no sysimage/create_sysimage.jl
# Test the CLI runs
RUN julia --startup-file=no --project -JTMLESysimage.so tmle.jl tmle data/sample_dataset.csv
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "1.1.2"
Documenter = "1.2.1"
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ makedocs(
modules = [TargetedEstimation],
pages=[
"Home" => "index.md",
"Command Line Interfaces" => ["environment.md", "tmle_estimation.md", "sieve_variance.md", "merge.md"],
"Command Line Interface" => ["cli.md", "tmle_estimation.md", "sieve_variance.md", "make_summary.md"],
"MLJ Extensions" => ["models.md", "resampling.md"],
],
pagesonly=true,
Expand Down
30 changes: 30 additions & 0 deletions docs/src/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# The Command Line Interface (CLI)

## CLI Installation

### Via Docker (requires Docker)

While we are getting close to providing a standalone application, the most reliable way to use the app is still via the provided [Docker container](https://hub.docker.com/r/olivierlabayle/targeted-estimation/tags). In this container, the command line interface is accessible and can be used directly. For example via:

```bash
docker run -it --rm -v HOST_DIR:CONTAINER_DIR olivierlabayle/targeted-estimation:TAG tmle --help
```

where `HOST_DIR:CONTAINER_DIR` will map the host directory `HOST_DIR` to the container's `CONTAINER_DIR` and `TAG` is the currently released version of the project.

### Build (requires Julia)

Alternatively, provided you have Julia installed, you can build the app via:

```bash
julia --project deps/build_app.jl app
```

Bellow is a description of the functionalities offered by the CLI.

## CLI Description

```@contents
Pages = ["tmle_estimation.md", "sieve_variance.md", "make_summary.md"]
Depth = 5
```
22 changes: 0 additions & 22 deletions docs/src/environment.md

This file was deleted.

Loading

0 comments on commit 19462d3

Please sign in to comment.