diff --git a/NAMESPACE b/NAMESPACE index 9df48ec..4eb4d8d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -28,10 +28,7 @@ export(TsoSampleAnalysisResultsFile) export(TsoTargetRegionCoverageFile) export(TsoTmbFile) export(TsoTmbTraceTsvFile) -export(UmChordTsvFile) -export(UmHrdetectTsvFile) -export(UmQcSumFile) -export(UmSigsSnvFile) +export(UmccriseCanRepTables) export(VCMetricsFile) export(Wf) export(Wf_tso_ctdna_tumor_only) diff --git a/R/umccrise.R b/R/umccrise.R index a8800b1..e358d2d 100644 --- a/R/umccrise.R +++ b/R/umccrise.R @@ -1,27 +1,81 @@ -#' UmChordTsvFile R6 Class +#' UmccriseCanRepTables R6 Class #' #' @description -#' Contains methods for reading and displaying contents of the -#' `chord.tsv.gz` file output from umccrise. +#' Reads and writes tidy versions of files within the `cancer_report_tables` directory +#' output from the `umccrise` workflow. #' #' @examples #' \dontrun{ -#' x <- "/path/to/chord.tsv.gz" -#' d <- UmChordTsvFile$new(x) -#' d_parsed <- d$read() # or read(d) -#' d$write(d_parsed, out_dir = tempdir(), prefix = "sample705", out_format = "tsv") +#' p1 <- "~/icav1/g/production/analysis_data/SBJ01155/umccrise/202408300c218043" +#' p2 <- "L2101566__L2101565/SBJ01155__PRJ211091/cancer_report_tables" +#' p <- file.path(p1, p2) +#' obj <- UmccriseCanRepTables$new(p) +#' obj$path +#' obj$contents +#' d <- obj$read() +#' obj$write(d, out_dir = tempdir(), prefix = "sampleA", out_format = "tsv") #' } +#' #' @export -UmChordTsvFile <- R6::R6Class( - "UmChordTsvFile", - inherit = File, +UmccriseCanRepTables <- R6::R6Class( + "UmccriseCanRepTables", public = list( - #' @description - #' Reads the `chord.tsv.gz` file output from umccrise. + #' @field path Path to the `cancer_report_tables` directory. + #' @field contents Tibble with file path, basename, and size. + path = NULL, + contents = NULL, + #' @description Create a new UmccriseCanRepTables object. + #' @param path Path to the `cancer_report_tables` directory. + initialize = function(path = NULL) { + stopifnot(is.character(path), length(path) == 1) + self$path <- normalizePath(path) + self$contents <- fs::dir_info(path, type = "file", recurse = TRUE) |> + dplyr::mutate( + bname = basename(.data$path), + size = as.character(trimws(.data$size)) + ) |> + dplyr::select("path", "bname", "size") + }, + #' @description Print details about the cancer_report_tables directory. + #' @param ... (ignored). + print = function(...) { + bnames <- self$contents |> + dplyr::mutate( + low = tolower(.data$bname), + ) |> + dplyr::arrange(.data$low) |> + dplyr::mutate( + n = dplyr::row_number(), + bn = glue("{.data$n}. {.data$bname} ({.data$size})") + ) |> + dplyr::pull("bn") + cat("#--- UmccriseCanRepTables ---#\n") + cat(glue("Path: {self$path}"), "\n") + cat("Contents:\n") + cat(bnames, sep = "\n") + invisible(self) + }, + #' @description Returns file with given pattern from the cancer_report_tables directory. + #' @param pat File pattern to look for. + grep_file = function(pat) { + x <- self$contents |> + dplyr::filter(grepl(pat, .data$path)) |> + dplyr::pull(.data$path) + if (length(x) > 1) { + fnames <- paste(x, collapse = ", ") + cli::cli_abort("More than 1 match found for {pat} ({fnames}). Aborting.") + } + if (length(x) == 0) { + return("") # file.exists("") returns FALSE + } + return(x) + }, + + #' @description Read `chord.tsv.gz` file output from umccrise. #' - #' @return A tibble. - read = function() { - x <- self$path + #' @param x (`character(1)`)\cr + #' Path to `chord.tsv.gz` file. + read_chordtsv = function(x) { ct <- readr::cols_only( p_hrd = "d", hr_status = "c", @@ -31,49 +85,11 @@ UmChordTsvFile <- R6::R6Class( ) read_tsvgz(x, col_types = ct) }, - - #' @description - #' Writes a tidy version of the `chord.tsv.gz` file output from umccrise. - #' - #' @param d Parsed object from `self$read()`. - #' @param prefix Prefix of output file(s). - #' @param out_dir Output directory. - #' @param out_format Format of output file(s). - #' @param drid dracarys ID to use for the dataset (e.g. `wfrid.123`, `prid.456`). - write = function(d, out_dir = NULL, prefix, out_format = "tsv", drid = NULL) { - if (!is.null(out_dir)) { - prefix <- file.path(out_dir, prefix) - } - # prefix2 <- glue("{prefix}_chord") - write_dracarys(obj = d, prefix = prefix, out_format = out_format, drid = drid) - } - ) -) - -#' UmHrdetectTsvFile R6 Class -#' -#' @description -#' Contains methods for reading and displaying contents of the -#' `hrdetect.tsv.gz` file output from umccrise. -#' -#' @examples -#' \dontrun{ -#' x <- "/path/to/hrdetect.tsv.gz" -#' d <- UmHrdetectTsvFile$new(x) -#' d_parsed <- d$read() # or read(d) -#' d$write(d_parsed, out_dir = tempdir(), prefix = "sample705", out_format = "tsv") -#' } -#' @export -UmHrdetectTsvFile <- R6::R6Class( - "UmHrdetectTsvFile", - inherit = File, - public = list( - #' @description - #' Reads the `hrdetect.tsv.gz` file output from umccrise. + #' @description Read `hrdetect.tsv.gz` file output from umccrise. #' - #' @return A tibble. - read = function() { - x <- self$path + #' @param x (`character(1)`)\cr + #' Path to `hrdetect.tsv.gz` file. + read_hrdetecttsv = function(x) { ct <- readr::cols( .default = "d", sample = "c" @@ -82,49 +98,12 @@ UmHrdetectTsvFile <- R6::R6Class( dplyr::select(-c("sample")) }, - #' @description - #' Writes a tidy version of the `hrdetect.tsv.gz` file output from umccrise. - #' - #' @param d Parsed object from `self$read()`. - #' @param prefix Prefix of output file(s). - #' @param out_dir Output directory. - #' @param out_format Format of output file(s). - #' @param drid dracarys ID to use for the dataset (e.g. `wfrid.123`, `prid.456`). - write = function(d, out_dir, prefix, out_format = "tsv", drid = NULL) { - if (!is.null(out_dir)) { - prefix <- file.path(out_dir, prefix) - } - # prefix2 <- glue("{prefix}_hrdetect") - write_dracarys(obj = d, prefix = prefix, out_format = out_format, drid = drid) - } - ) -) -#' UmSigsSnvFile R6 Class -#' -#' @description -#' Contains methods for reading and displaying contents of the -#' `snv_20XX.tsv.gz` file with SNV signatures output from umccrise. -#' -#' @examples -#' \dontrun{ -#' x <- "/path/to/snv_2015.tsv.gz" -#' d <- UmSigsSnvFile$new(x) -#' d_parsed <- d$read() # or read(d) -#' d$write(d_parsed, out_dir = tempdir(), prefix = "sample705", out_format = "tsv") -#' } -#' @export -UmSigsSnvFile <- R6::R6Class( - "UmSigsSnvFile", - inherit = File, - public = list( - #' @description - #' Reads the `snv.tsv.gz` file output from umccrise. + #' @description Read `snv_20XX.tsv.gz` file output from umccrise. #' - #' @return A tibble. - read = function() { - x <- self$path - version <- dplyr::if_else(grepl("2015\\.tsv.\\gz", x), "2015", "2020") + #' @param x (`character(1)`)\cr + #' Path to `snv_20XX.tsv.gz` file. + read_sigs = function(x) { ct <- readr::cols( .default = "d", Signature = "c" @@ -132,48 +111,11 @@ UmSigsSnvFile <- R6::R6Class( read_tsvgz(x, col_types = ct) }, - #' @description - #' Writes a tidy version of the `snv_20XX.tsv.gz` signature file output from umccrise. - #' - #' @param d Parsed object from `self$read()`. - #' @param prefix Prefix of output file(s). - #' @param out_dir Output directory. - #' @param out_format Format of output file(s). - #' @param drid dracarys ID to use for the dataset (e.g. `wfrid.123`, `prid.456`). - write = function(d, out_dir, prefix, out_format = "tsv") { - if (!is.null(out_dir)) { - prefix <- file.path(out_dir, prefix) - } - # prefix2 <- glue("{prefix}_sigs_snv") - write_dracarys(obj = d, prefix = prefix, out_format = out_format, drid = drid) - } - ) -) - -#' UmQcSumFile R6 Class -#' -#' @description -#' Contains methods for reading and displaying contents of the -#' `qc_summary.tsv.gz` file with QC summary metrics output from umccrise. -#' -#' @examples -#' \dontrun{ -#' x <- "/path/to/snv_2015.tsv.gz" -#' d <- UmQcSumFile$new(x) -#' d_parsed <- d$read() # or read(d) -#' d$write(d_parsed, out_dir = tempdir(), prefix = "sample705", out_format = "tsv") -#' } -#' @export -UmQcSumFile <- R6::R6Class( - "UmQcSumFile", - inherit = File, - public = list( - #' @description - #' Reads the `qc_summary.tsv.gz` file output from umccrise. + #' @description Read `qc_summary.tsv.gz` file output from umccrise. #' - #' @return A tibble. - read = function() { - x <- self$path + #' @param x (`character(1)`)\cr + #' Path to `qc_summary.tsv.gz` file. + read_qcsummarytsv = function(x) { d <- read_tsvgz(x, col_types = readr::cols(.default = "c")) d |> dplyr::select("variable", "value") |> @@ -202,25 +144,51 @@ UmQcSumFile <- R6::R6Class( "hrd_chord", "hrd_hrdetect", "contamination_hmf", "deleted_genes_hmf", "tmb_hmf", "tml_hmf", wgd_hmf = "WGD", - hypermutated, bpi_enabled + "hypermutated", "bpi_enabled" ) }, + #' @description + #' Reads contents of `cancer_report_tables` directory output by umccrise. + #' + #' @return A list of tibbles. + #' @export + read = function() { + # now return all as list elements + list( + chord = self$grep_file("-chord\\.tsv\\.gz$") |> self$read_chordtsv(), + hrdetect = self$grep_file("-hrdetect\\.tsv\\.gz$") |> self$read_hrdetecttsv(), + sigs2015 = self$grep_file("-snv_2015\\.tsv\\.gz$") |> self$read_sigs(), + sigs2020 = self$grep_file("-snv_2020\\.tsv\\.gz$") |> self$read_sigs(), + sigsdbs = self$grep_file("-dbs\\.tsv\\.gz$") |> self$read_sigs(), + sigsindel = self$grep_file("-indel\\.tsv\\.gz$") |> self$read_sigs(), + qcsum = self$grep_file("-qc_summary\\.tsv\\.gz$") |> self$read_qcsummarytsv() + ) + }, #' @description - #' Writes a tidy version of the `qc_summary.tsv.gz` QC summary file output - #' from umccrise. + #' Writes tidied contents of `cancer_report_tables` directory output by umccrise. #' #' @param d Parsed object from `self$read()`. #' @param prefix Prefix of output file(s). #' @param out_dir Output directory. #' @param out_format Format of output file(s). #' @param drid dracarys ID to use for the dataset (e.g. `wfrid.123`, `prid.456`). - write = function(d, out_dir, prefix, out_format = "tsv", drid = NULL) { + write = function(d, out_dir = NULL, prefix, out_format = "tsv", drid = NULL) { if (!is.null(out_dir)) { prefix <- file.path(out_dir, prefix) } - # prefix2 <- glue("{prefix}_qc_summary") - write_dracarys(obj = d, prefix = prefix, out_format = out_format, drid = drid) + d_write <- d |> + tibble::enframe(name = "section") |> + dplyr::rowwise() |> + dplyr::mutate( + section_low = tolower(.data$section), + p = glue("{prefix}_{.data$section_low}"), + out = list(write_dracarys(obj = .data$value, prefix = .data$p, out_format = out_format, drid = drid)) + ) |> + dplyr::ungroup() |> + dplyr::select("section", "value") |> + tibble::deframe() + invisible(d_write) } ) ) diff --git a/man/UmChordTsvFile.Rd b/man/UmChordTsvFile.Rd deleted file mode 100644 index 358e6db..0000000 --- a/man/UmChordTsvFile.Rd +++ /dev/null @@ -1,100 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/umccrise.R -\name{UmChordTsvFile} -\alias{UmChordTsvFile} -\title{UmChordTsvFile R6 Class} -\description{ -Contains methods for reading and displaying contents of the -\code{chord.tsv.gz} file output from umccrise. -} -\examples{ -\dontrun{ -x <- "/path/to/chord.tsv.gz" -d <- UmChordTsvFile$new(x) -d_parsed <- d$read() # or read(d) -d$write(d_parsed, out_dir = tempdir(), prefix = "sample705", out_format = "tsv") -} -} -\section{Super class}{ -\code{\link[dracarys:File]{dracarys::File}} -> \code{UmChordTsvFile} -} -\section{Methods}{ -\subsection{Public methods}{ -\itemize{ -\item \href{#method-UmChordTsvFile-read}{\code{UmChordTsvFile$read()}} -\item \href{#method-UmChordTsvFile-write}{\code{UmChordTsvFile$write()}} -\item \href{#method-UmChordTsvFile-clone}{\code{UmChordTsvFile$clone()}} -} -} -\if{html}{\out{ -
Inherited methods - -
-}} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmChordTsvFile-read}{}}} -\subsection{Method \code{read()}}{ -Reads the \code{chord.tsv.gz} file output from umccrise. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmChordTsvFile$read()}\if{html}{\out{
}} -} - -\subsection{Returns}{ -A tibble. -} -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmChordTsvFile-write}{}}} -\subsection{Method \code{write()}}{ -Writes a tidy version of the \code{chord.tsv.gz} file output from umccrise. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmChordTsvFile$write( - d, - out_dir = NULL, - prefix, - out_format = "tsv", - drid = NULL -)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{d}}{Parsed object from \code{self$read()}.} - -\item{\code{out_dir}}{Output directory.} - -\item{\code{prefix}}{Prefix of output file(s).} - -\item{\code{out_format}}{Format of output file(s).} - -\item{\code{drid}}{dracarys ID to use for the dataset (e.g. \code{wfrid.123}, \code{prid.456}).} -} -\if{html}{\out{
}} -} -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmChordTsvFile-clone}{}}} -\subsection{Method \code{clone()}}{ -The objects of this class are cloneable with this method. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmChordTsvFile$clone(deep = FALSE)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{deep}}{Whether to make a deep clone.} -} -\if{html}{\out{
}} -} -} -} diff --git a/man/UmHrdetectTsvFile.Rd b/man/UmHrdetectTsvFile.Rd deleted file mode 100644 index e2f7777..0000000 --- a/man/UmHrdetectTsvFile.Rd +++ /dev/null @@ -1,94 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/umccrise.R -\name{UmHrdetectTsvFile} -\alias{UmHrdetectTsvFile} -\title{UmHrdetectTsvFile R6 Class} -\description{ -Contains methods for reading and displaying contents of the -\code{hrdetect.tsv.gz} file output from umccrise. -} -\examples{ -\dontrun{ -x <- "/path/to/hrdetect.tsv.gz" -d <- UmHrdetectTsvFile$new(x) -d_parsed <- d$read() # or read(d) -d$write(d_parsed, out_dir = tempdir(), prefix = "sample705", out_format = "tsv") -} -} -\section{Super class}{ -\code{\link[dracarys:File]{dracarys::File}} -> \code{UmHrdetectTsvFile} -} -\section{Methods}{ -\subsection{Public methods}{ -\itemize{ -\item \href{#method-UmHrdetectTsvFile-read}{\code{UmHrdetectTsvFile$read()}} -\item \href{#method-UmHrdetectTsvFile-write}{\code{UmHrdetectTsvFile$write()}} -\item \href{#method-UmHrdetectTsvFile-clone}{\code{UmHrdetectTsvFile$clone()}} -} -} -\if{html}{\out{ -
Inherited methods - -
-}} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmHrdetectTsvFile-read}{}}} -\subsection{Method \code{read()}}{ -Reads the \code{hrdetect.tsv.gz} file output from umccrise. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmHrdetectTsvFile$read()}\if{html}{\out{
}} -} - -\subsection{Returns}{ -A tibble. -} -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmHrdetectTsvFile-write}{}}} -\subsection{Method \code{write()}}{ -Writes a tidy version of the \code{hrdetect.tsv.gz} file output from umccrise. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmHrdetectTsvFile$write(d, out_dir, prefix, out_format = "tsv", drid = NULL)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{d}}{Parsed object from \code{self$read()}.} - -\item{\code{out_dir}}{Output directory.} - -\item{\code{prefix}}{Prefix of output file(s).} - -\item{\code{out_format}}{Format of output file(s).} - -\item{\code{drid}}{dracarys ID to use for the dataset (e.g. \code{wfrid.123}, \code{prid.456}).} -} -\if{html}{\out{
}} -} -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmHrdetectTsvFile-clone}{}}} -\subsection{Method \code{clone()}}{ -The objects of this class are cloneable with this method. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmHrdetectTsvFile$clone(deep = FALSE)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{deep}}{Whether to make a deep clone.} -} -\if{html}{\out{
}} -} -} -} diff --git a/man/UmQcSumFile.Rd b/man/UmQcSumFile.Rd deleted file mode 100644 index eaf8b83..0000000 --- a/man/UmQcSumFile.Rd +++ /dev/null @@ -1,95 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/umccrise.R -\name{UmQcSumFile} -\alias{UmQcSumFile} -\title{UmQcSumFile R6 Class} -\description{ -Contains methods for reading and displaying contents of the -\code{qc_summary.tsv.gz} file with QC summary metrics output from umccrise. -} -\examples{ -\dontrun{ -x <- "/path/to/snv_2015.tsv.gz" -d <- UmQcSumFile$new(x) -d_parsed <- d$read() # or read(d) -d$write(d_parsed, out_dir = tempdir(), prefix = "sample705", out_format = "tsv") -} -} -\section{Super class}{ -\code{\link[dracarys:File]{dracarys::File}} -> \code{UmQcSumFile} -} -\section{Methods}{ -\subsection{Public methods}{ -\itemize{ -\item \href{#method-UmQcSumFile-read}{\code{UmQcSumFile$read()}} -\item \href{#method-UmQcSumFile-write}{\code{UmQcSumFile$write()}} -\item \href{#method-UmQcSumFile-clone}{\code{UmQcSumFile$clone()}} -} -} -\if{html}{\out{ -
Inherited methods - -
-}} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmQcSumFile-read}{}}} -\subsection{Method \code{read()}}{ -Reads the \code{qc_summary.tsv.gz} file output from umccrise. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmQcSumFile$read()}\if{html}{\out{
}} -} - -\subsection{Returns}{ -A tibble. -} -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmQcSumFile-write}{}}} -\subsection{Method \code{write()}}{ -Writes a tidy version of the \code{qc_summary.tsv.gz} QC summary file output -from umccrise. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmQcSumFile$write(d, out_dir, prefix, out_format = "tsv", drid = NULL)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{d}}{Parsed object from \code{self$read()}.} - -\item{\code{out_dir}}{Output directory.} - -\item{\code{prefix}}{Prefix of output file(s).} - -\item{\code{out_format}}{Format of output file(s).} - -\item{\code{drid}}{dracarys ID to use for the dataset (e.g. \code{wfrid.123}, \code{prid.456}).} -} -\if{html}{\out{
}} -} -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmQcSumFile-clone}{}}} -\subsection{Method \code{clone()}}{ -The objects of this class are cloneable with this method. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmQcSumFile$clone(deep = FALSE)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{deep}}{Whether to make a deep clone.} -} -\if{html}{\out{
}} -} -} -} diff --git a/man/UmSigsSnvFile.Rd b/man/UmSigsSnvFile.Rd deleted file mode 100644 index 78480fd..0000000 --- a/man/UmSigsSnvFile.Rd +++ /dev/null @@ -1,94 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/umccrise.R -\name{UmSigsSnvFile} -\alias{UmSigsSnvFile} -\title{UmSigsSnvFile R6 Class} -\description{ -Contains methods for reading and displaying contents of the -\code{snv_20XX.tsv.gz} file with SNV signatures output from umccrise. -} -\examples{ -\dontrun{ -x <- "/path/to/snv_2015.tsv.gz" -d <- UmSigsSnvFile$new(x) -d_parsed <- d$read() # or read(d) -d$write(d_parsed, out_dir = tempdir(), prefix = "sample705", out_format = "tsv") -} -} -\section{Super class}{ -\code{\link[dracarys:File]{dracarys::File}} -> \code{UmSigsSnvFile} -} -\section{Methods}{ -\subsection{Public methods}{ -\itemize{ -\item \href{#method-UmSigsSnvFile-read}{\code{UmSigsSnvFile$read()}} -\item \href{#method-UmSigsSnvFile-write}{\code{UmSigsSnvFile$write()}} -\item \href{#method-UmSigsSnvFile-clone}{\code{UmSigsSnvFile$clone()}} -} -} -\if{html}{\out{ -
Inherited methods - -
-}} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmSigsSnvFile-read}{}}} -\subsection{Method \code{read()}}{ -Reads the \code{snv.tsv.gz} file output from umccrise. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmSigsSnvFile$read()}\if{html}{\out{
}} -} - -\subsection{Returns}{ -A tibble. -} -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmSigsSnvFile-write}{}}} -\subsection{Method \code{write()}}{ -Writes a tidy version of the \code{snv_20XX.tsv.gz} signature file output from umccrise. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmSigsSnvFile$write(d, out_dir, prefix, out_format = "tsv")}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{d}}{Parsed object from \code{self$read()}.} - -\item{\code{out_dir}}{Output directory.} - -\item{\code{prefix}}{Prefix of output file(s).} - -\item{\code{out_format}}{Format of output file(s).} - -\item{\code{drid}}{dracarys ID to use for the dataset (e.g. \code{wfrid.123}, \code{prid.456}).} -} -\if{html}{\out{
}} -} -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-UmSigsSnvFile-clone}{}}} -\subsection{Method \code{clone()}}{ -The objects of this class are cloneable with this method. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{UmSigsSnvFile$clone(deep = FALSE)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{deep}}{Whether to make a deep clone.} -} -\if{html}{\out{
}} -} -} -} diff --git a/man/UmccriseCanRepTables.Rd b/man/UmccriseCanRepTables.Rd new file mode 100644 index 0000000..67e20f3 --- /dev/null +++ b/man/UmccriseCanRepTables.Rd @@ -0,0 +1,231 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/umccrise.R +\name{UmccriseCanRepTables} +\alias{UmccriseCanRepTables} +\title{UmccriseCanRepTables R6 Class} +\description{ +Reads and writes tidy versions of files within the \code{cancer_report_tables} directory +output from the \code{umccrise} workflow. +} +\examples{ +\dontrun{ +p1 <- "~/icav1/g/production/analysis_data/SBJ01155/umccrise/202408300c218043" +p2 <- "L2101566__L2101565/SBJ01155__PRJ211091/cancer_report_tables" +p <- file.path(p1, p2) +obj <- UmccriseCanRepTables$new(p) +obj$path +obj$contents +d <- obj$read() +obj$write(d, out_dir = tempdir(), prefix = "sampleA", out_format = "tsv") +} + +} +\section{Public fields}{ +\if{html}{\out{
}} +\describe{ +\item{\code{path}}{Path to the \code{cancer_report_tables} directory.} + +\item{\code{contents}}{Tibble with file path, basename, and size.} +} +\if{html}{\out{
}} +} +\section{Methods}{ +\subsection{Public methods}{ +\itemize{ +\item \href{#method-UmccriseCanRepTables-new}{\code{UmccriseCanRepTables$new()}} +\item \href{#method-UmccriseCanRepTables-print}{\code{UmccriseCanRepTables$print()}} +\item \href{#method-UmccriseCanRepTables-grep_file}{\code{UmccriseCanRepTables$grep_file()}} +\item \href{#method-UmccriseCanRepTables-read_chordtsv}{\code{UmccriseCanRepTables$read_chordtsv()}} +\item \href{#method-UmccriseCanRepTables-read_hrdetecttsv}{\code{UmccriseCanRepTables$read_hrdetecttsv()}} +\item \href{#method-UmccriseCanRepTables-read_sigs}{\code{UmccriseCanRepTables$read_sigs()}} +\item \href{#method-UmccriseCanRepTables-read_qcsummarytsv}{\code{UmccriseCanRepTables$read_qcsummarytsv()}} +\item \href{#method-UmccriseCanRepTables-read}{\code{UmccriseCanRepTables$read()}} +\item \href{#method-UmccriseCanRepTables-write}{\code{UmccriseCanRepTables$write()}} +\item \href{#method-UmccriseCanRepTables-clone}{\code{UmccriseCanRepTables$clone()}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-new}{}}} +\subsection{Method \code{new()}}{ +Create a new UmccriseCanRepTables object. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$new(path = NULL)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{path}}{Path to the \code{cancer_report_tables} directory.} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-print}{}}} +\subsection{Method \code{print()}}{ +Print details about the cancer_report_tables directory. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$print(...)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{...}}{(ignored).} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-grep_file}{}}} +\subsection{Method \code{grep_file()}}{ +Returns file with given pattern from the cancer_report_tables directory. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$grep_file(pat)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{pat}}{File pattern to look for.} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-read_chordtsv}{}}} +\subsection{Method \code{read_chordtsv()}}{ +Read \code{chord.tsv.gz} file output from umccrise. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$read_chordtsv(x)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{x}}{(\code{character(1)})\cr +Path to \code{chord.tsv.gz} file.} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-read_hrdetecttsv}{}}} +\subsection{Method \code{read_hrdetecttsv()}}{ +Read \code{hrdetect.tsv.gz} file output from umccrise. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$read_hrdetecttsv(x)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{x}}{(\code{character(1)})\cr +Path to \code{hrdetect.tsv.gz} file.} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-read_sigs}{}}} +\subsection{Method \code{read_sigs()}}{ +Read \code{snv_20XX.tsv.gz} file output from umccrise. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$read_sigs(x)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{x}}{(\code{character(1)})\cr +Path to \code{snv_20XX.tsv.gz} file.} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-read_qcsummarytsv}{}}} +\subsection{Method \code{read_qcsummarytsv()}}{ +Read \code{qc_summary.tsv.gz} file output from umccrise. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$read_qcsummarytsv(x)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{x}}{(\code{character(1)})\cr +Path to \code{qc_summary.tsv.gz} file.} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-read}{}}} +\subsection{Method \code{read()}}{ +Reads contents of \code{cancer_report_tables} directory output by umccrise. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$read()}\if{html}{\out{
}} +} + +\subsection{Returns}{ +A list of tibbles. +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-write}{}}} +\subsection{Method \code{write()}}{ +Writes tidied contents of \code{cancer_report_tables} directory output by umccrise. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$write( + d, + out_dir = NULL, + prefix, + out_format = "tsv", + drid = NULL +)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{d}}{Parsed object from \code{self$read()}.} + +\item{\code{out_dir}}{Output directory.} + +\item{\code{prefix}}{Prefix of output file(s).} + +\item{\code{out_format}}{Format of output file(s).} + +\item{\code{drid}}{dracarys ID to use for the dataset (e.g. \code{wfrid.123}, \code{prid.456}).} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-UmccriseCanRepTables-clone}{}}} +\subsection{Method \code{clone()}}{ +The objects of this class are cloneable with this method. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{UmccriseCanRepTables$clone(deep = FALSE)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{deep}}{Whether to make a deep clone.} +} +\if{html}{\out{
}} +} +} +}