Skip to content

Commit

Permalink
Merge pull request #175 from /issues/174-purple
Browse files Browse the repository at this point in the history
Handling new PURPLE CNV file
  • Loading branch information
pdiakumis authored Oct 4, 2024
2 parents 680a7c0 + b5b5b70 commit c5015a4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
^data-raw$
^\.bumpversion\.toml$

inst/rmd/rnasum.html
^CODE_OF_CONDUCT\.md$
^inst/rmd/rnasum.html$
inst/rmd/html
28 changes: 20 additions & 8 deletions R/sample_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -337,20 +337,32 @@ immune_summary <- function(tbl_imarkers, tbl_igram = NULL, igram_param = TRUE) {
#'
#' @export
ppl_cnv_som_gene_read <- function(x) {
nm <- c(
"chromosome" = "c", "start" = "i", "end" = "i", "gene" = "c",
ct <- list(
"chromosome" = "c", "start" = "d", "end" = "d", "gene" = "c",
"minCopyNumber" = "d", "maxCopyNumber" = "d",
"unused" = "c", "somaticRegions" = "d", "germlineHomDeletionRegions" = "d",
"germlineHetToHomDeletionRegions" = "d",
"transcriptId" = "c", "transcriptVersion" = "c", "chromosomeBand" = "c",
"minRegions" = "d", "minRegionStart" = "i", "minRegionEnd" = "i",
"minRegions" = "d", "minRegionStart" = "d", "minRegionEnd" = "d",
"minRegionStartSupport" = "c", "minRegionEndSupport" = "c",
"minRegionMethod" = "c", "minMinorAlleleCopyNumber" = "d"
)
# PURPLE as of at least v3.9.2 (2023-09-05) has some different columns
ct2 <- list(
"chromosome" = "c", "start" = "d", "end" = "d", "gene" = "c",
"minCopyNumber" = "d", "maxCopyNumber" = "d",
"somaticRegions" = "d", "transcriptId" = "c", "isCanonical" = "c",
"chromosomeBand" = "c",
"minRegions" = "d", "minRegionStart" = "d", "minRegionEnd" = "d",
"minRegionStartSupport" = "c", "minRegionEndSupport" = "c",
"minRegionMethod" = "c", "minMinorAlleleCopyNumber" = "d",
"depthWindowCount" = "d"
)

ctypes <- paste(nm, collapse = "")
purple_cnv_gene <- readr::read_tsv(x, col_types = ctypes)
assertthat::assert_that(ncol(purple_cnv_gene) == length(nm))
assertthat::assert_that(all(colnames(purple_cnv_gene) == names(nm)))
purple_cnv_gene
hdr <- readr::read_tsv(x, n_max = 0, show_col_types = FALSE)
if (all(names(ct2) %in% colnames(hdr))) {
ct <- ct2
}
d <- readr::read_tsv(x, col_types = ct)
d[]
}
2 changes: 2 additions & 0 deletions R/utils_shortcuts.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ dummy1 <- function() {
optparse::make_option
preprocessCore::normalize.quantiles
ragg::agg_png
purrr::map
stringr::str_detect
}
7 changes: 4 additions & 3 deletions man/pcgr_tiers_tsv_read.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-roxytest-testexamples-pcgr.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# File R/pcgr.R: @testexamples

test_that("Function pcgr_tiers_tsv_read() @ L17", {
test_that("Function pcgr_tiers_tsv_read() @ L18", {

x <- system.file(
"rawdata/test_data/umccrised/test_sample_WGS/small_variants",
Expand Down

0 comments on commit c5015a4

Please sign in to comment.