topSeqsPlot: Cumulative frequency bar plot of top sequences

Description Usage Arguments Details Value See Also Examples

View source: R/topSeqsPlot.R

Description

Create a cumulative frequency bar plot of a specified number of top sequences.

Usage

1
topSeqsPlot(list, top = 10)

Arguments

list

A list data frames imported using the LymphoSeq function readImmunoSeq or productiveSeq.

top

The number of top sequences to be colored in the bar plot. All other, less frequent sequences are colored violet.

Details

The plot is made using the package ggplot2 and can be reformatted using ggplot2 functions. See examples below.

Value

Returns a cumulative frequency bar plot of the top sequences.

See Also

An excellent resource for examples on how to reformat a ggplot can be found in the R Graphics Cookbook online (http://www.cookbook-r.com/Graphs/).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
file.path <- system.file("extdata", "TCRB_sequencing", package = "LymphoSeq")

file.list <- readImmunoSeq(path = file.path)

topSeqsPlot(list = file.list, top = 10)

# Display the number of sequences at the top of bar plot and add a title
n <- as.character(lapply(file.list, nrow))

topSeqsPlot(list = file.list, top = 10) + 
   ggplot2::annotate("text", x = 1:length(file.list), y = 105, label = n, color = "black") +
   ggplot2::expand_limits(y = c(0, 110)) + ggplot2::ggtitle("Figure Title") + 
   ggplot2::scale_x_discrete(limits = names(file.list))

Example output

Loading required package: LymphoSeqDB
sh: 1: wc: Permission denied
sh: 1: cannot create /dev/null: Permission denied
Could not detect number of cores, defaulting to 1.

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |======================================================================| 100%
Scale for 'x' is already present. Adding another scale for 'x', which will
replace the existing scale.

LymphoSeq documentation built on Nov. 8, 2020, 8:09 p.m.