Hi,
I am trying to create a Sankey plot that illustrates the relationship of some GO terms, and I have a dataset that looks like this:
structure(list(parent_id = c("GO:0015727", "GO:0035873", "GO:0035873",
"GO:0015129", "GO:0035879"), parent_name = c("lactate transport",
"lactate transmembrane transport", "lactate transmembrane transport",
"lactate transmembrane transporter activity", "plasma membrane lactate transport"
), aspect_parent = c("biological_process", "biological_process",
"biological_process", "molecular_function", "biological_process"
), id = c("GO:0035873", "GO:0015129", "GO:0035879", "GO:0015650",
"GO:0046722"), name = c("lactate transmembrane transport", "lactate transmembrane transporter activity",
"plasma membrane lactate transport", "lactate:proton symporter activity",
"lactic acid secretion"), relation = c("is_a", "part_of", "is_a",
"is_a", "is_a"), hasChildren = c("TRUE", "TRUE", "TRUE", "FALSE",
"FALSE"), aspect = c("biological_process", "molecular_function",
"biological_process", "molecular_function", "biological_process"
), recursive_pass = structure(c(1L, 2L, 2L, 3L, 3L), levels = c("first",
"second", "third"), class = "factor"), next_pass = structure(c(1L,
2L, 2L, NA, NA), levels = c("first", "second", "third"), class = "factor")), row.names = c(NA,
-5L), class = "data.frame")
Now i have used the ggsankey R package to make a Sankey plot and the ordering of the data, everything looks fine to me but I get a plot that does not show any flow between columns, and I do not understand where my code or my data structure is falling.
Thank you !
The ggplot code:
pathways_connections <- ggplot(data = GOs_childs_recursive,
aes(x = recursive_pass,
next_x = next_pass,
node = parent_id,
next_node = parent_id,
fill = factor(parent_id))) +
geom_sankey(flow_alpha = 1,
node.color = "black",
show.legend = TRUE)
pathways_connections
The graph I get:
Use
dput
to share the dataset, not to show what it looks like - use a simpleprint()
to do that, like so: