Hi all, I'd like to write a plugin extracting the...
# nextflow-plugins
p
Hi all, I'd like to write a plugin extracting the samples from a SAM file (old story: https://github.com/nextflow-io/nextflow/pull/1266 ) were can I find a simple example of a plugin
@Operator
that emits many object for one input value (just like flatMap). For example.
Copy code
bams_ch.extract_samples(tag:"SM").view()

["sample1","file1.sam"]
["sample2","file1.sam"]
["sample3","file3.bam"]
["sample5","file6.cram"]
here file1.sam contains two samples (so one "input" produces two "values")
❤️ 3
😮 1
p
it looks like it's working:
Copy code
final List<String> L = new ArrayList<>();
(...)
final next = {
  L.each{V->target.bind(V)}
   }
(...)
final done = { target.bind(Channel.STOP) }
DataflowHelper.subscribeImpl(source, [onNext: next, onComplete: done])
🙌 1
🙌🏻 2