Interacting with IRanges
You can use the IRanges() function to create a single sequence. You can also provide vectors to IRanges() to create multiple sequence ranges at the same time. This is both fascinating and useful! The creation of objects seq_1 and seq_2 are examples of this.
For this exercise, check the width of each of the sequences provided here, using width() and lengths(). Notice the difference between the two types of outputs.
Remember that width = end - start + 1.
This exercise is part of the course
Introduction to Bioconductor in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create the first sequence seq_1
seq_1 <- IRanges(start = 10, end = 37)
# Create the second sequence seq_2
seq_2 <- IRanges(start = c(5, 35, 50),
end = c(12, 39, 61),
names = LETTERS[1:3])
# Check the width of seq_1 and seq_2
___
___