Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust chapter about genomic ranges #85

Merged
merged 4 commits into from
May 15, 2024
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
31 changes: 26 additions & 5 deletions episodes/07-genomic-ranges.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ demo_granges2 <- GRanges(
demo_granges2
```

Finally, the examples above also demonstrate that `GRanges` objects include a
component called `seqinfo`, which is occasionally used to store information
Finally, the example above also demonstrate that `GRanges` objects include a
component called `seqinfo`, which can be used to store information
about each sequence that may be represented in the `seqnames` component.
In the latest example above, we have not provide any information about any
sequence.
Expand Down Expand Up @@ -442,6 +442,24 @@ seqinfo(demo_granges2) <- Seqinfo(
demo_granges2
```

The start and end positions of the individual ranges as well as the width of
every interval can be extracted as numeric vector using the functions `start()`,
`end()` and `width()`, respectively.

```{r}
start(demo_granges2)
end(demo_granges2)
width(demo_granges2)
```

The sequence names and strand information can be extracted using the functions
`seqnames()` and `strand()`, respectively.

```{r}
seqnames(demo_granges2)
strand(demo_granges2)
```

### Metadata on GRanges

Similarly to `IRanges`, metadata can be passed directly to the `GRanges`
Expand Down Expand Up @@ -583,10 +601,13 @@ lengths(actb_exons_by_transcript)

Importantly, the function `lengths()` (with a final `s`) demonstrated above
is different from the function `length()` (without `s`).
The former is meant to be used on list objects, while the latter is meant
to be used on vectors.
The former is meant to be used on list objects, returning a vector giving the
length of each element in the list; while the latter returns a single numeric
scalar giving the length of the list itself (i.e., the number of elements
in the list).

What does `length(actb_exons_by_transcript)` return, and why?
What does `length(actb_exons_by_transcript)` return, and what does this
number represent biologically?

::::::::::::::: solution

Expand Down
Loading