Adding to what @CarsonJM explained, this Nextflow snippet may help you achieve what you’re looking for