Skip to content

Commit

Permalink
un-dplyr and robustness of example
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-plessy committed Oct 31, 2023
1 parent e1411a4 commit 0ea5768
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ importFrom(S4Vectors,endoapply)
importFrom(S4Vectors,isSorted)
importFrom(S4Vectors,queryHits)
importFrom(S4Vectors,subjectHits)
importFrom(dplyr,bind_rows)
importFrom(dplyr,filter)
importFrom(dplyr,pull)
importFrom(genoPlotR,as.comparison)
importFrom(genoPlotR,dna_seg)
importFrom(genoPlotR,plot_gene_map)
Expand Down
10 changes: 3 additions & 7 deletions R/scaffoldByFlipAndMerge.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@
#' chrD = data.frame(contig = "chrD", orientation = 1),
#' chrBC = data.frame(contig = c("chrB", "chrC"), orientation = c(1,-1))))
#'
#' scaffoldByFlipAndMerge(gr, g, drop = T)
#'
#' @importFrom dplyr bind_rows filter pull
#' scaffoldByFlipAndMerge(gr, g, drop = TRUE)
#'
#' @export

scaffoldByFlipAndMerge <- function(gr, guide, drop = FALSE) {
# First, flip what should be flipped
which.flip <- guide |>
dplyr::bind_rows(.id='chromosome') |>
dplyr::filter(orientation == -1) |>
dplyr::pull(contig)
which.flip <- do.call(rbind, guide)
which.flip <- which.flip[which.flip$orientation == -1, "contig", drop = TRUE]
gr <- flipContigs(gr, which.flip)

# Then, merge what should be merged
Expand Down
3 changes: 2 additions & 1 deletion man/scaffoldByFlipAndMerge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0ea5768

Please sign in to comment.