[Kasumi_H3K36, Kasumi_IgG, /mnt/Data/cut_and_tag/work/d0/3db2bde9eb1bdb0578073fb128bc4c/Kasumi_H3K36.no0.bedgraph]
[Kasumi_JMJD1C, Kasumi_IgG, /mnt/Data/cut_and_tag/work/b1/dffe2120acda5b05860e1a3bb0c1bf/Kasumi_JMJD1C.no0.bedgraph]
[Kasumi_NCOR1, Kasumi_IgG, /mnt/Data/cut_and_tag/work/9f/7c3680a1ff0ae0a5a27f42e1a27225/Kasumi_NCOR1.no0.bedgraph]
[Kasumi_IgG, Kasumi_IgG, /mnt/Data/cut_and_tag/work/21/1038cd4ecbc5b3f88da23ad1ee3147/Kasumi_IgG.no0.bedgraph]
[Kasumi_H4K5, Kasumi_IgG, /mnt/Data/cut_and_tag/work/3d/7b5239ab9dc83b00f992fea8926630/Kasumi_H4K5.no0.bedgraph]
这是我的频道视图之一。当第一个和第二个 ID 相同时,我试图创建一个新的控制通道,其余的作为示例通道。
答案 0 :(得分:0)
这是使用 branch 运算符的一种方法。我对字段的名称做了一些假设,但希望该模式与您要查找的内容相近:
nextflow.enable.dsl=2
Channel
.of(
['Kasumi_H3K36', 'Kasumi_IgG', file('/mnt/Data/cut_and_tag/work/d0/3db2bde9eb1bdb0578073fb128bc4c/Kasumi_H3K36.no0.bedgraph')],
['Kasumi_JMJD1C', 'Kasumi_IgG', file('/mnt/Data/cut_and_tag/work/b1/dffe2120acda5b05860e1a3bb0c1bf/Kasumi_JMJD1C.no0.bedgraph')],
['Kasumi_NCOR1', 'Kasumi_IgG', file('/mnt/Data/cut_and_tag/work/9f/7c3680a1ff0ae0a5a27f42e1a27225/Kasumi_NCOR1.no0.bedgraph')],
['Kasumi_IgG', 'Kasumi_IgG', file('/mnt/Data/cut_and_tag/work/21/1038cd4ecbc5b3f88da23ad1ee3147/Kasumi_IgG.no0.bedgraph')],
['Kasumi_H4K5', 'Kasumi_IgG', file('/mnt/Data/cut_and_tag/work/3d/7b5239ab9dc83b00f992fea8926630/Kasumi_H4K5.no0.bedgraph')],
) \
.branch { sample1, sample2, bedgraph ->
controls: sample1 == sample2
return tuple( sample1, sample2, bedgraph )
others: true
return tuple( sample1, sample2, bedgraph )
} \
.set { inputs }
inputs.controls.view { "controls: $it" }
inputs.others.view { "others: $it" }
结果:
others: [Kasumi_H3K36, Kasumi_IgG, /mnt/Data/cut_and_tag/work/d0/3db2bde9eb1bdb0578073fb128bc4c/Kasumi_H3K36.no0.bedgraph]
controls: [Kasumi_IgG, Kasumi_IgG, /mnt/Data/cut_and_tag/work/21/1038cd4ecbc5b3f88da23ad1ee3147/Kasumi_IgG.no0.bedgraph]
others: [Kasumi_JMJD1C, Kasumi_IgG, /mnt/Data/cut_and_tag/work/b1/dffe2120acda5b05860e1a3bb0c1bf/Kasumi_JMJD1C.no0.bedgraph]
others: [Kasumi_NCOR1, Kasumi_IgG, /mnt/Data/cut_and_tag/work/9f/7c3680a1ff0ae0a5a27f42e1a27225/Kasumi_NCOR1.no0.bedgraph]
others: [Kasumi_H4K5, Kasumi_IgG, /mnt/Data/cut_and_tag/work/3d/7b5239ab9dc83b00f992fea8926630/Kasumi_H4K5.no0.bedgraph]
评论更新:
Channel
.of(
['Kasumi_H3K36', 'Kasumi_IgG', file('/path/to/Kasumi_H3K36.no0.bedgraph')],
['Kasumi_JMJD1C', 'Kasumi_IgG', file('/path/to/Kasumi_JMJD1C.no0.bedgraph')],
['Kasumi_NCOR1', 'Kasumi_IgG', file('/path/to/Kasumi_NCOR1.no0.bedgraph')],
['Kasumi_IgG', 'Kasumi_IgG', file('/path/to/Kasumi_IgG.no0.bedgraph')],
['Kasumi_H4K5', 'Kasumi_IgG', file('/path/to/Kasumi_H4K5.no0.bedgraph')],
['NB4_H3K36', 'NB4_IgG', file('/path/to/NB4_H3K36.no0.bedgraph')],
['NB4_JMJD1C', 'NB4_IgG', file('/path/to/NB4_JMJD1C.no0.bedgraph')],
['NB4_NCOR1', 'NB4_IgG', file('/path/to/NB4_NCOR1.no0.bedgraph')],
['NB4_IgG', 'NB4_IgG', file('/path/to/NB4_IgG.no0.bedgraph')],
['NB4_H4K5', 'NB4_IgG', file('/path/to/NB4_H4K5.no0.bedgraph')],
) \
.branch { test_sample, control_sample, bedgraph ->
control_samples: test_sample == control_sample
return tuple( control_sample, tuple( test_sample, bedgraph ) )
test_samples: true
return tuple( control_sample, tuple( test_sample, bedgraph ) )
} \
.set { inputs }
inputs.test_samples
.combine( inputs.control_samples, by: 0 ) \
.map { group, test_tuple, control_tuple ->
tuple( *test_tuple, *control_tuple )
} \
.view()
结果:
[Kasumi_H3K36, /path/to/Kasumi_H3K36.no0.bedgraph, Kasumi_IgG, /path/to/Kasumi_IgG.no0.bedgraph]
[Kasumi_JMJD1C, /path/to/Kasumi_JMJD1C.no0.bedgraph, Kasumi_IgG, /path/to/Kasumi_IgG.no0.bedgraph]
[Kasumi_NCOR1, /path/to/Kasumi_NCOR1.no0.bedgraph, Kasumi_IgG, /path/to/Kasumi_IgG.no0.bedgraph]
[Kasumi_H4K5, /path/to/Kasumi_H4K5.no0.bedgraph, Kasumi_IgG, /path/to/Kasumi_IgG.no0.bedgraph]
[NB4_H3K36, /path/to/NB4_H3K36.no0.bedgraph, NB4_IgG, /path/to/NB4_IgG.no0.bedgraph]
[NB4_JMJD1C, /path/to/NB4_JMJD1C.no0.bedgraph, NB4_IgG, /path/to/NB4_IgG.no0.bedgraph]
[NB4_NCOR1, /path/to/NB4_NCOR1.no0.bedgraph, NB4_IgG, /path/to/NB4_IgG.no0.bedgraph]
[NB4_H4K5, /path/to/NB4_H4K5.no0.bedgraph, NB4_IgG, /path/to/NB4_IgG.no0.bedgraph]