compMatrix: Make Comparison Matrix

Description Usage Arguments Value Examples

View source: R/compMatrix.R

Description

A matrix is created for pca/hclust/tsne which contains read number, average methylation levels, pdr, epipolymorphism, and Shannon entropy values across multiple samples at the same loci using read number in a GenomicRanges object

Usage

1
2
3
compMatrix(epi.gr, outprefix = NULL, readNumber = 60,
  metrics = c("read1", "meth1", "pdr", "epipoly", "shannon"),
  p = 1, cores = 5, sve = FALSE)

Arguments

epi.gr

An input file containing the read number, locus, pdr, epipolymorphism, and Shannon entropy values stored in a list of GenomicRanges objects

outprefix

The prefix name of the outputted matrix file. 'sve' must be set to TRUE (default: NULL)

readNumber

The lowest number of reads required for each loci (default: 60)

metrics

The epigenetic heterogeneity metrics included in comp.Matrix (default: read1,meth1,pdr,epipoly,shannon)

p

Percentage (as decimal) of matching samples required to determine a match at a given locus, e.g. a value of 0.75 requires 75% of the samples to have an epiallele at a common loci in order to add the loci to the matrix (default: 1)

cores

The number of cores to be used for parallel execution (default: 5)

sve

A boolean to save the comparison matrix (default: FALSE)

Value

A large matrix containing values (pdr, etc.) at the same loci

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
p1.GR<-GRanges(seqnames = Rle(c("chr22"), c(5)),
ranges = IRanges(c(327,821,838,755,761), end = c(364,849,858,773,781)),
strand = Rle(strand(c("-", "+", "+", "+", "-"))),
values.loci = c("327:350:361:364","821:837:844:849",
"838:845:850:858","755:761:771:773","761:771:773:781"),
values.read1 = c(92,72,68,176,176),values.meth1=c(84,93,94,96,95),
values.shannon=c(0.4,0.5,0.5,0.2,0.5),values.pdr=c(0.6,0.25,0.23,0.15,0.17),
values.epipoly=c(0.48,0.42,0.38,0.27,0.3))

p2.GR<-GRanges(seqnames = Rle(c("chr22"), c(5)),
ranges = IRanges(c(327,821,838,755,761), end = c(364,849,858,773,781)),
strand = Rle(strand(c("-", "+", "+", "+", "-"))),
values.loci = c("327:350:361:364","821:837:844:849",
"838:845:850:858","755:761:771:773","761:771:773:781"),
values.read1 = c(107,102,102,76,76),values.meth1=c(88,66,69,71,94),
values.shannon=c(0.12,0.25,0.54,0.23,0.25),
values.pdr=c(0.38,1,0.97,1,0.13),
values.epipoly=c(0.57,0.42,0.28,0.18,0.23))

N1.GR<-GRanges(seqnames = Rle(c("chr22"), c(5)),
ranges = IRanges(c(327,821,838,755,761), end = c(364,849,858,773,781)),
strand = Rle(strand(c("-", "+", "+", "+", "-"))),
values.loci = c("327:350:361:364","821:837:844:849",
"838:845:850:858","755:761:771:773","761:771:773:781"),
values.read1 = c(112,112,112,68,76),values.meth1=c(82,60,91,71,90),
values.shannon=c(0.15,0.26,0.34,0.24,0.15),
values.pdr=c(0.32,0.57,0.37,0.37,0.13),
values.epipoly=c(0.57,0.42,0.28,0.38,0.23))

N2.GR<-GRanges(seqnames = Rle(c("chr22"), c(5)),
ranges = IRanges(c(327,821,838,755,761), end = c(364,849,858,773,781)),
strand = Rle(strand(c("-", "+", "+", "+", "-"))),
values.loci = c("327:350:361:364","821:837:844:849",
"838:845:850:858","755:761:771:773","761:771:773:781"),
values.read1 = c(385,78,70,96,96),values.meth1=c(96,81,87,87,93),
values.pdr=c(0.15,0.52,0.48,0.25,0.25),
values.epipoly=c(0.26,0.58,0.58,0.37,0.37),
values.shannon=c(0.12,0.25,0.54,0.23,0.25))

GR.List<-list(p1=p1.GR,p2=p2.GR,N1=N1.GR,N2=N2.GR)
comp.Matrix <- compMatrix(epi.gr = GR.List, outprefix = NULL,
readNumber = 60, p = 1, cores = 1, sve = FALSE)

epihet documentation built on Dec. 31, 2020, 2:01 a.m.