Nextflow: Can I parameterize similar processes inside a for loop?
Use channels, this is what nextflow's entire design is based on. I'm honestly surprised that spawning 5 processes with the same name in a loop even works.
Turn your parameters into regular channels, use the combine operator (https://www.nextflow.io/docs/latest/operator.html#combine) to transform the 2 parameter channels into a channel that has each combination of params/inputs. Feed this channel into the  foo  process. Afterward use branch (https://www.nextflow.io/docs/latest/operator.html#branch) to split your foo output channel into 5 different channels.
typechan = Channel.from(5,3,2,7,1)
numchan = Channel.from('prot','dna', 'rna')

cartesian = numchan.combine(typechan)

process foo {
  input:
  val numtype from cartesian
  output:
  val numtype into bar 
  script:
  &quot;&quot;&quot;
  echo $numtype
  &quot;&quot;&quot;
}

bar.branch {
  one: it[1] == 1
  two: it[1] == 2
  three: it[1] == 3 
  five: it[1] == 5
  seven : it[1] == 7
}.set {result}
result.one.view()
```