## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 6, fig.height = 6, dpi = 110 ) library(plasmidplot) ## ----scratch------------------------------------------------------------------ p <- plasmid("pBR322", 4361) |> pp_marker(86, 1276, label = "TcR", arrow = "end") |> pp_marker(1915, 2106, label = "rop", arrow = "start") |> pp_marker(2535, 3122, label = "ori") |> pp_marker(3293, 4153, label = "AmpR", arrow = "start") plot(p) ## ----wrap--------------------------------------------------------------------- plot(pp_marker(plasmid("pWrap", 3000), 2800, 300, label = "crosses origin", arrow = "end")) ## ----features----------------------------------------------------------------- feats <- data.frame( start = c(86, 2535, 3293), end = c(1276, 3122, 4153), label = c("TcR", "ori", "AmpR"), arrow = c("end", "none", "start") ) plot(pp_features(plasmid("pBR322", 4361), feats)) ## ----read--------------------------------------------------------------------- gb <- system.file("extdata", "pDemo.gb", package = "plasmidplot") p <- read_plasmid(gb) p ## ----read-args, eval = FALSE-------------------------------------------------- # read_genbank(gb, # types = "CDS", # keep only these feature types # skip_types = "source", # drop these (source spans the whole molecule) # label_from = c("label", "gene", "product"), # qualifier priority # color_by = "feature", # or "type": one color per feature type # colors = "style", # or "file": keep the colors stored in the file # sequence = TRUE # keep the sequence for pp_find_sites() # ) ## ----sites, fig.height = 6.5-------------------------------------------------- p <- pp_find_sites(p) plot(p) ## ----sites-args, eval = FALSE------------------------------------------------- # pp_find_sites(p, c("EcoRI", "BamHI")) # pp_find_sites(p, c(MyEnz = "GGWCC")) # pp_find_sites(p, unique_only = FALSE, max_sites = 3) ## ----style-scratch------------------------------------------------------------ plot(p, style = pp_style(anchor = "outside", backbone = "line", radius = 0.26, arc = 0.05)) ## ----style-preset------------------------------------------------------------- plot(p, style = pp_style("minimal", arc = 0.05)) ## ----presets------------------------------------------------------------------ pp_style() ## ----canvas------------------------------------------------------------------- plot(p, style = "neon", bg = pp_canvas("neon")) ## ----linear, fig.width = 8, fig.height = 4------------------------------------ plot(p, style = pp_style("angular", layout = "linear")) ## ----palettes----------------------------------------------------------------- pp_palette() plot(p, style = pp_style("angular", palette = "jewel")) ## ----external, eval = FALSE--------------------------------------------------- # plot(p, style = pp_style("angular", palette = ggsci::pal_npg("nrc"))) # plot(p, style = pp_style("angular", palette = RColorBrewer::brewer.pal(8, "Dark2"))) ## ----check-------------------------------------------------------------------- pp_check_palette("default") ## ----panels, fig.width = 8, fig.height = 4------------------------------------ grid::grid.newpage() grid::pushViewport(grid::viewport(layout = grid::grid.layout(1, 2))) grid::pushViewport(grid::viewport(layout.pos.col = 1)) plot(p, style = pp_style("angular", show_title = FALSE), newpage = FALSE) grid::popViewport() grid::pushViewport(grid::viewport(layout.pos.col = 2)) plot(p, style = pp_style("minimal", show_title = FALSE), newpage = FALSE) grid::popViewport(2) ## ----unicode, eval = FALSE---------------------------------------------------- # ragg::agg_png("plasmid.png", width = 1400, height = 1400, res = 220) # plot(p) # dev.off() .