Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bed_sort failed test "by_chrom option" #319

Closed
raysinensis opened this issue Jan 19, 2018 · 1 comment
Closed

bed_sort failed test "by_chrom option" #319

raysinensis opened this issue Jan 19, 2018 · 1 comment

Comments

@raysinensis
Copy link
Contributor

by_chrom sort didn't group by chrom, regardless of reverse option

library(valr)
  x <- tibble::tribble(
    ~chrom, ~start, ~end, ~name, ~score, ~strand,
    "chr7", 240L, 560L,   "x",  "86",  "-",
    "chr7",  210L,  525L,  "d",  "21",  "+",
    "chr7", 2100L, 2310L,  "e",  "32",  "+",
    "chr3",   40L,  260L,  "p",  "41",  "-",
    "chr3",   10L,  220L,  "f",  "12",  "+",
    "chr3",  100L,  320L,  "g",  "96",  "-",
    "chr9",  140L,  160L,  "z",  "05",  "+",
    "chr9",  110L,  120L,  "a",  "81",  "-",
    "chr9", 1100L, 1120L,  "b",  "12",  "+"
  )
  res <- bed_sort(x, by_chrom = TRUE, by_size = TRUE)
  res2 <- bed_sort(x, by_size = TRUE, by_chrom = TRUE, reverse = TRUE)
  res
#> # A tibble: 9 x 6
#> # Groups:   chrom [3]
#>   chrom start   end  name score strand
#>   <chr> <int> <int> <chr> <chr>  <chr>
#> 1  chr9   110   120     a    81      -
#> 2  chr9   140   160     z    05      +
#> 3  chr9  1100  1120     b    12      +
#> 4  chr7  2100  2310     e    32      +
#> 5  chr3    10   220     f    12      +
#> 6  chr3    40   260     p    41      -
#> 7  chr3   100   320     g    96      -
#> 8  chr7   210   525     d    21      +
#> 9  chr7   240   560     x    86      -
  res2
#> # A tibble: 9 x 6
#> # Groups:   chrom [3]
#>   chrom start   end  name score strand
#>   <chr> <int> <int> <chr> <chr>  <chr>
#> 1  chr7   240   560     x    86      -
#> 2  chr7   210   525     d    21      +
#> 3  chr3    40   260     p    41      -
#> 4  chr3   100   320     g    96      -
#> 5  chr7  2100  2310     e    32      +
#> 6  chr3    10   220     f    12      +
#> 7  chr9   140   160     z    05      +
#> 8  chr9  1100  1120     b    12      +
#> 9  chr9   110   120     a    81      -

Created on 2018-01-19 by the reprex package (v0.1.1.9000).

@raysinensis raysinensis changed the title bed_sort failed by_chrom option test bed_sort failed "by_chrom option" test Jan 19, 2018
@raysinensis raysinensis changed the title bed_sort failed "by_chrom option" test bed_sort failed test "by_chrom option" Jan 19, 2018
@raysinensis
Copy link
Contributor Author

the issue is due to dplyr updating arrange behavior so that arrange ignores groups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant