rugplotDonorTargetTest: rugplotDonorTargetTest

Description Usage Arguments Value See Also Examples

View source: R/rugplotDonorTargetTest.R

Description

This function is called by CellScoreReport to make a rugplot showing the CellScore of all test samples, in relation to the standards. Donor and target individual CellScore values are plotted in one horizontal lane, then test CellScore values are are in another horizontal lane. Z-score cutoffs based on the target standards are shown as dashed vertical lines.

Usage

1
rugplotDonorTargetTest(test.data, cellscore)

Arguments

test.data

a data.frame of CellScore values as calculated by CellScore(), for only plot group of test samples.

cellscore

a data.frame of CellScore values as calculated by CellScore().

Value

This function outputs the plot on the active graphical device and returns invisibly NULL.

See Also

CellScore for details on CellScore.

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
56
57
58
## Not run: 
## Load the expression set for the standard cell types
library(Biobase)
library(hgu133plus2CellScore) # eset.std

## Locate the external data files in the CellScore package
rdata.path <- system.file("extdata", "eset48.RData", package = "CellScore")
tsvdata.path <- system.file("extdata", "cell_change_test.tsv",
                             package = "CellScore")

if (file.exists(rdata.path) && file.exists(tsvdata.path)) {

   ## Load the expression set with normalized expressions of 48 test samples
   load(rdata.path)

   ## Import the cell change info for the loaded test samples
   cell.change <- read.delim(file= tsvdata.path, sep="\t",
                             header=TRUE, stringsAsFactors=FALSE)

   ## Combine the standards and the test data
   eset <- combine(eset.std, eset48)

   ## Generate the on/off scores for the combined data
   individ.OnOff <- OnOff(eset, cell.change, out.put="individual")

   ## Generate cosine similarity for the combined data
   ## NOTE: May take 1-2 minutes on the full eset object
   cs <- CosineSimScore(eset, cell.change, iqr.cutoff=0.05)

   ## Generate the CellScore values for all samples
   cellscore <- CellScore(eset, cell.change, individ.OnOff$scores,
                          cs$cosine.samples)
   ## Get the CellScore fvalues rom valid transitions defined by cell.change
   ## table
   plot.data <- extractTransitions(cellscore, cell.change)

   ## Define a plot group variable
   plot.data$plot_group <- paste(plot.data$experiment_id,
                                plot.data$cxkey.subcelltype, sep="_")
   ## Sort the scores 1) by target 2) by donor 3) by study
   plot.data.ordered <- plot.data[order(plot.data$target,
                                       plot.data$donor_tissue,
                                       plot.data$experiment_id), ]
   ## How many plot_groups are there?
   table(plot.data$plot_group)

   ## pick one plot_group to plot
   group <- unique(plot.data$plot_group)[4]

  ## Select scores for only one plot group
  test.data <- plot.data.ordered[plot.data.ordered$plot_group %in% group, ]

  ## Plot
  rugplotDonorTargetTest(test.data, cellscore)

}

## End(Not run)

CellScore documentation built on Nov. 1, 2018, 3:48 a.m.