nextflow-io / nf-prov

Apache License 2.0
23 stars 11 forks source link

Add task dag format #12

Closed bentsherman closed 10 months ago

bentsherman commented 11 months ago

Render the task graph as an HTML document, originally developed in https://github.com/nextflow-io/nextflow/pull/3802

@samuell I was originally going to add your visualizer script, but then I realized we could just render the DAG directly in the plugin! I already wrote the code in a Nextflow PR but i think it fits better here. The task DAG is a sort of provenance report after all... anyway, want to give it a try and let me know if it can be improved at all?

Here is an example diagram for an rnaseq-nf run:

<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
</head>
<body>
<pre class="mermaid" style="text-align: center;">
flowchart TD
    subgraph " "
    in0["ggal_gut_1.fq"]
    click in0 href "https://github.com/nextflow-io/rnaseq-nf/tree/d910312506c6539365ed70aacda5068dea9152dd/data/ggal/ggal_gut_1.fq" _blank
    in1["ggal_gut_2.fq"]
    click in1 href "https://github.com/nextflow-io/rnaseq-nf/tree/d910312506c6539365ed70aacda5068dea9152dd/data/ggal/ggal_gut_2.fq" _blank
    in2["ggal_1_48850000_49020000.Ggal71.500bpflank.fa"]
    click in2 href "https://github.com/nextflow-io/rnaseq-nf/tree/d910312506c6539365ed70aacda5068dea9152dd/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa" _blank
    in3["multiqc"]
    click in3 href "https://github.com/nextflow-io/rnaseq-nf/tree/d910312506c6539365ed70aacda5068dea9152dd/multiqc" _blank
    end
    subgraph RNASEQ
    t0(["FASTQC (FASTQC on ggal_gut)"])
    t1(["INDEX (ggal_1_48850000_49020000)"])
    t2(["QUANT (ggal_gut)"])
    end
    t3(["MULTIQC"])
    in0 --> t0
    in1 --> t0
    in2 --> t1
    t1 -->|index| t2
    in0 --> t2
    in1 --> t2
    t2 -->|ggal_gut| t3
    t0 -->|fastqc_ggal_gut_logs| t3
    in3 --> t3
    t3 --> out0
    subgraph " "
    out0[multiqc_report.html]
    end
</pre>
<script type="module">
  import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
  mermaid.initialize({ startOnLoad: true });
</script>
</body>
</html>
samuell commented 10 months ago

@bentsherman Cool, hope to have a look in the beginning of next week!

bentsherman commented 10 months ago

I'm gonna move this forward, but feel free to share any feedback here at your convenience. Not an urgent thing by any means