Skip to contents

An R6 class to represent metadata for expression data. It combines a pairwise design of experiments with a 2-level structure and transcriptome annotation. Specifically, it provides the following features:

  • Pairwise design of experiment with a 2-level structure:

    • Samples are regrouped into groups

    • Groups are regrouped into batches, where one group is designed as the control group used as a reference for pairwise comparisons

Details

For more information on how to specify the arguments, please refer to the vignette defining file formats.

Methods


Method new()

Initialize a new PairwiseDesign object.

This method initializes a new PairwiseDesign object. The object represents metadata for expression data, including pairwise design of experiments and transcriptome annotation.

Usage

PairwiseDesign$new(
  pairwise_design_file,
  src_dir = NULL,
  quant_source = "kallisto"
)

Arguments

pairwise_design_file

Path to the pairwise design file, which must be in .yml or .csv format.

src_dir

Path(s) specified only in case of csv file with the path for each run to the folder with expression files. In case of several runs defined in the design file, a named vector is required. Can be specified for YML also but only 1 value for all runs.

quant_source

The source of quantification files. Either "kallisto" (default) or "salmon". This determines the file patterns to look for.

Returns

A new PairwiseDesignWithAnnotation object.


Method get_b_labels()

get batch labels

Usage

PairwiseDesign$get_b_labels()

Returns

named vector with batch label (batch code as names)


Method get_g_labels()

get group labels

Usage

PairwiseDesign$get_g_labels()

Returns

named vector with group label (group code as names)


Method get_quant_source()

get quantification source

Usage

PairwiseDesign$get_quant_source()

Returns

character string, either "kallisto" or "salmon"


Method build_file_paths()

get the paths of files with raw expression data for all samples

Usage

PairwiseDesign$build_file_paths()

Returns

named vector with paths and sample name as keys


Method get_simple_design()

get the simplified design with only batch/group/ctrl

Usage

PairwiseDesign$get_simple_design(include_ctrl = TRUE)

Arguments

include_ctrl

whether to include controls

Returns

simplified design data.frame


Method extract_sample_names()

get sample names with simple design-based filtering

Usage

PairwiseDesign$extract_sample_names(
  in_batch = NULL,
  in_group = NULL,
  in_run = NULL,
  basename = FALSE
)

Arguments

in_batch

A character vector of batch codes. Select or report only samples in those batches.

in_group

A character vector of group codes. Select or report only samples in those groups.

in_run

A character vector of run IDs. Select or report only samples in those runs.

basename

whether to return the basename in place of the complete name (with run id)

Returns

sample names in character vector


Method list_groups_per_batches()

Get a the groups foreach batch

Usage

PairwiseDesign$list_groups_per_batches(include_ctrl = FALSE)

Arguments

include_ctrl

whether to include control group

Returns

list of vectors with batch as key and groups as value


Method list_batches()

Get a all batchs

Usage

PairwiseDesign$list_batches()

Returns

vector with batch code


Method find_control_group_per_batches()

get the control group per batch

Usage

PairwiseDesign$find_control_group_per_batches()

Returns

get named vector with batch as key and ctrl group as value


Method get_pairwise_design()

get the pairwise_design table with design-based filtering

Usage

PairwiseDesign$get_pairwise_design(
  in_batch = NULL,
  in_group = NULL,
  in_run = NULL
)

Arguments

in_batch

A character vector of batch codes. Select or report only samples in those batches.

in_group

A character vector of group codes. Select or report only samples in those groups.

in_run

A character vector of run IDs. Select or report only samples in those runs.

Returns

pairwise_design data.frame


Method list_paired_id_per_sample()

get the id to be used for paired analysis per sample only return for samples in batch with a paired design

Usage

PairwiseDesign$list_paired_id_per_sample()

Returns

named character vector sample_name -> paired_id


Method filter_and_set_selected_samples()

Select samples based on design. The results will be an intersect with the previous selection. You can reset the object if it's not desired.

Usage

PairwiseDesign$filter_and_set_selected_samples(
  in_batch = NULL,
  in_group = NULL,
  in_run = NULL
)

Arguments

in_batch

A character vector of batch codes. Select or report only samples in those batches.

in_group

A character vector of group codes. Select or report only samples in those groups.

in_run

A character vector of run IDs. Select or report only samples in those runs.

Returns

vector of the selected samples


Method set_selected_samples()

Set selected samples. The results will be an intersect with the previous selection. You can reset the object if it's not desired.

Usage

PairwiseDesign$set_selected_samples(sample_list)

Arguments

sample_list

vector of sample codes to select

Returns

vector of the selected samples


Method is_paired()

get the list of batch with a paired design (DEPRECATED)

Usage

PairwiseDesign$is_paired()

Returns

character vector


Method reset()

Reset object, this affects:

  • samples selection (as initially)

Usage

PairwiseDesign$reset()

Returns

vector of the selected samples


Method clone()

The objects of this class are cloneable with this method.

Usage

PairwiseDesign$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.