Skip to content

Commit

Permalink
Only check warning message for deprecated features
Browse files Browse the repository at this point in the history
  • Loading branch information
arisp99 committed Jul 31, 2022
1 parent b392ca4 commit c6a6605
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 105 deletions.
64 changes: 3 additions & 61 deletions tests/testthat/_snaps/read-deprecated.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,7 @@
# chrom and gene are deprecated
# read() is deprecated

Code
read("small.csv", "small.csv", "small.csv", chrom = "13")
Condition
Warning:
`read()` was deprecated in miplicorn 0.2.0.
Please use `read_tbl_ref_alt_cov()` instead.
Warning:
The `chrom` argument of `read()` is deprecated as of miplicorn 0.1.0.
Please use the `...` argument instead to filter data.
Message
Joining, by = "gene_id"
Joining, by = "gene_id"
Joining, by = "gene_id"
Output
# A ref alt cov table: 0 x 10
# ... with 10 variables: sample <chr>, gene_id <chr>, gene <chr>,
# mutation <chr>, func <chr>, aa_chng <chr>, target <chr>,
# ref_umi_count <dbl>, alt_umi_count <dbl>, coverage <dbl>
# i Use `colnames()` to see all variable names

---

Code
read("small.csv", "small.csv", "small.csv", chrom = "atp")
Condition
Warning:
`read()` was deprecated in miplicorn 0.2.0.
Please use `read_tbl_ref_alt_cov()` instead.
Warning:
The `chrom` argument of `read()` is deprecated as of miplicorn 0.1.0.
Please use the `...` argument instead to filter data.
Message
Joining, by = "gene_id"
Joining, by = "gene_id"
Joining, by = "gene_id"
Output
# A ref alt cov table: 0 x 10
# ... with 10 variables: sample <chr>, gene_id <chr>, gene <chr>,
# mutation <chr>, func <chr>, aa_chng <chr>, target <chr>,
# ref_umi_count <dbl>, alt_umi_count <dbl>, coverage <dbl>
# i Use `colnames()` to see all variable names

---

Code
read("small.csv", "small.csv", "small.csv", chrom = "13", gene = "atp")
Condition
Warning:
`read()` was deprecated in miplicorn 0.2.0.
Please use `read_tbl_ref_alt_cov()` instead.
Warning:
The `chrom` argument of `read()` is deprecated as of miplicorn 0.1.0.
Please use the `...` argument instead to filter data.
Warning:
The `gene` argument of `read()` is deprecated as of miplicorn 0.1.0.
Please use the `...` argument instead to filter data.
Error in `read_tbl_ref_alt_cov()`:
! Multiple filtering criteria selected.
x Cannot filter on both `chrom` and `gene`.
i Select only one piece of information to filter on.
`read()` was deprecated in miplicorn 0.2.0.
Please use `read_tbl_ref_alt_cov()` instead.

# read_file() is deprecated

Expand Down
39 changes: 4 additions & 35 deletions tests/testthat/_snaps/read-tbl.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,44 +33,13 @@

# chrom and gene are deprecated

Code
read_tbl_ref_alt_cov(.tbl_ref = "small.csv", .tbl_alt = "small.csv", .tbl_cov = "small.csv",
chrom = "13")
Condition
Warning:
The `chrom` argument of `read()` is deprecated as of miplicorn 0.1.0.
Please use the `...` argument instead to filter data.
Message
Joining, by = "gene_id"
Joining, by = "gene_id"
Joining, by = "gene_id"
Output
# A ref alt cov table: 0 x 10
# ... with 10 variables: sample <chr>, gene_id <chr>, gene <chr>,
# mutation <chr>, func <chr>, aa_chng <chr>, target <chr>,
# ref_umi_count <dbl>, alt_umi_count <dbl>, coverage <dbl>
# i Use `colnames()` to see all variable names
The `chrom` argument of `read()` is deprecated as of miplicorn 0.1.0.
Please use the `...` argument instead to filter data.

---

Code
read_tbl_ref_alt_cov(.tbl_ref = "small.csv", .tbl_alt = "small.csv", .tbl_cov = "small.csv",
gene = "atp")
Condition
Warning:
The `gene` argument of `read()` is deprecated as of miplicorn 0.1.0.
Please use the `...` argument instead to filter data.
Message
Joining, by = "gene"
Joining, by = "gene"
Joining, by = "gene"
Output
# A ref alt cov table: 2 x 9
sample gene mutation func aa_chng target ref_umi_count alt_um~1 cover~2
<chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
1 S1 atp6 atp6-A623E missense A623E Yes 0 0 0
2 S2 atp6 atp6-A623E missense A623E Yes 0 0 0
# ... with abbreviated variable names 1: alt_umi_count, 2: coverage
The `gene` argument of `read()` is deprecated as of miplicorn 0.1.0.
Please use the `...` argument instead to filter data.

---

Expand Down
9 changes: 2 additions & 7 deletions tests/testthat/test-read-deprecated.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
test_that("chrom and gene are deprecated", {
expect_snapshot(read("small.csv", "small.csv", "small.csv", chrom = "13"))
expect_snapshot(read("small.csv", "small.csv", "small.csv", chrom = "atp"))
expect_snapshot(
error = TRUE,
read("small.csv", "small.csv", "small.csv", chrom = "13", gene = "atp")
)
test_that("read() is deprecated", {
expect_snapshot_warning(read("small.csv", "small.csv", "small.csv"))
})

test_that("read_file() is deprecated", {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-read-tbl.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ test_that("can filter rows", {

# Test read_tbl_ref_alt_cov() --------------------------------------------------
test_that("chrom and gene are deprecated", {
expect_snapshot(read_tbl_ref_alt_cov(
expect_snapshot_warning(read_tbl_ref_alt_cov(
.tbl_ref = "small.csv",
.tbl_alt = "small.csv",
.tbl_cov = "small.csv",
chrom = "13"
))

expect_snapshot(read_tbl_ref_alt_cov(
expect_snapshot_warning(read_tbl_ref_alt_cov(
.tbl_ref = "small.csv",
.tbl_alt = "small.csv",
.tbl_cov = "small.csv",
Expand Down

0 comments on commit c6a6605

Please sign in to comment.