gcap.plotKMcurve: Draw K-M Curve for fCNA Survival Comparison by Sample or...

View source: R/kmcurve.R

gcap.plotKMcurveR Documentation

Draw K-M Curve for fCNA Survival Comparison by Sample or Cytoband or Gene

Description

Draw K-M Curve for fCNA Survival Comparison by Sample or Cytoband or Gene

Usage

gcap.plotKMcurve(
  fCNA,
  surv_data,
  mat = NULL,
  ID = NULL,
  focus = c("fCNA", "circular", "all"),
  palette = c("grey", "#0066CC", "#CC0033"),
  class_col = "class",
  ending_time = NULL,
  ...
)

Arguments

fCNA

a fCNA object.

surv_data

survival data, eithor a 3-column data.frame to store sample, time and status, or a length-2 string to specify the colnames representing time and status in fCNA$sample_summary.

  • sample must be identical to sample ID in fCNA.

  • time must be numeric.

  • status must be 0 or 1.

mat

a gene/cytoband-by-sample matrix like data.frame.

ID

a list of gene or cytoband IDs.

focus

focal amplication type you focus on. Typically used when the ID is not NULL. Can be 'fCNA', 'circular', 'all'. If 'fCNA' selected, noncircular and circular genes/cytobands are included to classify samples.

palette

plot color palette.

class_col

column name in sample_summary field for classification. If you set to other column (you want to run survival analysis with custom column), parameters like ID, focus etc. will be omitted.

ending_time

survival analysis ending time. If a numeric ending is typed, all survival data longer than the ending time will be rewritten.

...

other parameters passing to survminer::ggsurvplot.

Value

a plot.

See Also

gcap.plotProfile for plot landscape of fCNA, gcap::fCNA for building object.

Examples


library(gcap)
if (require("survminer") && require("IDConverter")) {
  data("ascn")
  data = ascn

  # Create fake data
  set.seed(1234)
  data$sample = sample(LETTERS[1:10], nrow(data), replace = TRUE)
  rv = gcap.ASCNworkflow(data, outdir = tempdir(), model = "XGB11")
  rv$convertGeneID()

  surv_data = data.frame(
    sample = rv$sample_summary$sample,
    time = 3000 * abs(rnorm(nrow(rv$sample_summary))),
    status = sample(c(0, 1), nrow(rv$sample_summary), replace = TRUE)
  )
  p = gcap.plotKMcurve(rv, surv_data)
  p

  p2 = gcap.plotKMcurve(rv, surv_data,
    ID = "MYC",
    mat = rv$getGeneSummary(return_mat = TRUE)
  )

  p2
}


ShixiangWang/gcaputils documentation built on Feb. 14, 2023, 5:58 a.m.