.is_dot <- function(x){
## The first line should open the dot structure
opens <- grepl("\\{$", x[[1]])
## The last line should close the dot structure
## In between can be empty
closes <- grepl("^\\}", x[[length(x)]])
hasType <- grepl("^(digraph|graph)", x[[1]])
all(opens, closes, hasType)
}
.is_valid_snakemake_digraph <- function(x, snake_warn = TRUE){
# The minimal requirements are a digraph & at least one edge
is_digraph <- grepl("digraph", x[[1]])
has_edges <- any(grepl("->", x))
if (!grepl("snakemake", x[[1]]) & snake_warn) warning(
"Graph not generated by snakemake. Unexpected structures may be present"
)
all(.is_dot(x), is_digraph, has_edges)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.