Contents

LAST UPDATE AT

   [1] "Fri Apr 13 15:59:22 2018"

1 Required packages and other preparations

library("readxl")
library("BiocStyle")
library("knitr")
library("matrixStats")
library("RColorBrewer")
library("stringr")
library("pheatmap")
library("purrr")
library("fdrtool")
library("readr")
library("gtools")
library("factoextra")
library("magrittr")
library("entropy")
library("forcats")
library("plotly")
library("corrplot")
library("car")
library("forcats")
library("openxlsx")
library("readxl")
library("limma")
library("ggthemes")
library("tidyverse")

theme_set(theme_solarized(base_size = 18))


data_dir <- file.path("data/")

2 Introduction to (single cell) RNA–Seq data

The advent of next-generation sequencing over a decade ago spurred the development of a host of sequencing-based technologies. One major innovation, RNA–sequencing (RNA–seq) enabled transcriptomic profiling at unprecedented sensitivity and breadth, leading to the discovery of new RNA species and deepening our understanding of transcriptome dynamics. In recent years, low-input RNA-seq methods have been adapted to work in single cells. These single-cell RNA-seq (scRNA- seq) technologies can quantify intra-population heterogeneity and enable study of cell states and transitions at very high resolution, potentially revealing cell subtypes or gene expression dynamics that are masked in bulk, population-averaged measurements.

In RNA–Seq, RNA is captured for reverse transcription into cDNA. This cDNA is pre-amplified and then used to prepare libraries for sequencing and downstream analysis. In single cell RNA–Seq (scRNA–Seq), the cells have to be lysed first. The capture effeciency of scRNA–Seq is quite only around 10%, so the data obtained is often quite sparse: Many genes are simply not captured.

3 The Brennecke et. al. mTEC data

The ability of the immune system to distinguish self from foreign (“self–antigen–tolerance”) is largely established in the thymus, a primary lymphoid organ where T cells develop.

Intriguingly, T–cells encounter most tissue–specific constituents already there, thus imposing a broad scope of tolerance before T cells circulate through the body.

This “training” of the T–cells is neccessary to prevent autoimunity. It happens by the “promiscuous” expression of numerous tissue-specific antigens (TRAs) in medullary thymic epithelial cells (mTECs, Kyewski and Klein (2006)).

However, it is poorly understood how this process is regulated in single mTECs and is coordinated at the population level. Brennecke et al. (2015) obtained scRNA–Seq data of mTECs and find evidence of numerous recurring TRA–co–expression patterns, each present in only a subset of mTECs. Thus, they could show that the gene expression in mTEC cells rather “mosaic” and coordianted rather than entirely stochastic.

Before we dive more deeply into the data, we review important R basics.

4 Basics of arithmetics and data handling in R

4.1 Elementary data types and arithmetics

The elementary unit in R is an object and the simplest objects are scalars, vectors and matrices. R is designed with interactivity in mind, so you can get started by simply typing:

4 + 6
   [1] 10

What does R do? It sums up the two numbers and returns the scalar value 10. In fact, R returns a vector of length 1 - hence the [1] denoting first element of the vector. We can assign objects values for subsequent use. For example:

x <- 6
y <- 4
z <- x + y
z
   [1] 10

does the same calculation as above, storing the result in an object called z. We can look at the contents of the object by simply typing its name. At any time we can list the objects which we have created:

ls()
   [1] "data_dir"     "golden_ratio" "x"            "y"            "z"

Notice that ls is actually an object itself. Typing ls ould result in a display of the contents of this object, in this case, the commands of the function. The use of parentheses, ls(), ensures that the function is executed and its result — in this case, a list of the objects in the current environment — displayed. More commonly, a function will operate on an object, for example

sqrt(16)
   [1] 4

calculates the square root of 16. Objects can be removed from the current workspace with the function rm(). There are many standard functions available in R, and it is also possible to create new ones. Vectors can be created in R in a number of ways. For example, we can list all of the elements:

z <- c(5, 9, 1, 0)

Note the use of the function c to concatenate or “glue together” individual elements. This function can be used much more widely, for example

x <- c(5, 9)
y <- c(1, 0)
z <- c(x, y)

would lead to the same result by gluing together two vectors to create a single vector. Sequences can be generated as follows:

seq(1, 9, by = 2)
   [1] 1 3 5 7 9
seq(8, 20, length = 6)
   [1]  8.0 10.4 12.8 15.2 17.6 20.0

These examples illustrate that many functions in R have optional arguments, in this case, either the step length or the total length of the sequence (it doesn’t make sense to use both). If you leave out both of these options, R will make its own default choice, in this case assuming a step length of 1. So, for example,

x <- seq(1, 10)

also generates a vector of integers from 1 to 10. At this point it’s worth mentioning the help facility again. If you don’t know how to use a function, or don’t know what the options or default values are, type help(functionname) or simply ?functionname where functionname is the name of the function you are interested in. This will usually help and will often include examples to make things even clearer. Another useful function for building vectors is the rep command for repeating things: the first command will repeat the vector 1, 2, 3 six times, will the second one will repeat each element six times.

rep(1:3, 6)
    [1] 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
rep(1:3, times = c(6, 6, 6))
    [1] 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3

R will often adapt to the objects it is asked to work on. An example is the vectorized arithmetic used in R:

x <- 1:5
y <- 5:1
x + y
   [1] 6 6 6 6 6
x^2
   [1]  1  4  9 16 25
x * y
   [1] 5 8 9 8 5

showing that R uses component-wise arithmetic on vectors. R will also try to make sense of a statement if objects are mixed. For example:

x <- c(6, 8 , 9 )
x + 2
   [1]  8 10 11

Two particularly useful functions worth remembering are length, which returns the length of a vector (i.e. the number of elements it contains) and sum which calculates the sum of the elements of a vector. R also has basic calculator capabilities:

  • a+b, a-b, a\*b, a\*\*b (a to the power of b)
  • additionally: sqrt(a), sin(a)

and some simple statistics:

  • mean(a)
  • summary(a)
  • var(a)
  • min(a,b), max(a,b)

4.2 Subscripting and useful vector functions

Let’s suppose we’ve collected some data from an experiment and stored them in an object x. Some simple summary statistics of these data can be produced:

x <- c(7.5, 8.2, 3.1, 5.6, 8.2, 9.3, 6.5, 7.0, 9.3, 1.2, 14.5, 6.2)
mean(x)
   [1] 7.22
var(x)
   [1] 11
summary(x)
      Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      1.20    6.05    7.25    7.22    8.47   14.50

It may be, however, that we subsequently learn that the first 6 data points correspond to measurements made in one experiment, and the second six on another experiment. This might suggest summarizing the two sets of data separately, so we would need to extract from x the two relevant subvectors. This is achieved by subscripting:

x[1:6]
   [1] 7.5 8.2 3.1 5.6 8.2 9.3
x[7:12]
   [1]  6.5  7.0  9.3  1.2 14.5  6.2
summary(x[1:6])
      Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      3.10    6.07    7.85    6.98    8.20    9.30
summary(x[7:12])
      Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      1.20    6.28    6.75    7.45    8.73   14.50

You simply put the indexes of the element you want to access in square brackets. Note that R starts counting from 1 onwards. Other subsets can be created in the obvious way. Putting a minus in front, excludes the elements:

x[c(2, 4, 9)]
   [1] 8.2 5.6 9.3
x[-(1:6)]
   [1]  6.5  7.0  9.3  1.2 14.5  6.2
head(x)
   [1] 7.5 8.2 3.1 5.6 8.2 9.3

The function head provides a preview of the vector. There are also
useful functions to order and sort vectors:

  • sort: sort in increasing order
  • order: orders the indexes is such a way that the elements of the vector are sorted, i.e sort(v) = v[order(v)]

  • rank: gives the ranks of the elements of a vector, different options for handling ties are available.

x <- c(1.3, 3.5, 2.7, 6.3, 6.3)
sort(x)
   [1] 1.3 2.7 3.5 6.3 6.3
order(x)
   [1] 1 3 2 4 5
x[order(x)]
   [1] 1.3 2.7 3.5 6.3 6.3
rank(x)
   [1] 1.0 3.0 2.0 4.5 4.5

4.3 Matrices

Matrices are two–dimensional vectors and can be created in R in a variety of ways. Perhaps the simplest is to create the columns and then glue them together with the command cbind. For example:

x <- c(5, 7 , 9)
y <- c(6, 3 , 4)
z <- cbind(x, y)
z
        x y
   [1,] 5 6
   [2,] 7 3
   [3,] 9 4
dim(z)
   [1] 3 2

We can also use the function matrix() directly to create a matrix.

z <- matrix(c(5, 7, 9, 6, 3, 4), nrow = 3)

There is a similar command, rbind, for building matrices by gluing rows together. The functions cbind and rbind can also be applied to matrices themselves (provided the dimensions match) to form larger matrices.

Notice that the dimension of the matrix is determined by the size of the vector and the requirement that the number of rows is 3 in the example above, as specified by the argument nrow = 3. As an alternative we could have specified the number of columns with the argument ncol = 2 (obviously, it is unnecessary to give both). Notice that the matrix is “filled up” column-wise. If instead you wish to fill up row-wise, add the option byrow=TRUE.

z <- matrix(c(5, 7 , 9 , 6 , 3 , 4), nrow = 3, byrow = TRUE)
z
        [,1] [,2]
   [1,]    5    7
   [2,]    9    6
   [3,]    3    4

R will try to interpret operations on matrices in a natural way. For example, with z as above, and y defined below we get:

y <- matrix(c(1, 3, 0, 9, 5, -1), nrow = 3, byrow = TRUE)
y
        [,1] [,2]
   [1,]    1    3
   [2,]    0    9
   [3,]    5   -1
y + z
        [,1] [,2]
   [1,]    6   10
   [2,]    9   15
   [3,]    8    3
y * z
        [,1] [,2]
   [1,]    5   21
   [2,]    0   54
   [3,]   15   -4

Notice that multiplication here is component–wise. As with vectors it is useful to be able to extract sub-components of matrices. In this case, we may wish to pick out individual elements, rows or columns. As before, the [ ] notation is used to subscript. The following examples illustrate this:

z[1, 1]
   [1] 5
z[, 2]
   [1] 7 6 4
z[1:2, ]
        [,1] [,2]
   [1,]    5    7
   [2,]    9    6
z[-1, ]
        [,1] [,2]
   [1,]    9    6
   [2,]    3    4
z[-c(1, 2), ]
   [1] 3 4

So, in particular, it is necessary to specify which rows and columns are required, whilst omitting the index for either dimension implies that every element in that dimension is selected.

4.4 Data frames (tibbles) and lists

A data frame is a matrix where the columns can have different data types. As such, it is usually used to represent a whole data set, where the rows represent the samples and columns the variables. Essentially, you can think of a data frame as an excel table.

Here, we will meet the first tidyverse member, namely the tibble package, which improves the conventional R data.frame class. A tibble is a data.frame which a lot of tweaks and more sensible defaults that make your life easier. For details on the tweaks, see the help on tibble: ?tibble so that you never have to use a standard data frame anymore.

Let’s illustrate this by the small data set saved in comma–separated-format (csv) — patients. We load it in from a website using the function read_csv, which is used to import a data file in comma separated format — csv into R. In a .csv–file the data are stored row–wise, and the entries in each row are separated by commas.

The function read_csv is from the readr package and will give us a tibble as the result. The function glimpse() gives a nice summary of a tibble.

pat <- read_csv("http://www-huber.embl.de/users/klaus/BasicR/Patients.csv")
   Parsed with column specification:
   cols(
     PatientId = col_character(),
     Height = col_double(),
     Weight = col_double(),
     Gender = col_character()
   )
pat
glimpse(pat)
   Observations: 3
   Variables: 4
   $ PatientId <chr> "P1", "P2", "P3"
   $ Height    <dbl> 1.65, 1.90, 1.60
   $ Weight    <dbl> 75, NA, 50
   $ Gender    <chr> "f", "m", "f"

It has weight, height and gender of three people.

4.5 Accessing data in data frames

Now that we have imported the small data set, you might be wondering how to actually access the data. For this the functions filter and select from the dplyr package of the tidyverse are useful. filter will select certain rows (observations), while select will subset the columns (variables of the data). In the following command, we get all the patients that are less tall than 1.5 and select their Height and Gender as well as their Id:

pat_tiny <- filter(pat, Height < 1.7)
select(pat_tiny, PatientId,  Height, Gender)

There are a couple of operators useful for comparisons:

  • Variable == value: equal
  • Variable != value: un–equal
  • Variable < value: less
  • Variable > value: greater
  • &: and
  • | or
  • !: negation
  • %in%: is element?

The function filter allows us to combine multiple conditions easily, if you specify multiple of them, they will automatically concatenated via a &. For example, we can easily get light and female patients via:

filter(pat, Height < 1.7, Gender == "f")

We can also retrieve small OR female patients via

filter(pat, (Height < 1.5) | (Gender == "f"))

4.6 Vectors with arbitrary contents: Lists

Lists can be viewed as vectors that contain not only elementary objects such as number or strings but can potentially arbitrary objects. The following example will make this clear. The list that we create contains a number, two vectors and a string that is itself part of a list.

L <- list(one = 1, two = c(1, 2), five = seq(1, 4, length = 5), 
          list(string = "Hello World"))
L
   $one
   [1] 1
   
   $two
   [1] 1 2
   
   $five
   [1] 1.00 1.75 2.50 3.25 4.00
   
   [[4]]
   [[4]]$string
   [1] "Hello World"

Lists are the most general data type in R. In fact, data frames (tibbles) are lists with elements of equal lengths. List elements can either be accessed by their name using the dollar sign $ or via their position via a double bracket operator [[]].

names(L)
   [1] "one"  "two"  "five" ""
L$five + 10
   [1] 11.0 11.8 12.5 13.2 14.0
L[[3]] + 10
   [1] 11.0 11.8 12.5 13.2 14.0

Using only a single bracket ([]) will extract a sublist, so the result will always be a list, while the dollar sign $ or the double bracket operator [[]] removes a level of the list hierarchy. Thus, in order to access the string, we would first have to extract the sublist containing the string from L and then get the actual string from the sublist, [[ drills down into the list while [ returns a new, smaller list.

L[[4]]$string
   [1] "Hello World"
L[2]
   $two
   [1] 1 2

Since data frames are just a special kind of lists, they can actually be accessed in the same way.

pat$Height
   [1] 1.65 1.90 1.60
pat[[2]]
   [1] 1.65 1.90 1.60
pat[["Gender"]]
   [1] "f" "m" "f"

More on lists can be found in the respective chapter of “R for data science” here.

4.7 Summary: data access in R

We prape a simple vector to illustrate the access options again:

sample_vector <- c("Alice" = 5.4, "Bob" = 3.7, "Claire" = 8.8)
sample_vector
    Alice    Bob Claire 
      5.4    3.7    8.8

4.7.1 Access by index

The simplest way to access the elements in a vector is via their indices. Specifically, you provide a vector of indices to say which elements from the vector you want to retrieve. A minus sign excludes the respective positions

sample_vector[1:2]
   Alice   Bob 
     5.4   3.7
sample_vector[-(1:2)]
   Claire 
      8.8

4.7.2 Access by boolean

If you generate a boolean vector the same size as your actual vector you can use the positions of the true values to pull out certain positions from the full set. You can also use smaller boolean vectors and they will be concatenated to match all of the positions in the vector, but this is less common.

sample_vector[c(TRUE, FALSE, TRUE)]
    Alice Claire 
      5.4    8.8

This can also be used in conjunction with logical tests which generate a boolean result. Boolean vectors can be combined with logical operators to create more complex filters.

sample_vector[sample_vector < 6]
   Alice   Bob 
     5.4   3.7

4.7.3 Access by name

if there are names such as column names present (note that rowname are not preserved in the tidyverse), you can access by name as well:

sample_vector[c("Alice", "Claire")]
    Alice Claire 
      5.4    8.8

5 mTEC quality control data

For each single-cell transcriptome of the mTEC data, the sequenced fragments were mapped to the Mouse reference genome. For each sample the reads were classified as either:

We look at the data after importing it via a load command from an RData file.

load(file.path(data_dir, "sc_qc_stats.RData"))
sc_qc_stats

6 Introducing tibbles: a data.frame replacement

sc_qc_stats is a tibble. A tibble is a data.frame which a lot of tweaks and more sensible defaults that make your life easier, among other things it …

  1. Never coerces inputs (i.e. strings stay as strings!)

  2. Never adds row.names

  3. Never munges column names (they stay as they are)

  4. Only recycles length 1 inputs.

  5. Automatically adds column names.

The data is a typical data set in a tabular format, where multipe mapping statistics are given for each single cell. The table is in a “long” format, meaning that each single cell has data in multiple rows.

The columns give the annotation variables (a.k.a. “keys”): type, cell and batch as well as on measuremnt (percent). An important concept in data handling is “tidy data” and we will explain what that means next.

7 The concept of tidy data

In a nutshell, a dataset is a collection of values, usually either numbers (if quantitative) or strings (if qualitative). Values are organized in two ways: Every value belongs to a variable and an observation.

A variable contains all values that measure an underlying attribute (like height, temperature, duration, or here: percentage of reads) across units. An observation contains all values measured on the same unit (like a person, a day or a single cell) across attributes.

Now, a tidy data frame has:

  1. one row per observation

  2. one column per variable

  3. on cell per value

Tidy data will result in a “long” data table and is the most appropriate format for data handling. It allows straighforward subestting and group–wise computations. However, a “wide” data table is better for viewing.

In our quality control data, the requirements for tidy data are fullfilled. However, for viewing, it would be nice to make the data “wider” by spreading the columns type and `percent across multiple columns, so that we all data for one single cell in one single row.

The package tidyr has two main functions that allows us to go back and forth:

Widening our data frame is simple: we provide a column to spread (a key column) and a column containing the values use (a value column). Our key column is type and our value column is percent

sc_qc_stats_wide  <- spread(sc_qc_stats, key = type, value = percent)
sc_qc_stats_wide

We now have separate columns for every mapping type, which makes it easier to view the data. This data is not “tidy”, as the columns we created contain both ther pecent as well as the type variable — We have multiple variables per column.

The function gather can be used to obtain the original format again:

sc_qc_stats_org <- gather(sc_qc_stats_wide, key = "type",
                          value = "percent", concordantMult:others)

We specify to gather the percentages in a column percent and the mapping type in a column type. The type column allows the matching of the percentages to the corresponding column in the wide data frame. Hence it is called a key column.

8 Basic data manipulation with dplyr verbs

The package dplyr provides a “grammar” of data manipulation. We will also use them extensively later on when discussing the “split–apply–combine” strategy for data analysis.

Since the first thing you do in a data manipulation task is to subset/transform your data, it includes “verbs” that provide basic functionality. We will introduce these in the following. The command structure for all dplyr verbs is :

Note that dplyr generally does not preserve row names.

8.1 Selecting rows (observations) by their values with filter()

The function filter() allows you to select a subset of the rows of a data frame. The first argument is the name of the data frame, and the second and subsequent are filtering expressions evaluated in the context of that data frame. In the command below, we get all cells with at least 80% of concordantly mapped read pairs.

filter(sc_qc_stats_wide, concordantUniq > 80 )

filter() works similarly to subset() except that you can give it any number of filtering conditions which are joined together with & (not && which is easy to do accidentally otherwise).

head(filter(sc_qc_stats_wide, concordantUniq > 80, others < 5 ))

You can use other boolean operators explicitly as in:

head(filter(sc_qc_stats_wide, concordantUniq > 80 | nomap < 10 ))

8.2 Arrange rows (samples) with arrange()

arrange() works similarly to filter() except that instead of filtering or selecting rows, it reorders them. It takes a data frame, and a set of column names (or more complicated expressions) to order by. If you provide more than one column name, each additional column will be used to break ties in the values of preceding columns:

arrange(sc_qc_stats_wide, concordantUniq, nomap) 

Use desc() to order a column in descending order:

arrange(sc_qc_stats_wide, desc(concordantUniq), nomap) 

8.3 Select columns (variables) by their names with select()

Often you work with large data sets with many columns where only a few are actually of interest to you. select() allows you to rapidly zoom in on a useful subset using operations that usually only work on numeric variable positions. This way, we can e.g. select only the column giving the percentage of uniquely mapping reads.

select(sc_qc_stats_wide, concordantUniq) 

The select is similar to the basic R acccess options for data frame: the square bracket for index/name based access.

sc_qc_stats_wide[, "concordantUniq"]
idx <- which(colnames(sc_qc_stats_wide) == "concordantUniq")
idx
   [1] 5
sc_qc_stats_wide[, idx]

There are two options for obtaining a vector as a return type, the double bracket [[ and the dollar sign $.

head(sc_qc_stats_wide$concordantUniq, 5)
   [1] 82.6 87.6 88.2 74.5 79.7
head(sc_qc_stats_wide[[idx]], 5)
   [1] 82.6 87.6 88.2 74.5 79.7

8.4 Create new variables using existing ones with mutate()

dplyr::mutate() allows to add columns using existing columns as input. We implement a column holding a sum of all percentages as sanity check:

sc_qc_stats_wide <- mutate(sc_qc_stats_wide, 
                           sum_perc = concordantMult + concordantUniq + nomap
                           + others)

all(round(sc_qc_stats_wide$sum_perc) == 100)
   [1] TRUE

Indeed, all of the mapped reads are assigned to at least one category for every single cell.

8.5 Grouped summaries: group_by() and summarize()

While the basic dplyr verbs merely replicate base R functionality, they become really powerful when used in conjuction with grouped data frames.

The function group_by() creates groups in a data frame to which you can then apply any set of functions and finally obtain a new data frame with the results via a call to summarize().

Let’s look at the mean alignment rates per batch:

sc_qc_stats_per_batch <- group_by(sc_qc_stats, type, batch)

sc_qc_mean_align_per_batch <- filter(summarize(sc_qc_stats_per_batch, 
          mean_align_rate = mean(percent)),
         type == "concordantUniq")

sc_qc_mean_align_per_batch

Here, we first group the data by type and batch, then summarize the percentages per read category and finally subset the result so that only the mean rate for the concordant read pairs are given. Note that each call to summarize peels off one level of grouping. The function ungroup() can be used to remove the grouping again.

9 The piping / chaining operator

Our code in the previous code chunk is neither very elegent nor clear: we create an intermediate data table for the grouped data and then use this in a line of code that has to be read from the inside to outside.

To change this, we use the chaining (or piping) operator %>%. x %>% f(y) simply means f(x, y). Thus, the current data frame can be put into a function (or even multiple processing steps), which in turn returns a data frame.

This allows us to code multiple operations in such a way that they can be read from you can read from left–to–right, top–to–bottom.

A simple example will make that clear: We create two vectors and calculate Euclidean distance between them. Instead of the usual way:

x1 <- 1:5; x2 <- 2:6
sqrt(sum((x1 - x2)^2))
   [1] 2.24

We can use the piping operator

(x1 - x2)^2 %>%
sum() %>%
sqrt()
   [1] 2.24

Which makes the set of operations much easier to digest and understand. We can simplify our code like this:

sc_qc_mean_align_per_batch <- group_by(sc_qc_stats, batch, type ) %>%
                                  summarize(mean_align_rate = mean(percent)) %>%
                                  filter(type == "concordantUniq")

It is now clear that you group first, then you summarize and then you filter.

9.1 Filtering per group

Filtering also works on grouped data frames, we can identify the cell with the worst alignment rate in each batch like this:

worst_cells <-  group_by(sc_qc_stats, batch, type ) %>%
                                  filter(percent == min(percent), 
                                         type == "concordantUniq") %>%
                                         arrange(percent)  

worst_cells 

11 Session Info

sessionInfo()
   R version 3.4.4 (2018-03-15)
   Platform: x86_64-pc-linux-gnu (64-bit)
   Running under: Ubuntu 16.04.4 LTS
   
   Matrix products: default
   BLAS: /usr/lib/libblas/libblas.so.3.6.0
   LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
   
   locale:
    [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
    [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8    
    [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8   
    [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
    [9] LC_ADDRESS=C               LC_TELEPHONE=C            
   [11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       
   
   attached base packages:
   [1] stats4    parallel  stats     graphics  grDevices utils     datasets 
   [8] methods   base     
   
   other attached packages:
    [1] bibtex_0.4.2                     knitcitations_1.0.8             
    [3] hexbin_1.27.2                    devtools_1.13.5                 
    [5] Rtsne_0.13                       vsn_3.46.0                      
    [7] psych_1.8.3.3                    recount_1.4.6                   
    [9] locfit_1.5-9.1                   scran_1.6.9                     
   [11] Single.mTEC.Transcriptomes_1.6.0 bindrcpp_0.2.2                  
   [13] randomForest_4.6-14              crossval_1.0.3                  
   [15] sda_1.3.7                        clue_0.3-54                     
   [17] clusterExperiment_1.4.0          zinbwave_1.0.0                  
   [19] SingleCellExperiment_1.0.0       sva_3.26.0                      
   [21] BiocParallel_1.12.0              genefilter_1.60.0               
   [23] mgcv_1.8-23                      nlme_3.1-137                    
   [25] corpcor_1.6.9                    broom_0.4.4                     
   [27] DESeq2_1.18.1                    SummarizedExperiment_1.8.1      
   [29] DelayedArray_0.4.1               Biobase_2.38.0                  
   [31] GenomicRanges_1.30.3             GenomeInfoDb_1.14.0             
   [33] IRanges_2.12.0                   S4Vectors_0.16.0                
   [35] BiocGenerics_0.24.0              MASS_7.3-49                     
   [37] dplyr_0.7.4                      tidyr_0.8.0                     
   [39] tibble_1.4.2                     tidyverse_1.2.1                 
   [41] ggthemes_3.4.2                   limma_3.34.9                    
   [43] openxlsx_4.0.17                  car_3.0-0                       
   [45] carData_3.0-1                    corrplot_0.84                   
   [47] plotly_4.7.1                     forcats_0.3.0                   
   [49] entropy_1.2.1                    magrittr_1.5                    
   [51] factoextra_1.0.5                 ggplot2_2.2.1                   
   [53] gtools_3.5.0                     readr_1.1.1                     
   [55] fdrtool_1.2.15                   purrr_0.2.4                     
   [57] pheatmap_1.0.8                   stringr_1.3.0                   
   [59] RColorBrewer_1.1-2               matrixStats_0.53.1              
   [61] readxl_1.0.0                     knitr_1.20                      
   [63] BiocStyle_2.6.1                 
   
   loaded via a namespace (and not attached):
     [1] Hmisc_4.1-1              class_7.3-14             Rsamtools_1.30.0        
     [4] foreach_1.4.4            rprojroot_1.3-2          glmnet_2.0-16           
     [7] crayon_1.3.4             backports_1.1.2          rlang_0.2.0             
    [10] XVector_0.18.0           phylobase_0.8.4          scater_1.6.3            
    [13] rjson_0.2.15             bit64_0.9-7              glue_1.2.0              
    [16] trimcluster_0.1-2        rngtools_1.2.4           vipor_0.4.5             
    [19] AnnotationDbi_1.40.0     shinydashboard_0.7.0     haven_1.1.1             
    [22] rio_0.5.10               XML_3.98-1.10            zoo_1.8-1               
    [25] GenomicAlignments_1.14.2 xtable_1.8-2             evaluate_0.10.1         
    [28] cli_1.0.0                zlibbioc_1.24.0          rstudioapi_0.7          
    [31] doRNG_1.6.6              whisker_0.3-2            rpart_4.1-13            
    [34] derfinderHelper_1.12.0   locfdr_1.1-8             tinytex_0.4             
    [37] shiny_1.0.5              xfun_0.1                 cluster_2.0.7           
    [40] ggrepel_0.7.0            ape_5.1                  stabledist_0.7-1        
    [43] dendextend_1.7.0         Biostrings_2.46.0        reshape_0.8.7           
    [46] withr_2.1.2              bitops_1.0-6             plyr_1.8.4              
    [49] cellranger_1.1.0         pcaPP_1.9-73             pillar_1.2.1            
    [52] bumphunter_1.20.0        GenomicFeatures_1.30.3   flexmix_2.3-14          
    [55] kernlab_0.9-25           RMySQL_0.10.14           NMF_0.21.0              
    [58] tools_3.4.4              foreign_0.8-69           rncl_0.8.2              
    [61] beeswarm_0.2.3           munsell_0.4.3            compiler_3.4.4          
    [64] abind_1.4-5              httpuv_1.3.6.2           rtracklayer_1.38.3      
    [67] pkgmaker_0.22            GenomeInfoDbData_1.0.0   gridExtra_2.3           
    [70] edgeR_3.20.9             lattice_0.20-35          jsonlite_1.5            
    [73] affy_1.56.0              scales_0.5.0             lazyeval_0.2.1          
    [76] taxize_0.9.3             doParallel_1.0.11        latticeExtra_0.6-28     
    [79] checkmate_1.8.5          rmarkdown_1.9            statmod_1.4.30          
    [82] downloader_0.4           copula_0.999-18          softImpute_1.4          
    [85] BSgenome_1.46.0          igraph_1.2.1             survival_2.41-3         
    [88] numDeriv_2016.8-1        yaml_2.1.18              prabclus_2.2-6          
    [91] htmltools_0.3.6          memoise_1.1.0            VariantAnnotation_1.24.5
    [94] modeltools_0.2-21        viridisLite_0.3.0        digest_0.6.15           
    [97] assertthat_0.2.0         mime_0.5                 registry_0.5            
   [100] RSQLite_2.1.0            derfinder_1.12.6         data.table_1.10.4-3     
   [103] blob_1.1.1               RNeXML_2.0.8             preprocessCore_1.40.0   
   [106] splines_3.4.4            Formula_1.2-2            fpc_2.1-11              
   [109] bold_0.5.0               RCurl_1.95-4.10          hms_0.4.2               
   [112] modelr_0.1.1             rhdf5_2.22.0             colorspace_1.3-2        
   [115] base64enc_0.1-3          mnormt_1.5-5             ggbeeswarm_0.6.0        
   [118] nnet_7.3-12              tximport_1.6.0           GEOquery_2.46.15        
   [121] Rcpp_0.12.16             ADGofTest_0.3            mclust_5.4              
   [124] bookdown_0.7             mvtnorm_1.0-7            pspline_1.0-18          
   [127] R6_2.2.2                 grid_3.4.4               crul_0.5.2              
   [130] acepack_1.4.1            BiocInstaller_1.28.0     curl_3.2                
   [133] affyio_1.48.0            robustbase_0.92-8        Matrix_1.2-13           
   [136] howmany_0.3-1            qvalue_2.10.0            iterators_1.0.9         
   [139] RefManageR_0.14.20       htmlwidgets_1.0          biomaRt_2.34.2          
   [142] rvest_0.3.2              htmlTable_1.11.2         codetools_0.2-15        
   [145] lubridate_1.7.3          FNN_1.1                  prettyunits_1.0.2       
   [148] gridBase_0.4-7           RSpectra_0.12-0          gtable_0.2.0            
   [151] DBI_0.8                  dynamicTreeCut_1.63-1    httr_1.3.1              
   [154] stringi_1.1.7            progress_1.1.2           reshape2_1.4.3          
   [157] uuid_0.1-2               diptest_0.75-7           annotate_1.56.2         
   [160] viridis_0.5.1            rentrez_1.2.1            DT_0.4                  
   [163] xml2_1.2.0               ade4_1.7-11              geneplotter_1.56.0      
   [166] DEoptimR_1.0-8           bit_1.1-12               pkgconfig_2.0.1         
   [169] gsl_1.9-10.3             bindr_0.1.1              GenomicFiles_1.14.0

References

Brennecke, Philip, Alejandro Reyes, Sheena Pinto, Kristin Rattay, Michelle Nguyen, Rita Küchler, Wolfgang Huber, Bruno Kyewski, and Lars M Steinmetz. 2015. “Single-Cell Transcriptome Analysis Reveals Coordinated Ectopic Gene-Expression Patterns in Medullary Thymic Epithelial Cells.” Nature Immunology 16 (9). Springer Nature: 933–41. doi:10.1038/ni.3246.

Kyewski, Bruno, and Ludger Klein. 2006. “A CENTRAL ROLE FOR CENTRAL TOLERANCE.” Annual Review of Immunology 24 (1). Annual Reviews: 571–606. doi:10.1146/annurev.immunol.23.021704.115601.

LS0tCnRpdGxlOiAiRGF0YSBoYW5kbGluZyBmb3IgYmlvaW5mb3JtYXRpY3MiCmF1dGhvcjogIkJlcm5kIEtsYXVzIgpkYXRlOiAiYHIgZG9jX2RhdGUoKWAiCm91dHB1dDogCiAgICBCaW9jU3R5bGU6Omh0bWxfZG9jdW1lbnQ6CiAgICAgICAgdG9jOiB0cnVlCiAgICAgICAgc2VsZl9jb250YWluZWQ6IHRydWUKICAgICAgICB0b2NfZmxvYXQ6IGZhbHNlCiAgICAgICAgY29kZV9kb3dubG9hZDogdHJ1ZQogICAgICAgIGRmX3ByaW50OiBwYWdlZAogICAgICAgIHRvY19kZXB0aDogMgogICAgICAgIGhpZ2hsaWdodDogdGFuZ28KICAgIEJpb2NTdHlsZTo6cGRmX2RvY3VtZW50OgogICAgICAgIHRvYzogdHJ1ZQogICAgICAgIHRvY19kZXB0aDogMgpiaWJsaW9ncmFwaHk6IHN0YXRfbWV0aG9kc19iaW9pbmYuYmliCi0tLQoKPCEtLQpncmFwaGljcy5vZmYoKTtybShsaXN0PWxzKCkpO3JtYXJrZG93bjo6cmVuZGVyKCdkYXRhX2hhbmRsaW5nX2Jpb2luZi5SbWQnLCAKb3V0cHV0X2Zvcm1hdCA9ICJCaW9jU3R5bGU6Omh0bWxfZ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