Last updated: 2019-10-30

Checks: 7 0

Knit directory: fibroblast-clonality/

This reproducible R Markdown analysis was created with workflowr (version 1.4.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


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.

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.

The command set.seed(20180807) 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.

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

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

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:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    .vscode/
    Ignored:    code/.DS_Store
    Ignored:    code/selection/.DS_Store
    Ignored:    code/selection/.Rhistory
    Ignored:    code/selection/figures/
    Ignored:    data/.DS_Store
    Ignored:    logs/
    Ignored:    src/.DS_Store
    Ignored:    src/Rmd/.Rhistory

Untracked files:
    Untracked:  .dockerignore
    Untracked:  .dropbox
    Untracked:  .snakemake/
    Untracked:  Rplots.pdf
    Untracked:  Snakefile_clonality
    Untracked:  Snakefile_somatic_calling
    Untracked:  analysis/.ipynb_checkpoints/
    Untracked:  analysis/assess_mutect2_fibro-ipsc_variant_calls.ipynb
    Untracked:  analysis/cardelino_fig1b.R
    Untracked:  analysis/cardelino_fig2b.R
    Untracked:  code/analysis_for_garx.Rmd
    Untracked:  code/selection/data/
    Untracked:  code/selection/fit-dist.nb
    Untracked:  code/selection/result-figure.R
    Untracked:  code/yuanhua/
    Untracked:  data/Melanoma-RegevGarraway-DFCI-scRNA-Seq/
    Untracked:  data/PRJNA485423/
    Untracked:  data/canopy/
    Untracked:  data/cell_assignment/
    Untracked:  data/cnv/
    Untracked:  data/de_analysis_FTv62/
    Untracked:  data/donor_info_070818.txt
    Untracked:  data/donor_info_core.csv
    Untracked:  data/donor_neutrality.tsv
    Untracked:  data/exome-point-mutations/
    Untracked:  data/fdr10.annot.txt.gz
    Untracked:  data/human_H_v5p2.rdata
    Untracked:  data/human_c2_v5p2.rdata
    Untracked:  data/human_c6_v5p2.rdata
    Untracked:  data/neg-bin-rsquared-petr.csv
    Untracked:  data/neutralitytestr-petr.tsv
    Untracked:  data/raw/
    Untracked:  data/sce_merged_donors_cardelino_donorid_all_qc_filt.rds
    Untracked:  data/sce_merged_donors_cardelino_donorid_all_with_qc_labels.rds
    Untracked:  data/sce_merged_donors_cardelino_donorid_unstim_qc_filt.rds
    Untracked:  data/sces/
    Untracked:  data/selection/
    Untracked:  data/simulations/
    Untracked:  data/variance_components/
    Untracked:  docs/figure/analysis_for_joxm_cardelino-relax.Rmd/
    Untracked:  docs/figure/clone_prevalences_cardelino-relax.Rmd/
    Untracked:  figures/
    Untracked:  output/differential_expression/
    Untracked:  output/differential_expression_cardelino-relax/
    Untracked:  output/donor_specific/
    Untracked:  output/line_info.tsv
    Untracked:  output/nvars_by_category_by_donor.tsv
    Untracked:  output/nvars_by_category_by_line.tsv
    Untracked:  output/variance_components/
    Untracked:  qolg_BIC.pdf
    Untracked:  references/
    Untracked:  reports/
    Untracked:  src/Rmd/DE_pathways_FTv62_callset_clones_pairwise_vs_base.unst_cells.carderelax.Rmd
    Untracked:  src/Rmd/Rplots.pdf
    Untracked:  src/Rmd/cell_assignment_cardelino-relax_template.Rmd
    Untracked:  tree.txt

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.


These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
html 8729e02 davismcc 2018-11-09 Build site.
html 0540cdb davismcc 2018-09-02 Build site.
html f0ed980 davismcc 2018-08-31 Build site.
html ca3438f davismcc 2018-08-29 Build site.
Rmd dc78a95 davismcc 2018-08-29 Minor updates to analyses.
html e573f2f davismcc 2018-08-27 Build site.
html 9ec2a59 davismcc 2018-08-26 Build site.
html 36acf15 davismcc 2018-08-25 Build site.
Rmd d618fe5 davismcc 2018-08-25 Updating analyses
html 090c1b9 davismcc 2018-08-24 Build site.
html d2e8b31 davismcc 2018-08-19 Build site.
html 1489d32 davismcc 2018-08-17 Add html files
Rmd c5c1416 davismcc 2018-08-17 Adding variance components analysis.

Results aggregated across all lines

Previously, we conducted variance components analysis combining scRNA-seq data across all lines. We used the variancePartion package, fitting assigned clone, line, plate (on which cells were processed) and cellular detection rate (cdr; proportion of genes per cell with non-zero expression) as random effects.

The output of the model gives us the proportion of variance explained, for each gene, by clone, line, plate, cdr and residuals.

Warning: `as_data_frame()` is deprecated, use `as_tibble()` (but mind the new semantics).
This warning is displayed once per session.
# A tibble: 6 x 6
     clone    line   plate      cdr residuals gene_id               
     <dbl>   <dbl>   <dbl>    <dbl>     <dbl> <chr>                 
1 3.54e- 3 0.0179  0.0216  0.0124       0.945 ENSG00000001167_NFYA  
2 0.       0.167   0.0215  0.0354       0.776 ENSG00000001626_CFTR  
3 0.       0.00580 0.0143  0.000248     0.980 ENSG00000001629_ANKIB1
4 5.35e- 3 0.0194  0.0215  0.0152       0.939 ENSG00000001631_KRIT1 
5 9.73e-15 0.369   0.00582 0.0336       0.592 ENSG00000002016_RAD52 
6 0.       0.125   0.0827  0.0143       0.778 ENSG00000002330_BAD   

We ran the analysis for 4998 highly variable genes (as identified using methods in the scran package).

We detect 194 genes with more than 5% of variance explained by clone and 1034 genes for which variance explained by clone is both greater than 1% and also greater than the variance explained by plate (a good proxy for technical effects on variability in gene expression between cells).

The median percentage of variance explained by clone is 0.487273, whereas the median percentage of variance explained by line is 5.4807953

Version Author Date
d2e8b31 davismcc 2018-08-19

Results for individual lines

Load individual lines

We load a SingleCellExperiment object for each line containing expression data, cell metadata and gene metadata.

reading euts :    79 cells
reading fawm :    53 cells
reading feec :    75 cells
reading fikt :    39 cells
reading garx :    70 cells
reading gesg :    105 cells
reading heja :    50 cells
reading hipn :    62 cells
reading ieki :    58 cells
reading joxm :    79 cells
reading kuco :    48 cells
reading laey :    55 cells
reading lexy :    63 cells
reading naju :    44 cells
reading nusw :    60 cells
reading oaaz :    38 cells
reading oilg :    90 cells
reading pipw :    107 cells
reading puie :    41 cells
reading qayj :    97 cells
reading qolg :    36 cells
reading qonc :    58 cells
reading rozh :    91 cells
reading sehl :    30 cells
reading ualf :    89 cells
reading vass :    37 cells
reading vuna :    71 cells
reading wahn :    82 cells
reading wetu :    77 cells
reading xugn :    35 cells
reading zoxy :    88 cells

We load variance component analysis results for each line.

For each line we thus have a data.frame with the variance components results.

# A tibble: 6 x 6
   clone   plate `cell. det. rate` residuals gene_id                  line 
   <dbl>   <dbl>             <dbl>     <dbl> <chr>                    <chr>
1 0      0.0727           0.0155       0.912 ENSG00000137804_NUSAP1   euts 
2 0.165  0                0.0439       0.791 ENSG00000115318_LOXL3    euts 
3 0      0.0311           0.000381     0.969 ENSG00000161888_SPC24    euts 
4 0.0274 0.00157          0.0518       0.919 ENSG00000171345_KRT19    euts 
5 0      0.0357           0.0222       0.942 ENSG00000089685_BIRC5    euts 
6 0      0                0.00906      0.991 ENSG00000197061_HIST1H4C euts 

Number of genes with substantial clone component

We observe larger clone effects if we fit the linear mixed model for each line separately. A large number of genes for each line have >5% of variance explained by clone (median: 825).

pipw vuna gesg euts oilg heja puie kuco wetu zoxy naju wahn qayj joxm qolg 
 331  347  382  478  532  548  559  561  566  584  609  635  651  741  760 
hipn xugn fawm ualf nusw garx oaaz lexy rozh vass feec fikt ieki laey sehl 
 825  844  856  881  901  920  948  962 1036 1096 1102 1314 1356 1392 1651 
qonc 
2162 

Plot results for individual lines

For each line we will plot the variance explained by clone for the to 400 genes with most variance explained by clone (for that line).

First, we need to process the raw variance component results from each line.

Warning: `data_frame()` is deprecated, use `tibble()`.
This warning is displayed once per session.

The table below provides a summary of the per-line variance component results. We can read off the mean proportion of variance explained by clone for the top 400 genes for each line (var_top_mean), as well as other information for each line.

   rank line_id clone_cells n_genes_use n_hv_genes var_top_mean
1     1    feec          64        8243        342   0.50769558
2     2    xugn          34        7480        260   0.41529069
3     3    qonc          43        9882        420   0.35658891
4     4    fikt          36        9762        219   0.29630805
5     5    sehl          24        8792        198   0.27796718
6     6    ieki          26        8324        166   0.25419512
7     7    vass          37        7231        129   0.23747536
8     8    lexy          63       10154        123   0.23580397
9     9    oaaz          37        9946        105   0.22820218
10   10    nusw          20        9544        110   0.22397105
11   11    kuco          48       10021        121   0.22329573
12   12    euts          78       10210        128   0.21836347
13   13    wahn          77       10241        114   0.21728504
14   14    laey          55        7402         89   0.20944535
15   15    wetu          66        7177         79   0.20065196
16   16    hipn          49        7971         86   0.19522467
17   17    rozh          42        7819         57   0.18304904
18   18    heja          50        9315         57   0.16430667
19   19    qolg          36        8640         41   0.16297743
20   20    joxm          77       10095         45   0.15834547
21   21    garx          69        9571         25   0.15202524
22   22    pipw         107       10260         73   0.15192220
23   23    oilg          57        7875         44   0.14300906
24   24    qayj          59        6844         30   0.14024325
25   25    fawm          47        8537         17   0.13702877
26   26    ualf          88        7001         16   0.13288015
27   27    zoxy          82        6968         27   0.12433830
28   28    puie          41        8478         12   0.11222310
29   29    naju          44        9089          5   0.10986147
30   30    gesg         101       10036          5   0.08542351
31   31    vuna          71       10000          2   0.07668159

Now we can plot a curve for each line showing the variance explained by clone for the top 400 genes.

Version Author Date
d2e8b31 davismcc 2018-08-19

Each line has a substantial number of genes with a substantial proportion of variance explained by clone. For example, the number of genes with more than 25% of variance explained by line across lines:

euts fawm feec fikt garx gesg heja hipn ieki joxm kuco laey lexy naju nusw 
 128   17  342  219   25    5   57   86  166   45  121   89  123    5  110 
oaaz oilg pipw puie qayj qolg qonc rozh sehl ualf vass vuna wahn wetu xugn 
 105   44   73   12   30   41  420   57  198   16  129    2  114   79  260 
zoxy 
  27 

There are a large number of genes in each line with more than 5% of variance explained by clone:

euts fawm feec fikt garx gesg heja hipn ieki joxm kuco laey lexy naju nusw 
 478  856 1102 1314  920  382  548  825 1356  741  561 1392  962  609  901 
oaaz oilg pipw puie qayj qolg qonc rozh sehl ualf vass vuna wahn wetu xugn 
 948  532  331  559  651  760 2162 1036 1651  881 1096  347  635  566  844 
zoxy 
 584 

Plots including line selection information

We have inferred selection dynamics from somatic variants detected from whole-exome sequencing data. We can overlay selection status on the plot above to look for any relationship between selection and variance explained by clone in top genes by line.

Version Author Date
d2e8b31 davismcc 2018-08-19

There is not any obvious relationship between selection dynamics and variance explained by clone here.

Write mean variance explained to file

Write a table with the mean fraction of variance explained by clone for the top 400 genes per line out to file.


─ Session info ──────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.0 (2019-04-26)
 os       Ubuntu 18.04.3 LTS          
 system   x86_64, linux-gnu           
 ui       X11                         
 language (EN)                        
 collate  en_AU.UTF-8                 
 ctype    en_AU.UTF-8                 
 tz       Australia/Melbourne         
 date     2019-10-30                  

─ Packages ──────────────────────────────────────────────────────────────
 package              * version   date       lib source        
 assertthat             0.2.1     2019-03-21 [1] CRAN (R 3.6.0)
 backports              1.1.4     2019-04-10 [1] CRAN (R 3.6.0)
 Biobase              * 2.44.0    2019-05-02 [1] Bioconductor  
 BiocGenerics         * 0.30.0    2019-05-02 [1] Bioconductor  
 BiocParallel         * 1.18.1    2019-08-06 [1] Bioconductor  
 bitops                 1.0-6     2013-08-17 [1] CRAN (R 3.6.0)
 broom                  0.5.2     2019-04-07 [1] CRAN (R 3.6.0)
 callr                  3.3.2     2019-09-22 [1] CRAN (R 3.6.0)
 cellranger             1.1.0     2016-07-27 [1] CRAN (R 3.6.0)
 cli                    1.1.0     2019-03-19 [1] CRAN (R 3.6.0)
 colorspace             1.4-1     2019-03-18 [1] CRAN (R 3.6.0)
 cowplot              * 1.0.0     2019-07-11 [1] CRAN (R 3.6.0)
 crayon                 1.3.4     2017-09-16 [1] CRAN (R 3.6.0)
 DelayedArray         * 0.10.0    2019-05-02 [1] Bioconductor  
 desc                   1.2.0     2018-05-01 [1] CRAN (R 3.6.0)
 devtools               2.2.1     2019-09-24 [1] CRAN (R 3.6.0)
 digest                 0.6.21    2019-09-20 [1] CRAN (R 3.6.0)
 dplyr                * 0.8.3     2019-07-04 [1] CRAN (R 3.6.0)
 ellipsis               0.3.0     2019-09-20 [1] CRAN (R 3.6.0)
 evaluate               0.14      2019-05-28 [1] CRAN (R 3.6.0)
 fansi                  0.4.0     2018-10-05 [1] CRAN (R 3.6.0)
 forcats              * 0.4.0     2019-02-17 [1] CRAN (R 3.6.0)
 fs                     1.3.1     2019-05-06 [1] CRAN (R 3.6.0)
 generics               0.0.2     2018-11-29 [1] CRAN (R 3.6.0)
 GenomeInfoDb         * 1.20.0    2019-05-02 [1] Bioconductor  
 GenomeInfoDbData       1.2.1     2019-04-30 [1] Bioconductor  
 GenomicRanges        * 1.36.1    2019-09-06 [1] Bioconductor  
 ggplot2              * 3.2.1     2019-08-10 [1] CRAN (R 3.6.0)
 ggpubr               * 0.2.3     2019-09-03 [1] CRAN (R 3.6.0)
 ggrepel              * 0.8.1     2019-05-07 [1] CRAN (R 3.6.0)
 ggsignif               0.6.0     2019-08-08 [1] CRAN (R 3.6.0)
 git2r                  0.26.1    2019-06-29 [1] CRAN (R 3.6.0)
 glue                   1.3.1     2019-03-12 [1] CRAN (R 3.6.0)
 gridExtra              2.3       2017-09-09 [1] CRAN (R 3.6.0)
 gtable                 0.3.0     2019-03-25 [1] CRAN (R 3.6.0)
 haven                  2.1.1     2019-07-04 [1] CRAN (R 3.6.0)
 hms                    0.5.1     2019-08-23 [1] CRAN (R 3.6.0)
 htmltools              0.3.6     2017-04-28 [1] CRAN (R 3.6.0)
 httr                   1.4.1     2019-08-05 [1] CRAN (R 3.6.0)
 IRanges              * 2.18.3    2019-09-24 [1] Bioconductor  
 jsonlite               1.6       2018-12-07 [1] CRAN (R 3.6.0)
 knitr                  1.25      2019-09-18 [1] CRAN (R 3.6.0)
 labeling               0.3       2014-08-23 [1] CRAN (R 3.6.0)
 lattice                0.20-38   2018-11-04 [4] CRAN (R 3.5.1)
 lazyeval               0.2.2     2019-03-15 [1] CRAN (R 3.6.0)
 lifecycle              0.1.0     2019-08-01 [1] CRAN (R 3.6.0)
 lubridate              1.7.4     2018-04-11 [1] CRAN (R 3.6.0)
 magrittr             * 1.5       2014-11-22 [1] CRAN (R 3.6.0)
 Matrix                 1.2-17    2019-03-22 [1] CRAN (R 3.6.0)
 matrixStats          * 0.55.0    2019-09-07 [1] CRAN (R 3.6.0)
 memoise                1.1.0     2017-04-21 [1] CRAN (R 3.6.0)
 mgcv                   1.8-28    2019-03-21 [4] CRAN (R 3.5.3)
 modelr                 0.1.5     2019-08-08 [1] CRAN (R 3.6.0)
 munsell                0.5.0     2018-06-12 [1] CRAN (R 3.6.0)
 nlme                   3.1-139   2019-04-09 [4] CRAN (R 3.5.3)
 pillar                 1.4.2     2019-06-29 [1] CRAN (R 3.6.0)
 pkgbuild               1.0.5     2019-08-26 [1] CRAN (R 3.6.0)
 pkgconfig              2.0.3     2019-09-22 [1] CRAN (R 3.6.0)
 pkgload                1.0.2     2018-10-29 [1] CRAN (R 3.6.0)
 plyr                   1.8.4     2016-06-08 [1] CRAN (R 3.6.0)
 prettyunits            1.0.2     2015-07-13 [1] CRAN (R 3.6.0)
 processx               3.4.1     2019-07-18 [1] CRAN (R 3.6.0)
 ps                     1.3.0     2018-12-21 [1] CRAN (R 3.6.0)
 purrr                * 0.3.2     2019-03-15 [1] CRAN (R 3.6.0)
 R6                     2.4.0     2019-02-14 [1] CRAN (R 3.6.0)
 Rcpp                   1.0.2     2019-07-25 [1] CRAN (R 3.6.0)
 RCurl                  1.95-4.12 2019-03-04 [1] CRAN (R 3.6.0)
 readr                * 1.3.1     2018-12-21 [1] CRAN (R 3.6.0)
 readxl                 1.3.1     2019-03-13 [1] CRAN (R 3.6.0)
 remotes                2.1.0     2019-06-24 [1] CRAN (R 3.6.0)
 reshape2             * 1.4.3     2017-12-11 [1] CRAN (R 3.6.0)
 rlang                  0.4.0     2019-06-25 [1] CRAN (R 3.6.0)
 rmarkdown              1.15      2019-08-21 [1] CRAN (R 3.6.0)
 rprojroot              1.3-2     2018-01-03 [1] CRAN (R 3.6.0)
 rstudioapi             0.10      2019-03-19 [1] CRAN (R 3.6.0)
 rvest                  0.3.4     2019-05-15 [1] CRAN (R 3.6.0)
 S4Vectors            * 0.22.1    2019-09-09 [1] Bioconductor  
 scales                 1.0.0     2018-08-09 [1] CRAN (R 3.6.0)
 sessioninfo            1.1.1     2018-11-05 [1] CRAN (R 3.6.0)
 SingleCellExperiment * 1.6.0     2019-05-02 [1] Bioconductor  
 stringi                1.4.3     2019-03-12 [1] CRAN (R 3.6.0)
 stringr              * 1.4.0     2019-02-10 [1] CRAN (R 3.6.0)
 SummarizedExperiment * 1.14.1    2019-07-31 [1] Bioconductor  
 testthat               2.2.1     2019-07-25 [1] CRAN (R 3.6.0)
 tibble               * 2.1.3     2019-06-06 [1] CRAN (R 3.6.0)
 tidyr                * 1.0.0     2019-09-11 [1] CRAN (R 3.6.0)
 tidyselect             0.2.5     2018-10-11 [1] CRAN (R 3.6.0)
 tidyverse            * 1.2.1     2017-11-14 [1] CRAN (R 3.6.0)
 usethis                1.5.1     2019-07-04 [1] CRAN (R 3.6.0)
 utf8                   1.1.4     2018-05-24 [1] CRAN (R 3.6.0)
 vctrs                  0.2.0     2019-07-05 [1] CRAN (R 3.6.0)
 viridis              * 0.5.1     2018-03-29 [1] CRAN (R 3.6.0)
 viridisLite          * 0.3.0     2018-02-01 [1] CRAN (R 3.6.0)
 whisker                0.4       2019-08-28 [1] CRAN (R 3.6.0)
 withr                  2.1.2     2018-03-15 [1] CRAN (R 3.6.0)
 workflowr              1.4.0     2019-06-08 [1] CRAN (R 3.6.0)
 xfun                   0.9       2019-08-21 [1] CRAN (R 3.6.0)
 xml2                   1.2.2     2019-08-09 [1] CRAN (R 3.6.0)
 XVector                0.24.0    2019-05-02 [1] Bioconductor  
 yaml                   2.2.0     2018-07-25 [1] CRAN (R 3.6.0)
 zeallot                0.1.0     2018-01-28 [1] CRAN (R 3.6.0)
 zlibbioc               1.30.0    2019-05-02 [1] Bioconductor  

[1] /home/AD.SVI.EDU.AU/dmccarthy/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library