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 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) +}