Taavi Päll b8ecbc616b updated README.Rmd 3 年 前
..
README.Rmd b8ecbc616b updated README.Rmd 3 年 前

README.Rmd

---
title: "Working with model objects"
output: github_document
---

## Install

- Download and install R [https://www.r-project.org](https://www.r-project.org) (and RStudio [https://www.rstudio.com/products/rstudio/](https://www.rstudio.com/products/rstudio/)).

- Go to R console or open scripts/README.Rmd in RStudio.

- Install these packages (this needs to be done once).

```{r}
if(!require(brms)){
install.packages(c("brms", "here"))
library(brms)
library(here)
}
```

## Run

In R console OR in .Rmd file:

- Load packages to R environment.

```{r, message=FALSE}
library(brms)
library(here)
```

- Load the model object and print model summary.

```{r}
m <- readRDS(here("models/anticons_detool.rds"))
print(m)
```

- Get fitted coefficients with 95% credible intervals.

```{r}
posterior_summary(m)
```

- Get the full posterior.

```{r}
post <- posterior_samples(m)
head(post)
```

- What is the estimated difference in the proportion of anti-conservative p value histograms between DESeq2 and EdgeR?


```{r, eval=FALSE}
posterior_deseq_edger <- inv_logit_scaled(post$b_de_tooldeseq - post$b_de_tooledger)
hist(posterior_deseq_edger, breaks = 40)
```


```{r, echo=FALSE, message=FALSE}
posterior_deseq_edger <- inv_logit_scaled(post$b_de_tooldeseq - post$b_de_tooledger)
png(here("plots/posterior.png"))
hist(posterior_deseq_edger, breaks = 40)
invisible(dev.off())
```

![](plots/posterior.png)


- The posterior summary for the effect size.

```{r}
posterior_summary(posterior_deseq_edger)
```

```{r, echo=FALSE}
ps <- posterior_summary(posterior_deseq_edger)
```

The estimated effect size is somewhere between `r paste(signif(ps[1,3:4], digits = 3) * 100, collapse = " and ")` percentage points.

- Get data from model object.

```{r}
data <- m$data
head(data)
```

- Extract stan code from model object. This is the fullest model description.

```{r}
stancode(m)
```


## This document

This README.md was generated by running:

```{r, eval=FALSE}
rmarkdown::render("scripts/README.Rmd", output_file = here::here("README.md"))
```

datacite.yml
Title A field-wide assessment of differential high throughput sequencing reveals widespread bias
Authors Päll,Taavi;Institute of Biomedicine and Translational Medicine, University of Tartu, Estonia
Luidalepp,Hannes;Quretec (https://www.quretec.com)
Tenson,Tanel;Institute of Technology, University of Tartu, Estonia
Maiväli,Ülo;Institute of Technology, University of Tartu, Estonia
Description Model objects supplement to the "A field-wide assessment of differential high throughput sequencing reveals widespread bias".
License Creative Commons CC0 1.0 Public Domain Dedication (https://creativecommons.org/publicdomain/zero/1.0/)
References A field-wide assessment of differential high throughput sequencing reveals widespread bias. Taavi Päll, Hannes Luidalepp, Tanel Tenson, Ülo Maiväli. bioRxiv 2021.01.04.424681; doi: https://doi.org/10.1101/2021.01.04.424681 [doi:10.1101/2021.01.04.424681] (IsSupplementTo)
Funding Estonian Research Council, PRG335
Estonian Research Council, PUT1580
European Regional Development Fund, 2014-2020.4.01.15-0013
Keywords NCBI GEO
Bayes
stan-mc
brms
Resource Type Dataset