From c83a402341e7249bc69b7849f0c530717e94a052 Mon Sep 17 00:00:00 2001 From: fernandogelin Date: Mon, 29 Jul 2019 14:28:02 -0400 Subject: [PATCH 1/7] feat(build): add build.jl to create symlink to usr/local/bin --- deps/build.jl | 19 +++++++++++++++++++ deps/build.log | 1 + docs/src/installation.md | 15 --------------- src/init.jl | 16 ---------------- 4 files changed, 20 insertions(+), 31 deletions(-) create mode 100644 deps/build.jl create mode 100644 deps/build.log delete mode 100755 src/init.jl diff --git a/deps/build.jl b/deps/build.jl new file mode 100644 index 0000000..4e3a01a --- /dev/null +++ b/deps/build.jl @@ -0,0 +1,19 @@ +function get_executable_path(package::AbstractString, exec::AbstractString) + base_path = Base.find_package(package) + exec_path = joinpath(split(base_path, "src/$package.jl")[1], exec) + + return exec_path +end + +function symlink_user_bin(path_::AbstractString) + exec = split(path_, "/")[end] + if Sys.iswindows() + symlink(path_, "C:\\ProgramData\\Bin\\$exec") + else + symlink(path_, "/usr/local/bin/$exec") + end + @info "Created symlink: /usr/local/bin/viva -> $path_" +end + +path_ = get_executable_path("VariantVisualization", "viva") +symlink_user_bin(path_) diff --git a/deps/build.log b/deps/build.log new file mode 100644 index 0000000..9634f6d --- /dev/null +++ b/deps/build.log @@ -0,0 +1 @@ +[ Info: Created symlink: /usr/local/bin/viva -> /Users/fgelin/.julia/dev/VariantVisualization/viva diff --git a/docs/src/installation.md b/docs/src/installation.md index 83ed50c..e3f4dbd 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -119,21 +119,6 @@ Go to `http://0.0.0.0:8888/?token=` [Click here](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html) for more information about Jupyter Docker Images. -#### Using Docker Compose - -To run the images with Docker Compose, install Docker following the steps above and then install [Docker Compose[(https://docs.docker.com/compose/). Then copy the [docker-compose.yml](https://github.com/compbiocore/viva-docker/blob/master/docker-compose.yml) file to a local directory. From that same directory, run the command as it appears below. - -*Note*: Your current directory will mount to `/notebook/data` in the notebook image and to `/data` in the CLI image. - -- Notebook -```shell -docker-compose up viva-notebook -``` - -- Command Line Tool -```shell -docker-compose run viva -f file.vcf --save_remotely arg3 arg4 ... -``` ----- diff --git a/src/init.jl b/src/init.jl deleted file mode 100755 index e26d22e..0000000 --- a/src/init.jl +++ /dev/null @@ -1,16 +0,0 @@ -function alias() - - if isfile(joinpath(homedir(), ".zshrc")) - rcfile = ".zshrc" - else - rcfile = ".bash_profile" - end - - dir = split(@__DIR__, "/src")[1] - exe = joinpath(dir, "viva") - - open(joinpath(homedir(), rcfile), "a+") do io - write(io, "\n # viva Alias \nalias viva=\"$exe\"") - end - chmod(exe, 333) -end From 2de5428de7d8a937ba2b29e6bea7aed7ce3c4155 Mon Sep 17 00:00:00 2001 From: fernandogelin Date: Mon, 29 Jul 2019 14:30:43 -0400 Subject: [PATCH 2/7] docs(install): update installation docs --- docs/src/installation.md | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/docs/src/installation.md b/docs/src/installation.md index 4b2f8f8..d5f56c3 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -33,25 +33,12 @@ To install VariantVisualization.jl: 1. Open the command line or PowerShell 2. Run the following block of code ->`julia` - ->`]` - ->`add VariantVisualization` - ->`exit()` - -### Step 3: Install the VIVA command line script - -Download the VIVA tool script and save it to a working directory for your analysis. Save your VCF file in the working directory. - -Copy and paste the following block of code into the command line or PowerShell: - ->mkdir new_folder/ - ->cd new_folder/ +```julia +julia +]add VarianatVisualization +exit() +``` ->curl -L https://raw.githubusercontent.com/compbiocore/VariantVisualization.jl/master/viva > viva ### Optional Step: Install VIVA Jupyter Notebook @@ -75,12 +62,18 @@ git clone https://github.com/compbiocore/VariantVisualization.jl or from the Julia REPL (useful if using the PowerShell and don't have git installed): ```julia -using Pkg -Pkg.clone("https://github.com/compbiocore/VariantVisualization.jl") +julia +]add VariantVisualization#master ``` ### For Developers +Install VariantVisualization in development mode: +```julia +julia +]dev VariantVisualization +``` + VIVA Jupyter notebook and the VIVA the command line tool are built with functions contained in our VariantVisualization.jl package. Developers may contribute to these open source tools by using [functions contained within VariantVisualization.jl](https://github.com/compbiocore/VariantVisualization.jl/tree/master/src/) which are carefully documented with docstrings. From dcdaadc15625d3698e4438e91375c7f463e66e90 Mon Sep 17 00:00:00 2001 From: Gelin Date: Mon, 29 Jul 2019 16:48:04 -0400 Subject: [PATCH 3/7] build script for windows --- .gitignore | 1 + deps/build.jl | 16 ++++++++++++---- deps/build.log | 1 - 3 files changed, 13 insertions(+), 5 deletions(-) delete mode 100644 deps/build.log diff --git a/.gitignore b/.gitignore index 5cca319..110ccd9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ Manifest.toml docs/build docs/site +build.log diff --git a/deps/build.jl b/deps/build.jl index 4e3a01a..b33d4be 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,18 +1,26 @@ function get_executable_path(package::AbstractString, exec::AbstractString) base_path = Base.find_package(package) - exec_path = joinpath(split(base_path, "src/$package.jl")[1], exec) + sep = joinpath("src", "$package.jl") + exec_path = joinpath(split(base_path, sep)[1], exec) return exec_path end function symlink_user_bin(path_::AbstractString) - exec = split(path_, "/")[end] if Sys.iswindows() - symlink(path_, "C:\\ProgramData\\Bin\\$exec") + exec = split(path_, "\\")[end] + try + bin_path = split(path_, "\\$exec")[1] + @warn bin_path + run(`setx path "%path%;$bin_path"`) + catch + @warn bin_path + end else + exec = split(path_, "/")[end] symlink(path_, "/usr/local/bin/$exec") + @warn "Created symlink: /usr/local/bin/viva -> $path_" end - @info "Created symlink: /usr/local/bin/viva -> $path_" end path_ = get_executable_path("VariantVisualization", "viva") diff --git a/deps/build.log b/deps/build.log deleted file mode 100644 index 9634f6d..0000000 --- a/deps/build.log +++ /dev/null @@ -1 +0,0 @@ -[ Info: Created symlink: /usr/local/bin/viva -> /Users/fgelin/.julia/dev/VariantVisualization/viva From 56dcf9e3409dd20ffd5424da049a5f85e4badf5d Mon Sep 17 00:00:00 2001 From: fernandogelin Date: Mon, 29 Jul 2019 17:38:39 -0400 Subject: [PATCH 4/7] refactor(build): clean up --- deps/build.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index b33d4be..584ce64 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -7,8 +7,8 @@ function get_executable_path(package::AbstractString, exec::AbstractString) end function symlink_user_bin(path_::AbstractString) + exec = splitdir(path_)[end] if Sys.iswindows() - exec = split(path_, "\\")[end] try bin_path = split(path_, "\\$exec")[1] @warn bin_path @@ -17,7 +17,6 @@ function symlink_user_bin(path_::AbstractString) @warn bin_path end else - exec = split(path_, "/")[end] symlink(path_, "/usr/local/bin/$exec") @warn "Created symlink: /usr/local/bin/viva -> $path_" end From c333cc4b81e043974057232d180eb9d9713bd179 Mon Sep 17 00:00:00 2001 From: fernandogelin Date: Tue, 30 Jul 2019 09:56:07 -0400 Subject: [PATCH 5/7] fix(build): remove init --- deps/build.jl | 10 +++------- src/VariantVisualization.jl | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index 584ce64..4673fd1 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -9,13 +9,9 @@ end function symlink_user_bin(path_::AbstractString) exec = splitdir(path_)[end] if Sys.iswindows() - try - bin_path = split(path_, "\\$exec")[1] - @warn bin_path - run(`setx path "%path%;$bin_path"`) - catch - @warn bin_path - end + bin_path = split(path_, "\\$exec")[1] + @warn bin_path + run(`setx path "%path%;$bin_path"`) else symlink(path_, "/usr/local/bin/$exec") @warn "Created symlink: /usr/local/bin/viva -> $path_" diff --git a/src/VariantVisualization.jl b/src/VariantVisualization.jl index a65aa26..b3d9af2 100644 --- a/src/VariantVisualization.jl +++ b/src/VariantVisualization.jl @@ -72,6 +72,5 @@ export include("vcf_utils_complete.jl") include("plot_utils.jl") include("new_notebook_utils.jl") -include("init.jl") end # module From 4c12a448e4695316ff991f81fb3e9e10cbb0fd48 Mon Sep 17 00:00:00 2001 From: fernandogelin Date: Tue, 30 Jul 2019 10:18:50 -0400 Subject: [PATCH 6/7] docs: update docs to reflect build --- docs/src/installation.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/src/installation.md b/docs/src/installation.md index d5f56c3..42d32ab 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -38,6 +38,24 @@ julia ]add VarianatVisualization exit() ``` +### Step 3: Run `viva` + +#### Mac and Linux + +On Mac and Linux, open another terminal window, navigate to your project folder and run: +`viva -f filename.vcf -s -o output/directory/` + +#### Windows + +!!! Warning + Viva will not work with Win32. + +On windows, after installing VariantVisualization, open a new PowerShell and run: +`viva -f filename.vcf -s -o output/directory/` + +You'll then be prompted to select an application to open the script. Select the Julia executable, that is located normally +at `C:\Users\\AppData\Local\Julia-\bin\`. + ### Optional Step: Install VIVA Jupyter Notebook @@ -120,22 +138,22 @@ When entering the filename of the VCF file and files to support filtering option - On Mac or Linux: ```shell -docker run -it --rm -v "$PWD":/data compbiocore/viva-cli:v0.3.8 --save_remotely arg1 arg2 arg3 +docker run -it --rm -v "$PWD":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o /output ``` - Example run: ```shell -docker run -it --rm -v "$PWD":/data compbiocore/viva-cli:v0.3.8 --save_remotely -f file.vcf -p +docker run -it --rm -v "$PWD":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o /output ``` - On Windows: ```shell -docker run -it --rm -v "${pwd}":/data compbiocore/viva-cli:v0.3.8 --save_remotely arg1 arg2 arg3 +docker run -it --rm -v "${pwd}":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o /output ``` - Example run: ```shell -docker run -it --rm -v "${pwd}":/data compbiocore/viva-cli:v0.3.8 --save_remotely -f file.vcf -p +docker run -it --rm -v "${pwd}":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o /output ``` ##### Run the VIVA Jupyter Notebook from a Docker image: @@ -149,7 +167,7 @@ docker run --rm -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -v "$PWD":/home/jovyan/no Go to the following url in your internet browser. You'll receive a token to enter into the url. -Go to `http://0.0.0.0:8888/?token=` +Go to `http://127.0.0.1:8888/?token=` - On Windows: ```shell @@ -158,7 +176,7 @@ docker run --rm -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -v "${pwd}":/home/jovyan/ Go to the following url in your internet browser. You'll receive a token to enter into the url. -Go to `http://0.0.0.0:8888/?token=` +Go to `http://127.0.0.1:8888/?token=` [Click here](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html) for more information about Jupyter Docker Images. From b2b83fef03618f0490267edf260b5967be217304 Mon Sep 17 00:00:00 2001 From: fernandogelin Date: Tue, 30 Jul 2019 10:26:46 -0400 Subject: [PATCH 7/7] docs(chore): clean up docs --- docs/src/installation.md | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/docs/src/installation.md b/docs/src/installation.md index 42d32ab..e643c58 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -43,7 +43,10 @@ exit() #### Mac and Linux On Mac and Linux, open another terminal window, navigate to your project folder and run: -`viva -f filename.vcf -s -o output/directory/` + +```shell +viva -f filename.vcf -s -o output/directory/ +``` #### Windows @@ -51,9 +54,11 @@ On Mac and Linux, open another terminal window, navigate to your project folder Viva will not work with Win32. On windows, after installing VariantVisualization, open a new PowerShell and run: -`viva -f filename.vcf -s -o output/directory/` +```shell +viva -f filename.vcf -s -o output/directory/ +``` -You'll then be prompted to select an application to open the script. Select the Julia executable, that is located normally +You'll then be prompted to select an application to open the script. Select the Julia executable, that is normally located at `C:\Users\\AppData\Local\Julia-\bin\`. @@ -71,15 +76,9 @@ Then, follow the in-notebook instructions to generate your plots. To stay up to date with cutting edge development features install VariantVisualization.jl from the Master branch. -Using git from the command line: +From the Julia REPL: -``` -git clone https://github.com/compbiocore/VariantVisualization.jl -``` - -or from the Julia REPL (useful if using the PowerShell and don't have git installed): - -```julia +```shell julia ]add VariantVisualization#master ``` @@ -87,7 +86,7 @@ julia ### For Developers Install VariantVisualization in development mode: -```julia +```shell julia ]dev VariantVisualization ``` @@ -128,9 +127,8 @@ mkdir project_x cd project_x ``` -Make sure to add your project VCF files to that folder. That directory will be mapped to `/notebook/data` inside of the container. +Make sure to add your project VCF files to that folder. -When entering the filename of the VCF file and files to support filtering options, you should include `/data/...` in the path to your files. ##### Run the VIVA Command Line Tool from a Docker image: @@ -138,22 +136,22 @@ When entering the filename of the VCF file and files to support filtering option - On Mac or Linux: ```shell -docker run -it --rm -v "$PWD":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o /output +docker run -it --rm -v "$PWD":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o output ``` - Example run: ```shell -docker run -it --rm -v "$PWD":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o /output +docker run -it --rm -v "$PWD":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o output ``` - On Windows: ```shell -docker run -it --rm -v "${pwd}":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o /output +docker run -it --rm -v "${pwd}":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o output ``` - Example run: ```shell -docker run -it --rm -v "${pwd}":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o /output +docker run -it --rm -v "${pwd}":/data compbiocore/viva-cli viva --save_remotely -f file.vcf -s pdf -o output ``` ##### Run the VIVA Jupyter Notebook from a Docker image: