Constructing IRanges
In the video, some IRanges constructor examples were provided. This is your turn to practice creating sequence ranges with different arguments and see how these arguments are reused or complemented.
Using the IRanges() function, you can specify parameters such as start, end, or width. These parameter inputs can fall into one of two categories:
start,end, andwidthare numeric vectors.- The
startparameter is a logical vector.
Missing arguments will be resolved using the equation width = end - start + 1.
The IRanges() constructor indicates that all of the parameters are optional with default NULL:
IRanges(start = NULL, end = NULL, width = NULL, names = NULL)
Este exercício faz parte do curso
Introduction to Bioconductor in R
Instruções do exercício
Construct three IRanges objects with the following arguments:
IRnum1: Astartequal to a vector of values 1 through 5 andendequal to 100.IRnum2: Anendequal to 100 andwidthequal to both 89 and 10.IRlog1:startequal toRle(c(F, T, T, T, F, T, T, T)).- Print the objects and see the results!
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Load IRanges package
library(___)
# IRnum1: start - vector 1 through 5, end - 100
IRnum1 <- ___
# IRnum2: end - 100, width - 89 and 10
IRnum2 <- ___
# IRlog1: start = Rle(c(F, T, T, T, F, T, T, T)))
IRlog1 <- IRanges(___ = Rle(___))
# Print objects in a list
print(list(IRnum1 = IRnum1, IRnum2 = IRnum2, IRlog1 = IRlog1))