Rgb (version 1.5.1)

track.table-class: Class

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 -inherited methods. As the slice method relies on a R call object using 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 -inherited methods.

Arguments

Extends

Class , directly. Class , directly. Class , by class , distance 2. Class , by class , distance 3. All reference classes extend and inherit methods from .

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 ()
  • colIterator ()
  • colNames ()
  • colReferences ()
  • name ()
  • parameters ()
  • rowCount ()
  • rowNamed ()
  • rowNames ()
  • values ()

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 (, overloaded)
  • addDataFrame ()
  • addEmptyRows ()
  • addList (, overloaded)
  • addVectors ()
  • callParams ()
  • callSuper ()
  • check (, overloaded)
  • chromosomes (, overloaded)
  • coerce (, overloaded)
  • colOrder ()
  • copy ()
  • cross ()
  • defaultParams (, overloaded)
  • delColumns (, overloaded)
  • draw ()
  • erase ()
  • export ()
  • extract ()
  • field ()
  • fill (, overloaded)
  • fix.param ()
  • getChromEnd (, overloaded)
  • getClass ()
  • getColCount ()
  • getColNames ()
  • getLevels ()
  • getName ()
  • getParam ()
  • getRefClass ()
  • getRowCount ()
  • getRowNames ()
  • import ()
  • indexes ()
  • initFields ()
  • initialize (, overloaded)
  • metaFields (, overloaded)
  • rowOrder (, overloaded)
  • setColNames (, overloaded)
  • setLevels (, overloaded)
  • setName ()
  • setParam ()
  • setRowNames ()
  • show (, overloaded)
  • slice (, overloaded)
  • trace ()
  • types ()
  • untrace ()
  • usingMethods ()

See Also

refTable-class track.table, subtrack, istrack

Examples

Run this code
  # Exemplar data : subset of human genes
  data(hsFeatures)
  
  # 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)))

Run the code above in your browser using DataCamp Workspace