fp_contrasts: Returns contrasts between fingerprints

Description Usage Arguments Examples

View source: R/fp_contrasts.R

Description

This function returns contrasts between fingerprints generated by flowBasis() which can be visualized with ggplot2.

Usage

1
fp_contrasts(x, comp1, comp2, param = c("FL1-H", "FL3-H"), d = 3, thresh = 0.1)

Arguments

x

flowbasis object generated by flowBasis()

comp1

A vector of factors/indices indicating the groups to be compared. This group will be compared to comp2. Negative density values indicate that comp1 had a higher density at that specific bin/area.

comp2

A vector of factors/indices indicating the groups to be compared. This group will be compared to comp1. Negative density values indicate that comp1 had a higher density at that specific bin/area.

param

A vector of the two parameters to be compared. Please adhere to the order defined in @param of the flowBasis object. See below for example.

d

Round value for density values, defaults at 3.

thresh

threshold required to return the density values. Values lower than this threshold will be removed.

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
data(CoolingTower)

### Check which parameters are in the fingerprint
CoolingTower@param

### Lets run with the standard c("FL1-H","FL3-H") and lets evaluate how the 
### microbial community compares between the start-up and control phase of the
### cooling water system.
comp <- fp_contrasts(CoolingTower, comp1 = c(5:9), comp2 = c(1:4), 
param=c("FL1-H","FL3-H"), thresh=0.01)

### Plot
v <- ggplot2::ggplot(comp, ggplot2::aes(`FL1-H`, `FL3-H`, z = Density))+
  ggplot2::geom_tile(ggplot2::aes(fill=Density)) + 
  ggplot2::geom_point(colour="gray", alpha=0.4)+
  ggplot2::scale_fill_distiller(palette="RdBu", na.value="white") + 
  ggplot2::stat_contour(ggplot2::aes(fill=..level..), geom="polygon", binwidth=0.1)+
  ggplot2::theme_bw()+
  ggplot2::geom_contour(color = "white", alpha = 1)
 
 ### Red/positive values indicate higher density for the reactor start-up.
 ### blue/negative values indicate lower density during start-up.
 print(v)
 

rprops/Phenoflow_package documentation built on Sept. 22, 2020, 5:43 p.m.