-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Mermaid diagram in HTML DAG (#4337)
Signed-off-by: Ben Sherman <[email protected]> Signed-off-by: Paolo Di Tommaso <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]>
- Loading branch information
1 parent
7924835
commit 0f3e263
Showing
15 changed files
with
147 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
flowchart TD | ||
flowchart TB | ||
subgraph " " | ||
v0["Channel.fromFilePairs"] | ||
v1["transcriptome"] | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 0 additions & 74 deletions
74
modules/nextflow/src/main/groovy/nextflow/dag/CytoscapeJsRenderer.groovy
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,32 +15,31 @@ | |
*/ | ||
|
||
package nextflow.dag | ||
|
||
import java.nio.file.Path | ||
|
||
/** | ||
* Render the DAG in HTML using Cytoscape.js | ||
* to the specified file. | ||
* See http://js.cytoscape.org for more info. | ||
* Render the DAG as a Mermaid diagram embedded in an HTML document. | ||
* See https://mermaid.js.org/ for more info. | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
* @author Mike Smoot <[email protected]> | ||
* @author Ben Sherman <[email protected]> | ||
*/ | ||
class CytoscapeHtmlRenderer implements DagRenderer { | ||
class MermaidHtmlRenderer implements DagRenderer { | ||
|
||
@Override | ||
void renderDocument(DAG dag, Path file) { | ||
String tmplPage = readTemplate() | ||
String network = CytoscapeJsRenderer.renderNetwork(dag) | ||
file.text = tmplPage.replaceAll(~/\/\* REPLACE_WITH_NETWORK_DATA \*\//, network) | ||
final template = readTemplate() | ||
final network = new MermaidRenderer().renderNetwork(dag) | ||
file.text = template.replace('REPLACE_WITH_NETWORK_DATA', network) | ||
} | ||
|
||
private String readTemplate() { | ||
StringWriter writer = new StringWriter(); | ||
def res = CytoscapeHtmlRenderer.class.getResourceAsStream('cytoscape.js.dag.template.html') | ||
final writer = new StringWriter() | ||
final res = MermaidHtmlRenderer.class.getResourceAsStream('mermaid.dag.template.html') | ||
int ch | ||
while( (ch=res.read()) != -1 ) { | ||
writer.append(ch as char); | ||
writer.append(ch as char) | ||
} | ||
writer.toString(); | ||
writer.toString() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.