-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GEN-1574] Add merge and decode to staging #161
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a31296d
initial commit of changes to migrate to staging
rxu17 18612bb
add tests
rxu17 883e972
update dockerfile to use rstudio
rxu17 4b26dff
add merge and decode as individual step in nextflow
rxu17 938c077
remove unused library
rxu17 61a6c7f
add save_synapse
rxu17 a2efa9a
add merge and decode as option
rxu17 209e486
add logging
rxu17 b7c894c
remove extra bracket
rxu17 9c89b28
update to use params docker
rxu17 9079192
add ability to add version comment
rxu17 d0a2c88
add missing comment arg in call
rxu17 e500fe6
change comment shorthand
rxu17 c3be46c
remove short flag
rxu17 2d1a3ff
add comment method
rxu17 5d778f4
update readme
rxu17 5335d0c
merge with develop, resolve conflicts
rxu17 73dbcce
add better instructions
rxu17 e319e6e
revert comment storage, fix comments
rxu17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
FROM r-base:4.0.0 | ||
FROM rstudio/r-base:4.0-bullseye | ||
|
||
# Set working directory | ||
WORKDIR /usr/local/src/myscripts | ||
|
||
# Set environment variable for renv version | ||
ENV RENV_VERSION 0.14.0 | ||
|
||
RUN rm /etc/apt/apt.conf.d/default | ||
RUN apt-get update -y | ||
RUN apt-get install -y dpkg-dev zlib1g-dev libssl-dev libffi-dev | ||
# procps is required for nextflow tower | ||
RUN apt-get install -y curl libcurl4-openssl-dev procps | ||
RUN R -e "install.packages('synapser', repos=c('http://ran.synapse.org', 'http://cran.fhcrc.org'))" | ||
# Update apt-get and install system dependencies (only install required) | ||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends \ | ||
dpkg-dev zlib1g-dev libssl-dev libffi-dev \ | ||
libcurl4-openssl-dev curl procps && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
ENV PYTHON /usr/local/lib/R/site-library/PythonEmbedInR/bin/python3.6 | ||
# Install R packages including remotes and renv | ||
RUN R -e "install.packages('remotes', repos = 'https://cloud.r-project.org')" && \ | ||
R -e "remotes::install_github('rstudio/renv', ref = '${RENV_VERSION}')" || true | ||
|
||
RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))" | ||
RUN R -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')" | ||
# Install synapser with specific version | ||
RUN R -e "remotes::install_version('synapser', version = '0.11.7', repos = c('http://ran.synapse.org', 'http://cran.fhcrc.org'))" | ||
|
||
COPY . . | ||
# Set Python environment variable for R | ||
ENV PYTHON /usr/local/lib/R/site-library/PythonEmbedInR/bin/python3.6 | ||
|
||
# Copy only renv.lock first to leverage docker cache for dependencies | ||
COPY renv.lock renv.lock | ||
|
||
# Restore R environment with renv | ||
RUN R -e "renv::restore()" | ||
|
||
# Copy the local project files into the container | ||
COPY . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,10 @@ | |
[![automated](https://img.shields.io/docker/cloud/automated/sagebionetworks/genie-bpc-pipeline-uploads)](https://hub.docker.com/r/sagebionetworks/genie-bpc-pipeline-uploads) | ||
![status](https://img.shields.io/docker/cloud/build/sagebionetworks/genie-bpc-pipeline-uploads) | ||
|
||
## Setup | ||
|
||
You will want to run on an EC2 instance with docker installed. | ||
|
||
## Installation | ||
|
||
Clone this repository and navigate to the directory: | ||
|
@@ -10,11 +14,43 @@ git clone [email protected]:Sage-Bionetworks/genie-bpc-pipeline.git | |
cd genie-bpc-pipeline/bpc/uploads/ | ||
``` | ||
|
||
Install all required R packages: | ||
### Local installation | ||
|
||
Install all required R packages by copying and running the commands in the Dockerfile | ||
at `scripts/uploads/Dockerfile` except for the last step which is copying your current repo. | ||
|
||
### Docker | ||
|
||
Alternatively, you can pull the docker image associated with this module from [here](https://github.com/Sage-Bionetworks/genie-bpc-pipeline/pkgs/container/genie-bpc-pipeline) into your EC2. | ||
|
||
You can also pull the production docker: | ||
|
||
```bash | ||
git pull sagebionetworks/genie-bpc-pipeline-uploads | ||
``` | ||
R -e 'renv::restore()' | ||
|
||
To run the docker image: | ||
|
||
1. Run the docker | ||
|
||
```bash | ||
docker run -d --name <nickname_for_container> <container_name> /bin/bash -c "while true; do sleep 1; done" | ||
``` | ||
|
||
2. **Optional.** Do anything you need to do to the container (e.g: copy current local changes to the docker) | ||
|
||
```bash | ||
docker cp ./. test_container:/usr/local/src/myscripts | ||
``` | ||
|
||
3. Execute container into a bash session | ||
|
||
```bash | ||
docker exec -it <nickname_for_container> /bin/bash | ||
``` | ||
|
||
Now you can run the script commands | ||
|
||
## Synapse credentials | ||
|
||
Cache your Synapse personal access token (PAT) as an environmental variable: | ||
|
@@ -45,7 +81,7 @@ Usage: merge_and_uncode_rca_uploads.R [options] | |
Options: | ||
-c COHORT, --cohort=COHORT | ||
BPC cohort | ||
|
||
-u, --save_synapse | ||
Save output to Synapse | ||
|
||
|
@@ -54,13 +90,21 @@ Options: | |
|
||
-h, --help | ||
Show this help message and exit | ||
|
||
--production | ||
Whether to run in production mode or not (staging mode). | ||
``` | ||
|
||
Example run: | ||
Example run (staging run): | ||
``` | ||
Rscript merge_and_uncode_rca_uploads.R -c NSCLC -u -a $SYNAPSE_AUTH_TOKEN | ||
``` | ||
|
||
Example run (production run): | ||
``` | ||
Rscript merge_and_uncode_rca_uploads.R -c NSCLC -u -a $SYNAPSE_AUTH_TOKEN --production | ||
``` | ||
|
||
## Usage: remove patient IDs from a REDCap formatted file | ||
|
||
To display the command line interface: | ||
|
@@ -100,3 +144,19 @@ Example run: | |
``` | ||
Rscript remove_patients_from_merged.R -i syn23285494 -c NSCLC -r syn29266682 -v | ||
``` | ||
|
||
## Running tests | ||
There are unit tests under `scripts/uploads/tests`. | ||
|
||
1. Install the `mockery` and `testthat` packages via the command line: | ||
|
||
```bash | ||
R -e "remotes::install_cran('testthat')" | ||
``` | ||
|
||
2. Run the following in a R session in your EC2: | ||
|
||
```R | ||
library(testthat) | ||
test_dir("/usr/local/src/myscripts/tests") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wonderful! Yay for scalable solutions!