Skip to content

Commit

Permalink
commit before channel exp
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed Feb 7, 2020
1 parent 38f2a0c commit e087cdd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
2 changes: 2 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ params{
version = false
// Path to sqlite db
params.sqlite = false
// Output directory default
outdir = './results'
}

manifest {
Expand Down
37 changes: 33 additions & 4 deletions pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def helpMessage() {
Other options:
--help Print this help message.
--version Print the current version number
--version Print the current version number.
--outdir The output directory where results are saved.
""".stripIndent()
}

Expand All @@ -52,25 +53,30 @@ if (params.version){
exit 0
}

// Print sqlite database info
// -------------------------------------------------------------------------- //
// SQLite database import and download //
// -------------------------------------------------------------------------- //
if (params.sqlite){
// sqlite db from Path
log.info pipelineHeader()

sqlite_ch = Channel.fromPath(params.sqlite, checkIfExists: true)
.ifEmpty { exit 1, "SQLite database not found: ${params.sqlite}" }
sqlite_cmd_ch = Channel.fromPath(params.sqlite_commands, checkIfExists: true)
.ifEmpty { exit 1, "SQLite commands script not found: ${params.sqlite_commands}" }

process sqlite_import{
// Import assembly ftp url from database, retrieve file names and URL for web get
publishDir "${params.outdir}/sqlite_import", mode: 'copy'
echo true
log.info pipelineHeader()
log.info"""SQLite database selected: ${params.sqlite}"""

input:
file sqlite from sqlite_ch

output:
file params.assembly_for_download_file into assembly_for_download
file params.assembly_for_download_file into assembly_for_download_ch
file asm_ftp into assembly_for_download_ftp_ch

script:
"""
Expand All @@ -85,8 +91,31 @@ if (params.sqlite){
done;
"""
}

process assembly_download{
// Download assemblies using ftp links
publishDir "${params.outdir}/assembly_download", mode: 'copy'

echo true

input:
file asm_dwnl_txt from assembly_for_download_ch

output:

script:
"""
cat ${asm_dwnl_txt} | while read line;
do
echo \$line;
done
"""
}
}



def pipelineHeader() {
return"""
=========================================
Expand Down

0 comments on commit e087cdd

Please sign in to comment.