plot_elbow: plots Elbow curve data.

Description Usage Arguments Examples

View source: R/elbowlib.R

Description

Plots an elbow curve and its associated data:

Usage

1
2
3
4
  plot_elbow(my_data, upper_limit, lower_limit, pvalue1,
    prowmin, prowmax, prowmedian, max_upper_variance,
    min_upper_variance, max_lower_variance,
    min_lower_variance, gtitle = "")

Arguments

my_data

A table (data.frame) to plot. The columns in the table should be as follows:

  • probes — one column containing the names of the probes

  • fold — the fold values for the table

upper_limit

the upper limit/cut-off for the elbow.

lower_limit

the lower limit/cut-off for the elbow.

pvalue1

the \logχ^2 p-value for the elbow curve.

prowmin

the error limit based on the maximum value for each probe.

prowmax

the error limit based on the minimum value for each probe.

prowmedian

the null (median) value for each probe.

max_upper_variance

the maximum upper elbow limit (most positive).

min_upper_variance

the minimum upper elbow limit.

max_lower_variance

the maximum lower elbow limit.

min_lower_variance

the minimum lower elbow limit (most negative).

gtitle

the title to display for the graph.

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
43
44
45
46
47
48
49
50
51
52
53
54
55
# read in the EcoliMutMA sample data from the package
		data(EcoliMutMA, package="ELBOW")
		csv_data <- EcoliMutMA
		# - OR - Read in a CSV file (uncomment - remove the #'s
		#        - from the line below and replace 'filename' with
		#        the CSV file's filename)
		# csv_data <- read.csv(filename)

		# set the number of initial and final condition replicates both to three
		init_count  <- 3
		final_count <- 3

		# Parse the probes, intial conditions and final conditions
		# out of the CSV file.  Please see: extract_working_sets
		# for more information.
		#
		# init_count should be the number of columns associated with
		#       the initial conditions of the experiment.
		# final_count should be the number of columns associated with
		#       the final conditions of the experiment.
		working_sets <- extract_working_sets(csv_data, init_count, final_count)

		probes <- working_sets[[1]]
		initial_conditions <- working_sets[[2]]
		final_conditions <- working_sets[[3]]

		# Uncomment to output the plot to a PNG file (optional)
		# png(file="output_plot.png")

		my_data <- replicates_to_fold(probes, initial_conditions, final_conditions)

		# compute the elbow for the dataset
		limits <- do_elbow(data.frame(my_data$fold))

		plus_minus <- elbow_variance(probes, initial_conditions, final_conditions)

		max_upper_variance <- plus_minus$max_upper
		min_upper_variance <- plus_minus$min_upper
		max_lower_variance <- plus_minus$max_lower
		min_lower_variance <- plus_minus$min_lower

		# rounded number for nice appearance graph
		upper_limit <- round(limits[[1]],digits=2)

		# rounded number nice appearance for graph
		lower_limit <- round(limits[[2]],digits=2)

		p_limits <- null_variance(my_data, upper_limit, lower_limit, initial_conditions)

		prowmin <- p_limits[[1]]
		prowmax <- p_limits[[2]]
		prowmedian <- p_limits[[3]]

		pvalue1 <- get_pvalue(my_data, upper_limit, lower_limit)
		plot_elbow(my_data, upper_limit, lower_limit, pvalue1, prowmin, prowmax, prowmedian, max_upper_variance, min_upper_variance, max_lower_variance, min_lower_variance, "Title of the ELBOW Plot")

Example output

[1] "rowsums"
[1] "fold"
[1]  0.06873333 -0.08933333  0.34013333  0.19313333  0.00940000 -0.02596667
[1] "bound data"
    ID_REF        fold
1 1001_115  0.06873333
2  1002_33 -0.08933333
3 1003_942  0.34013333
4 1004_552  0.19313333
5 1005_657  0.00940000
6 1006_393 -0.02596667
[1] "firsta_data"
    ID_REF        fold
1 1001_115  0.06873333
2  1002_33 -0.08933333
3 1003_942  0.34013333
4 1004_552  0.19313333
5 1005_657  0.00940000
6 1006_393 -0.02596667
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1]  0.2138 -0.2044  0.1604  0.1214 -0.1342 -0.0477
[1] "bound data"
    ID_REF    fold
1 1001_115  0.2138
2  1002_33 -0.2044
3 1003_942  0.1604
4 1004_552  0.1214
5 1005_657 -0.1342
6 1006_393 -0.0477
[1] "firsta_data"
    ID_REF    fold
1 1001_115  0.2138
2  1002_33 -0.2044
3 1003_942  0.1604
4 1004_552  0.1214
5 1005_657 -0.1342
6 1006_393 -0.0477
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1]  0.2071  0.0046  0.0323  0.3172  0.0230 -0.0754
[1] "bound data"
    ID_REF    fold
1 1001_115  0.2071
2  1002_33  0.0046
3 1003_942  0.0323
4 1004_552  0.3172
5 1005_657  0.0230
6 1006_393 -0.0754
[1] "firsta_data"
    ID_REF    fold
1 1001_115  0.2071
2  1002_33  0.0046
3 1003_942  0.0323
4 1004_552  0.3172
5 1005_657  0.0230
6 1006_393 -0.0754
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1]  0.2611  0.0195  0.0503  0.3531 -0.0252 -0.0441
[1] "bound data"
    ID_REF    fold
1 1001_115  0.2611
2  1002_33  0.0195
3 1003_942  0.0503
4 1004_552  0.3531
5 1005_657 -0.0252
6 1006_393 -0.0441
[1] "firsta_data"
    ID_REF    fold
1 1001_115  0.2611
2  1002_33  0.0195
3 1003_942  0.0503
4 1004_552  0.3531
5 1005_657 -0.0252
6 1006_393 -0.0441
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1]  0.0346 -0.2222  0.5502  0.0479 -0.0125  0.0560
[1] "bound data"
    ID_REF    fold
1 1001_115  0.0346
2  1002_33 -0.2222
3 1003_942  0.5502
4 1004_552  0.0479
5 1005_657 -0.0125
6 1006_393  0.0560
[1] "firsta_data"
    ID_REF    fold
1 1001_115  0.0346
2  1002_33 -0.2222
3 1003_942  0.5502
4 1004_552  0.0479
5 1005_657 -0.0125
6 1006_393  0.0560
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1]  0.0279 -0.0132  0.4221  0.2437  0.1447  0.0283
[1] "bound data"
    ID_REF    fold
1 1001_115  0.0279
2  1002_33 -0.0132
3 1003_942  0.4221
4 1004_552  0.2437
5 1005_657  0.1447
6 1006_393  0.0283
[1] "firsta_data"
    ID_REF    fold
1 1001_115  0.0279
2  1002_33 -0.0132
3 1003_942  0.4221
4 1004_552  0.2437
5 1005_657  0.1447
6 1006_393  0.0283
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1] 0.0819 0.0017 0.4401 0.2796 0.0965 0.0596
[1] "bound data"
    ID_REF   fold
1 1001_115 0.0819
2  1002_33 0.0017
3 1003_942 0.4401
4 1004_552 0.2796
5 1005_657 0.0965
6 1006_393 0.0596
[1] "firsta_data"
    ID_REF   fold
1 1001_115 0.0819
2  1002_33 0.0017
3 1003_942 0.4401
4 1004_552 0.2796
5 1005_657 0.0965
6 1006_393 0.0596
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1] -0.0828 -0.2743  0.5480 -0.0174 -0.0913 -0.0621
[1] "bound data"
    ID_REF    fold
1 1001_115 -0.0828
2  1002_33 -0.2743
3 1003_942  0.5480
4 1004_552 -0.0174
5 1005_657 -0.0913
6 1006_393 -0.0621
[1] "firsta_data"
    ID_REF    fold
1 1001_115 -0.0828
2  1002_33 -0.2743
3 1003_942  0.5480
4 1004_552 -0.0174
5 1005_657 -0.0913
6 1006_393 -0.0621
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1] -0.0895 -0.0653  0.4199  0.1784  0.0659 -0.0898
[1] "bound data"
    ID_REF    fold
1 1001_115 -0.0895
2  1002_33 -0.0653
3 1003_942  0.4199
4 1004_552  0.1784
5 1005_657  0.0659
6 1006_393 -0.0898
[1] "firsta_data"
    ID_REF    fold
1 1001_115 -0.0895
2  1002_33 -0.0653
3 1003_942  0.4199
4 1004_552  0.1784
5 1005_657  0.0659
6 1006_393 -0.0898
[1] "sorted"
[1] "headers"
[1] "rowsums"
[1] "fold"
[1] -0.0355 -0.0504  0.4379  0.2143  0.0177 -0.0585
[1] "bound data"
    ID_REF    fold
1 1001_115 -0.0355
2  1002_33 -0.0504
3 1003_942  0.4379
4 1004_552  0.2143
5 1005_657  0.0177
6 1006_393 -0.0585
[1] "firsta_data"
    ID_REF    fold
1 1001_115 -0.0355
2  1002_33 -0.0504
3 1003_942  0.4379
4 1004_552  0.2143
5 1005_657  0.0177
6 1006_393 -0.0585
[1] "sorted"
[1] "headers"
[1] "upper elbow limit = 0.82 (replicate variance error 0.67  to  1.05 )"
[1] "lower elbow limit = -0.45 ( replicate variance error -0.37  to  -0.63 )"
[1] "log chi squared p = 1.08e-44"

ELBOW documentation built on Nov. 8, 2020, 8:14 p.m.