xCorrelation: Function to calculate and visualise correlation

Description Usage Arguments Value Note See Also Examples

View source: R/xCorrelation.r

Description

xCorrelation is supposed to calculate and visualise correlation between a data frame and a named vector (or a list of named vectors).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
xCorrelation(
df,
list_vec,
method = c("pearson", "spearman"),
p.type = c("nominal", "empirical"),
seed = 825,
nperm = 2000,
p.adjust.method = c("BH", "BY", "bonferroni", "holm", "hochberg",
"hommel"),
plot = FALSE,
plot.smooth = c(NA, "lm", "loess"),
point.size = 1,
point.color = "grey90"
)

Arguments

df

a data frame with two columns ('name' and 'value')

list_vec

a named vector containing numeric values. Alternatively it can be a list of named vectors

method

the method used to calcualte correlation. It can be 'pearson' for Pearson's correlation or 'spearman' for Spearman rank correlation

p.type

the type of the p-value calcualted. It can be 'nominal' for nominal p-value or 'empirical' for empirical p-value

seed

an integer specifying the seed

nperm

the number of random permutations

p.adjust.method

the method used to adjust p-values. It can be one of "BH", "BY", "bonferroni", "holm", "hochberg" and "hommel". The first two methods "BH" (widely used) and "BY" control the false discovery rate (FDR: the expected proportion of false discoveries amongst the rejected hypotheses); the last four methods "bonferroni", "holm", "hochberg" and "hommel" are designed to give strong control of the family-wise error rate (FWER). Notes: FDR is a less stringent condition than FWER

plot

logical to indicate whether scatter plot is drawn

plot.smooth

the smooth method for the scatter plot. It can be NA (depending on correlation type), "lm" for the linear line or 'loess' for the loess curve

point.size

the point size

point.color

the point color

Value

a list with three componets:

Note

none

See Also

xCorrelation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
RData.location <- "http://galahad.well.ox.ac.uk/bigdata"
## Not run: 
# a) provide the seed nodes/genes with the weight info
## load ImmunoBase
ImmunoBase <- xRDataLoader(RData.customised='ImmunoBase',
RData.location=RData.location)
## get genes within 500kb away from AS GWAS lead SNPs
seeds.genes <- ImmunoBase$AS$genes_variants
## seeds weighted according to distance away from lead SNPs
data <- 1- seeds.genes/500000

# b) prepare a data frame
df <- data.frame(name=names(data), value=data, stringsAsFactors=FALSE)

# c) do correlation
ls_res <- xCorrelation(df, data, method="pearson", p.type="empirical",
nperm=2000, plot=TRUE)

## End(Not run)

Pi documentation built on Nov. 29, 2021, 3 p.m.