Learn R Programming

genoset (version 1.28.2)

segPairTable: Convert Rle objects to tables of segments

Description

Like segTable, but for two Rle objects. Takes a pair of Rle or DataFrames with Rle columns and makes one or more data.frames with bounds of each new segment. Rle objects are broken up so that each resulting segment has one value from each Rle. 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

segPairTable(x, y, ...)

## S3 method for class 'Rle,Rle': segPairTable(x, y, locs = NULL, chr.ind = NULL, start = NULL, end = NULL, factor.chr = TRUE)

## S3 method for class 'DataFrame,DataFrame': segPairTable(x, y, locs, stack = FALSE, factor.chr = TRUE)

Arguments

x
Rle or list/DataFrame of Rle vectors
y
Rle or list/DataFrame of Rle vectors
...
in generic, extra arguments for 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?

Value

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

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.

See Also

Other "segmented data": bounds2Rle, rangeSegMeanLength, runCBS, segTable, segs2Granges, segs2RleDataFrame, segs2Rle

Examples

Run this code
cn = Rle(c(3,4,5,6),rep(3,4))
  loh = Rle(c(2,4,6,8,10,12),rep(2,6))
  start = c(9:11,4:9,15:17)
  end = start
  locs = GRanges(IRanges(start=start,end=end),seqnames=c(rep("chr1",3),rep("chr2",6),rep("chr3",3)))
  segPairTable(cn,loh,locs)

Run the code above in your browser using DataLab