track.table-class: Class '"track.table"'

track.table-classR Documentation

Class "track.table"

Description

"track.table" describes a collection of features localized on a genome, defined by a chromosomal location ("chrom"), two boundaries ("start" and "end") and various data (other columns).

Objects can be created by two distincts means :

  • The track.table constructor, similar to the data.frame constructor. It imports a single data.frame or a collection of vectors into the object, reorder it to meet the track.table class restrictions (see below) and check immediatly for validity.

  • The new function (standard behavior for S4 and reference classes), which produces an empty object and do NOT check for validity. It takes as named arguments the values to store in the fields of the various classes the new object will inherit from.

3 columns are mandatory in "track.table", with restricted names and types :

name

The unique name of the feature, as character.

chrom

The chromosomal location of the feature, as integer or factor.

start

The starting position of the feature on the chromosome, as integer.

end

The ending position of the feature on the chromosome, as integer.

The track is supposed to be ordered by chromosome, then by starting position. When chromosomes are stored as factors, they need to be numerically ordered by their internal codes (as the order function does), not alphabetically by their labels.

As the slice method relies on a row index, each update in the feature coordinates must be followed by a call to the buildIndex method, a behavior that is enforced by overloading most of refTable-inherited methods.

As the slice method relies on a R call object using refTable column references, each update in the column names must be followed by a call to the buildCalls method, a behavior that is enforced by overloading most of refTable-inherited methods.

Extends

Class refTable, directly.
Class crossable, directly.
Class sliceable, by class crossable, distance 2.
Class drawable, by class crossable, distance 3.

All reference classes extend and inherit methods from envRefClass.

Fields

assembly:

Single character value, the assembly version for the coordinates stored in the object. Must have length 1, should not be NA.

checktrack:

A call to the C external "checktrack", for faster object check (see the check method).

index:

integer vector, giving the index of the first row in each chromosome. See the subtrack function for further details.

organism:

Single character value, the name of the organism whose data is stored in the object. Must have length 1, should not be NA.

sizetrack:

A call to the C external "track", for faster row counting (see the size method).

subtrack:

A call to the C external "track", for faster slicing (see the slice method).

The following fields are inherited (from the corresponding class):

  • colCount (refTable)

  • colIterator (refTable)

  • colNames (refTable)

  • colReferences (refTable)

  • name (drawable)

  • parameters (drawable)

  • rowCount (refTable)

  • rowNamed (refTable)

  • rowNames (refTable)

  • values (refTable)

Methods

addArms(centromeres, temp = ):

Adds an arm localization ('p' or 'q') to the 'chrom' column.
- centromeres : named numeric vector, providing the centromere position of each chromosome. Can also be a band track, as returned by track.UCSC_bands().
- temp : single logical value, whether to alter the object or return an altered copy.

buildCalls():

Updates 'checktrack' and 'subtrack' fields. To be performed after each modification of colNames and colReferences (concerned methods are overloaded to enforce this).

buildGroupPosition(groupBy, colName = , reverse = ):

Adds a column to be used as 'groupPosition' by draw.boxes()
- groupBy : single character value, the name of a column to group rows on.
- colName : single character value, the name of the column to buid.
- reverse : single logical value, whether to reverse numbering on reverse strand or not.

buildGroupSize(groupBy, colName = ):

Adds a column to be used as 'groupSize' by draw.boxes()
- groupBy : single character value, the name of a column to group rows on.
- colName : single character value, the name of the column to buid.

buildIndex():

Updates the 'index' parameter, should be done after any change made on the 'chrom' column (concerned methods are overloaded to enforce this).

eraseArms(temp = ):

Removes 'p' and 'q' added by the addArms() method from the 'chrom' column.
- temp : single logical value, whether to alter the object or return an altered copy.

isArmed():

Detects whether the 'chrom' column refers to whole chromosomes or chromosome arms.

segMerge(...):

Apply the segMerge() function to the track content.
- ... : arguments to be passed to segMerge().

segOverlap(...):

Apply the segOverlap() function to the track content.
- ... : arguments to be passed to segOverlap().

size(chrom, start, end):

Count elements in the specified window.
- chrom : single integer, numeric or character value, the chromosomal location.
- start : single integer or numeric value, inferior boundary of the window.
- end : single integer or numeric value, superior boundary of the window.

The following methods are inherited (from the corresponding class):

  • addColumn (refTable, overloaded)

  • addDataFrame (refTable)

  • addEmptyRows (refTable)

  • addList (refTable, overloaded)

  • addVectors (refTable)

  • callParams (drawable)

  • callSuper (envRefClass)

  • check (refTable, overloaded)

  • chromosomes (drawable, overloaded)

  • coerce (refTable, overloaded)

  • colOrder (refTable)

  • copy (refTable)

  • cross (crossable)

  • defaultParams (sliceable, overloaded)

  • delColumns (refTable, overloaded)

  • draw (sliceable)

  • erase (refTable)

  • export (envRefClass)

  • extract (refTable)

  • field (envRefClass)

  • fill (refTable, overloaded)

  • fix.param (drawable)

  • getChromEnd (sliceable, overloaded)

  • getClass (envRefClass)

  • getColCount (refTable)

  • getColNames (refTable)

  • getLevels (refTable)

  • getName (drawable)

  • getParam (drawable)

  • getRefClass (envRefClass)

  • getRowCount (refTable)

  • getRowNames (refTable)

  • import (envRefClass)

  • indexes (refTable)

  • initFields (envRefClass)

  • initialize (refTable, overloaded)

  • metaFields (refTable, overloaded)

  • rowOrder (refTable, overloaded)

  • setColNames (refTable, overloaded)

  • setLevels (refTable, overloaded)

  • setName (drawable)

  • setParam (drawable)

  • setRowNames (refTable)

  • show (refTable, overloaded)

  • slice (sliceable, overloaded)

  • trace (envRefClass)

  • types (refTable)

  • untrace (envRefClass)

  • usingMethods (envRefClass)

Author(s)

Sylvain Mareschal

See Also

refTable-class

track.table, subtrack, istrack

Examples

  # Exemplar data : subset of human genes
  data(hsGenes)
  
  # Construction
  trackTable <- track.table(
    hsGenes,
    .name = "NCBI Genes",
    .organism = "Homo sapiens",
    .assembly = "GRCh37"
  )
  
  # Slicing
  print(trackTable$slice(chrom="1", as.integer(15e6), as.integer(20e6)))

Rgb documentation built on Aug. 18, 2023, 5:05 p.m.