Merge TSSs or TSRs by group or select samples.

merge_samples(
  experiment,
  data_type = c("tss", "tsr"),
  threshold = NULL,
  sample_sheet = NULL,
  merge_group = NULL,
  merge_list = NULL,
  max_distance = NULL,
  genome_assembly = NULL
)

Arguments

experiment

TSRexploreR object.

data_type

Merge TSSs ('tss') or TSRs ('tsr').

threshold

TSSs or TSRs with a score below this value will not be considered.

sample_sheet

A sample sheet data.frame or tab delimited file. Must have the columns 'sample_name', 'file_1', and 'file_2'. Additional meta-data columns can be added with sample information such as condition and batch.

merge_group

The name of the column in the sample sheet that has the factor levels to merge samples by.

merge_list

If merge_group is set to 'FALSE', specify what samples to merge in list format. List names will be the new TSS/TSR name, and the list contents should be a character vector of the TSSs or TSRs to merge.

max_distance

Merge TSRs within this distance.

genome_assembly

Genome assembly in FASTA or BSgenome format.

Value

TSRexploreR object containing merged TSSs or TSRs.

Details

This function will merge overlapping TSSs or TSRs from different samples using either the sample sheet or a named list. If 'merge_group' is specified, the new merged TSS/TSR set will be the factor level in the column, and all TSS/TSR sets sharing that factor level will be merged. If 'merge_list' is specified, the new TSS/TSR set will be the name of the list element, and the samples to merge will be a character vector as the list element.

'merge_distance' is provided for TSRs, and will merge TSRs within a certain distance from other TSRs.

Examples

data(TSSs) sample_sheet <- data.frame( sample_name=sprintf("S288C_D_%s", seq_len(2)), file_1=rep(NA, 2), file_2=rep(NA, 2), condition="Diamide" ) assembly <- system.file("extdata", "S288C_Assembly.fasta", package="TSRexploreR") exp <- TSSs[seq_len(2)] %>% tsr_explorer(sample_sheet=sample_sheet, genome_assembly=assembly) %>% format_counts(data_type="tss") exp <- merge_samples(exp, data_type="tss", merge_group="condition")