@@ -548,24 +548,13 @@ g2 <- ggplot(data = stats)+
548
548
# Case Study C: analyzing paired-IRRs
549
549
550
550
``` {r}
551
- require(IgGeneUsage)
552
- require(rstan)
553
- require(knitr)
554
- require(ggplot2)
555
- require(ggforce)
556
- require(ggrepel)
557
- require(reshape2)
558
- require(patchwork)
559
- ```
560
-
561
- ``` {r}
562
- data("d_zibb_3", package = "IgGeneUsage")
551
+ data("d_zibb_5", package = "IgGeneUsage")
563
552
```
564
553
565
554
566
- ``` {r, fig.width=6, fig.height=6 }
567
- ggplot(data = d_zibb_3 )+
568
- facet_wrap(facets = ~gene_name)+
555
+ ``` {r, fig.width=6, fig.height=4 }
556
+ ggplot(data = d_zibb_5 )+
557
+ facet_wrap(facets = ~gene_name, ncol = 4, scales = "free_y" )+
569
558
geom_line(aes(x = condition, y = gene_usage_count, group = individual_id))+
570
559
geom_point(aes(x = condition, y = gene_usage_count, col = condition))+
571
560
theme_bw(base_size = 11)+
@@ -575,12 +564,11 @@ ggplot(data = d_zibb_3)+
575
564
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.4))
576
565
```
577
566
578
-
579
567
``` {r}
580
- M <- DGU(ud = d_zibb_3 , # input data
568
+ M <- DGU(ud = d_zibb_5 , # input data
581
569
mcmc_warmup = 500, # how many MCMC warm-ups per chain (default: 500)
582
570
mcmc_steps = 1500, # how many MCMC steps per chain (default: 1,500)
583
- mcmc_chains = 3 , # how many MCMC chain to run (default: 4)
571
+ mcmc_chains = 1 , # how many MCMC chain to run (default: 4)
584
572
mcmc_cores = 3, # how many PC cores to use? (e.g. parallel chains)
585
573
hdi_lvl = 0.95, # highest density interval level (de fault: 0.95)
586
574
adapt_delta = 0.8, # MCMC target acceptance rate (default: 0.95)
@@ -590,16 +578,15 @@ M <- DGU(ud = d_zibb_3, # input data
590
578
591
579
592
580
``` {r, fig.height = 3, fig.width = 6}
593
- rstan::stan_rhat(object = M$fit)|
594
- rstan::stan_ess(object = M$fit)
581
+ rstan::stan_rhat(object = M$fit)|rstan::stan_ess(object = M$fit)
595
582
```
596
583
597
584
598
585
``` {r, fig.weight = 7, fig.height = 4}
599
586
g1 <- ggplot(data = M$gu)+
600
587
geom_errorbar(aes(x = gene_name, y = prob_mean, ymin = prob_L,
601
588
ymax = prob_H, col = condition),
602
- width = 0.1 , position = position_dodge(width = 0.4))+
589
+ width = 0.01 , position = position_dodge(width = 0.4))+
603
590
geom_point(aes(x = gene_name, y = prob_mean, col = condition), size = 1,
604
591
position = position_dodge(width = 0.4))+
605
592
theme_bw(base_size = 11)+
@@ -616,7 +603,7 @@ g2 <- ggplot(data = stats)+
616
603
facet_wrap(facets = ~contrast)+
617
604
geom_hline(yintercept = 0, linetype = "dashed", col = "gray")+
618
605
geom_errorbar(aes(x = pmax, y = es_mean, ymin = es_L, ymax = es_H),
619
- col = "darkgray")+
606
+ col = "darkgray", width = 0.01 )+
620
607
geom_point(aes(x = pmax, y = es_mean, col = contrast))+
621
608
geom_text_repel(data = stats[stats$pmax >= 0.9, ],
622
609
aes(x = pmax, y = es_mean, label = gene_fac),
@@ -635,6 +622,61 @@ g2 <- ggplot(data = stats)+
635
622
636
623
637
624
625
+ <!-- ```{r} -->
626
+ <!-- Mu <- DGU(ud = d_zibb_5, # input data -->
627
+ <!-- mcmc_warmup = 500, # how many MCMC warm-ups per chain (default: 500) -->
628
+ <!-- mcmc_steps = 1500, # how many MCMC steps per chain (default: 1,500) -->
629
+ <!-- mcmc_chains = 3, # how many MCMC chain to run (default: 4) -->
630
+ <!-- mcmc_cores = 3, # how many PC cores to use? (e.g. parallel chains) -->
631
+ <!-- hdi_lvl = 0.95, # highest density interval level (de fault: 0.95) -->
632
+ <!-- adapt_delta = 0.8, # MCMC target acceptance rate (default: 0.95) -->
633
+ <!-- max_treedepth = 10, # tree depth evaluated at each step (default: 12) -->
634
+ <!-- paired = FALSE) -->
635
+ <!-- ``` -->
636
+
637
+
638
+
639
+ <!-- ```{r, fig.weight = 7, fig.height = 4} -->
640
+ <!-- g1 <- ggplot(data = Mu$gu)+ -->
641
+ <!-- geom_errorbar(aes(x = gene_name, y = prob_mean, ymin = prob_L, -->
642
+ <!-- ymax = prob_H, col = condition), -->
643
+ <!-- width = 0.01, position = position_dodge(width = 0.4))+ -->
644
+ <!-- geom_point(aes(x = gene_name, y = prob_mean, col = condition), size = 1, -->
645
+ <!-- position = position_dodge(width = 0.4))+ -->
646
+ <!-- theme_bw(base_size = 11)+ -->
647
+ <!-- theme(legend.position = "top")+ -->
648
+ <!-- ylab(label = "GU [probability]")+ -->
649
+ <!-- theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.4)) -->
650
+
651
+
652
+ <!-- stats <- Mu$dgu -->
653
+ <!-- stats <- stats[order(abs(stats$es_mean), decreasing = FALSE), ] -->
654
+ <!-- stats$gene_fac <- factor(x = stats$gene_name, levels = unique(stats$gene_name)) -->
655
+
656
+ <!-- g2 <- ggplot(data = stats)+ -->
657
+ <!-- facet_wrap(facets = ~contrast)+ -->
658
+ <!-- geom_hline(yintercept = 0, linetype = "dashed", col = "gray")+ -->
659
+ <!-- geom_errorbar(aes(x = pmax, y = es_mean, ymin = es_L, ymax = es_H), -->
660
+ <!-- col = "darkgray", width = 0.01)+ -->
661
+ <!-- geom_point(aes(x = pmax, y = es_mean, col = contrast))+ -->
662
+ <!-- geom_text_repel(data = stats[stats$pmax >= 0.9, ], -->
663
+ <!-- aes(x = pmax, y = es_mean, label = gene_fac), -->
664
+ <!-- min.segment.length = 0, size = 2.75)+ -->
665
+ <!-- theme_bw(base_size = 11)+ -->
666
+ <!-- theme(legend.position = "top")+ -->
667
+ <!-- xlab(label = expression(pi))+ -->
668
+ <!-- xlim(c(0, 1))+ -->
669
+ <!-- ylab(expression(gamma)) -->
670
+ <!-- ``` -->
671
+
672
+
673
+ <!-- ```{r, fig.height = 6, fig.width = 7} -->
674
+ <!-- (g1/g2) -->
675
+ <!-- ``` -->
676
+
677
+
678
+
679
+
638
680
# Session
639
681
640
682
``` {r}
0 commit comments