Pārlūkot izejas kodu

Progress on slides

Ryan C. Thompson 5 gadi atpakaļ
vecāks
revīzija
a0104f2918

+ 30 - 3
Snakefile

@@ -6,7 +6,7 @@ import regex
 import urllib.parse
 import os.path
 import bibtexparser
-import mistune
+import pypandoc
 
 from collections.abc import Iterable, Mapping
 from distutils.spawn import find_executable
@@ -210,9 +210,15 @@ def tex_gfx_extensions(tex_format = 'xetex'):
 def get_mkdn_included_images(fname):
     '''Return list of all images references in a markdown file.'''
     with open(fname) as f:
-        tree = html.fromstring(mistune.markdown(f.read()))
+        tree = html.fromstring(pypandoc.convert_text(f.read(), 'html', format='md'))
     return list(map(str, tree.xpath("//img/@src")))
 
+def get_mkdn_included_pdfs(fname):
+    '''Return list of all images references in a markdown file.'''
+    with open(fname) as f:
+        tree = html.fromstring(pypandoc.convert_text(f.read(), 'html', format='md'))
+    return list(map(str, tree.xpath("//embed/@src")))
+
 rsync_common_args = ['-rL', '--size-only', '--delete', '--exclude', '.DS_Store', '--delete-excluded',]
 
 rule build_all:
@@ -314,10 +320,19 @@ rule png_crop:
     output: pdf = 'graphics/{basename,.*(?<!-CROP)}-CROP.png'
     shell: 'convert {input:q} -trim {output:q}'
 
+rule jpg_crop:
+    '''Crop away empty margins from a JPG.'''
+    input: pdf = 'graphics/{basename}.jpg'
+    output: pdf = 'graphics/{basename,.*(?<!-CROP)}-CROP.jpg'
+    shell: 'convert {input:q} -trim {output:q}'
+
 rule svg_to_pdf:
     input: 'graphics/{filename}.svg'
     output: 'graphics/{filename}-SVG.pdf'
-    shell: '''inkscape {input:q} --export-pdf={output:q} --export-dpi=300'''
+    run:
+        infile = os.path.join(os.path.abspath("."), input[0])
+        outfile = os.path.join(os.path.abspath("."), output[0])
+        shell('''inkscape {infile:q} --export-pdf={outfile:q} --export-dpi=300''')
 
 rule R_to_html:
     '''Render an R script as syntax-hilighted HTML.'''
@@ -330,6 +345,7 @@ rule build_presentation:
         extra_preamble='extra-preamble.latex',
         mkdn_file='{basename}.mkdn',
         images=lambda wildcards: get_mkdn_included_images('{basename}.mkdn'.format(**wildcards)),
+        pdfs=lambda wildcards: get_mkdn_included_pdfs('{basename}.mkdn'.format(**wildcards)),
     output:
         pdf='{basename,presentation.*}.pdf'
     params:
@@ -343,3 +359,14 @@ rule build_presentation:
       -V theme:{params.theme:q} \
       {input.mkdn_file:q}
     '''
+
+rule make_transplant_organs_graph:
+    input:
+        Rscript='graphics/presentation/transplants-organ.R',
+        data='graphics/presentation/transplants-organ.xlsx',
+    output:
+        pdf='graphics/presentation/transplants-organ.pdf'
+
+    shell: '''
+    Rscript 'graphics/presentation/transplants-organ.R'
+    '''

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 301 - 0
graphics/presentation/T-cells.svg


BIN
graphics/presentation/kidney-graft-survival.png


+ 26 - 0
graphics/presentation/transplants-organ.R

@@ -0,0 +1,26 @@
+#!/usr/bin/env Rscript
+
+library(rctutils)
+library(scriptName)
+library(openxlsx)
+library(forcats)
+library(tidyverse)
+
+tryCatch(
+    setwd(dirname(current_filename())),
+    error=function(...) warning("Could not find script path. Hopefully you are in the right directory already."))
+
+organ_data <- read.xlsx("transplants-organ.xlsx") %>%
+    arrange(desc(Count)) %>%
+    mutate(Organ=fct_inorder(Organ))
+
+p <- ggplot(organ_data) + aes(x=Organ, y=Count, fill=Organ) +
+    geom_col() +
+    geom_text(aes(label=str_c("  ", Organ, " (", Count, ")   "), hjust=ifelse(Count>max(Count)/4, 1, 0)), vjust=0.5) +
+    coord_flip() + scale_x_discrete(limits = rev(levels(organ_data$Organ))) +
+    scale_y_continuous(expand=expand_scale(mult=c(0, 0.01))) +
+    guides(fill=FALSE) +
+    theme(axis.text.y=element_blank(),
+          axis.ticks.y=element_blank()) +
+    ylab("Transplants performed")
+ggprint(p, pdf("transplants-organ.pdf", width=6, height=4))

BIN
graphics/presentation/transplants-organ.xlsx


+ 198 - 4
presentation.mkdn

@@ -6,11 +6,205 @@
 
 # Intro
 
-## A slide
+# Biological motivation: Transplant rejection
 
-This is a slide.
+## Organ transplants are a life-saving treatment for many
 
-## Another slide
+\Large
 
-This is another slide.
+* 36,528 transplants performed in the USA in 2018[^1]
 
+. . .
+
+* 100 transplants every day!
+
+. . .
+
+* Over 113,000 people on the national transplant waiting list as of
+  July 2019
+
+[^1]: Source: https://www.organdonor.gov/statistics-stories/statistics.html
+
+## Organ transplants are a life-saving treatment for many
+
+![Organ donation statistics for the USA in 2018[^2]](graphics/presentation/transplants-organ-CROP.pdf){ height=70% }
+
+[^2]: Source: https://www.organdonor.gov/statistics-stories/statistics.html
+
+## Rejection is an adaptive immune response against a graft
+
+* The host's adaptive immune system identifies and attacks cells
+  bearing non-self antigens
+
+. . .
+
+* An allograft contains differnet genetic variants from the host,
+  resulting in protein-coding differences
+
+. . .
+
+* Left unchecked, the host immune system eventually notices these
+  alloantigens and begins attacking (rejecting) the graft
+
+. . .
+
+\Large
+
+* Rejection is the major long-term threat to organ allografts
+
+## Allograft rejection remains a major long-term problem
+
+![Kidney allograft survival rates in children by transplant year[^3]](graphics/presentation/kidney-graft-survival.png){ height=65% }
+
+[^3]: Kim & Marks. "Long-term outcomes of children after solid organ transplantation". In: Clinics (2014)
+
+## Immune memory is a significant contributor to rejection
+
+![Memory T-cells proliferate and respond more quickly](graphics/presentation/T-cells-SVG.pdf)
+
+# Figure Storage
+
+## Slides
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/Intro/eBayes-CROP-RASTER.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/IDR/D4659vsD5053_epic-PAGE1-CROP-RASTER.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me2-sample-MAplot-bins-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/Intro/med-pval-hist-colored-CROP.pdf) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/RNA-seq/PCA-no-batchsub-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/RNA-seq/PCA-combat-batchsub-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/RNA-seq/weights-vs-covars-nobcv-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/csaw/CCF-plots-noBL-PAGE2-CROP.pdf) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/csaw/CCF-plots-PAGE2-CROP.pdf) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me2-PCA-raw-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me2-PCA-SVsub-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me3-PCA-raw-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me3-PCA-SVsub-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K27me3-PCA-raw-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K27me3-PCA-SVsub-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/MOFA-varExplaiend-matrix-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/MOFA-LF-scatter-small.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/MOFA-batch-correct-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/RNA-seq/PCA-final-12-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/Promoter-Peak-Distance-Profile-PAGE1-CROP.pdf) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/FPKM-by-Peak-Violin-Plots-CROP.pdf) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me2-promoter-PCA-group-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me3-promoter-PCA-group-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K27me3-promoter-PCA-group-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/RNA-seq/PCA-final-23-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me2-neighborhood-clusters-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me2-neighborhood-PCA-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me2-neighborhood-expression-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me3-neighborhood-clusters-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me3-neighborhood-PCA-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K4me3-neighborhood-expression-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K27me3-neighborhood-clusters-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K27me3-neighborhood-PCA-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/ChIP-seq/H3K27me3-neighborhood-expression-CROP.png) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/LaMere2016_fig8.pdf) -->
+
+<!-- ## Slide -->
+
+<!-- ![Figure](graphics/CD4-csaw/rulegraphs/rulegraph-all.pdf) -->

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels