# reads <- readFasta("https://drive.google.com/file/d/1r6E0U5LyYwjWenxy9yqh5QQ2mq1umWOW/view?usp=sharing")
# # post <- readFasta("/Users/bust0037/Desktop/ragtag.scaffold.fasta")
# n_chroms <- 18
# pb <- progress::progress_bar$new(total = n_chroms)
# out <- list()
# for (i in 1:n_chroms) {
# pb$tick()
# dat <- strsplit(substr(as.character(post[i]), 1, 50000000), "")[[1]]
# b <- rle(dat)
# # Create a data frame
# dt <- data.frame(number = b$values, lengths = b$lengths, scaff = i)
# # Get the end
# dt$end <- cumsum(dt$lengths)
# # Get the start
# dt$start <- dt$end - dt$lengths + 1
# # Select columns
# dt <- dt[, c("number", "start", "end", "scaff")]
# # Sort rows
# dt <- dt[order(dt$number), ]
# dt %>%
# filter(number == "N") -> N_dat
# out[[i]] <- N_dat
# }
# out <- do.call(rbind, out)
# chroms <- data.frame(
# lengths = post@ranges@width[1:n_chroms],
# scaff = seq(1,n_chroms,1)
# )
# ggplot() +
# statebins:::geom_rrect(data = chroms, aes(xmin = 0, xmax = lengths, ymin = -1, ymax = 1, fill = scaff), color = "black") +
# geom_rect(data = out, aes(xmin = start, xmax = end, ymin = -0.95, ymax = 0.95), color = "white", fill = "white", size = 0.08) +
# facet_grid(scaff~.) +
# scale_fill_viridis(end = 0.8) +
# theme_classic()
# ggplot() +
# geom_rect(data = filter(chroms, scaff == 1 | scaff == 2), aes(xmin = 0, xmax = lengths, ymin = -1, ymax = 1, fill = scaff), color = "black") +
# geom_rect(data = filter(out, scaff == 1 | scaff == 2), aes(xmin = start, xmax = end, ymin = -0.95, ymax = 0.95), color = "white", fill = "white", size = 0.08) +
# facet_grid(scaff~.) +
# scale_y_continuous(limits = c(-2,2)) +
# scale_fill_viridis(end = 0.8) +
# theme_classic() +
# coord_polar()