Skip to content

Commit

Permalink
devtools check/styler - part4
Browse files Browse the repository at this point in the history
  • Loading branch information
pdiakumis committed May 6, 2024
1 parent 39b3cdf commit 00c8b2e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions R/oncokb.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#' @param x Path to something.
#'
#' @export
read_oncokb <- function(x) {
readr::read_tsv(x) |>
Expand All @@ -7,6 +9,9 @@ read_oncokb <- function(x) {
dplyr::pull("Hugo Symbol")
}

#' @param x Path to something.
#' @param oncokb_genes Tibble of something.
#'
#' @export
get_oncokb_genes <- function(x, oncokb_genes) {
delimiters <- " ,&-"
Expand Down
11 changes: 7 additions & 4 deletions R/purple.R
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ set_many_transcripts_cnv <- function(x) {
)
}

#' @param x Path to something.
#'
#' @export
process_cnv_tsv <- function(x) {
# Read input
Expand Down Expand Up @@ -539,7 +541,7 @@ purple_cnv_som_process <- function(x) {
#' x <- system.file("extdata/purple/purple.qc", package = "gpgr")
#' (q <- purple_qc_read(x))
#' @testexamples
#' expect_true(q$raw[1, "value", drop = TRUE] == "WARN_DELETED_GENES")
#' expect_true(q$raw[1, "value", drop = TRUE] == "FAIL_CONTAMINATION")
#'
#' @export
purple_qc_read <- function(x) {
Expand All @@ -551,7 +553,7 @@ purple_qc_read <- function(x) {
"QCStatus", "Method", "CopyNumberSegments",
"UnsupportedCopyNumberSegments", "Purity", "AmberGender",
"CobaltGender", "DeletedGenes", "Contamination", "GermlineAberrations",
"AmberMeanDepth", "LohPercent"
"AmberMeanDepth"
)

assertthat::assert_that(all(purple_qc$key == nm))
Expand Down Expand Up @@ -597,7 +599,7 @@ purple_qc_read <- function(x) {
#' (p <- purple_purity_read(x))
#' @testexamples
#' expect_equal(p$raw[1, "column", drop = TRUE], "purity")
#' expect_equal(p$raw[nrow(p$raw), "column", drop = TRUE], "svTumorMutationalBurden")
#' expect_equal(p$raw[nrow(p$raw), "column", drop = TRUE], "targeted")
#'
#' @export
purple_purity_read <- function(x) {
Expand All @@ -617,6 +619,7 @@ purple_purity_read <- function(x) {
"maxPloidy", "d",
"minDiploidProportion", "d",
"maxDiploidProportion", "d",
"version", "c",
"somaticPenalty", "d",
"wholeGenomeDuplication", "c",
"msIndelsPerMb", "d",
Expand All @@ -637,7 +640,7 @@ purple_purity_read <- function(x) {

purple_purity <- purple_purity |>
dplyr::mutate(
dplyr::across(tidyselect::vars_select_helpers$where(is.numeric), round, 2),
dplyr::across(tidyselect::where(is.numeric), \(x) round(x, 2)),
dplyr::across(dplyr::everything(), as.character)
) |>
tidyr::pivot_longer(dplyr::everything(), names_to = "column", values_to = "value") |>
Expand Down
2 changes: 2 additions & 0 deletions R/sv.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ set_many_transcripts_sv <- function(x) {
)
}

#' @param x Path to something.
#'
#' @export
process_sv <- function(x) {
# Read input and set column information
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-roxytest-testexamples-purple.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test_that("Function purple_qc_read() @ L545", {

x <- system.file("extdata/purple/purple.qc", package = "gpgr")
(q <- purple_qc_read(x))
expect_true(q$raw[1, "value", drop = TRUE] == "WARN_DELETED_GENES")
expect_true(q$raw[1, "value", drop = TRUE] == "FAIL_CONTAMINATION")
})


Expand All @@ -48,6 +48,6 @@ test_that("Function purple_purity_read() @ L603", {
x <- system.file("extdata/purple/purple.purity.tsv", package = "gpgr")
(p <- purple_purity_read(x))
expect_equal(p$raw[1, "column", drop = TRUE], "purity")
expect_equal(p$raw[nrow(p$raw), "column", drop = TRUE], "svTumorMutationalBurden")
expect_equal(p$raw[nrow(p$raw), "column", drop = TRUE], "targeted")
})

0 comments on commit 00c8b2e

Please sign in to comment.