Learn R Programming

iGC (version 1.2.2)

create_sample_desc: Create sample description table containing all required inputs

Description

Each sample will have a unique name along with a pair of CNA and gene expression file. This function generates a table of sample descriptions by either reading an external CSV file or specifying them through separate arugments in same order.

Usage

create_sample_desc(sample_desc_filepath = NULL, sample_names = NULL,
  cna_filepaths = NULL, ge_filepaths = NULL, sample_root = NULL)

Arguments

sample_desc_filepath
external sample description CSV file having at least these three columns: Sample, CNA_filepath, and GE_filepath. Note that the column names must be given as is.
sample_names
character vector of distinct sample names. Samples will be referenced by the given name through out the analysis process. They should be valid R data.table column names.
cna_filepaths
character vector of filepaths to CNA data.
ge_filepaths
character vector of filepaths to gene expression data.
sample_root
path to the root of sample data. If given, this path will be appended before all given filepaths.

Value

  • data.table of sample description having the following columns in order: Sample, CNA_filepath, and GE_filepath. Each row contains a sample's unique name and the corresponding filepaths to CNA and gene expression data.

Examples

Run this code
## Custom sample description by specifying separate arguments

sample_names <- letters[1:5]
sample_desc <- create_sample_desc(
    sample_names = sample_names,
    cna_filepaths = file.path('cna', paste0(sample_names, '.csv')),
    ge_filepaths = file.path('ge', paste0(sample_names, '.txt'))
)
sample_desc


## Prepend the file path with a root directory /path/to/sample

create_sample_desc(
    sample_names = sample_desc$Sample,
    cna_filepaths = sample_desc$CNA_filepath,
    ge_filepaths = sample_desc$GE_filepath,
    sample_root = '/path/to/sample'
)


## Create by reading a sample description CSV file

sample_desc_pth <- system.file("extdata", "sample_desc.csv", package = "iGC")
sample_desc <- create_sample_desc(sample_desc_pth)


## Read a external description and append the given file paths
create_sample_desc('/path/to/desc.csv', sample_root='/path/to/sample/root')

Run the code above in your browser using DataLab