Skip to content

Commit

Permalink
doc: remove useless callout boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Oct 19, 2023
1 parent 6b56ba4 commit b3a6ea0
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 137 deletions.
2 changes: 1 addition & 1 deletion _common.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ options(
cli.num_colors = 0,
cli.hyperlink = FALSE,
pillar.bold = TRUE,
width = 77 # 80 - 3 for #> comment
width = 9999 # 80 - 3 for #> comment
)

ggplot2::theme_set(ggplot2::theme_gray(12))
43 changes: 10 additions & 33 deletions data-representation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ involve comparisons *between* ranges **in a single** GRanges object.
::: {.callout-note}
## Note
Compared to previous section, the result of each function described below
depends on the entire set of ranges in the input `GRanges` object.
depends on the **entire set of ranges** in the input `GRanges` object.
:::

- Computing the "inverse" genomic ranges, i.e. ranges in-between the input ranges:
Expand Down Expand Up @@ -345,18 +345,13 @@ none of the remaining ranges from `query` overlap with ranges from `subject`.

To directly **subset** ranges from `query` overlapping with ranges from a
`subject` (e.g. to only keep *peaks* overlapping a *TSS*), we can use the
`subsetByOverlaps` function.
`subsetByOverlaps` function. The output of `subsetByOverlaps` is a subset of the original `GRanges` object
provided as a `query`, with retained ranges being unmodified.

```{r}
subsetByOverlaps(peaks, TSSs)
```

::: {.callout-note}
## Note
The output of `subsetByOverlaps` is a subset of the original `GRanges` object
provided as a `query`, with retained ranges being unmodified.
:::

- Counting overlaps between a query and a subject

Finally, the `countOverlaps` is used to count, for each range in a `query`, how
Expand Down Expand Up @@ -506,8 +501,6 @@ The way `GInteractions` objects are printed in an R console mimics that of
`GRanges`, but pairs two "ends" (a.k.a. *anchors*) of an interaction together,
each end being represented as a separate `GRanges` range.

::: {.callout-note}
## Notes
- Note that it is possible to have interactions joining two identical anchors.

```{r}
Expand All @@ -525,7 +518,6 @@ gi[4]
```{r}
gi[5]
```
:::

### `GInteractions` specific slots

Expand Down Expand Up @@ -650,9 +642,7 @@ Note that for "trans" inter-chromosomal interactions, i.e. interactions with anc
different chromosomes, the notion of genomic distance is meaningless and for
this reason, `pairdist` returns a `NA` value.

::: {.callout-tip}
## Advanced `pairdist` arguments
The `type` argument can be tweaked to specify which type of "distance" should
The `type` argument of the `pairdist()` function can be tweaked to specify which type of "distance" should
be computed:

- `mid`: The distance between the midpoints of the two regions
Expand All @@ -665,7 +655,6 @@ be computed:
- `diag`: The difference between the anchor indices is returned.
This corresponds to a diagonal on the interaction space when
bins are used in the 'regions' slot of 'x'.
:::

#### `GInteractions` overlap methods

Expand Down Expand Up @@ -929,8 +918,6 @@ to describe important topological features.
the contact matrix has been created. This is often useful to estimate some Hi-C metrics.
- `metadata` is a `list` to further describe the experiment.

::: {.callout-tip}
## `HiCExperiment` slots
These pieces of information are called `slots`. They can be directly accessed
using `getter` functions, bearing the same name than the slot.

Expand All @@ -953,10 +940,6 @@ pairsFile(hic)
metadata(hic)
```
:::

::: {.callout-note}
## Notes

`import` also works for other types of `ContactFile` (`HicFile`,
`HicproFile`, `PairsFile`), e.g.
Expand All @@ -977,17 +960,19 @@ pf <- PairsFile(pairsf)
pairs <- import(pf)
pairs
```
:::

#### Customizing the `import`

To reduce the `import` to only parse the data that is relevant to the study,
two arguments can be passed to `import`, along with a `ContactFile`.

::: {.callout-tip}
## Key `import` arguments:
::: {.callout-warning icon='true'}

##### Key `import` arguments:

- `focus`: This can be used to **only parse data for a specific genomic location**.
- `resolution`: This can be used to choose which resolution to parse the contact matrix at (this is ignored if the `ContactFile` is not multi-resolution, e.g. `.cool` or HiC-Pro generated matrices)

:::

- Import interactions within a single chromosome:
Expand Down Expand Up @@ -1059,12 +1044,9 @@ The imported genomic interactions can be directly **exposed** using the
interactions(yeast_hic)
```

::: {.callout-note}
## Note
Because genomic interactions are actually stored as `GInteractions`, `regions`
and `anchors` work on `HiCExperiment` objects just as they work with
`GInteractions`!
:::

```{r}
regions(yeast_hic)
Expand Down Expand Up @@ -1119,8 +1101,6 @@ head(scores(yeast_hic, "count"))
head(scores(yeast_hic, "balanced"))
```

::: {.callout-tip}
## Tip
Calling `interactions(hic)` returns a `GInteractions` with `scores` already
stored in extra columns. This short-hand allows one to dynamically check `scores`
directly from the `interactions` output.
Expand All @@ -1130,7 +1110,6 @@ interactions(yeast_hic)
head(interactions(yeast_hic)$count)
```
:::

#### topologicalFeatures

Expand Down Expand Up @@ -1173,8 +1152,7 @@ pairsFile(yeast_hic)
readLines(pairsFile(yeast_hic), 25)
```

::: {.callout-important}
## Importing a `PairsFile`
#### Importing a `PairsFile`
The `.pairs` file linked to a `HiCExperiment` object can itself be imported in
a `GInteractions` object:

Expand All @@ -1185,7 +1163,6 @@ import(pairsFile(yeast_hic), format = 'pairs')
Note that these `GInteractions` are **not** binned, contrary to `interactions`
extracted from a `HiCExperiment`. Anchors of the interactions listed in the
`GInteractions` imported from a disk-stored `.pairs` file are all of width `1`.
:::

## Visual summary of the `HiCExperiment` data structure

Expand Down
26 changes: 3 additions & 23 deletions interactions-centric.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,12 @@ pf <- PairsFile(pairsf)
pf
```

::: {.callout-note}
## Reminder!
`PairsFile` connections can be imported directly into a `GInteractions` object
with `import()`:
If needed, `PairsFile` connections can be imported directly into a `GInteractions` object
with `import()`.

```{r}
import(pf)
```
:::

We can compute a P(s) per chromosome from this `.pairs` file using the `distanceLaw` function.

Expand All @@ -133,15 +130,6 @@ ps <- distanceLaw(pf, by_chr = TRUE)
ps
```

::: {.callout-note}
## Note
Because this is a toy dataset, contacts are only provided for the chromosome `II`.

```{r}
table(ps$chr)
```
:::

The `plotPs()` and `plotPsSlope()` functions are convenient `ggplot2`-based functions
with pre-configured settings optimized for P(s) visualization.

Expand Down Expand Up @@ -198,13 +186,8 @@ plotPsSlope(ps_from_hic, aes(x = binned_distance, y = slope))

The ratio between cis interactions and trans interactions is often used to
assess the overall quality of a Hi-C dataset. It can be computed *per chromosome*
using the `cisTransRatio()` function.

::: {.callout-tip}
## Tip!
You will need to provide a genome-wide `HiCExperiment` to estimate
using the `cisTransRatio()` function. You will need to provide a **genome-wide** `HiCExperiment` to estimate
cis/trans ratios!
:::

```{r}
full_hic <- import(cf, resolution = 2000)
Expand All @@ -223,13 +206,10 @@ ggplot(ct, aes(x = chr, y = cis_pct)) +
labs(x = 'Chromosomes', y = '% of cis contacts')
```

::: {.callout-important}
## Watch out
Cis/trans contact ratios will greatly vary **depending on the cell cycle
phase the sample is in!** For instance, chromosomes during the mitosis phase
of the cell cycle have very little trans contacts, due to their structural
organization and individualization.
:::

## Virtual 4C profiles

Expand Down
24 changes: 5 additions & 19 deletions matrix-centric.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,15 @@ data can be normalized using matrix balancing approaches
disk-stored matrices using out-of-memory strategies (e.g. with
`cooler balance <.cool>`). However, if contact matrix files are imported
into a `HiCExperiment` object but no `balanced` scores are available,
in-memory balancing can be performed using the `normalize` function.
in-memory balancing can be performed using the `normalize` function. This
adds an extra `ICE` element in `scores` list (while the `interactions`
themselves are unmodified).

```{r}
normalized_hic <- normalize(hic)
normalized_hic
```

::: {.callout-note}
## Note
The only change done to the `HiCExperiment` object by the `normalize` function is
the addition of a single extra `ICE` in `scores` list. The `interactions`
themselves are unmodified.
:::

It is possible to plot the different `scores` of the resulting object to
visualize the newly computed `scores`. In this example, `ICE` scores
should be nearly identical to `balanced` scores, which were originally imported
Expand Down Expand Up @@ -161,23 +156,14 @@ This is sometimes called "detrending", as it
effectively removes the average polymer behavior from the balanced matrix.

The `detrend` function performs this operation on a given `HiCExperiment` object.
It adds two extra elements in `scores` list: `expected` and `detrended` metrics
(while the `interactions` themselves are unmodified).

```{r}
detrended_hic <- detrend(hic)
detrended_hic
```

::: {.callout-note}
## Note
The only change done to the `HiCExperiment` object by the `detrend` function is
the addition of two extra `scores`:

1. `expected`
2. `detrended`

The `interactions` themselves are unmodified.
:::

Topological features will be visually more prominent in the O/E `detrended` Hi-C map.

:::{.column-page-right}
Expand Down
13 changes: 3 additions & 10 deletions parsing.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ telomere <- GRanges("II:700001-813184")
subsetByOverlaps(hic, telomere) |> interactions()
```

::: {.callout-important icon='true'}
## `type` argument

By default, `subsetByOverlaps(hic, telomere)` will only recover interactions
**constrained** within `telomere`, i.e. interactions for which both ends are
in `telomere`.
Expand All @@ -225,7 +222,6 @@ at least one of their anchors within `telomere`.
```{r}
subsetByOverlaps(hic, telomere, type = "any") |> interactions()
```
:::

#### `<HiCExperiment>["..."]`

Expand Down Expand Up @@ -287,10 +283,9 @@ hic["II:300001-320000|IV:1-100000"]
```{r}
hic[c('II', 'III', 'IV')]
```
:::

::: {.callout-note}
## Note
Some notes:

- This last example (subsetting for a vector of several chromosomes) is the
only scenario for which `[`-based in-memory subsetting of pre-imported data is
the only way to go, as such subsetting is not possible with `focus`
Expand All @@ -301,6 +296,7 @@ efficiently using the `focus` argument when `import`ing data into a
- However, keep in mind that subsetting preserves extra data, e.g. added `scores`,
`topologicalFeatures`, `metadata` or `pairsFile`, whereas this information is
lost using `focus` with `import`.

:::

### Zooming on a `HiCExperiment`
Expand Down Expand Up @@ -431,8 +427,6 @@ topologicalFeatures(hic, 'loops')
hic
```

::: {.callout-note}
## Note
All these objects can be used in `*Overlap` methods, as they all
extend the `GRanges` class of objects.

Expand All @@ -444,7 +438,6 @@ countOverlaps(
subject = topologicalFeatures(hic, 'loops')
)
```
:::

#### `pairsFile`

Expand Down
Loading

0 comments on commit b3a6ea0

Please sign in to comment.