Solution
bam_for_ASE_ch .groupTuple() .phase(vcf_for_ASE) .map{ left, right -> def sampleId = left[0] def bam = left[1] def bai = left[2] def vcf = right[1] tuple(sampleId, vcf, bam, bai) } .set { grouped_vcf_bam_bai_ch }
bam_for_ASE_ch .groupTuple() .phase(vcf_for_ASE) .map{ left, right -> def sampleId = left[0] def bam = left[1] def bai = left[2] def vcf = right[1] tuple(sampleId, vcf, bam, bai) } .set { grouped_vcf_bam_bai_ch }