get_score_matrix.Rd
Get Copy Number Sequence Similarity or Distance Matrix
get_score_matrix( x, sub_mat = NULL, simple_version = FALSE, block_size = NULL, dislike = FALSE, cores = 1L, verbose = FALSE )
x | a coding copy number sequence (valid letters are A to X). |
---|---|
sub_mat | default is |
simple_version | if |
block_size | a block size to aggregrate, this is designed for big data, it means results from adjacent sequences will be aggregrate by means to reduce the size of result matrix. |
dislike | if |
cores | computer cores, default is |
verbose | if |
a score matrix.
load(system.file("extdata", "toy_segTab.RData", package = "CNVMotif", mustWork = TRUE )) x <- transform_seqs(segTabs) x seqs <- extract_seqs(x$dt) seqs seqs2 <- extract_seqs(x$dt, flexible_approach = TRUE) seqs2 mat <- get_score_matrix(seqs$keep, x$mat, verbose = TRUE) mat mat2 <- get_score_matrix(seqs$keep, x$mat, dislike = TRUE) identical(mat2, 120L - mat) mat_b <- get_score_matrix(seqs$keep, x$mat, block_size = 2L) ## block1 represents the first 2 sequences ## block2 represents the 3rd, 4th sequences ## ... mat_b mat_c <- get_score_matrix(seqs$keep) mat_c mat_d <- get_score_matrix(seqs$keep, dislike = TRUE) mat_d # \donttest{ if (requireNamespace("doParallel")) { mock_seqs <- sapply(1:10000, function(x) { paste(sample(LETTERS[1:24], 5, replace = TRUE), collapse = "") }) system.time( y1 <- get_score_matrix(mock_seqs, x$mat, cores = 1) ) system.time( y2 <- get_score_matrix(mock_seqs, x$mat, cores = 2) ) all.equal(y1, y2) } # }