library(ggchord)

library(dplyr)
foundation_source <- ribbon_data_example |>
  mutate(source_hsp_id = paste0("bundled:", row_number()))
foundation_pair <- foundation_source |>
  slice_head(n = 1) |>
  select(qaccver, saccver)
foundation_ids <- c(foundation_pair$qaccver, foundation_pair$saccver)
foundation_seqs <- seq_data_example |>
  filter(accver %in% foundation_ids) |>
  select(accver, length)
foundation_hsp <- foundation_source |>
  filter(qaccver %in% foundation_ids, saccver %in% foundation_ids,
    qaccver != saccver)
foundation_features <- gene_data_example |>
  filter(accver %in% foundation_ids) |>
  transmute(accver, start, end, strand = source_strand, anno)


p_foundationsankey <- ggchord(foundation_seqs, foundation_hsp) +
  geom_seq() +
  geom_seq_label() +
  geom_link_ribbon() +
  coord_sankey()
view_ggchord(p_foundationsankey, width = 9, height = 8, units = "in")


p_coursesankeygap <- p_foundationsankey + coord_sankey(column_gap = 0.8)
view_ggchord(p_coursesankeygap, width = 10, height = 8, units = "in")


get_chord_layout(p_foundationsankey)$display_instances

