Create sample description table containing all required inputs

Share:

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

1
2
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.

Note

One could convert the relative file paths into absolute paths by passing the root folder path to sample_root.

If for some special reasons, for example gene expression of all samples have been collected or the CNA records for each gene exist, but do not have the file paths to either CNA or gene expression data, pass it with empty character vector of correct length, such as rep('', num_samples).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## 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)


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

## End(Not run)