-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from dnwillia23/master
Initial commit of Seven Bridges file manifest generator
- Loading branch information
Showing
3 changed files
with
401 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM rocker/r-ubuntu:22.04 | ||
|
||
LABEL maintainer="David Williams <dnwilliams@rti.org>" | ||
LABEL description="This Docker image contains an in-house script written to generate a file manifest of projects in Seven Bridges." | ||
LABEL base-image="rocker/r-ubuntu:22.04" | ||
LABEL software-version="1.0" | ||
|
||
# Install vim and required packages for R libraries | ||
RUN apt update && apt install -y \ | ||
libcurl4-openssl-dev \ | ||
libssl-dev \ | ||
vim | ||
|
||
# Install R libraries | ||
RUN Rscript -e 'install.packages(c("dplyr","stringr", "lubridate", "openxlsx", "sevenbridges2", "getopt"))' | ||
|
||
# Add scripts to make it run | ||
ADD generate_manifest_sevenbridges.R / | ||
|
||
# Add to /opt folder | ||
RUN mv generate_manifest_sevenbridges.R /opt/ | ||
|
||
# Change permissions to make things exectuable | ||
RUN chmod u+x /opt/generate_manifest_sevenbridges.R | ||
|
||
# Set wrkdir | ||
RUN mkdir /data | ||
WORKDIR /data | ||
|
||
# Add to environment | ||
ENV PATH=$PATH:/opt/ | ||
|
||
# Set default command to display help message | ||
CMD ["Rscript", "/opt/generate_manifest_sevenbridges.R", "-h"] |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Description | ||
|
||
This Docker image contains an in-house script written to create an Excel workbook of a file and folder manifest of a Seven Bridges project. Its purpose is to get a sense of how folders are structured, how much space is used, and how many files exits. The Input to this should be a Seven Bridges developer's token and a string indicating which project to get a manifest of, and the output is an Excel file with a manifest of files and folders of the specified Seven Bridges project. The following information is provided about the project and its files and folders: | ||
|
||
Summary metrics: | ||
- Report Date - date manifest was generated | ||
- Project ID - supplied project ID in format "\<username\>/\<project-name\>" | ||
- Project URL - Seven Bridges platform URL in format "https://platform.sb.bioodatacatalyst.nhlbi.nih.gov/u/\<username\>/\<project-name\>" | ||
- Total number of files uploaded | ||
- Total size of uploaded files | ||
- Most recent upload - date and time of most recently uploaded file | ||
|
||
Folders: | ||
- Hierarchy of folders in project | ||
- Number of files in each folder | ||
|
||
Files: | ||
- File name | ||
- File Size | ||
- Upload Date | ||
- Path - path to folder where file is located | ||
- SB URI - URI of file in Seven Bridges in format "https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/files/\<file-id\>" | ||
|
||
## Sample usage | ||
|
||
Build | ||
``` | ||
docker build -t generate_manifest_sevenbridges:v1 . | ||
``` | ||
|
||
Run | ||
``` | ||
docker run -it -v $PWD:/data generate_manifest_sevenbridges:v1 Rscript generate_manifest_sevenbridges.R | ||
``` | ||
|
||
Usage info: | ||
``` | ||
Usage: convert_ab1_to_fasta.r [OPTIONS] | ||
-- Required Parameters -- | ||
[-t | --token ] <Seven Bridges Developer token> (REQUIRED) | ||
[-p | --project_id ] <Project ID, e.g. "username/test-project"> (REQUIRED) | ||
-- Optional Parameters -- | ||
[-v | --verbose ] <Activates verbose mode> | ||
-- Help Flag -- | ||
[-h | --help ] <Displays this help message> | ||
Example: | ||
convert_ab1_to_fasta.r -v -t <token-here> -p <project_id-here> | ||
``` | ||
|
||
## Files included | ||
|
||
- `Dockerfile`: the Docker file used to build this image | ||
- `generate_manifest_sevenbridges.R`: R script that serves as the main executable when the Docker container is run. Expected behavior is to call the Seven Bridges API recursively on a project and generate an Excel report containing the project's summary metrics, a directory manifest, and a file manifest. In the end, this writes the extracted results to an output Excel sheet (.xlsx) named after the project's name. | ||
|
||
## Contact | ||
|
||
If you have any questions or feedback, please feel free to contact the maintainers of this project: | ||
|
||
- David Williams, email: dnwilliams@rti.org |
Oops, something went wrong.