Skip to content

Commit

Permalink
fix: groups in P(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Aug 25, 2023
1 parent f66c384 commit 8cb64cb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions interactions-centric.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ The `plotPs()` and `plotPsSlope()` functions are convenient `ggplot2`-based func
with pre-configured settings optimized for P(s) visualization.

```{r ps}
plotPs(ps, aes(x = binned_distance, y = norm_p))
plotPsSlope(ps, ggplot2::aes(x = binned_distance, y = slope))
library(ggplot2)
plotPs(ps, aes(x = binned_distance, y = norm_p, color = chr))
plotPsSlope(ps, aes(x = binned_distance, y = slope, color = chr))
```

### P(s) for multiple `.pairs` files
Expand All @@ -174,9 +175,9 @@ merged_ps <- rbind(
ps |> mutate(sample = 'WT'),
eco1_ps |> mutate(sample = 'eco1')
)
plotPs(merged_ps, aes(x = binned_distance, y = norm_p, color = sample)) +
plotPs(merged_ps, aes(x = binned_distance, y = norm_p, color = sample, linetype = chr)) +
scale_color_manual(values = c('#c6c6c6', '#ca0000'))
plotPsSlope(merged_ps, ggplot2::aes(x = binned_distance, y = slope, color = sample)) +
plotPsSlope(merged_ps, aes(x = binned_distance, y = slope, color = sample, linetype = chr)) +
scale_color_manual(values = c('#c6c6c6', '#ca0000'))
```

Expand All @@ -190,7 +191,7 @@ curves will be greatly impacted, notably at short distances.
```{r}
ps_from_hic <- distanceLaw(hic, by_chr = TRUE)
plotPs(ps_from_hic, aes(x = binned_distance, y = norm_p))
plotPsSlope(ps_from_hic, ggplot2::aes(x = binned_distance, y = slope))
plotPsSlope(ps_from_hic, aes(x = binned_distance, y = slope))
```

## Cis/trans ratios
Expand Down Expand Up @@ -240,6 +241,7 @@ For instance, we can compute the genome-wide virtual 4C profile of interactions
anchored at the centromere in chromosome `II` (located at ~ 238kb).

```{r}
library(GenomicRanges)
v4C <- virtual4C(full_hic, viewpoint = GRanges("II:230001-240000"))
v4C
```
Expand Down

0 comments on commit 8cb64cb

Please sign in to comment.