From 59b02c04d1cdb665a0de436956d4b8211f8d8ca9 Mon Sep 17 00:00:00 2001 From: js2264 Date: Wed, 19 Jun 2024 10:15:01 +0200 Subject: [PATCH] fix: tests for pair_granges --- NAMESPACE | 1 + R/pair-granges.R | 2 +- R/reexports-plyranges.R | 1 + tests/testthat.R | 20 ++++++++++---------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index b47c66d..25b39ac 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -240,6 +240,7 @@ importFrom(plyranges,anchor_5p) importFrom(plyranges,anchor_center) importFrom(plyranges,anchor_end) importFrom(plyranges,anchor_start) +importFrom(plyranges,as_granges) importFrom(plyranges,count_overlaps) importFrom(plyranges,count_overlaps_directed) importFrom(plyranges,filter_by_non_overlaps) diff --git a/R/pair-granges.R b/R/pair-granges.R index 10722b1..5e37468 100644 --- a/R/pair-granges.R +++ b/R/pair-granges.R @@ -27,6 +27,6 @@ pair_granges <- function(x) { combs <- combn(length(x), 2) - InteractionSet::GInteractions(combs[1,], combs[2,], gr) + InteractionSet::GInteractions(combs[1,], combs[2,], x) } diff --git a/R/reexports-plyranges.R b/R/reexports-plyranges.R index c820878..d2cb6e2 100644 --- a/R/reexports-plyranges.R +++ b/R/reexports-plyranges.R @@ -1,4 +1,5 @@ #' @rdname reexports +#' @importFrom plyranges as_granges #' @importFrom plyranges anchor #' @export plyranges::anchor diff --git a/tests/testthat.R b/tests/testthat.R index f858f15..5c3cde7 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -10,15 +10,15 @@ library(testthat) library(plyinteractions) gi <- read.table(text = " - chr1 11 20 chr1 21 30 + + - chr1 11 20 chr1 51 55 + + - chr1 11 30 chr1 51 55 - - - chr1 11 30 chr2 51 60 - -", - col.names = c( - "seqnames1", "start1", "end1", - "seqnames2", "start2", "end2", "strand1", "strand2") - ) |> - as_ginteractions() |> - mutate(score = runif(4), type = c('cis', 'cis', 'cis', 'trans')) + chr1 11 20 chr1 21 30 + + + chr1 11 20 chr1 51 55 + + + chr1 11 30 chr1 51 55 - - + chr1 11 30 chr2 51 60 - -", + col.names = c( + "seqnames1", "start1", "end1", + "seqnames2", "start2", "end2", "strand1", "strand2") +) |> + as_ginteractions() |> + mutate(score = runif(4), type = c('cis', 'cis', 'cis', 'trans')) test_check("plyinteractions")