@@ -185,13 +185,31 @@ deploy_apps <- function(apps, path){
185185 })
186186}
187187
188+ deploy_repos <- function (repo_url , path ){
189+ ui_info(" Getting templates from {ui_value(repo_url)}" )
190+
191+ dest_file = file.path(path , paste0(names(repo_url ), " .zip" ))
192+ download.file(url = repo_url ,
193+ destfile = dest_file )
194+ unzip(zipfile = dest_file , exdir = dirname(dest_file ))
195+ fs :: file_delete(dest_file )
196+ repo_unzip_path <- file.path(path ,
197+ paste0(names(repo_url ), " -main" ))
198+ copy_files_in_folder(repo_unzip_path ,
199+ path )
200+ fs :: dir_delete(repo_unzip_path )
201+ }
202+
188203copy_templates <- function (path , pipeline , org = NULL ){
189204 apps = list ()
190205 base = c(" bcbioR" )
206+ repos = c(" none" )
191207 if (pipeline == " base" ){
192208 parts = c(" templates/base" )
193209 }else if (pipeline == " nf-core/rnaseq" ){
194210 parts = c(" templates/rnaseq" )
211+ repos = " https://github.com/bcbio/rnaseq-reports/archive/refs/heads/main.zip"
212+ names(repos )= " rnaseq-reports"
195213 }else if (pipeline == " singlecell" ){
196214 parts = c(" templates/singlecell" )
197215 apps = c(apps , scRNAseq_qc = " https://github.com/hbc/scRNAseq_qc_app/archive/refs/heads/main.zip" )
@@ -205,13 +223,19 @@ copy_templates <- function(path, pipeline, org=NULL){
205223 }else if (pipeline == " chipseq" ){
206224 parts = c(" templates/chipseq" )
207225 }
208- analysis_template <- fs :: path_package(base , parts )
209226
210- ui_info(" Getting templates from {ui_value(analysis_template)}" )
211- # ls_files <- grep("org", list.files(analysis_template, full.names = TRUE),
212- # value = TRUE, invert = TRUE)
213- # ui_info("{ui_value(length(ls_files))} amount of files to copy")
214- copy_files_in_folder(analysis_template , path )
227+ # check if it is url or folder
228+ if (isUrl(repos )){
229+ deploy_repos(repos , path )
230+ }else {
231+ analysis_template <- fs :: path_package(base , parts )
232+
233+ ui_info(" Getting templates from {ui_value(analysis_template)}" )
234+ # ls_files <- grep("org", list.files(analysis_template, full.names = TRUE),
235+ # value = TRUE, invert = TRUE)
236+ # ui_info("{ui_value(length(ls_files))} amount of files to copy")
237+ copy_files_in_folder(analysis_template , path )
238+ }
215239 if (! is.null(org )){
216240 org_template <- fs :: path_package(base , parts , " org" , org )
217241 if (fs :: dir_exists(org_template )){
0 commit comments