#' Read a COMPOSITE catalog
#'
#' A COMPOSITE catalog is an rbind
#' of a 1536 catalog, a DBS catalog, and an ID catalog.
#' This function does not read SignatureAnalyzer
#' signatures as found on the PCAWG7 Synapse web
#' site, but rather
#' as generated by this package for analysis by
#' SignatureAnalyzer.
#'
#' @seealso \code{\link{WriteCatCOMPOSITE}}
#'
#' @param path Path of the file to read from.
#'
#' @param strict For compatibility with other \code{ReadCat} functions; ignored.
#'
#' @return An in memory matrix corresponding to the
#' contents of the file at \code{path}.
#'
#' @importFrom utils read.csv
#'
#' @export
ReadCatCOMPOSITE <- function(path, strict = FALSE) {
retval <- read.csv(path, header = T, row.names = 1)
return(as.matrix(retval))
}
#' Write a COMPOSITE catalog or signature matrix to disk
#'
#' @param ct A catalog or signature matrix
#'
#' @param path Path to file to write
#'
#' @importFrom utils write.csv
#'
#' @seealso \code{\link{ReadCatCOMPOSITE}}
#'
#' @export
# Exported because of Create.pancreas.Rmd, Create.2.7a.7b.Rmd, etc.
WriteCatCOMPOSITE <- function(ct, path) {
write.csv(ct, file = path, row.names = TRUE,
quote = FALSE)
}
#' Split COMPOSITE (SNS1536+DBS78+ID83) catalogs
#' in \code{\link[ICAMS]{ICAMS}} format into 3 individual catalogs.
#' @param catalog Input catalog, can be a .csv file or matrix
#' in ICAMS COMPOSITE format.
#'
#' @return a list, containing 3 catalog matrices in MultiModalMuSig format.
#' Each matrix contains SNS1536, DBS78 and ID83 information, respectively.
OLD.SplitCatCOMPOSITE <- function(catalog) {
# Read COMPOSITE catalog. Either from file or matrix-like
stopifnot(is.character(catalog) | is.data.frame(catalog) | is.matrix(catalog))
if (class(catalog) == "character")
catMatrix <- ReadCatCOMPOSITE(catalog)
else
catMatrix <- catalog
# Split COMPOSITE catalog to 3 catalogues
# (1 SNS1536, 1 DNS78, 1 Indel83)
# use function in ReadWriteCatalogs.R
catList <- list("SNS1536" = catMatrix[1:1536,],
"DNS78" = catMatrix[1537:1614,],
"ID83" = catMatrix[1615:1697,])
return(catList)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.