diff --git a/NAMESPACE b/NAMESPACE
index 00b4bafb..bc105e6c 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -22,6 +22,7 @@ export(get_matrix)
export(hello)
export(prepare_copynumber)
export(read_copynumber)
+export(read_maf)
export(read_variation)
export(sig_assign_samples)
export(sig_estimate)
diff --git a/NEWS.md b/NEWS.md
index 85f7e6ed..48e14b00 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,8 +1,12 @@
# sigminer v0.1.5
-* update intro for package
+* update introduction for package `sigminer`
* fix text problem provided by CRAN check team
* add `sig_get_similarity` function
+* add toy datasets & update examples
+* fix typo in `sig_assign_samples`
+* export `read_maf`
+* update README
# sigminer v0.1.4
diff --git a/R/draw_series.R b/R/draw_series.R
index 81589fcd..b6d80d47 100644
--- a/R/draw_series.R
+++ b/R/draw_series.R
@@ -18,17 +18,13 @@
#' @import ggplot2
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
+#' # Load copy number object
+#' load(system.file("extdata", "toy_copynumber.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Plot distribution
#' draw_cn_distribution(cn)
#' draw_cn_distribution(cn, mode = "cd")
#' draw_cn_distribution(cn, mode = "cd", fill = TRUE)
-#' }
#' @family copy number plot
draw_cn_distribution = function(data,
rm_normal = TRUE,
@@ -169,16 +165,10 @@ draw_cn_distribution = function(data,
#' @import ggplot2
#' @family copy number plot
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
+#' # Load copy number prepare object
+#' load(system.file("extdata", "toy_copynumber_prepare.RData",
+#' package = "sigminer", mustWork = TRUE))
#' draw_cn_features(cn_prepare$features)
-#' }
#' @export
#'
draw_cn_features = function(features, ylab = "", ...) {
@@ -243,16 +233,10 @@ draw_cn_features = function(features, ylab = "", ...) {
#' @import ggplot2
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
+#' # Load copy number prepare object
+#' load(system.file("extdata", "toy_copynumber_prepare.RData",
+#' package = "sigminer", mustWork = TRUE))
#' draw_cn_components(cn_prepare$features, cn_prepare$components)
-#' }
#' @family copy number plot
#'
draw_cn_components = function(features, components, ...) {
@@ -376,17 +360,10 @@ draw_cn_components = function(features, components, ...) {
#' @import ggplot2
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+#' # Load copy number signature
+#' load(system.file("extdata", "toy_copynumber_signature.RData",
+#' package = "sigminer", mustWork = TRUE))
#' draw_sig_profile(res$nmfObj)
-#' }
#' @family signature plot
draw_sig_profile = function(nmfObj, mode = c("copynumber", "mutation"),
y_scale = c("relative", "absolute"), font_scale = 1) {
@@ -481,17 +458,10 @@ draw_sig_profile = function(nmfObj, mode = c("copynumber", "mutation"),
#' @importFrom grDevices rainbow
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+#' # Load copy number signature
+#' load(system.file("extdata", "toy_copynumber_signature.RData",
+#' package = "sigminer", mustWork = TRUE))
#' draw_sig_activity(res$nmfObj)
-#' }
#' @family signature plot
draw_sig_activity = function(nmfObj, mode = c("copynumber", "mutation"),
font_scale = 1, hide_samps = TRUE) {
@@ -574,14 +544,9 @@ draw_sig_activity = function(nmfObj, mode = c("copynumber", "mutation"),
#' @export
#' @examples
#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+#' # Load copy number signature
+#' load(system.file("extdata", "toy_copynumber_signature.RData",
+#' package = "sigminer", mustWork = TRUE))
#' sig_activity = sig_get_activity(res$nmfObj)
#' sig_cor = sig_get_correlation(sig_activity)
#' draw_sig_corrplot(sig_cor)
@@ -622,23 +587,20 @@ draw_sig_corrplot = function(mat_list, order = "original", type = "lower",
#' @import ggplot2
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
-#' subtypes = sig_assign_samples(res$nmfObj)
+#' # Load copy number signature
+#' load(system.file("extdata", "toy_copynumber_signature.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Assign samples to clusters
+#' subtypes = sig_assign_samples(res$nmfObj, type = "samples")
+#'
#' set.seed(1234)
+#' # Add custom groups
#' subtypes$new_group = sample(c("1", "2","3", "4"), size = nrow(subtypes), replace = TRUE)
+#' # Summarize subtypes
#' subtypes.sum = sig_summarize_subtypes(subtypes[, -1], col_subtype = "nmf_subtypes",
-#' cols_to_summary = colnames(subtypes[, -1])[-1],
-#' type = c("co", "ca"), verbose = TRUE)
-#' plot_list = draw_subtypes_comparison(subtypes.sum)
-#' }
+#' cols_to_summary = colnames(subtypes[, -1])[c(-1,-2)],
+#' type = c("co", "ca"), verbose = TRUE)
+#' draw_subtypes_comparison(subtypes.sum)
#' @family signature plot
draw_subtypes_comparison = function(subtype_summary,
xlab = "subtype", ylab_co = NA,
diff --git a/R/get_series.R b/R/get_series.R
index 9ac94952..59463538 100644
--- a/R/get_series.R
+++ b/R/get_series.R
@@ -35,11 +35,9 @@
#' @return a `list`
#' @export
#' @examples
-#' \donttest{
#' extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
#' cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
#' cn_list = get_cnlist(cp)
-#' }
#' @family internal calculation function series
get_cnlist = function(CopyNumber) {
@@ -75,12 +73,10 @@ get_cnlist = function(CopyNumber) {
#' @import foreach
#' @export
#' @examples
-#' \donttest{
-#' extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
-#' cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
-#' cn_list = get_cnlist(cp)
+#' # Load copy number list
+#' load(system.file("extdata", "toy_cnlist.RData",
+#' package = "sigminer", mustWork = TRUE))
#' cn_features = get_features(cn_list, cores = 1)
-#' }
#' @family internal calculation function series
get_features = function(CN_data,
@@ -179,10 +175,9 @@ get_features = function(CN_data,
#' @export
#' @examples
#' \donttest{
-#' extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
-#' cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
-#' cn_list = get_cnlist(cp)
-#' cn_features = get_features(cn_list, cores = 1)
+#' # Load copy number features
+#' load(system.file("extdata", "toy_cn_features.RData",
+#' package = "sigminer", mustWork = TRUE))
#' cn_components = get_components(cn_features)
#' }
#' @family internal calculation function series
@@ -311,14 +306,14 @@ get_components = function(CN_features,
#' @importFrom utils data download.file str
#' @export
#' @examples
-#' \donttest{
-#' extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
-#' cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
-#' cn_list = get_cnlist(cp)
-#' cn_features = get_features(cn_list, cores = 1)
-#' cn_components = get_components(cn_features)
+#' # Load copy number components
+#' load(system.file("extdata", "toy_cn_components.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Load copy number features
+#' load(system.file("extdata", "toy_cn_features.RData",
+#' package = "sigminer", mustWork = TRUE))
+#'
#' cn_matrix = get_matrix(cn_features, cn_components)
-#' }
#' @family internal calculation function series
get_matrix = function(CN_features,
all_components = NULL,
@@ -393,12 +388,10 @@ get_matrix = function(CN_features,
#' @return a data table
#' @export
#' @examples
-#' \donttest{
-#' extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
-#' cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
-#' cn_list = get_cnlist(cp)
+#' # Load copy number list
+#' load(system.file("extdata", "toy_cnlist.RData",
+#' package = "sigminer", mustWork = TRUE))
#' annot = get_LengthFraction(cn_list, seg_cols = c("chromosome", "start", "end", "segVal"))
-#' }
#' @family internal calculation function series
get_LengthFraction = function(CN_data,
genome_build = c("hg19", "hg38"),
diff --git a/R/prepare_series.R b/R/prepare_series.R
index b3ef7b57..ee97d88a 100644
--- a/R/prepare_series.R
+++ b/R/prepare_series.R
@@ -21,12 +21,9 @@
#' @export
#' @examples
#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
+#' # Load copy number object
+#' load(system.file("extdata", "toy_copynumber.RData",
+#' package = "sigminer", mustWork = TRUE))
#' cn_prepare = prepare_copynumber(cn)
#' }
#' @family signature analysis prepare function series
diff --git a/R/read_series.R b/R/read_series.R
index 99f911ce..389baf3d 100644
--- a/R/read_series.R
+++ b/R/read_series.R
@@ -12,7 +12,8 @@
#' laml.maf = system.file("extdata", "tcga_laml.maf.gz", package = "maftools")
#' laml = read_maf(maf = laml.maf)
#' }
-#'
+#' @export
+#' @family read genomic variation data function series
read_maf = function(
maf, clinicalData = NULL, removeDuplicatedVariants = TRUE,
@@ -68,14 +69,12 @@ read_maf = function(
#' @return a [CopyNumber] object
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
+#' # Load toy dataset of absolute copynumber profile
+#' load(system.file("extdata", "toy_segTab.RData",
#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' }
+#' seg_cols = c("chromosome", "start", "end", "segVal"),
+#' genome_build = "hg19", complement = FALSE, verbose = TRUE)
#' @family read genomic variation data function series
read_copynumber = function(input,
pattern = NULL,
@@ -339,6 +338,9 @@ read_copynumber = function(input,
message(" Filter - ", nrow(dropoff_df))
}
+ # make sure seg value is integer
+ data_df[["segVal"]] = as.integer(round(data_df[["segVal"]]))
+
if (verbose) message("Anotating...")
annot = get_LengthFraction(data_df,
genome_build = genome_build,
@@ -350,27 +352,16 @@ read_copynumber = function(input,
genome_measure = genome_measure )
if (verbose) message("Done!")
- if (is.null(clinical_data)) {
- res = CopyNumber(
- data = data_df,
- summary.per.sample = sum_sample,
- genome_build = genome_build,
- genome_measure = genome_measure,
- annotation = annot,
- dropoff.segs = dropoff_df,
- clinical.data = data.table::data.table()
- )
- } else {
- res = CopyNumber(
- data = data_df,
- summary.per.sample = sum_sample,
- genome_build = genome_build,
- genome_measure = genome_measure,
- annotation = annot,
- dropoff.segs = dropoff_df,
- clinical.data = data.table::as.data.table(clinical_data)
- )
- }
+
+ res = CopyNumber(
+ data = data_df,
+ summary.per.sample = sum_sample,
+ genome_build = genome_build,
+ genome_measure = genome_measure,
+ annotation = annot,
+ dropoff.segs = dropoff_df,
+ clinical.data = data.table::as.data.table(clinical_data)
+ )
res = validate_segTab(res, verbose = verbose)
res
@@ -415,20 +406,14 @@ validate_segTab = function(object, verbose = FALSE){
#' @return a [GenomicVariation] object
#' @export
#' @examples
-#' \donttest{
#' # Read MAF
#' laml.maf = system.file("extdata", "tcga_laml.maf.gz", package = "maftools")
#' laml = read_maf(maf = laml.maf)
-#' # Read absolute copy number profile
-#' load(system.file("extdata", "example_cn_list.RData",
+#' # Load copy number object
+#' load(system.file("extdata", "toy_copynumber.RData",
#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
#' # Combine as GenomicVariation object
#' gv = read_variation(cn, laml)
-#' }
#' @family read genomic variation data function series
read_variation = function(copynumber, maf, clinical_data = NULL) {
diff --git a/R/signature_series.R b/R/signature_series.R
index 02b1d6de..ff5b275d 100644
--- a/R/signature_series.R
+++ b/R/signature_series.R
@@ -5,25 +5,25 @@
# S3 method for signature analysis prepare --------------------------------
-#' Variation signature analysis prepare generic
+#' Prepare variation signature analysis
#'
#' Generate a matrix for NMF de-composition.
#'
#' The result matrix generated further need to transpose before calling NMF
#' if user use [NMF::nmf] by hand.
-#' @param object a [CopyNumber] object or [MAF] object or [GenomicVariation] object.
-#' @param ... custom setting for operating object.
-#' @return a `matrix` used for NMF de-composition.
+#' @param object a [CopyNumber] object or [MAF] object or
+#' [GenomicVariation] (not support for now) object.
+#' @param ... custom setting for operating object. Detail see S3 method for
+#' corresponding class.
+#' @return a `list` contains a `matrix` used for NMF de-composition.
#' @author Shixiang Wang
#' @export
#' @examples
#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
+#' # Load copy number object
+#' load(system.file("extdata", "toy_copynumber.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Prepare copy number signature analysis
#' cn_prepare = sig_prepare(cn)
#' }
#' @family signature analysis series function
@@ -55,10 +55,10 @@ sig_prepare.MAF = function(object, ref_genome = NULL, prefix = NULL,
add = add, ignoreChr = ignoreChr, useSyn = useSyn, fn = NULL)
}
-# # sig_prepare Signature analysis prepare for GenomicVariation object
-# sig_prepare.GenomicVariation = function(object) {
-# print("Not support right now.")
-# }
+#' @describeIn sig_prepare Signature analysis prepare for GenomicVariation object
+sig_prepare.GenomicVariation = function(object) {
+ print("Not support right now.")
+}
@@ -94,13 +94,9 @@ sig_prepare.MAF = function(object, ref_genome = NULL, prefix = NULL,
#' @export
#' @examples
#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
+#' # Load copy number prepare object
+#' load(system.file("extdata", "toy_copynumber_prepare.RData",
+#' package = "sigminer", mustWork = TRUE))
#' library(NMF)
#' cn_estimate = sig_estimate(cn_prepare$nmf_matrix, cores = 1, nrun = 5,
#' verbose = TRUE)
@@ -293,14 +289,11 @@ sig_estimate <-
#' @export
#' @examples
#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+#' # Load copy number prepare object
+#' load(system.file("extdata", "toy_copynumber_prepare.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Extract copy number signatures
+#' res = sig_extract(cn_prepare$nmf_matrix, 2, mode = "copynumber", nrun = 1)
#' }
#' @family signature analysis series function
sig_extract = function(nmf_matrix,
@@ -506,23 +499,18 @@ sig_extract = function(nmf_matrix,
#' More detail please see [NMF::predict()].
#' @param nmfObj a `NMF` result object which is an element return from [sig_extract]
#' or run results of **NMF** package.
-#' @param type cluster type, could be 'consensus' or 'sample'.
-#' @param matchConseOrder if `TRUE`, the result will match order as shown in consensus map.
-#' @return a `data.frame`
+#' @param type cluster type, could be 'consensus' or 'samples'.
+#' @param matchConseOrder if `TRUE`, the result will match order as shown in consensus map
+#' when type argument is 'consensus'.
+#' @return a `data.table` object
#' @import NMF cluster
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
-#' subtypes = sig_assign_samples(res$nmfObj)
-#' }
+#' # Load copy number signature
+#' load(system.file("extdata", "toy_copynumber_signature.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Assign samples to clusters
+#' subtypes = sig_assign_samples(res$nmfObj, type = "samples")
#' @family signature analysis series function
sig_assign_samples = function(nmfObj, type="consensus", matchConseOrder=F){
@@ -573,17 +561,11 @@ sig_assign_samples = function(nmfObj, type="consensus", matchConseOrder=F){
#' @return a `list`
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+#' # Load copy number signature
+#' load(system.file("extdata", "toy_copynumber_signature.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Get activity of signatures
#' sig_activity = sig_get_activity(res$nmfObj)
-#' }
#' @family signature analysis series function
sig_get_activity = function(nmfObj) {
@@ -628,18 +610,13 @@ sig_get_activity = function(nmfObj) {
#' @author Shixiang Wang
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+#' # Load copy number signature
+#' load(system.file("extdata", "toy_copynumber_signature.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Get activity of signatures
#' sig_activity = sig_get_activity(res$nmfObj)
+#' # Get correlation matrix between signature activities
#' sig_cor = sig_get_correlation(sig_activity)
-#' }
#' @family signature analysis series function
sig_get_correlation = function(cn_activity=NULL, snv_activity=NULL,
type = c("absolute", "relative"),
@@ -770,22 +747,19 @@ sig_get_similarity = function(sig1, sig2, type = c("cos", "cor")) {
#' @return a `list` contains data, summary, p value etc..
#' @export
#' @examples
-#' \donttest{
-#' load(system.file("extdata", "example_cn_list.RData",
-#' package = "sigminer", mustWork = TRUE))
-#' segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-#' cn = read_copynumber(segTabs,
-#' seg_cols = c("chromosome", "start", "end", "segVal"),
-#' genome_build = "hg19")
-#' cn_prepare = sig_prepare(cn)
-#' res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
-#' subtypes = sig_assign_samples(res$nmfObj)
+#' # Load copy number signature
+#' load(system.file("extdata", "toy_copynumber_signature.RData",
+#' package = "sigminer", mustWork = TRUE))
+#' # Assign samples to clusters
+#' subtypes = sig_assign_samples(res$nmfObj, type = "samples")
+#'
#' set.seed(1234)
+#' # Add custom groups
#' subtypes$new_group = sample(c("1", "2","3", "4"), size = nrow(subtypes), replace = TRUE)
+#' # Summarize subtypes
#' subtypes.sum = sig_summarize_subtypes(subtypes[, -1], col_subtype = "nmf_subtypes",
-#' cols_to_summary = colnames(subtypes[, -1])[-1],
-#' type = c("co", "ca"), verbose = TRUE)
-#' }
+#' cols_to_summary = colnames(subtypes[, -1])[c(-1,-2)],
+#' type = c("co", "ca"), verbose = TRUE)
#' @family signature analysis series function
sig_summarize_subtypes = function(data, col_subtype, cols_to_summary,
type = "ca", verbose = FALSE){
diff --git a/README.Rmd b/README.Rmd
index 7c9304c8..c4641838 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -14,9 +14,7 @@ knitr::opts_chunk$set(
```
-# sigminer
-
-
+# sigminer
[![CRAN status](https://www.r-pkg.org/badges/version/sigminer)](https://cran.r-project.org/package=sigminer) [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing) [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/ShixiangWang/sigminer?branch=master&svg=true)](https://ci.appveyor.com/project/ShixiangWang/sigminer) [![Travis build status](https://travis-ci.org/ShixiangWang/sigminer.svg?branch=master)](https://travis-ci.org/ShixiangWang/sigminer) [![Coverage status](https://codecov.io/gh/ShixiangWang/sigminer/branch/master/graph/badge.svg)](https://codecov.io/github/ShixiangWang/sigminer?branch=master)
@@ -29,7 +27,7 @@ The goal of **sigminer** is to provide an uniform interface for genomic variatio
You can install the development version of sigminer from Github with:
```{r, eval=FALSE}
-devtools::install_github("ShixiangWang/sigminer")
+remotes::install_github("ShixiangWang/sigminer")
```
diff --git a/README.md b/README.md
index b1b05f80..0bef8fd3 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,7 @@
-# sigminer
-
-
+# sigminer
[![CRAN
status](https://www.r-pkg.org/badges/version/sigminer)](https://cran.r-project.org/package=sigminer)
@@ -32,15 +30,15 @@ and [maftools](https://github.com/PoisonAlien/maftools) package.
You can install the development version of sigminer from Github with:
``` r
-devtools::install_github("ShixiangWang/sigminer")
+remotes::install_github("ShixiangWang/sigminer")
```
## Citation
- - *Macintyre, Geoff, et al. “Copy number signatures and mutational
+ - *Macintyre, Geoff, et al. “Copy number signatures and mutational
processes in ovarian carcinoma.” Nature genetics 50.9 (2018): 1262.*
- - *Wang, Shixiang, et al. “APOBEC3B and APOBEC mutational signature as
+ - *Wang, Shixiang, et al. “APOBEC3B and APOBEC mutational signature as
potential predictive markers for immunotherapy response in non-small
cell lung cancer.” Oncogene (2018).*
diff --git a/inst/extdata/toy_cn.RData b/inst/extdata/toy_cn.RData
new file mode 100644
index 00000000..e435a93e
Binary files /dev/null and b/inst/extdata/toy_cn.RData differ
diff --git a/inst/extdata/toy_cn_components.RData b/inst/extdata/toy_cn_components.RData
new file mode 100644
index 00000000..1a6a0ec4
Binary files /dev/null and b/inst/extdata/toy_cn_components.RData differ
diff --git a/inst/extdata/toy_cn_features.RData b/inst/extdata/toy_cn_features.RData
new file mode 100644
index 00000000..2d34ddb3
Binary files /dev/null and b/inst/extdata/toy_cn_features.RData differ
diff --git a/inst/extdata/toy_cnlist.RData b/inst/extdata/toy_cnlist.RData
new file mode 100644
index 00000000..e8d9b1d9
Binary files /dev/null and b/inst/extdata/toy_cnlist.RData differ
diff --git a/inst/extdata/toy_copynumber.RData b/inst/extdata/toy_copynumber.RData
new file mode 100644
index 00000000..beb81466
Binary files /dev/null and b/inst/extdata/toy_copynumber.RData differ
diff --git a/inst/extdata/toy_copynumber_prepare.RData b/inst/extdata/toy_copynumber_prepare.RData
new file mode 100644
index 00000000..c2c9baa6
Binary files /dev/null and b/inst/extdata/toy_copynumber_prepare.RData differ
diff --git a/inst/extdata/toy_copynumber_signature.RData b/inst/extdata/toy_copynumber_signature.RData
new file mode 100644
index 00000000..87d1e6a8
Binary files /dev/null and b/inst/extdata/toy_copynumber_signature.RData differ
diff --git a/inst/extdata/toy_segTab.RData b/inst/extdata/toy_segTab.RData
new file mode 100644
index 00000000..7d391849
Binary files /dev/null and b/inst/extdata/toy_segTab.RData differ
diff --git a/inst/test/develop.R b/inst/test/develop.R
index 8aa256b4..cd8e985b 100644
--- a/inst/test/develop.R
+++ b/inst/test/develop.R
@@ -6,17 +6,36 @@ load(system.file("extdata", "example_cn_list.RData",
package = "sigminer", mustWork = TRUE))
segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
+samps = segTabs[, .N, by=sample][order(N)]
+segTabs = segTabs[sample %in% samps$sample[6:15]]
cn = read_copynumber(segTabs,
seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
+ genome_build = "hg19", complement = FALSE, verbose = TRUE)
read_copynumber(segTabs,
seg_cols = c("chromosome", "start", "end", "segVal"),
genome_build = "hg19", genome_measure = "wg", verbose = T)
-cn_prepare = sig_prepare(cn, cores = 2)
+cn_prepare = sig_prepare(cn)
library(NMF)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5, cores = 2)
+sig_estimate(cn_prepare$nmf_matrix, verbose = TRUE)
+res = sig_extract(cn_prepare$nmf_matrix, 2, mode = "copynumber", nrun = 1, cores = 1)
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
+
+subtypes = sig_assign_samples(res$nmfObj, type = "samples")
+set.seed(1234)
+subtypes$new_group = sample(c("1", "2","3", "4"), size = nrow(subtypes), replace = TRUE)
+subtypes.sum = sig_summarize_subtypes(subtypes[, -1], col_subtype = "nmf_subtypes",
+ cols_to_summary = colnames(subtypes[, -1])[c(-1,-2)],
+ type = c("co", "ca"), verbose = TRUE)
+
+
+draw_sig_profile(res$nmfObj)
+draw_sig_activity(res$nmfObj)
+
+sig_activity = sig_get_activity(res$nmfObj)
+sig_cor = sig_get_correlation(sig_activity)
diff --git a/man/draw_cn_components.Rd b/man/draw_cn_components.Rd
index b9f4034a..1026397e 100644
--- a/man/draw_cn_components.Rd
+++ b/man/draw_cn_components.Rd
@@ -22,17 +22,11 @@ a ggplot object
Plot mixture fit model components
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
+# Load copy number prepare object
+load(system.file("extdata", "toy_copynumber_prepare.RData",
+ package = "sigminer", mustWork = TRUE))
draw_cn_components(cn_prepare$features, cn_prepare$components)
}
-}
\seealso{
Other copy number plot: \code{\link{draw_cn_distribution}},
\code{\link{draw_cn_features}}
diff --git a/man/draw_cn_distribution.Rd b/man/draw_cn_distribution.Rd
index c2e56055..de8b18d9 100644
--- a/man/draw_cn_distribution.Rd
+++ b/man/draw_cn_distribution.Rd
@@ -29,18 +29,14 @@ or chromosome. When input is a \link{CopyNumber} object, \code{genome_build} opt
read from \code{genome_build} slot of object instead of using argument set in function.
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
+# Load copy number object
+load(system.file("extdata", "toy_copynumber.RData",
+ package = "sigminer", mustWork = TRUE))
+# Plot distribution
draw_cn_distribution(cn)
draw_cn_distribution(cn, mode = "cd")
draw_cn_distribution(cn, mode = "cd", fill = TRUE)
}
-}
\seealso{
Other copy number plot: \code{\link{draw_cn_components}},
\code{\link{draw_cn_features}}
diff --git a/man/draw_cn_features.Rd b/man/draw_cn_features.Rd
index 5cd83016..2b23ef85 100644
--- a/man/draw_cn_features.Rd
+++ b/man/draw_cn_features.Rd
@@ -20,17 +20,11 @@ a ggplot object
Plot copy number feature distribution
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
+# Load copy number prepare object
+load(system.file("extdata", "toy_copynumber_prepare.RData",
+ package = "sigminer", mustWork = TRUE))
draw_cn_features(cn_prepare$features)
}
-}
\seealso{
Other copy number plot: \code{\link{draw_cn_components}},
\code{\link{draw_cn_distribution}}
diff --git a/man/draw_sig_activity.Rd b/man/draw_sig_activity.Rd
index b2595951..1cc449e8 100644
--- a/man/draw_sig_activity.Rd
+++ b/man/draw_sig_activity.Rd
@@ -24,18 +24,11 @@ a \code{ggplot} object
Currently support copy number signatures and mutation signatures.
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+# Load copy number signature
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
draw_sig_activity(res$nmfObj)
}
-}
\seealso{
Other signature plot: \code{\link{draw_sig_corrplot}},
\code{\link{draw_sig_profile}},
diff --git a/man/draw_sig_corrplot.Rd b/man/draw_sig_corrplot.Rd
index 51fc38d4..7f7115d3 100644
--- a/man/draw_sig_corrplot.Rd
+++ b/man/draw_sig_corrplot.Rd
@@ -40,14 +40,9 @@ Plot correlation between signature activities
}
\examples{
\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+# Load copy number signature
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
sig_activity = sig_get_activity(res$nmfObj)
sig_cor = sig_get_correlation(sig_activity)
draw_sig_corrplot(sig_cor)
diff --git a/man/draw_sig_profile.Rd b/man/draw_sig_profile.Rd
index 909284af..26066260 100644
--- a/man/draw_sig_profile.Rd
+++ b/man/draw_sig_profile.Rd
@@ -25,18 +25,11 @@ a \code{ggplot} object
Currently support copy number signatures and mutation signatures.
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+# Load copy number signature
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
draw_sig_profile(res$nmfObj)
}
-}
\seealso{
Other signature plot: \code{\link{draw_sig_activity}},
\code{\link{draw_sig_corrplot}},
diff --git a/man/draw_subtypes_comparison.Rd b/man/draw_subtypes_comparison.Rd
index 3481ff3d..283f4a36 100644
--- a/man/draw_subtypes_comparison.Rd
+++ b/man/draw_subtypes_comparison.Rd
@@ -35,23 +35,20 @@ a list of \code{ggplot} object contains individual and combined plots. The combi
plot is easily saved to local using \code{\link[cowplot:save_plot]{cowplot::save_plot()}}.
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
-subtypes = sig_assign_samples(res$nmfObj)
+# Load copy number signature
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
+# Assign samples to clusters
+subtypes = sig_assign_samples(res$nmfObj, type = "samples")
+
set.seed(1234)
+# Add custom groups
subtypes$new_group = sample(c("1", "2","3", "4"), size = nrow(subtypes), replace = TRUE)
+# Summarize subtypes
subtypes.sum = sig_summarize_subtypes(subtypes[, -1], col_subtype = "nmf_subtypes",
- cols_to_summary = colnames(subtypes[, -1])[-1],
- type = c("co", "ca"), verbose = TRUE)
-plot_list = draw_subtypes_comparison(subtypes.sum)
-}
+ cols_to_summary = colnames(subtypes[, -1])[c(-1,-2)],
+ type = c("co", "ca"), verbose = TRUE)
+draw_subtypes_comparison(subtypes.sum)
}
\seealso{
Other signature plot: \code{\link{draw_sig_activity}},
diff --git a/man/figures/logo.png b/man/figures/logo.png
new file mode 100644
index 00000000..a44d4f12
Binary files /dev/null and b/man/figures/logo.png differ
diff --git a/man/get_LengthFraction.Rd b/man/get_LengthFraction.Rd
index 1136e886..2425e463 100644
--- a/man/get_LengthFraction.Rd
+++ b/man/get_LengthFraction.Rd
@@ -32,13 +32,11 @@ a data table
Calculate length fraction profile of copy number
}
\examples{
-\donttest{
-extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
-cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
-cn_list = get_cnlist(cp)
+# Load copy number list
+load(system.file("extdata", "toy_cnlist.RData",
+ package = "sigminer", mustWork = TRUE))
annot = get_LengthFraction(cn_list, seg_cols = c("chromosome", "start", "end", "segVal"))
}
-}
\seealso{
Other internal calculation function series: \code{\link{get_ArmLocation}},
\code{\link{get_cnlist}},
diff --git a/man/get_cnlist.Rd b/man/get_cnlist.Rd
index 41774f52..e903347e 100644
--- a/man/get_cnlist.Rd
+++ b/man/get_cnlist.Rd
@@ -16,12 +16,10 @@ a \code{list}
Extract copy number profile as list from CopyNumber object
}
\examples{
-\donttest{
extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
cn_list = get_cnlist(cp)
}
-}
\seealso{
Other internal calculation function series: \code{\link{get_ArmLocation}},
\code{\link{get_LengthFraction}},
diff --git a/man/get_components.Rd b/man/get_components.Rd
index d5322e5c..f280deae 100644
--- a/man/get_components.Rd
+++ b/man/get_components.Rd
@@ -37,10 +37,9 @@ of Gaussian or mixtures of Poison distributions using \strong{flexmix} package.
}
\examples{
\donttest{
-extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
-cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
-cn_list = get_cnlist(cp)
-cn_features = get_features(cn_list, cores = 1)
+# Load copy number features
+load(system.file("extdata", "toy_cn_features.RData",
+ package = "sigminer", mustWork = TRUE))
cn_components = get_components(cn_features)
}
}
diff --git a/man/get_features.Rd b/man/get_features.Rd
index 82fc02c7..16493d9a 100644
--- a/man/get_features.Rd
+++ b/man/get_features.Rd
@@ -27,13 +27,11 @@ segment copy-number, breakpoint number (per chromosome arm), length of segments
copy-number.
}
\examples{
-\donttest{
-extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
-cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
-cn_list = get_cnlist(cp)
+# Load copy number list
+load(system.file("extdata", "toy_cnlist.RData",
+ package = "sigminer", mustWork = TRUE))
cn_features = get_features(cn_list, cores = 1)
}
-}
\seealso{
Other internal calculation function series: \code{\link{get_ArmLocation}},
\code{\link{get_LengthFraction}},
diff --git a/man/get_matrix.Rd b/man/get_matrix.Rd
index d65b28e2..af5cf205 100644
--- a/man/get_matrix.Rd
+++ b/man/get_matrix.Rd
@@ -29,15 +29,15 @@ Generate a sample-by-component matrix representing the sum of
posterior probabilities of each copy-number event being assigned to each component.
}
\examples{
-\donttest{
-extdata_dir = system.file("extdata", package = "sigminer", mustWork = TRUE)
-cp = read_copynumber(extdata_dir, pattern = "txt", genome_build = "hg19")
-cn_list = get_cnlist(cp)
-cn_features = get_features(cn_list, cores = 1)
-cn_components = get_components(cn_features)
+# Load copy number components
+load(system.file("extdata", "toy_cn_components.RData",
+ package = "sigminer", mustWork = TRUE))
+# Load copy number features
+load(system.file("extdata", "toy_cn_features.RData",
+ package = "sigminer", mustWork = TRUE))
+
cn_matrix = get_matrix(cn_features, cn_components)
}
-}
\seealso{
Other internal calculation function series: \code{\link{get_ArmLocation}},
\code{\link{get_LengthFraction}},
diff --git a/man/prepare_copynumber.Rd b/man/prepare_copynumber.Rd
index caab003d..f10a0575 100644
--- a/man/prepare_copynumber.Rd
+++ b/man/prepare_copynumber.Rd
@@ -49,12 +49,9 @@ Prepare nmf input matrix for copy number signature analysis
}
\examples{
\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
+# Load copy number object
+load(system.file("extdata", "toy_copynumber.RData",
+ package = "sigminer", mustWork = TRUE))
cn_prepare = prepare_copynumber(cn)
}
}
diff --git a/man/read_copynumber.Rd b/man/read_copynumber.Rd
index 94af44b0..5d1e5aa9 100644
--- a/man/read_copynumber.Rd
+++ b/man/read_copynumber.Rd
@@ -55,14 +55,12 @@ Read \strong{absolute} copy number profile for preparing CNV signature
analysis.
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
+# Load toy dataset of absolute copynumber profile
+load(system.file("extdata", "toy_segTab.RData",
package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-}
+ seg_cols = c("chromosome", "start", "end", "segVal"),
+ genome_build = "hg19", complement = FALSE, verbose = TRUE)
}
\seealso{
Other read genomic variation data function series: \code{\link{read_maf}},
diff --git a/man/read_maf.Rd b/man/read_maf.Rd
index 1cdd0005..6a262628 100644
--- a/man/read_maf.Rd
+++ b/man/read_maf.Rd
@@ -58,12 +58,14 @@ This note can be ignored without any harm, it's only generated as to make user a
laml.maf = system.file("extdata", "tcga_laml.maf.gz", package = "maftools")
laml = read_maf(maf = laml.maf)
}
-
}
\references{
Shyr C, Tarailo-Graovac M, Gottlieb M, Lee JJ, van Karnebeek C, Wasserman WW. FLAGS, frequently mutated genes in public exomes. BMC Med Genomics 2014; 7: 64.
}
\seealso{
+Other read genomic variation data function series: \code{\link{read_copynumber}},
+ \code{\link{read_variation}}
+
Other read genomic variation data function series: \code{\link{read_copynumber}},
\code{\link{read_variation}}
}
diff --git a/man/read_variation.Rd b/man/read_variation.Rd
index f2467b52..e29f36af 100644
--- a/man/read_variation.Rd
+++ b/man/read_variation.Rd
@@ -22,21 +22,15 @@ Read \link{CopyNumber} and \link{MAF} object as a new S4 object \link{GenomicVar
for uniform variation analysis. \strong{The function is initialized to construct structure of sigminer, please dont use it for now}.
}
\examples{
-\donttest{
# Read MAF
laml.maf = system.file("extdata", "tcga_laml.maf.gz", package = "maftools")
laml = read_maf(maf = laml.maf)
-# Read absolute copy number profile
-load(system.file("extdata", "example_cn_list.RData",
+# Load copy number object
+load(system.file("extdata", "toy_copynumber.RData",
package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
# Combine as GenomicVariation object
gv = read_variation(cn, laml)
}
-}
\seealso{
Other read genomic variation data function series: \code{\link{read_copynumber}},
\code{\link{read_maf}}
diff --git a/man/sig_assign_samples.Rd b/man/sig_assign_samples.Rd
index c4ecd805..52d8524f 100644
--- a/man/sig_assign_samples.Rd
+++ b/man/sig_assign_samples.Rd
@@ -10,12 +10,13 @@ sig_assign_samples(nmfObj, type = "consensus", matchConseOrder = F)
\item{nmfObj}{a \code{NMF} result object which is an element return from \link{sig_extract}
or run results of \strong{NMF} package.}
-\item{type}{cluster type, could be 'consensus' or 'sample'.}
+\item{type}{cluster type, could be 'consensus' or 'samples'.}
-\item{matchConseOrder}{if \code{TRUE}, the result will match order as shown in consensus map.}
+\item{matchConseOrder}{if \code{TRUE}, the result will match order as shown in consensus map
+when type argument is 'consensus'.}
}
\value{
-a \code{data.frame}
+a \code{data.table} object
}
\description{
One of key results from NMF decomposition is to cluster samples into different
@@ -31,17 +32,11 @@ After NMF run, use this function to select import features and assign groups for
More detail please see \code{\link[NMF:predict]{NMF::predict()}}.
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
-subtypes = sig_assign_samples(res$nmfObj)
-}
+# Load copy number signature
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
+# Assign samples to clusters
+subtypes = sig_assign_samples(res$nmfObj, type = "samples")
}
\seealso{
Other signature analysis series function: \code{\link{sig_estimate}},
diff --git a/man/sig_estimate.Rd b/man/sig_estimate.Rd
index c5984209..7bd78797 100644
--- a/man/sig_estimate.Rd
+++ b/man/sig_estimate.Rd
@@ -51,13 +51,9 @@ More custom features please directly use \link[NMF:nmfEstimateRank]{NMF::nmfEsti
}
\examples{
\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
+# Load copy number prepare object
+load(system.file("extdata", "toy_copynumber_prepare.RData",
+ package = "sigminer", mustWork = TRUE))
library(NMF)
cn_estimate = sig_estimate(cn_prepare$nmf_matrix, cores = 1, nrun = 5,
verbose = TRUE)
diff --git a/man/sig_extract.Rd b/man/sig_extract.Rd
index 9525e608..17986fe4 100644
--- a/man/sig_extract.Rd
+++ b/man/sig_extract.Rd
@@ -35,14 +35,11 @@ Do NMF de-composition and then extract signatures.
}
\examples{
\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+# Load copy number prepare object
+load(system.file("extdata", "toy_copynumber_prepare.RData",
+ package = "sigminer", mustWork = TRUE))
+# Extract copy number signatures
+res = sig_extract(cn_prepare$nmf_matrix, 2, mode = "copynumber", nrun = 1)
}
}
\seealso{
diff --git a/man/sig_get_activity.Rd b/man/sig_get_activity.Rd
index 34b326e3..2fa6283d 100644
--- a/man/sig_get_activity.Rd
+++ b/man/sig_get_activity.Rd
@@ -17,18 +17,12 @@ a \code{list}
Get signature activity
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+# Load copy number signature
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
+# Get activity of signatures
sig_activity = sig_get_activity(res$nmfObj)
}
-}
\seealso{
Other signature analysis series function: \code{\link{sig_assign_samples}},
\code{\link{sig_estimate}}, \code{\link{sig_extract}},
diff --git a/man/sig_get_correlation.Rd b/man/sig_get_correlation.Rd
index f837edba..1a2920b9 100644
--- a/man/sig_get_correlation.Rd
+++ b/man/sig_get_correlation.Rd
@@ -25,19 +25,14 @@ a \code{list}.
Compute correlation matrix and corresponding statistical test values.
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
+# Load copy number signature
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
+# Get activity of signatures
sig_activity = sig_get_activity(res$nmfObj)
+# Get correlation matrix between signature activities
sig_cor = sig_get_correlation(sig_activity)
}
-}
\seealso{
Other signature analysis series function: \code{\link{sig_assign_samples}},
\code{\link{sig_estimate}}, \code{\link{sig_extract}},
diff --git a/man/sig_prepare.Rd b/man/sig_prepare.Rd
index 4a0f30ac..74c16752 100644
--- a/man/sig_prepare.Rd
+++ b/man/sig_prepare.Rd
@@ -4,7 +4,8 @@
\alias{sig_prepare}
\alias{sig_prepare.CopyNumber}
\alias{sig_prepare.MAF}
-\title{Variation signature analysis prepare generic}
+\alias{sig_prepare.GenomicVariation}
+\title{Prepare variation signature analysis}
\usage{
sig_prepare(object, ...)
@@ -15,11 +16,15 @@ sig_prepare(object, ...)
\method{sig_prepare}{MAF}(object, ref_genome = NULL, prefix = NULL,
add = TRUE, ignoreChr = NULL, useSyn = TRUE)
+
+\method{sig_prepare}{GenomicVariation}(object)
}
\arguments{
-\item{object}{a \link{CopyNumber} object or \link{MAF} object or \link{GenomicVariation} object.}
+\item{object}{a \link{CopyNumber} object or \link{MAF} object or
+\link{GenomicVariation} (not support for now) object.}
-\item{...}{custom setting for operating object.}
+\item{...}{custom setting for operating object. Detail see S3 method for
+corresponding class.}
\item{reference_components}{default is \code{FALSE}, calculate mixture components
from \link{CopyNumber} object.
@@ -63,7 +68,7 @@ Default NULL, tries to auto-detect from installed genomes.}
\item{useSyn}{Logical. Whether to include synonymous variants in analysis. Defaults to TRUE}
}
\value{
-a \code{matrix} used for NMF de-composition.
+a \code{list} contains a \code{matrix} used for NMF de-composition.
}
\description{
Generate a matrix for NMF de-composition.
@@ -77,16 +82,16 @@ if user use \link[NMF:nmf]{NMF::nmf} by hand.
\item \code{CopyNumber}: Signature analysis prepare for CopyNumber object
\item \code{MAF}: Signature analysis prepare for CopyNumber object
+
+\item \code{GenomicVariation}: Signature analysis prepare for GenomicVariation object
}}
\examples{
\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
+# Load copy number object
+load(system.file("extdata", "toy_copynumber.RData",
+ package = "sigminer", mustWork = TRUE))
+# Prepare copy number signature analysis
cn_prepare = sig_prepare(cn)
}
}
diff --git a/man/sig_summarize_subtypes.Rd b/man/sig_summarize_subtypes.Rd
index a23c023b..b8c0a5c9 100644
--- a/man/sig_summarize_subtypes.Rd
+++ b/man/sig_summarize_subtypes.Rd
@@ -32,22 +32,19 @@ summary table and Tukey Honest significant difference (using \link[stats:TukeyHS
The result of this function can be plotted by \code{\link[=draw_subtypes_comparison]{draw_subtypes_comparison()}}.
}
\examples{
-\donttest{
-load(system.file("extdata", "example_cn_list.RData",
- package = "sigminer", mustWork = TRUE))
-segTabs = data.table::rbindlist(tcga_segTabs, idcol = "sample")
-cn = read_copynumber(segTabs,
- seg_cols = c("chromosome", "start", "end", "segVal"),
- genome_build = "hg19")
-cn_prepare = sig_prepare(cn)
-res = sig_extract(cn_prepare$nmf_matrix, 3, mode = "copynumber", nrun = 5)
-subtypes = sig_assign_samples(res$nmfObj)
+# Load copy number signature
+load(system.file("extdata", "toy_copynumber_signature.RData",
+ package = "sigminer", mustWork = TRUE))
+# Assign samples to clusters
+subtypes = sig_assign_samples(res$nmfObj, type = "samples")
+
set.seed(1234)
+# Add custom groups
subtypes$new_group = sample(c("1", "2","3", "4"), size = nrow(subtypes), replace = TRUE)
+# Summarize subtypes
subtypes.sum = sig_summarize_subtypes(subtypes[, -1], col_subtype = "nmf_subtypes",
- cols_to_summary = colnames(subtypes[, -1])[-1],
- type = c("co", "ca"), verbose = TRUE)
-}
+ cols_to_summary = colnames(subtypes[, -1])[c(-1,-2)],
+ type = c("co", "ca"), verbose = TRUE)
}
\seealso{
Other signature analysis series function: \code{\link{sig_assign_samples}},