From b38a60589ccfc7bbeca3281bcfd7815ced474663 Mon Sep 17 00:00:00 2001 From: Ryan Kelley Date: Sat, 7 May 2022 08:49:36 -0700 Subject: [PATCH 1/2] Add interface for custom file attributes --- .../groovy/nextflow/processor/TaskProcessor.groovy | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy b/modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy index c7d5e66825..5c0de12b5b 100644 --- a/modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy @@ -97,7 +97,9 @@ import nextflow.script.params.TupleOutParam import nextflow.script.params.ValueInParam import nextflow.script.params.ValueOutParam import nextflow.util.ArrayBag + import nextflow.util.BlankSeparatedList +import nextflow.util.CustomFileAttributesProvider import nextflow.util.CacheHelper import nextflow.util.CollectionHelper import nextflow.util.LockManager @@ -1934,7 +1936,15 @@ class TaskProcessor { final fileParam = param as FileInParam final normalized = normalizeInputToFiles(val, count, fileParam.isPathQualifier(), batch) final resolved = expandWildcards( fileParam.getFilePattern(ctx), normalized ) - ctx.put( param.name, singleItemOrList(resolved, task.type) ) + def blankSeparatedList = singleItemOrList(resolved, task.type) + + if ( val instanceof CustomFileAttributesProvider ) { + val.GetCustomFileAttributes(normalized).each { attributeName, attributeVal -> + blankSeparatedList.metaClass.setProperty(attributeName, attributeVal) + } + } + + ctx.put( param.name, blankSeparatedList ) count += resolved.size() for( FileHolder item : resolved ) { Integer num = allNames.getOrCreate(item.stageName, 0) +1 From 2d775de62a88ee88355bb2041532fde7f0afd204 Mon Sep 17 00:00:00 2001 From: Ryan Kelley Date: Sat, 7 May 2022 08:49:51 -0700 Subject: [PATCH 2/2] Create CustomAttributeProvider.groovy --- .../nextflow/util/CustomAttributeProvider.groovy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 modules/nextflow/src/main/groovy/nextflow/util/CustomAttributeProvider.groovy diff --git a/modules/nextflow/src/main/groovy/nextflow/util/CustomAttributeProvider.groovy b/modules/nextflow/src/main/groovy/nextflow/util/CustomAttributeProvider.groovy new file mode 100644 index 0000000000..4adea0612c --- /dev/null +++ b/modules/nextflow/src/main/groovy/nextflow/util/CustomAttributeProvider.groovy @@ -0,0 +1,16 @@ + +package nextflow.util + +import java.util.List +import nextflow.file.FileHolder +import java.util.Map +import groovy.transform.CompileStatic + +/** + * + */ + +@CompileStatic +interface CustomFileAttributesProvider { + Map GetCustomFileAttributes(List items) +}