Skip to content

Commit fd1ef46

Browse files
committed
update dynamic optional parameter path
1 parent d8c5bf2 commit fd1ef46

File tree

7 files changed

+80
-42
lines changed

7 files changed

+80
-42
lines changed

conf/base.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ process {
232232
withName: INTERPROSCAN_DATABASE {
233233
memory = { 6.GB * task.attempt }
234234
time = { 4.h * task.attempt }
235+
cpus = { 6 * task.attempt }
235236
}
236237

237238
}

conf/modules.config

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ process {
9999
withName: SEQKIT_SEQ_FILTER {
100100
ext.prefix = { "${meta.id}_cleaned.faa" } // i think it will ad .tsv by default
101101
publishDir = [
102-
path: { "${params.outdir}/function/seqkit" },
102+
path: { "${params.outdir}/function/interproscan" },
103103
mode: params.publish_dir_mode,
104104
enabled: { params.run_function_interproscan },
105105
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
@@ -119,11 +119,11 @@ process {
119119
}
120120

121121
withName: INTERPROSCAN {
122-
ext.prefix = { "${meta.id}_interproscan.faa.tsv" }
122+
ext.prefix = { "${meta.id}_interproscan.faa" } // add .tsv -- i tested it but it now saves it correctly as *faa.tsv which is what ampcombi requires
123123
publishDir = [
124124
path: { "${params.outdir}/function/interproscan/" },
125125
mode: params.publish_dir_mode,
126-
enabled: params.run_function_interproscan,
126+
enabled: params.run_function_interproscan, // SHould also be with save_annotation activated?
127127
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
128128
]
129129
ext.args = [
@@ -598,7 +598,8 @@ process {
598598
"--hmm_evalue ${params.amp_ampcombi_parsetables_hmmevalue}",
599599
"--window_size_stop_codon ${params.amp_ampcombi_parsetables_windowstopcodon}",
600600
"--window_size_transporter ${params.amp_ampcombi_parsetables_windowtransport}",
601-
params.amp_ampcombi_parsetables_removehitswostopcodons ? '--remove_stop_codons' : ''
601+
params.amp_ampcombi_parsetables_removehitswostopcodons ? '--remove_stop_codons' : '',
602+
"${params.dynamic_extra_args}" //dynamic arguments
602603
].join(' ').trim()
603604
ext.prefix = { "${meta.id}" }
604605
}

modules/local/interproscan_download.nf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
process INTERPROSCAN_DATABASE {
22
tag "interproscan_database_download"
33
//label 'process_medium'
4+
//TODO DOnt forget to change the link to the db :: the version optimized to AMPcombi
45

56
conda "conda-forge::sed=4.7"
67
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?

nextflow.config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ params {
101101

102102
// Function classification options
103103
run_function_interproscan = false
104-
function_interproscan_db = null
105-
function_interproscan_applications = 'Pfam' //PANTHER,ProSiteProfiles,ProSitePatterns,Pfam
104+
function_interproscan_db = '/Net/Groups/ccdata/databases/interproscan_5.67-99.0/'//null - change that in interproscan_download.nf
105+
function_interproscan_applications = 'PANTHER,ProSiteProfiles,ProSitePatterns,Pfam'
106106
function_interproscan_enableprecalc = false
107107
function_interproscan_enableresidueannot = false
108108
function_interproscan_disableresidueannottsv = false
@@ -139,6 +139,7 @@ params {
139139
amp_ampcombi_parsetables_windowstopcodon = 60
140140
amp_ampcombi_parsetables_windowtransport = 11
141141
amp_ampcombi_parsetables_removehitswostopcodons = false
142+
dynamic_extra_args = ''
142143
amp_ampcombi_cluster_covmode = 0
143144
amp_ampcombi_cluster_mode = 1
144145
amp_ampcombi_cluster_coverage = 0.8

subworkflows/local/amp.nf

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ include { MERGE_TAXONOMY_AMPCOMBI } from '..
1717

1818
workflow AMP {
1919
take:
20-
fastas // tuple val(meta), path(contigs)
21-
faas // tuple val(meta), path(PROKKA/PRODIGAL.out.faa)
22-
tsvs // tuple val(meta), path(MMSEQS_CREATETSV.out.tsv)
23-
gbks // tuple val(meta), path(ANNOTATION_ANNOTATION_TOOL.out.gbk)
20+
fastas // tuple val(meta), path(contigs)
21+
faas // tuple val(meta), path(PROKKA/PRODIGAL.out.faa)
22+
tsvs // tuple val(meta), path(MMSEQS_CREATETSV.out.tsv)
23+
gbks // tuple val(meta), path(ANNOTATION_ANNOTATION_TOOL.out.gbk)
24+
tsvs_interpro // tuple val(meta), path(INTERPROSCAN.out.tsv)'
2425

2526
main:
2627
ch_versions = Channel.empty()
@@ -110,8 +111,40 @@ workflow AMP {
110111
gbk: it[3]
111112
}
112113

114+
// INTERPROSCAN INPUT CHECK
115+
// Check if tsv_interpro is empty, if not empty update the params.dynamic_extra_ergs and if empty dont update that and continue the commands
116+
// dynamik arg
117+
ampcombi_parse_optional_args = tsvs_interpro
118+
.map { meta, file ->
119+
"--interproscan_input ${file}"
120+
}
121+
// pass dynamik arg
122+
ampcombi_parse_optional_args
123+
.first()
124+
.ifEmpty {} // just silently skip if empty
125+
.subscribe { dynamik_arg -> // terminal, consumes value
126+
// log.info "Resolved dynamic argument: ${dynamik_arg}" // only for debugging
127+
params.dynamic_extra_args = dynamik_arg
128+
}
129+
// Pass combined args to ext.args in modules.config
130+
113131
if ( params.amp_ampcombi_db != null ) {
114-
AMPCOMBI2_PARSETABLES ( ch_input_for_ampcombi.input, ch_input_for_ampcombi.faa, ch_input_for_ampcombi.gbk, params.amp_ampcombi_db )
132+
//AMPCOMBI2_PARSETABLES ( ch_input_for_ampcombi.input, ch_input_for_ampcombi.faa, ch_input_for_ampcombi.gbk, params.amp_ampcombi_db )
133+
//// dynamik arg
134+
//ampcombi_parse_optional_args = tsvs_interpro
135+
// .map { meta, file ->
136+
// "--interproscan_input ${file}"
137+
// }
138+
//// pass dynamik arg
139+
//ampcombi_parse_optional_args
140+
// .first()
141+
// .ifEmpty {} // just silently skip if empty
142+
// .subscribe { dynamik_arg -> // terminal, consumes value
143+
// // log.info "Resolved dynamic argument: ${dynamik_arg}" // only for debugging
144+
// params.dynamic_extra_args = dynamik_arg
145+
// }
146+
// Pass combined args to ext.args in modules.config
147+
AMPCOMBI2_PARSETABLES ( ch_input_for_ampcombi.input, ch_input_for_ampcombi.faa, ch_input_for_ampcombi.gbk, params.amp_ampcombi_db)
115148
} else {
116149
DRAMP_DOWNLOAD()
117150
ch_versions = ch_versions.mix( DRAMP_DOWNLOAD.out.versions )

subworkflows/local/function.nf

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,30 @@ workflow FUNCTION {
1010
faas // tuple val(meta), path(PROKKA/PRODIGAL.out.faa)
1111

1212
main:
13-
ch_versions = Channel.empty()
14-
ch_interproscan_tsv = Channel.empty()
15-
ch_interproscan_db = Channel.empty()
13+
ch_versions = Channel.empty()
14+
ch_interproscan_tsv = Channel.empty()
15+
ch_interproscan_db = Channel.empty()
1616

1717
ch_faa_for_interproscan = faas
1818

19-
//TODO: Download DB if not supplied by user
2019
if ( params.function_interproscan_db != null ) {
2120
ch_interproscan_db = Channel
2221
.fromPath( params.function_interproscan_db )
23-
.first() // i dont know if this is required
22+
.first() // i dont know if this is required!!!?
2423
} else {
25-
INTERPROSCAN_DATABASE ('http://ftp.ebi.ac.uk/pub/software/unix/iprscan/5/5.59-91.0/interproscan-5.59-91.0-64-bit.tar.gz')
24+
// NOTE: when url is changed here also change in 'funcscan/modules/local/interproscan_download.nf'
25+
INTERPROSCAN_DATABASE ('http://ftp.ebi.ac.uk/pub/software/unix/iprscan/5/5.59-91.0/interproscan-5.59-91.0-64-bit.tar.gz') //change to the newest version tested with AMP: http://ftp.ebi.ac.uk/pub/software/unix/iprscan/5/5.67-99.0/interproscan-5.67-99.0-64-bit.tar.gz
2626
ch_versions = ch_versions.mix( INTERPROSCAN_DATABASE.out.versions )
2727
ch_interproscan_db = ( INTERPROSCAN_DATABASE.out.db )
2828
}
2929

30-
INTERPROSCAN( ch_faa_for_interproscan, [] ) // change to this: ch_interproscan_db
31-
//INTERPROSCAN( ch_faa_for_interproscan, [] ) // change to this: ch_interproscan_db
30+
//INTERPROSCAN( ch_faa_for_interproscan, [] )
31+
INTERPROSCAN( ch_faa_for_interproscan, ch_interproscan_db )
3232
ch_interproscan_tsv = ch_interproscan_tsv.mix(INTERPROSCAN.out.tsv)
3333

3434
ch_versions = ch_versions.mix(INTERPROSCAN.out.versions)
3535

3636
emit:
37-
versions = ch_versions
38-
tsv = ch_interproscan_tsv // channel: [ val(meta), tsv ]
39-
db = INTERPROSCAN_DATABASE.out.db
37+
versions = ch_versions
38+
tsv = ch_interproscan_tsv // channel: [ val(meta), tsv ]
4039
}

workflows/funcscan.nf

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,36 +180,22 @@ workflow FUNCSCAN {
180180
FUNCTION
181181
*/
182182
if (params.run_function_interproscan) {
183-
// TODO:: fix this
184183
def filtered_faas = ch_prepped_input.faas.filter { meta, file ->
185184
if (file != [] && file.isEmpty()) {
186185
log.warn("[nf-core/funcscan] Annotation of the following sample produced an empty FAA file. InterProScan classification of the CDS requiring this file will not be executed: ${meta.id}")
187186
}
188-
!file.isEmpty() // Ensure this is the last statement for implicit return value
187+
!file.isEmpty()
189188
}
189+
190190
SEQKIT_SEQ_FILTER(filtered_faas)
191191
ch_versions = ch_versions.mix(SEQKIT_SEQ_FILTER.out.versions)
192192
ch_input_for_function = SEQKIT_SEQ_FILTER.out.fastx
193+
193194
FUNCTION (
194195
ch_input_for_function
195196
)
196-
//FUNCTION (
197-
// ch_prepped_input.faas.filter { meta, file ->
198-
// if (file != [] && file.isEmpty()) {
199-
// log.warn("[nf-core/funcscan] Annotation of the following sample produced an empty FAA file. InterProScan classification of the CDS requiring this file will not be executed: ${meta.id}")
200-
// }
201-
// !file.isEmpty() // Ensure this is the last statement for implicit return value
202-
// }
203-
// .map { meta, file ->
204-
// SEQKIT_SEQ_FILTER([meta, file])
205-
// }.filter { meta, filtered_file ->
206-
// if (filtered_file.isEmpty()) {
207-
// log.warn("[nf-core/funcscan] SEQKIT_SEQ_FILTER produced an empty FAA file. InterProScan classification of the CDS requiring this file will not be executed: ${meta.id}")
208-
// }
209-
// !filtered_file.isEmpty() // Ensure this is the last statement for implicit return value
210-
// }
211-
//)
212197
ch_versions = ch_versions.mix(FUNCTION.out.versions)
198+
//ch_interproscan_tsv = FUNCTION.out.tsv.map{ it[1] }.collect()
213199
ch_interproscan_tsv = FUNCTION.out.tsv
214200
} else {
215201
ch_interproscan_tsv = Channel.empty()
@@ -232,7 +218,15 @@ workflow FUNCSCAN {
232218
!file.isEmpty()
233219
},
234220
ch_taxonomy_tsv,
235-
ch_prepped_input.gbks
221+
//ch_prepped_input.gbks
222+
ch_prepped_input.gbks,
223+
ch_interproscan_tsv.filter { meta, file ->
224+
if (file != [] && file.isEmpty()) {
225+
log.warn("[nf-core/funcscan] Functional annotation with INTERPROSCAN produced an empty TSV file. No InterProScan classifications will be added in the final table: ${meta.id}")
226+
}
227+
//file
228+
!file.isEmpty()
229+
}//.collect()
236230
)
237231
ch_versions = ch_versions.mix(AMP.out.versions)
238232
}
@@ -251,7 +245,15 @@ workflow FUNCSCAN {
251245
}
252246
!file.isEmpty()
253247
},
254-
ch_prepped_input.gbks
248+
//ch_prepped_input.gbks
249+
ch_prepped_input.gbks,
250+
ch_interproscan_tsv.filter { meta, file ->
251+
if (file != [] && file.isEmpty()) {
252+
log.warn("[nf-core/funcscan] Functional annotation with INTERPROSCAN produced an empty TSV file. No InterProScan classifications will be added in the final table: ${meta.id}")
253+
}
254+
//file
255+
!file.isEmpty()
256+
}//.collect()
255257
)
256258
ch_versions = ch_versions.mix(AMP.out.versions)
257259
}

0 commit comments

Comments
 (0)