RowOrderExtractor: Extract row order from a hclust object stored in a...

Description Usage Arguments Details Author(s) Examples

View source: R/src_RowOrderExtractor.R

Description

This function (in a chronological order) comes right after running PlotHtmp. The function will take the returned output of PlotHtmp plus either a GRanges object or a list of gene of region names and will then extract the rows that belong to each cluster as defined in PlotHtmp.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
RowOrderExtractor(
  HtmpObject,
  ReferenceData,
  Type,
  ToDisk = FALSE,
  OutputDir = "./",
  OutputName = "",
  WithDate = FALSE,
  RangedIs1Based = TRUE
)

Arguments

HtmpObject

the output of PlotHtmp

ReferenceData

a GRanges object (when using ranged data) or a vector with names in the same order as used for PlotHtmp from which the rows will be extracted according clustering from PlotHtmp

Type

either "ranged" or "unranged", must be ranged when using GRanges input

ToDisk

whether to write the ranges or names of each cluster to disk

OutputDir

output directory for ToDisk

OutputName

name prefix for ToDisk

WithDate

logica, whether to prefix files written to disk with date

RangedIs1Based

Whether GRanges is 1-based so subtract 1 from start prior to writing to disk as BED

Details

During PlotHtmp there is an option to split the rows into clusters according to hclust output. In order to get the elements per cluster one could use cutree but since we want to ensure that the output order of the elements is 100 the returned heatmap object.

Author(s)

Alexander Toenges

Examples

1
2
3
4
5
6
Gr <- GRanges(seqnames = rep("chr1", 2000), ranges = IRanges(start = seq(1,1000), end = rep(1001, 2000)))
cts <- sapply(seq(1,10), function(x) rnorm(1000,10))
rownames(cts) <- paste0("gene", seq(1,1000))
Htmp <- PlotHtmp(InputData = cts, Htmp.hclustRow = hclust(dist(cts)), Htmp.nclusters = 3, Htmp.return = TRUE)
Extracted.unranged <- RowOrderExtractor(HtmpObject = Htmp, ReferenceData = rownames(cts), Type = "unranged")
Extracted.ranged <- RowOrderExtractor(HtmpObject = Htmp, ReferenceData = Gr, Type = "ranged")

ATpoint/misterplotR documentation built on Feb. 15, 2020, 12:17 a.m.