metagene: A class to manage metagene analysis.

Description Usage Format Value Constructor Methods Examples

Description

This class will allow to load, convert and normalize alignments and regions files/data. Once the data is ready, the user can then chose to produce metagene plots on the data (or a subset of the data).

Usage

1

Format

A metagene experiment manager

Value

metagene$new returns a metagene object which contains the normalized coverage values for every regions and for every BAM files.

Constructor

mg <- metagene$new(regions, bam_files, padding_size = 0, cores = SerialParam(), verbose = FALSE, force_seqlevels = FALSE, paired_end = FALSE, assay = 'chipseq'))

regions

Either a vector of BED, narrowPeak or broadPeak filenames, a GRanges object or a GRangesList object.

bam_files

A vector of BAM filenames. The BAM files must be indexed. i.e.: if a file is named file.bam, there must be a file named file.bam.bai or file.bai in the same directory.

padding_size

The regions will be extended on each side by the value of this parameter. The padding_size must be a non-negative integer. Default = 0.

cores

The number of cores available to parallelize the analysis. Either a positive integer or a BiocParallelParam. Default: SerialParam().

verbose

Print progression of the analysis. A logical constant. Default: FALSE.

force_seqlevels

If TRUE, Remove regions that are not found in bam file header. Default: FALSE. TRUE and FALSE respectively correspond to pruning.mode = "coarse" and "error" in ?seqinfo.

paired_end

If TRUE, metagene will deal with paired-ended data. If FALSE, single-ended data are expected. Default: FALSE

assay

'chipseq' or 'rnaseq', the two available options. Default: 'chipseq'

metagene$new returns a metagene object that contains the coverages for every BAM files in the regions from the regions param.

Methods

mg$plot(region_names = NULL, design_names = NULL, title = NULL, x_label = NULL)

region_names

The names of the regions to extract. If NULL, all the regions are returned. Default: NULL.

design_names

The names of the experiments to extract. If a design was added to the metagene object, design_names correspond to the column names in the design, otherwise design_names corresponds to the BAM name or the BAM filename. If NULL, all the experiments are returned. Default: NULL.

title

A title to add to the graph. If NULL, will be automatically created. Default: NULL

x_label

X-axis label to add to the metagene plot. If NULL, metagene will use generic label. Default: NULL.

mg$produce_table(design, bin_count, noise_removal, normalization, flip_regions, bin_size = NULL

design

A data.frame that describe to experiment to plot. see plot function for more details. NA can be used keep previous design value. Default: NA.

bin_count

The number of bin to create. NA can be used to keep previous bin_count value. A bin_count value of 100 will be used if no value is specified. Default: NA.

noise_removal

The algorithm to use to remove control(s). Possible values are NA, NULL or "NCIS". By default, value is NULL. Use NA keep previous noise_removal value (i.e. if produce_table was called before). See Liand and Keles 2012 for the NCIS algorithm.

normalization

The algorithm to use to normalize samples. Possible default, value is NULL and no normalization will be performed. Use NA keep previous normalization value (i.e. if produce_table was called before).

flip_regions

Should regions on negative strand be flip_regions? Default: FALSE.

bin_size

Deprecated.

mg$produce_data_frame(alpha = 0.05, sample_count = 1000, avoid_gaps = FALSE, gaps_threshold = 0)

alpha

The range of the estimation to be shown with the ribbon. 1 - alpha / 2 and alpha / 2 will be used. Default: 0.05.

sample_count

The number of draw to do in the bootstrap calculation. Default: 1000.

avoid_gaps

Provide the possibility to remove values = 0 and refit the data_frame for this suppression. Default : FALSE.

gaps_threshold

It works with avoid_gaps argument. It lets to remove values <= at gaps_threshold. Default : 0.

mg$get_params()

mg$get_design()

mg$get_regions(region_names = NULL)

region_names

The names of the regions to extract. If NULL, all the regions are returned. Default: NULL.

mg$get_table = function()

mg$get_matrices = function()

mg$get_data_frame(region_names = NULL, design_names = NULL)

region_names

The names of the regions to extract. If NULL, all the regions are returned. Default: NULL.

design_names

The names of the experiments to extract. If a design was added to the metagene object, design_names correspond to the column names in the design, otherwise design_names corresponds to the BAM name or the BAM filename. If NULL, all the experiments are returned. Default: NULL.

get_plot = function()

get_raw_coverages = function(filenames)

filenames

The name of the file to extract raw coverages. Can be the filename with the extension of the name of the bam file (if a named bam files was used during the creation of the metagene object). If NULL, returns the coverage of every bam files. Default: NULL.

get_normalized_coverages = function(filenames)

filenames

The name of the file to extract normalized coverages (in RPM). Can be the filename with the extension of the name of the bam file (if a named bam files was used during the creation of the metagene object). If NULL, returns the coverage every bam files. Default: NULL.

mg$export(bam_file, region, file)

bam_file

The name of the bam file to export.

region

The name of the region to export.

file

The name of the ouput file.

mg$add_design(design = NULL, check_bam_files = FALSE)

design

A data.frame that describe to experiment to plot. See plot function for more details. NA can be used keep previous design value. Default: NA.

check_bam_files

Force check that all the bam files from the first columns of the design are present in current metagene object. Default: FALSE

mg$unflip_regions()

mg$flip_regions()

mg$unflip_regions()

Examples

1
2
3
4
5
6
7
region <- get_demo_regions()[1]
bam_file <- get_demo_bam_files()[1]
mg <- metagene$new(regions = region, bam_files = bam_file)
## Not run: 
   df <- metagene$plot()

## End(Not run)

CharlesJB/metagene documentation built on July 11, 2021, 11:48 a.m.