I think you're not assuming that the two channels have the same order, therefore you must combine the two of them by some sort of matching key.
I think it won't be straightforward in this case, but you can tokenize the filenames in order to do so. I'd do it like this:
ch_alignment
.map{ it -> [ it.tokenize("."), it ] }
.map{ it -> [ [ it[0][0], it[0][1] ].join(".") , it[1] ] }
.set{ ch_alignment_token }
ch_clustered
.map{ it -> [ it.tokenize("."), it ] }
.map{ it -> [ [ it[0][0], it[0][1] ].join(".") , it[1] ] }
.set{ ch_clustered_token }
ch_alignment
.join(ch_clustered)
.map{ it -> it.flatten() }
.set{ ch_final }
output
ch_final.view()
[
[demux.Clontech_5p--bc1003_3p, demux.Clontech_5p--bc1003_3p.flnc_clustered.sorted.sam, demux.Clontech_5p--bc1003_3p.flnc_clustered.fasta]
[demux.Clontech_5p--bc1001_3p, demux.Clontech_5p--bc1001_3p.flnc_clustered.sorted.sam, demux.Clontech_5p--bc1001_3p.flnc_clustered.fasta]
[demux.Clontech_5p--bc1002_3p, demux.Clontech_5p--bc1002_3p.flnc_clustered.sorted.sam, demux.Clontech_5p--bc1002_3p.flnc_clustered.fasta]]