Last updated: 2019-02-15

workflowr checks: (Click a bullet for more information)
  • R Markdown file: up-to-date

    Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

  • Environment: empty

    Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

  • Seed: set.seed(20181119)

    The command set.seed(20181119) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

  • Session information: recorded

    Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

  • Repository version: 0d6ec80

    Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

    Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
    
    Ignored files:
        Ignored:    .Rproj.user/
    
    
    Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
Expand here to see past versions:
    File Version Author Date Message
    Rmd 0d6ec80 simingz 2019-02-15 permutation-qqplot
    Rmd 02a94e5 simingz 2019-02-15 permutation-qqplot
    html 02a94e5 simingz 2019-02-15 permutation-qqplot
    Rmd 01a5914 simingz 2019-02-14 permutation
    html 01a5914 simingz 2019-02-14 permutation
    html a78d83a simingz 2018-12-17 explore filtering
    Rmd 49ecf6e simingz 2018-12-16 explore filtering
    html 49ecf6e simingz 2018-12-16 explore filtering


Load data

source("code/summary_functions.R")
library(dplyr)
library(gtools)
library(data.table)
load("data/DE_input.Rd")
glocus <- "VPS45"
Nperm <- 5
dim(dm)[1]
NULL
gcount <- dm[1:(dim(dm)[1]-76), colnames(dm1dfagg)[dm1dfagg[glocus,] >0 & nlocus==1]]
# negative control cells defined as neg gRNA targeted cells
ncount <- dm[1:(dim(dm)[1]-76), colnames(dm1dfagg)[dm1dfagg["neg",] >0 & nlocus==1]]
coldata <- data.frame(row.names = c(colnames(gcount),colnames(ncount)),     
                      condition=c(rep('G',dim(gcount)[2]),rep('N',dim(ncount)[2])))
countall <- cbind(gcount,ncount)
totalcount <- apply(countall,1,sum)
cellpercent <-  apply(countall,1,function(x) length(x[x>0])/length(x))

edgeR quasi-likelihood F-tests function

library(edgeR)
run_edgeR <- function(y,plotit=T) {
  # y is DGElist object
  y <- calcNormFactors(y)
  group= y$samples[,"group"]
  design <- model.matrix(~group)
  y <- estimateDisp(y,design)

  fitqlf <- glmQLFit(y,design)
  qlf <- glmQLFTest(fitqlf,coef=2)
  out <- topTags(qlf, n=Inf, adjust.method = "BH")
  
  if (plotit==T) {
    summ_pvalues(qlf$table$PValue)
    outsig <- subset(out$table,FDR <0.1)
    print(paste0("There are ",dim(outsig)[1], " genes passed FDR <0.1 cutoff"))
    print(knitr::kable(signif(as.matrix(head(out$table[order(out$table$PValue),])),digit=2)))
  }
  return(out)
}

Run edgeR–No filtering

y <- DGEList(counts= countall,group=coldata$condition)
resm <- run_edgeR(y)

Expand here to see past versions of edgeRall-1.png:
Version Author Date
01a5914 simingz 2019-02-14
49ecf6e simingz 2018-12-16

[1] "There are 18 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F   PValue       FDR
-------  ------  -------  ---  -------  --------
LY6H       -2.8      6.6   59        0   0.0e+00
LGALS1     -2.3      6.6   45        0   1.2e-06
APOE       -1.8      6.4   45        0   1.2e-06
TSPO       -1.6      6.4   41        0   6.2e-06
LBX1       -2.0      6.4   39        0   9.0e-06
LHX5       -1.5      6.3   37        0   7.8e-05

Permutation

permreslist <- list()
permreslist[[1]] <- data.table(gene=rownames(resm$table), p=resm$table$PValue, fdr=resm$table$FDR, key="gene")
for (n in 2:(Nperm+1)){
  y <- DGEList(counts= countall,group=permute(coldata$condition))
  res <- run_edgeR(y,plotit = T)
  resp <- data.table(gene=rownames(res$table), p=res$table$PValue, fdr=res$table$FDR, key="gene")
  colnames(resp) <- c("gene", paste0("perm.p_",n-1), paste0("perm.fdr_",n-1))
  permreslist[[n]] <- resp
}

Expand here to see past versions of permall-1.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 9 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue       FDR
--------  ------  -------  ---  -------  --------
MYC         -3.3      7.4   76        0   0.0e+00
LY6H         2.8      6.6   54        0   0.0e+00
APOE         1.8      6.4   41        0   6.0e-06
S100A11      1.8      6.4   39        0   1.6e-05
NEUROD1      1.7      6.4   39        0   2.4e-05
LGALS1       2.1      6.6   35        0   5.6e-05

Expand here to see past versions of permall-2.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 9 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F    PValue       FDR
--------  ------  -------  ---  --------  --------
LY6H        -2.9      6.6   65   0.0e+00   0.0e+00
NEUROD1     -1.8      6.4   47   0.0e+00   1.7e-06
APOE        -1.8      6.4   44   0.0e+00   1.7e-06
LGALS1      -2.1      6.6   39   0.0e+00   1.6e-05
GAL         -1.6      6.4   34   0.0e+00   9.9e-05
TFF3        -1.2      6.4   29   3.9e-06   1.9e-02

Expand here to see past versions of permall-3.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 18 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue       FDR
--------  ------  -------  ---  -------  --------
LY6H         2.7      6.6   52        0   2.0e-07
LGALS1       2.4      6.6   47        0   7.0e-07
NEUROD1      1.9      6.4   49        0   8.0e-07
S100A11      1.9      6.4   45        0   8.0e-07
APOE         1.7      6.4   37        0   2.7e-05
KCNMA1      -1.5      6.4   32        0   1.7e-04

Expand here to see past versions of permall-4.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 13 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue       FDR
--------  ------  -------  ---  -------  --------
LY6H        -2.6      6.6   50    0e+00   4.0e-07
S100A11     -1.9      6.4   44    0e+00   3.1e-06
APOE        -1.8      6.4   41    0e+00   8.0e-06
LBX1         2.3      6.4   37    0e+00   6.0e-05
LGALS1      -2.0      6.6   34    0e+00   8.6e-05
LHX5         1.5      6.3   34    1e-07   4.6e-04

Expand here to see past versions of permall-5.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 19 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue       FDR
--------  ------  -------  ---  -------  --------
NEUROD1     -2.0      6.4   58    0e+00   1.0e-07
LY6H         2.7      6.6   50    0e+00   2.0e-07
APOE         1.9      6.4   45    0e+00   1.2e-06
MT1F        -1.6      6.4   33    0e+00   1.8e-04
CYP26A1      1.8      6.5   32    0e+00   2.2e-04
MYC         -2.0      7.4   31    1e-07   3.0e-04
mergedres <- Reduce(merge,permreslist)
knitr::kable(mergedres[fdr <0.1,],digits = 2)
gene p fdr perm.p_1 perm.fdr_1 perm.p_2 perm.fdr_2 perm.p_3 perm.fdr_3 perm.p_4 perm.fdr_4 perm.p_5 perm.fdr_5
A2M 0 0.00 0.08 1.00 0.54 1.00 0.76 1.00 0.31 1.00 0.17 1.00
APOE 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
CALB1 0 0.00 0.13 1.00 0.16 1.00 0.95 1.00 0.11 1.00 0.34 1.00
EDN1 0 0.06 0.00 1.00 0.05 1.00 0.01 1.00 0.04 1.00 0.19 1.00
FIBIN 0 0.02 0.48 1.00 0.99 1.00 0.72 1.00 0.43 1.00 0.58 1.00
H1F0 0 0.04 0.00 0.25 0.00 0.33 0.03 1.00 0.00 0.37 0.00 0.62
LBX1 0 0.00 0.06 1.00 0.07 1.00 0.00 0.06 0.00 0.00 0.01 0.96
LGALS1 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
LHX5 0 0.00 0.41 1.00 0.36 1.00 0.00 0.00 0.00 0.00 0.00 0.04
LY6H 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
MT1F 0 0.00 0.02 1.00 0.00 0.66 0.00 0.01 0.02 1.00 0.00 0.00
NEUROD1 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
NEUROG1 0 0.00 0.33 1.00 0.01 1.00 0.00 0.02 0.47 1.00 0.06 1.00
PI15 0 0.01 0.00 0.31 0.00 0.40 0.00 0.03 0.00 0.17 0.00 0.00
RGS4 0 0.08 0.01 1.00 0.22 1.00 0.56 1.00 0.00 0.21 0.77 1.00
SLF2 0 0.08 0.96 1.00 0.30 1.00 0.24 1.00 0.06 1.00 0.89 1.00
SST 0 0.01 0.00 0.06 0.12 1.00 0.06 1.00 0.03 1.00 0.00 0.01
TSPO 0 0.00 0.16 1.00 0.02 1.00 0.16 1.00 0.21 1.00 0.00 0.53

Run edgeR–at least one cell UMI > 0

y <- DGEList(counts= countall[totalcount>0,],group=coldata$condition)
resm <- run_edgeR(y)

Version Author Date simingz 2019-02-14 simingz 2018-12-16

[1] "There are 26 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F   PValue       FDR
-------  ------  -------  ---  -------  --------
LY6H       -2.8      6.6   59        0   0.0e+00
LGALS1     -2.3      6.6   45        0   6.0e-07
APOE       -1.8      6.4   45        0   6.0e-07
TSPO       -1.6      6.4   41        0   3.3e-06
LBX1       -2.0      6.4   39        0   4.8e-06
LHX5       -1.5      6.3   37        0   4.1e-05

Permutation

permreslist <- list()
permreslist[[1]] <- data.table(gene=rownames(resm$table), p=resm$table$PValue, fdr=resm$table$FDR, key="gene")
for (n in 2:(Nperm+1)){
  y <- DGEList(counts= countall[totalcount>0,],group=permute(coldata$condition))
  res <- run_edgeR(y, plotit = T)
  resp <- data.table(gene=rownames(res$table), p=res$table$PValue, fdr=res$table$FDR, key="gene")
  colnames(resp) <- c("gene", paste0("perm.p_",n-1), paste0("perm.fdr_",n-1))
  permreslist[[n]] <- resp
}

Version Author Date simingz 2019-02-15

[1] "There are 29 genes passed FDR <0.1 cutoff"

                 logFC   logCPM    F   PValue       FDR
--------------  ------  -------  ---  -------  --------
LY6H               2.8      6.6   55    0e+00   0.0e+00
APOE               1.7      6.4   38    0e+00   2.4e-05
G0S2               1.6      6.4   42    0e+00   2.4e-05
LGALS1             2.0      6.6   33    0e+00   1.2e-04
RP11-389K14.3     -1.3      6.3   40    2e-07   7.2e-04
NEUROD1            1.5      6.4   28    3e-07   7.9e-04

Version Author Date simingz 2019-02-15

[1] "There are 16 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F    PValue       FDR
--------  ------  -------  ---  --------  --------
CLDN5        3.4      6.8   69   0.0e+00   0.0e+00
LY6H        -2.8      6.6   58   0.0e+00   0.0e+00
APOE        -1.8      6.4   43   0.0e+00   1.9e-06
NEUROD1     -1.7      6.4   38   0.0e+00   2.4e-05
LGALS1      -1.7      6.6   26   7.0e-07   2.2e-03
SPARCL1     -1.0      6.3   40   6.5e-06   1.7e-02

Version Author Date simingz 2019-02-15

[1] "There are 26 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue   FDR
--------  ------  -------  ---  -------  ----
LY6H        -3.2      6.6   77        0     0
S100A11     -2.2      6.4   69        0     0
CLDN5       -2.9      6.8   54        0     0
APOE        -1.9      6.4   50        0     0
LGALS1      -2.4      6.6   50        0     0
GAL         -1.9      6.4   50        0     0

Version Author Date simingz 2019-02-15

[1] "There are 9 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue       FDR
--------  ------  -------  ---  -------  --------
APOE         1.9      6.4   46    0e+00   8.0e-07
NEUROD1     -1.8      6.4   48    0e+00   8.0e-07
LY6H         2.5      6.6   42    0e+00   2.5e-06
MT1F        -1.6      6.4   33    0e+00   1.3e-04
LGALS1       1.9      6.6   30    1e-07   3.6e-04
GAL          1.5      6.4   27    4e-07   1.2e-03

Version Author Date simingz 2019-02-15

[1] "There are 20 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue       FDR
--------  ------  -------  ---  -------  --------
LY6H         2.9      6.6   56    0e+00   0.0e+00
S100A11      2.3      6.4   42    0e+00   9.1e-06
APOE         1.7      6.4   35    0e+00   4.6e-05
CALB1        1.4      6.3   51    1e-07   2.4e-04
LBX1         1.8      6.4   31    1e-07   2.4e-04
LGALS1       1.9      6.6   30    1e-07   2.4e-04
mergedres <- Reduce(merge,permreslist)
knitr::kable(mergedres[fdr <0.1,],digits = 2)
gene p fdr perm.p_1 perm.fdr_1 perm.p_2 perm.fdr_2 perm.p_3 perm.fdr_3 perm.p_4 perm.fdr_4 perm.p_5 perm.fdr_5
A2M 0 0.00 0.24 0.68 0.47 0.87 0.77 0.98 0.58 0.93 0.01 0.66
APOE 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
CALB1 0 0.00 0.00 0.13 0.13 0.71 0.00 0.06 0.10 0.73 0.00 0.00
CMTM8 0 0.06 0.24 0.68 0.92 0.99 0.09 0.74 0.08 0.73 0.95 0.99
EDN1 0 0.03 0.00 0.02 0.00 0.02 0.03 0.74 0.00 0.24 0.00 0.47
FAM228B 0 0.07 0.04 0.67 0.22 0.71 0.84 0.99 0.26 0.73 0.75 0.96
FIBIN 0 0.01 0.82 0.98 0.87 0.99 0.92 0.99 0.61 0.93 0.01 0.66
GAL 0 0.10 0.00 0.00 0.03 0.71 0.00 0.00 0.00 0.00 0.01 0.57
GAP43 0 0.07 0.61 0.90 0.26 0.72 0.67 0.94 0.92 0.99 0.01 0.54
H1F0 0 0.02 0.00 0.29 0.00 0.50 0.60 0.93 0.00 0.36 0.00 0.29
KRT18 0 0.07 0.00 0.27 0.04 0.71 0.00 0.38 0.02 0.73 0.00 0.28
LBX1 0 0.00 0.22 0.68 0.11 0.71 0.04 0.74 0.04 0.73 0.00 0.00
LGALS1 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
LHX5 0 0.00 0.56 0.88 0.16 0.71 0.00 0.00 0.07 0.73 0.00 0.00
LINC00338 0 0.08 0.89 1.00 0.33 0.78 0.03 0.74 0.47 0.89 0.31 0.76
LY6H 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
MT1F 0 0.00 0.00 0.03 0.00 0.48 0.00 0.06 0.00 0.00 0.01 0.55
NEUROD1 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
NEUROG1 0 0.00 0.99 1.00 0.02 0.65 0.05 0.74 0.06 0.73 0.33 0.78
OTP 0 0.07 0.00 0.09 0.00 0.17 0.00 0.08 0.00 0.20 0.00 0.17
PI15 0 0.00 0.00 0.09 0.00 0.26 0.00 0.05 0.00 0.20 0.00 0.02
RGS4 0 0.04 0.58 0.88 0.01 0.65 0.42 0.86 0.79 0.99 0.76 0.96
SLF2 0 0.04 0.57 0.88 0.33 0.78 0.56 0.93 0.77 0.98 0.53 0.89
SMOC2 0 0.10 0.14 0.68 0.02 0.65 0.46 0.89 0.03 0.73 0.03 0.71
SST 0 0.00 0.02 0.62 0.00 0.08 0.11 0.74 0.05 0.73 0.00 0.02
TSPO 0 0.00 0.45 0.84 0.99 1.00 0.02 0.74 0.13 0.73 0.14 0.71

Run edgeR–3% cells with UMI > 0

y <- DGEList(counts= countall[cellpercent > 0.03,],group=coldata$condition)
resm <- run_edgeR(y)

Expand here to see past versions of edgeR0.03-1.png:
Version Author Date
01a5914 simingz 2019-02-14
49ecf6e simingz 2018-12-16

[1] "There are 20 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F   PValue       FDR
-------  ------  -------  ---  -------  --------
LY6H       -2.8      6.6   61        0   0.0e+00
LGALS1     -2.3      6.6   47        0   2.0e-07
APOE       -1.9      6.4   47        0   2.0e-07
TSPO       -1.6      6.4   43        0   1.0e-06
A2M        -1.6      6.9   35        0   1.9e-05
MT1F       -1.6      6.4   34        0   3.5e-05

Permutation

permreslist <- list()
permreslist[[1]] <- data.table(gene=rownames(resm$table), p=resm$table$PValue, fdr=resm$table$FDR, key="gene")
for (n in 2:(Nperm+1)){
  y <- DGEList(counts= countall[cellpercent > 0.03,],group=permute(coldata$condition))
  res <- run_edgeR(y,plotit = T)
  resp <- data.table(gene=rownames(res$table), p=res$table$PValue, fdr=res$table$FDR, key="gene")
  colnames(resp) <- c("gene", paste0("perm.p_",n-1), paste0("perm.fdr_",n-1))
  permreslist[[n]] <- resp
}

Expand here to see past versions of perm0.03-1.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 12 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue       FDR
--------  ------  -------  ---  -------  --------
MYC          3.2      7.4   70    0e+00   0.0e+00
LY6H        -2.9      6.6   66    0e+00   0.0e+00
APOE        -2.0      6.4   59    0e+00   0.0e+00
LGALS1      -2.5      6.6   53    0e+00   0.0e+00
SSTR2        1.7      6.4   32    0e+00   7.9e-05
DENND2A     -1.4      6.3   75    1e-07   2.2e-04

Expand here to see past versions of perm0.03-2.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 21 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F   PValue       FDR
-------  ------  -------  ---  -------  --------
LY6H        2.9      6.6   59    0e+00   0.0e+00
APOE        1.8      6.4   43    0e+00   1.9e-06
ELAVL4      1.7      6.4   32    0e+00   1.3e-04
STMN4       1.9      6.5   32    0e+00   1.4e-04
LGALS1      1.9      6.6   31    1e-07   1.7e-04
KCNMA1      1.4      6.4   28    3e-07   5.2e-04

Expand here to see past versions of perm0.03-3.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 12 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F    PValue       FDR
--------  ------  -------  ---  --------  --------
MYC          3.3      7.4   72   0.0e+00   0.0e+00
LY6H         2.8      6.6   54   0.0e+00   0.0e+00
LGALS1       2.3      6.6   43   0.0e+00   1.3e-06
APOE         1.7      6.4   36   0.0e+00   1.9e-05
CYP26A1      1.8      6.5   35   0.0e+00   2.7e-05
GAL          1.3      6.4   23   3.2e-06   6.3e-03

Expand here to see past versions of perm0.03-4.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 19 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue       FDR
-------  ------  -------  ---  --------  --------
LY6H       -2.8      6.6   60   0.0e+00   0.0e+00
APOE       -2.0      6.4   53   0.0e+00   0.0e+00
LGALS1     -2.4      6.6   49   0.0e+00   1.0e-07
KCNMA1      1.4      6.4   26   6.0e-07   1.7e-03
RASD1      -1.5      6.5   21   8.0e-06   1.9e-02
NPTX2      -1.3      6.4   20   1.2e-05   2.4e-02

Expand here to see past versions of perm0.03-5.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 36 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F   PValue       FDR
--------  ------  -------  ---  -------  --------
LY6H        -2.9      6.6   63    0e+00   0.0e+00
LGALS1      -2.4      6.6   50    0e+00   1.0e-07
APOE        -1.7      6.4   37    0e+00   1.4e-05
CALB1       -1.4      6.3   45    2e-07   6.9e-04
HES6         1.3      9.1   28    3e-07   6.9e-04
CYP26A1      1.6      6.5   27    4e-07   7.7e-04
mergedres <- Reduce(merge,permreslist)
knitr::kable(mergedres[fdr <0.1,],digits = 2)
gene p fdr perm.p_1 perm.fdr_1 perm.p_2 perm.fdr_2 perm.p_3 perm.fdr_3 perm.p_4 perm.fdr_4 perm.p_5 perm.fdr_5
A2M 0 0.00 0.23 0.96 0.80 1.00 0.71 1.00 0.18 0.86 0.03 0.67
APOE 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
CALB1 0 0.00 0.48 0.98 0.25 0.94 0.23 0.93 0.33 0.92 0.00 0.00
CMTM8 0 0.05 0.53 0.98 0.03 0.73 0.06 0.84 0.05 0.71 0.22 0.87
EDN1 0 0.04 0.27 0.97 0.32 0.95 0.02 0.75 0.39 0.94 0.00 0.12
FAM228B 0 0.06 0.39 0.97 0.96 1.00 0.80 1.00 0.83 0.99 0.55 0.95
GAL 0 0.08 0.00 0.53 0.00 0.22 0.00 0.01 0.00 0.26 0.00 0.31
GAP43 0 0.05 0.07 0.92 0.42 0.97 0.91 1.00 0.20 0.87 0.05 0.71
GLRX 0 0.08 0.12 0.92 0.21 0.93 0.25 0.94 0.00 0.03 0.01 0.53
H1F0 0 0.02 0.08 0.92 0.01 0.59 0.06 0.84 0.00 0.31 0.08 0.76
KRT18 0 0.05 0.09 0.92 0.24 0.94 0.41 0.96 0.77 0.99 0.00 0.03
LGALS1 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
LINC00338 0 0.08 0.92 0.99 0.33 0.95 0.06 0.84 0.54 0.96 0.06 0.72
LY6H 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
MT1F 0 0.00 0.00 0.16 0.00 0.05 0.00 0.01 0.00 0.15 0.00 0.29
NEUROG1 0 0.00 0.13 0.92 0.01 0.53 0.18 0.93 0.00 0.03 0.06 0.73
RGS4 0 0.05 0.09 0.92 0.17 0.92 0.07 0.84 0.02 0.63 0.03 0.67
SLF2 0 0.05 0.06 0.90 0.93 1.00 0.46 0.97 0.14 0.85 0.01 0.49
SMOC2 0 0.09 0.04 0.83 0.55 0.98 0.24 0.94 0.01 0.53 0.01 0.56
TSPO 0 0.00 0.00 0.53 0.97 1.00 0.01 0.67 0.00 0.47 0.68 0.97

Run edgeR–10% cells with UMI > 0

y <- DGEList(counts= countall[cellpercent > 0.1,],group=coldata$condition)
resm <- run_edgeR(y)

Expand here to see past versions of edgeR0.1-1.png:
Version Author Date
01a5914 simingz 2019-02-14
49ecf6e simingz 2018-12-16

[1] "There are 7 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue       FDR
-------  ------  -------  ---  --------  --------
LGALS1     -2.3      6.6   47   0.0e+00   5.0e-07
TSPO       -1.6      6.4   42   0.0e+00   2.3e-06
A2M        -1.6      6.9   35   0.0e+00   3.4e-05
SLF2        1.1      6.5   20   5.0e-05   8.6e-02
KRT18       1.3      7.1   17   5.3e-05   8.6e-02
CMTM8       1.1      6.6   17   5.7e-05   8.6e-02
save(resm, file="data/edgeR-qlf-10%filter_res.Rd")

Permutation

permreslist <- list()
permreslist[[1]] <- data.table(gene=rownames(resm$table), p=resm$table$PValue, fdr=resm$table$FDR, key="gene")
for (n in 2:(Nperm+1)){
  y <- DGEList(counts= countall[cellpercent > 0.1,],group=permute(coldata$condition))
  res <- run_edgeR(y,plotit = T)
  resp <- data.table(gene=rownames(res$table), p=res$table$PValue, fdr=res$table$FDR, key="gene")
  colnames(resp) <- c("gene", paste0("perm.p_",n-1), paste0("perm.fdr_",n-1))
  permreslist[[n]] <- resp
}

Expand here to see past versions of perm0.1-1.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 4 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue       FDR
-------  ------  -------  ---  --------  --------
LGALS1    -2.40      6.6   50   0.0e+00   1.0e-07
GDF15     -1.60      6.6   27   4.0e-07   1.9e-03
KRT18     -1.40      7.1   20   1.1e-05   3.4e-02
AHNAK     -1.10      6.4   21   4.2e-05   1.0e-01
FAM83D     1.00      6.5   16   6.8e-05   1.3e-01
ZNF91     -0.93      6.5   15   1.2e-04   1.5e-01

Expand here to see past versions of perm0.1-2.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 9 genes passed FDR <0.1 cutoff"

            logFC   logCPM    F    PValue       FDR
---------  ------  -------  ---  --------  --------
LGALS1        2.1      6.6   37   0.0e+00   3.9e-05
LGALS3BP      1.3      6.4   25   3.0e-06   1.5e-02
TOB1         -1.1      6.5   21   8.5e-06   2.3e-02
SORT1        -1.1      6.6   20   9.7e-06   2.3e-02
VAV2         -1.1      6.5   22   1.4e-05   2.7e-02
VWA1          1.1      6.5   19   2.5e-05   3.6e-02

Expand here to see past versions of perm0.1-3.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 7 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue       FDR
-------  ------  -------  ---  --------  --------
MYC         3.3      7.4   75   0.0e+00   0.0e+00
LGALS1     -2.0      6.6   34   0.0e+00   6.6e-05
ACTC1      -1.4      6.4   28   2.0e-07   7.1e-04
GDF15      -1.4      6.6   21   6.6e-06   1.4e-02
RASD1       1.5      6.5   21   8.1e-06   1.4e-02
CHKB       -1.2      6.4   36   8.7e-06   1.4e-02

Expand here to see past versions of perm0.1-4.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 3 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue       FDR
-------  ------  -------  ---  --------  --------
LGALS1    -2.20      6.6   43   0.0e+00   2.5e-06
MYC       -1.80      7.4   26   7.0e-07   3.2e-03
PDP1      -1.10      6.5   19   2.1e-05   6.7e-02
PALMD     -0.99      6.5   15   1.1e-04   2.7e-01
EIF4E2    -0.53      7.6   14   2.2e-04   4.3e-01
JOSD2     -0.87      6.5   13   3.4e-04   4.6e-01

Expand here to see past versions of perm0.1-5.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 5 genes passed FDR <0.1 cutoff"

            logFC   logCPM    F    PValue       FDR
---------  ------  -------  ---  --------  --------
MYC         -3.30      7.4   79   0.0e+00   0.00000
LGALS1       1.90      6.6   29   1.0e-07   0.00065
MT1X        -1.30      6.5   21   5.8e-06   0.01900
PPP1R14C     1.20      6.9   18   2.4e-05   0.05800
RGS16        1.50      6.8   17   5.1e-05   0.09800
CNN1         0.93      6.5   15   1.7e-04   0.22000
mergedres <- Reduce(merge,permreslist)
knitr::kable(mergedres[fdr <0.1,],digits = 2)
gene p fdr perm.p_1 perm.fdr_1 perm.p_2 perm.fdr_2 perm.p_3 perm.fdr_3 perm.p_4 perm.fdr_4 perm.p_5 perm.fdr_5
A2M 0 0.00 0.01 0.43 0.13 0.88 0.01 0.72 0.01 0.77 0.65 0.98
CMTM8 0 0.09 0.00 0.35 0.00 0.45 0.12 0.94 0.04 0.86 0.00 0.62
GAP43 0 0.09 0.02 0.46 0.07 0.82 0.10 0.94 0.02 0.83 0.01 0.71
KRT18 0 0.09 0.00 0.03 0.44 0.94 0.09 0.94 0.00 0.71 0.00 0.62
LGALS1 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
SLF2 0 0.09 0.02 0.49 0.49 0.95 0.84 1.00 0.87 1.00 0.49 0.97
TSPO 0 0.00 0.03 0.54 0.06 0.81 0.33 0.98 0.00 0.46 0.00 0.54

Run edgeR–20% cells with UMI > 0

y <- DGEList(counts= countall[cellpercent > 0.2,],group=coldata$condition)
resm <- run_edgeR(y)

Expand here to see past versions of edgeR0.2-1.png:
Version Author Date
01a5914 simingz 2019-02-14
49ecf6e simingz 2018-12-16

[1] "There are 1 genes passed FDR <0.1 cutoff"

           logFC   logCPM    F    PValue       FDR
--------  ------  -------  ---  --------  --------
A2M        -1.60      6.9   34   0.0e+00   0.00013
SLF2        1.10      6.5   20   4.8e-05   0.12000
CMTM8       1.10      6.6   17   5.9e-05   0.12000
KRT18       1.30      7.1   16   7.3e-05   0.12000
GAP43      -0.91      8.2   16   9.0e-05   0.12000
FAM228B    -0.99      6.5   18   9.2e-05   0.12000

Permutation

permreslist <- list()
permreslist[[1]] <- data.table(gene=rownames(resm$table), p=resm$table$PValue, fdr=resm$table$FDR, key="gene")
for (n in 2:(Nperm+1)){
  y <- DGEList(counts= countall[cellpercent > 0.2,],group=permute(coldata$condition))
  res <- run_edgeR(y,plotit = T)
  resp <- data.table(gene=rownames(res$table), p=res$table$PValue, fdr=res$table$FDR, key="gene")
  colnames(resp) <- c("gene", paste0("perm.p_",n-1), paste0("perm.fdr_",n-1))
  permreslist[[n]] <- resp
}

Expand here to see past versions of perm0.2-1.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 6 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue       FDR
-------  ------  -------  ---  --------  --------
MYC        -3.1      7.4   73   0.0e+00   0.0e+00
SPP1        2.2      7.0   39   0.0e+00   5.7e-06
DLL3       -1.7      7.5   25   9.0e-07   2.4e-03
VGF         1.3      6.8   21   8.3e-06   1.6e-02
CRABP1     -1.1     10.0   16   7.0e-05   9.9e-02
PLK3       -1.1      6.8   16   7.8e-05   9.9e-02

Expand here to see past versions of perm0.2-2.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 2 genes passed FDR <0.1 cutoff"

            logFC   logCPM    F    PValue     FDR
---------  ------  -------  ---  --------  ------
CAV1         1.40      7.1   24   1.5e-06   0.011
SLC4A2       1.10      6.5   21   7.4e-06   0.028
MIS18BP1    -0.92      6.6   15   1.4e-04   0.270
UBQLN2      -0.85      6.6   14   2.0e-04   0.270
RIF1        -0.78      6.8   14   2.1e-04   0.270
TMEM43      -0.85      6.6   14   2.3e-04   0.270

Expand here to see past versions of perm0.2-3.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 0 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue    FDR
-------  ------  -------  ---  --------  -----
MYC       -1.50      7.4   18   2.8e-05   0.21
CCZ1B     -0.96      6.6   17   5.7e-05   0.22
MALAT1    -0.46     14.0   15   1.1e-04   0.26
WSCD1      0.94      6.6   15   1.4e-04   0.26
PEX14     -0.79      6.7   13   4.6e-04   0.42
SLC3A2    -0.67      8.6   12   4.9e-04   0.42

Expand here to see past versions of perm0.2-4.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 3 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue    FDR
-------  ------  -------  ---  --------  -----
MYC       -3.10      7.4   70   0.0e+00   0.00
ATG14      1.20      6.4   29   7.1e-06   0.02
IGFBP5    -1.40      6.7   21   7.7e-06   0.02
SOCS3     -0.93      6.7   16   1.0e-04   0.19
BRAP       0.97      6.4   17   3.3e-04   0.47
UBR5       0.79      6.6   12   5.1e-04   0.47

Expand here to see past versions of perm0.2-5.png:
Version Author Date
02a94e5 simingz 2019-02-15

[1] "There are 2 genes passed FDR <0.1 cutoff"

          logFC   logCPM    F    PValue       FDR
-------  ------  -------  ---  --------  --------
SPP1      -2.00      7.0   38   0.0e+00   1.9e-05
MYC       -2.00      7.4   33   0.0e+00   1.1e-04
GCLM      -1.00      6.8   17   5.7e-05   1.4e-01
OSGIN1    -1.20      6.7   16   9.9e-05   1.9e-01
SPC25     -0.88      6.9   14   2.1e-04   3.2e-01
NTRK3     -0.94      6.5   15   2.7e-04   3.5e-01
mergedres <- Reduce(merge,permreslist)
knitr::kable(mergedres[fdr <0.1,],digits = 2)
gene p fdr perm.p_1 perm.fdr_1 perm.p_2 perm.fdr_2 perm.p_3 perm.fdr_3 perm.p_4 perm.fdr_4 perm.p_5 perm.fdr_5
A2M 0 0 0.15 0.96 0 0.42 0.14 0.82 0.1 0.96 0.67 0.99

Session information

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)

Matrix products: default
BLAS/LAPACK: /software/openblas-0.2.19-el7-x86_64/lib/libopenblas_haswellp-r0.2.19.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] gridExtra_2.3     edgeR_3.24.3      limma_3.38.2      Matrix_1.2-15    
[5] data.table_1.12.0 gtools_3.8.1      dplyr_0.7.8       lattice_0.20-38  

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0        highr_0.7         compiler_3.5.1   
 [4] pillar_1.3.1      git2r_0.23.0      workflowr_1.1.1  
 [7] bindr_0.1.1       R.methodsS3_1.7.1 R.utils_2.7.0    
[10] tools_3.5.1       digest_0.6.18     gtable_0.2.0     
[13] evaluate_0.12     tibble_2.0.1      pkgconfig_2.0.2  
[16] rlang_0.3.1       yaml_2.2.0        bindrcpp_0.2.2   
[19] stringr_1.4.0     knitr_1.20        locfit_1.5-9.1   
[22] rprojroot_1.3-2   tidyselect_0.2.5  glue_1.3.0       
[25] R6_2.3.0          rmarkdown_1.10    purrr_0.2.5      
[28] magrittr_1.5      whisker_0.3-2     backports_1.1.2  
[31] htmltools_0.3.6   splines_3.5.1     assertthat_0.2.0 
[34] stringi_1.3.1     crayon_1.3.4      R.oo_1.22.0      

This reproducible R Markdown analysis was created with workflowr 1.1.1