library(ggchord)

library(ggchord)
library(dplyr)


library(ggchord)
library(dplyr)
finish_dna <- plasmid_example_pUC19
finish_seq <- finish_dna[c("accver", "length")]
finish_features <- head(find_common_features(finish_dna), 6)
finish_circle <- ggchord(finish_seq) + geom_seq() + coord_circular()
finish_labels <- finish_features |>
  mutate(anno = paste0(anno, " [", start, "-", end, " bp]"))
finish_feature_base <- finish_circle + geom_feature(data = finish_labels)


p_comparefeaturearrow <- finish_circle + geom_feature(data = finish_features, shape = "arrow")
view_ggchord(p_comparefeaturearrow, width = 9, height = 8, units = "in")


p_comparefeatureblock <- finish_circle + geom_feature(data = finish_features, shape = "block")
view_ggchord(p_comparefeatureblock, width = 9, height = 8, units = "in")


p_comparefeaturepreset <- finish_circle + geom_feature_plasmid(data = finish_features)
view_ggchord(p_comparefeaturepreset, width = 9, height = 8, units = "in")


finish_position <- position_feature_stack(base_position = position_plasmid(), spacing = 0.1)
finish_stack_base <- ggchord(finish_seq) + geom_seq() + coord_circular()


finish_current_position <- position_identity()
p_comparepositionidentity <- finish_stack_base +
  geom_feature(data = finish_features, position = finish_current_position) +
  geom_feature_label_repel(data = finish_features, position = finish_current_position)
view_ggchord(p_comparepositionidentity, width = 9, height = 8, units = "in")


finish_current_position <- finish_position
p_comparepositionstack <- finish_stack_base +
  geom_feature(data = finish_features, position = finish_current_position) +
  geom_feature_label_repel(data = finish_features, position = finish_current_position)
view_ggchord(p_comparepositionstack, width = 9, height = 8, units = "in")

