segTable {genoset} | R Documentation

## Convert Rle objects to tables of segments

### Description

Like the inverse of segs2Rle and segs2RleDataFrame. Takes a Rle or a RleDataFrame and the rowRanges both from a GenoSet object and makes a list of data.frames each like the result of CBS's segment. Note the loc.start and loc.stop will correspond exactly to probe locations in rowRanges and the input to segs2RleDataFrame are not necessarily so. For a DataFrame, the argument `stack` combines all of the individual data.frames into one large data.frame and adds a 'Sample' column of sample ids.

### Usage

    segTable(object, ...)

    ## S4 method for signature 'Rle'
    segTable(object, locs = NULL, chr.ind = NULL,
      start = NULL, end = NULL, factor.chr = TRUE)

    ## S4 method for signature 'DataFrame'
    segTable(object, locs, factor.chr = TRUE,
      stack = FALSE)

### Arguments

`object` | Rle or RleDataFrame
`...` | in generic, for extra args in methods
`locs` | GenomicRanges with rows corresponding to rows of df
`chr.ind` | matrix, like from chrIndices method
`start` | integer, vector of feature start positions
`end` | integer, vector of feature end positions
`factor.chr` | scalar logical, make 'chrom' column a factor?
`stack` | logical, rbind list of segment tables for each sample and add 'Sample' column?

### Details

For a Rle, the user can provide `locs` or `chr.ind`, `start` and `stop`. The latter is surprisingly much faster and this is used in the DataFrame version.

### Value

one or a list of data.frames with columns chrom, loc.start, loc.end, num.mark, seg.mean

### See Also

Other 'segmented data': `bounds2Rle`, `rangeSegMeanLength`, `runCBS`, `segPairTable`, `segs2Granges`, `segs2RleDataFrame`, `segs2Rle`

### Examples

      data(genoset,package='genoset')
      seg.list = runCBS( genoset.ds[, , 'lrr'], rowRanges(genoset.ds), return.segs=TRUE )
      df = segs2RleDataFrame( seg.list, rowRanges(genoset.ds) )  # Loop segs2Rle on list of data.frames in seg.list
      genoset.ds[ , , 'lrr.segs'] = df
      segTable( df, rowRanges(genoset.ds) )
      segTable( genoset.ds[ , , 'lrr.segs'], rowRanges(genoset.ds) )
      segTable( genoset.ds[ , 1, 'lrr.segs'], rowRanges(genoset.ds), colnames(genoset.ds)[1] )

[Package genoset version 1.44.0 Index]