Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions vignettes/Introduction_to_CASE.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Introduction to CASE for multi-trait fine-mapping"
title: "Introduction to CASE for multi-cell-type eQTL fine-mapping"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Introduction_to_CASE}
Expand All @@ -14,9 +14,9 @@ knitr::opts_chunk$set(
)
```

This Vignette is a draft and will be further updated.
# This Vignette is a draft and will be further updated.

First, load necessary packages.
First, we load necessary packages.

```{r setup}
library(CASE)
Expand All @@ -25,16 +25,16 @@ library(susieR)
set.seed(1000)
```

## The example data

```{r}
data("example_data")
X = example_data$X
Y = example_data$Y
B = example_data$B
attach(example_data)

N = nrow(X)
M = ncol(X)
C = ncol(Y)
cat("sample size =", N, "\n",
cat(" Sample size =", N, "\n",
"SNP size =", M, "\n",
"Cell type number =", C, "\n")
```
Expand Down Expand Up @@ -66,13 +66,15 @@ g2 = ggplot(df, aes(x = Var1, y = Var2, fill = corr)) +
labs(fill = "corr")
print(g2)
```
Only SNP 10 have eQTL effects for three cell types and SNP 950 have eQTL effects for the first two cell types.

```{r}
print(which(B != 0, arr.ind = TRUE))
idx1 = 10
idx2 = 950
B[c(idx1, idx2), ]
```
Check the Z scores for the causal SNPs.

```{r}
Z = matrix(0, M, C)
Expand All @@ -83,7 +85,9 @@ for (i in 1:M){
Z[c(idx1, idx2), ]
```

Run SuSiE (a single-trait fine-mapping method) seperately.
## Fine-mapping

First, we try a single-trait fine-mapping method, SuSiE (Wang et al. 2020), for each cell type separately. The results lacks power for the third cell type and for SNP 950.

```{r}
for (c in 1:C){
Expand All @@ -92,13 +96,14 @@ for (c in 1:C){
}
```

Jointly studying three traits together improves the power of identifying the causal variants.
However, CASE jointly studies three traits together to improve the power of identifying the causal variants.

```{r}
fit <- CASE(Z = Z, R = R, N = rep(N, C))
print(fit$sets)
```

## Session Information

```{r}
sessionInfo()
Expand Down
Loading