Skip to content
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

Patch/update image #87

Merged
merged 4 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion new_project/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/nf-osi/nfportalutils:develop-reticulate-1.28
FROM ghcr.io/nf-osi/nfportalutils@sha256:b16251a7091aebcb8a789589b4adfbcea0fb23b50bbc20031dde8733fce1ac98

ARG USERNAME=nfosi
ARG USER_UID=1001
Expand Down
6 changes: 4 additions & 2 deletions new_project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ See files under tests for examples of what these study data look like.

#### Test

Note that `PROFILE=TEST` skips registration of the newly created study in the public portal.

Single study:
`docker run -v "$(pwd)":/app -e SYNAPSE_AUTH_TOKEN=$SYNAPSE_AUTH_TOKEN ghcr.io/nf-osi/jobs-new-project tests/study_basic.json`
`docker run -v "$(pwd)":/app -e SYNAPSE_AUTH_TOKEN=$SYNAPSE_AUTH_TOKEN -e PROFILE=TEST ghcr.io/nf-osi/jobs-new-project tests/study_basic.json`

Multiple studies:
`docker run -v "$(pwd)":/app -e SYNAPSE_AUTH_TOKEN=$SYNAPSE_AUTH_TOKEN ghcr.io/nf-osi/jobs-new-project tests/study_two_datasets.json tests/study_same_data_labels.json`
`docker run -v "$(pwd)":/app -e SYNAPSE_AUTH_TOKEN=$SYNAPSE_AUTH_TOKEN -e PROFILE=TEST ghcr.io/nf-osi/jobs-new-project tests/study_two_datasets.json tests/study_same_data_labels.json`

23 changes: 20 additions & 3 deletions new_project/new_project_from_json.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ configs <- commandArgs(trailingOnly = TRUE)
library(nfportalutils)
syn_login()


register_check <- Sys.getenv("PROFILE") == "TEST"
# Note that dataset folders must have unique names (Synapse won't create duplicates)
# Since this can't be enforced at the JSON schema level, we adjust folder names using `make.unique` as necessary
setup_from_config <- function(config_file) {
#' @param register_study Depends on whether PROFILE=TEST.
setup_from_config <- function(config_file, skip_register = register_check) {

config <- jsonlite::read_json(config_file)

Expand Down Expand Up @@ -52,6 +55,17 @@ setup_from_config <- function(config_file) {
}
}

# Non-data -- see schema for allowed resources
OTHER_RESOURCES <- NULL
if(length(config$nonDataResources)) {
resources <- unique(sapply(config$nonDataResources, `[[`, "resourceType"))
cat("Non-data resources:", resources, "\n")
if(length(resources)) {
if(grep("protocol", resources)) OTHER_RESOURCES <- append(OTHER_RESOURCES, "Protocols")
if(grep("tool", resources)) OTHER_RESOURCES <- append(OTHER_RESOURCES, "Tools")
}
}

# Create
created_project <- new_project(name = NAME,
pi = PI_CSV,
Expand All @@ -63,6 +77,7 @@ setup_from_config <- function(config_file) {
initiative = INITIATIVE,
publicview = INITPUBLICVIEW,
datasets = DATASETS,
other_resources = OTHER_RESOURCES
)

PROJECT_ID <- created_project$properties$id
Expand All @@ -79,14 +94,16 @@ setup_from_config <- function(config_file) {
config$studyName <- config$name
config$institutions <- config$institution
config$manifestation <- config$diseaseManifestation
nfportalutils::register_study(id = PROJECT_ID,

if(skip_register) cat("Study not registered since profile detected is TEST", "\n")
if(!skip_register) nfportalutils::register_study(id = PROJECT_ID,
study_meta = config,
summary = SUMMARY,
study_summary_table = "syn16787123",
portal_project_view = "syn52677631")

# Add to scope of master portal fileview
nfportalutils::register_study_files(PROJECT_ID)
if(!skip_register) nfportalutils::register_study_files(PROJECT_ID)

}

Expand Down
47 changes: 47 additions & 0 deletions new_project/tests/study_other_resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"schemaVersion": "v0.9",
"NFID": "Test_Project",
"name": "NF Test Study - Other Resources",
"summary": "This study has non-data resources included.",
"fundingAgency": "NIH-NCI",
"initiative": "Developmental and HyperActive Ras Tumor Specialized Programs of Research Excellence",
"grantID": "",
"grantStartDate": "2020-09-01",
"grantEndDate": "2030-08-31",
"diseaseFocus": "Neurofibromatosis type 1",
"diseaseManifestation": "Plexiform Neurofibroma",
"PI": [
"John Doe",
"Jane Doe"
],
"PIEmail": "[email protected]",
"dataLead": [
"John Doe",
"Jane Doe"
],
"institution": [
"Stanford University",
"Harvard University"
],
"dataDeposit": [
{
"dataRelatedAim": "Aim 1",
"dataLabel": "ChIP-seq",
"dataType": "chromatinActivity",
"dataAssay": "ChIP-seq",
"dataSpecies": "Homo sapiens"
}
],
"nonDataResources": [
{
"relatedAim": "Aim 1",
"resourceType": "protocol",
"label": "Protocol 1"
},
{
"relatedAim": "Aim 2",
"resourceType": "protocol",
"label": "Protocol 2"
}
]
}
23 changes: 23 additions & 0 deletions new_project/tests/study_principals_proliferate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"schemaVersion": "v0.9000",
"NFID": "Test_Multiple_Principals",
"name": "NF Test Study - A Basic Study With Multiple PIs",
"summary": "An NF Demo Project with multiple `synPrincipal`s.",
"fundingAgency": "Demo",
"initiative": "",
"grantDOI": "https://doi.org/xxx",
"grantStartDate": "2020-01-01",
"grantEndDate": "2021-01-01",
"embargoEndDate": "2022-10-01",
"diseaseFocus": "Neurofibromatosis type 1",
"diseaseManifestation": "Behavioral",
"PI": "NF Service",
"PIEmail": "[email protected]",
"dataLead": "NF Service",
"dataLeadEmail": "[email protected]",
"synPrincipal": ["avu", "anngvu"],
"institution": [
"Sage Bionetworks"
],
"notes": ""
}
Loading