subset_by_panel: Subset a Binary Matrix By Genes Available on Specified Panel

View source: R/subset-by-panel.R

subset_by_panelR Documentation

Subset a Binary Matrix By Genes Available on Specified Panel

Description

Subset a Binary Matrix By Genes Available on Specified Panel

Usage

subset_by_panel(gene_binary, panel_id = NULL, other_vars = NULL)

Arguments

gene_binary

A data frame with a row for each sample and column for each alteration. Data frame must have a sample_id column and columns for each alteration with values of 0, 1 or NA.

panel_id

A character string or vector of the specified panel to subset the genes (see gnomeR::gene_panels for available panels)

other_vars

One or more column names (quoted or unquoted) in data to be retained in resulting data frame. Default is NULL.

Value

a data frame with a sample_id column and columns for alterations on genes that were sequenced on the specified panel.

Author(s)

Jessica Lavery

Examples

samples <- unique(gnomeR::mutations$sampleId)
gene_binary <- create_gene_binary(
  samples = samples, mutation = mutations, cna = cna,
  mut_type = "somatic_only",
  include_silent = FALSE,
  specify_panel = "impact"
)
subset_by_panel(gene_binary = gene_binary, panel_id = "IMPACT468")

p_genes <- tidyr::unnest(gnomeR::gene_panels, cols = c("genes_in_panel"))
p_genes <- p_genes[p_genes$gene_panel == 'IMPACT300', ]
setdiff(p_genes$genes_in_panel, names(gene_binary))

MSKCC-Epi-Bio/gnomeR documentation built on March 28, 2024, 2:42 a.m.