Learn R Programming

kmeRtone (version 1.0)

Coordinate: Loading, manipulating, and analyzing coordinate data.

Description

Loading, manipulating, and analyzing coordinate data.

Loading, manipulating, and analyzing coordinate data.

Arguments

Public fields

root_path

A path to a directory containing coordinate files.

single_len

Single case length e.g. damage length. Default is NULL.

is_strand_sensitive

Coordinate strand polarity. Default is TRUE.

merge_replicate

Merge coordinate from different replicates. Default is TRUE.

rm_dup

Remove duplicate entry in the coordinate table. Default is TRUE.

add_col_rep

If add_col_rep is TRUE, column replicate is added to the coordinate table. Default is TRUE.

paths

Individual coordinate files.

rep_names

Replicate names determined from coordinate subdirectory.

chr_names

Chromosome names determined from filenames.

coor

Chromosome-named list of coordinate data.table.

is_kmer

A data.table of is_kmer status. The first column is original is_kmer status.

k

K-mer size when is_kmer is TRUE. When is_kmer is FALSE, k is NA.

ori_first_index

Original chromosome-separated table first index is either starting from zero or one.

load_limit

Maximum coordinate table loaded.

Methods


Method new()

Create a new Coordinate class

Usage

Coordinate$new(
  root.path,
  single.len,
  is.strand.sensitive,
  merge.replicate,
  rm.dup,
  add.col.rep,
  is.kmer,
  k,
  ori.first.index,
  load.limit
)

Arguments

root.path

A path to a directory containing either: (1) chromosome-separated coordinate files (assume replicates for subdirectories) OR (2) bedfile. (assume replicates for bedfiles)

single.len

Single case length e.g. damage length. Default is NULL

is.strand.sensitive

A boolean whether strand polarity matters. Default is TRUE.

merge.replicate

Merge coordinate from different replicates. Default is TRUE. If not merging, duplicates will give weight to the kmer counting. If add_col_rep, merged coordinate will contain column replicate e.g. "rep1&rep2".

rm.dup

Remove duplicates in each replicate. Default is FALSE Default is FALSE

add.col.rep

Add column replicate to coordinate table.

is.kmer

Is the coordinate refers to k-mer i.e. expanded case? Default is FALSE.

k

Length of k-mer if is_kmer is TRUE.

ori.first.index

Zero- or one-based index. Default is 1.

load.limit

Maximum coordinate data.table loaded. Default is 1.

Returns

A new Coordinate object.


Method [()

Calling coordinate table by loading on demand. Maximum load is determine by load_limit field.

Usage

Coordinate$[(
  chr.name,
  state = "current",
  k,
  reload = FALSE,
  rm.other.cols = TRUE
)

Arguments

chr.name

Chromosome name. It can be a vector of chromosomes.

state

Coordinate state: "current", "case", "kmer". The coordinate state is changed automatically on demand. Default is "current".

k

K-mer size. If state is "kmer", k is needed to expand the coordinate.

reload

Reload the coordinate table from the root.path. Default is TRUE.

rm.other.cols

Remove unnecessary columns for kmeRtone operation.

Returns

A single or list of data.table coordinate of requested chromosome.


Method mark_overlap()

Mark overlapping regions in the coordinate table. A column name is_overlap is added.

Usage

Coordinate$mark_overlap()

Arguments

chr.names

Chromosome names

Returns

New column is_overlap is added.


Method print()

Print Coordinate object parameters.

Usage

Coordinate$print()

Returns

Message of Coordinate object parameters.


Method map_sequence()

Get corresponding sequence from the loaded coordinate.

Usage

Coordinate$map_sequence(genome)

Arguments

genome

Genome object or vector of named chromosome sequences.

Returns

New column seq.


Method clone()

The objects of this class are cloneable with this method.

Usage

Coordinate$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.