In this lesson we will discuss list life objects from genomic ranges. This is another set or another class of objects, that you're going to encounter again and again. And it needs a short introduction. In genomic ranges, we have a lot of lists or xx lists where xx is some class. For example, a GRanges list. There's also an integer list and other things. This is basically similar to a normal list in R. But a GUH's list is, you can think of, as a list where each element is a GUHs. Behind the scenes of list live objects in GUHs, there is some optimization going on that makes them very efficient to compute on. But for the end user, it also gives a way of making sure that what we are working on makes sure that everything is kind of on the same kind. For example, the ranges list. So what's a use case for GRanges list? Well, a single GRange could be, for example, describing the exons of a transcript. And let's say we have a gene. The gene has multiple transcript and each transcript has multiple exons. It's very natural to think of the gene structure, for one specific gene, is being encoded in a GRanges list, or a list of GRanges. Let's load the package, and construct an example. The first thing I'm doing here, is I'm, basically constructing two GRanges, one in chromosome one. One in chromosome two. And now I'm going to do a GRanges list. Where I'm just going to put them in. I'm going to give them names. Now this is going to be a name list. And now we have GRanges list. Pretty simple. It looks and feels a little bit like a list. We can subset it with the first one, which is a GRanges list of length 1. We can use the double bracket as we know from normal lists, we can use the name, and all the usual things from lists. We can also think of this as one really long GRanges. So let's say, for example, we want to run the start of the start access on this. What do we get out of this? Well, we get a list on integer list, where for each element, we have the start vector for the GRanges inside that element. In a same way, we have end, we do seqnames. And so on and so forth. It's very appealing to think about using things like il apply and is apply, and that's very worthwhile. There's one type of apply I use very often too GRanges list. That's like figuring out how long are the GRanges need for them. And there's a convenience function that is a lot faster than using is apply called elementLength. So elementLength just tells us how long are each of the element, we have four ranges on each of them. It's highly useful. It's much, much faster than doing, let's say, is apply. [INAUDIBLE] length. You are not going to be able to see that because these are really pretty small objects. But for very, very big lists, there is a huge speed difference there. There's something in g ranges that is being introduced that are called indoor applies. Indoor applies is a fancy name for a very simple operation. It's applying a function to a GRanges list that results in a new g ranges list. So, there's a lot of standard GRanges functions that we can use in GRanges list. For example, we can shift everything by 10. And this is an example of an indoor apply which take a GRangesList in, and a GRangesList comes out. We can use findOverlaps, and here the situation is a little different. Let's look at the output and explain it. So findOverlaps thinks of the tree ranges list as having two elements. And we have an overlap between the first element, if any of the ranges inside that element overlaps. So now I've run into an overlap between a whole GRanges, and a single range, and I'm going to count it as an overlap if any of my ranges in my GRanges overlap a range in gr2. In the same way, we can find overlaps between the two GRangesLists, this is not too interesting, everything hits each other. But this is kind of a very natural way of using find overlap for GRanges. But it's a little bit different from what happens for GRanges. This is also usually what you want to do, if you want to say overlap a transcript with a ChIPseek peak, or a read. We are not necessarily interested in exactly which x r overlaps. We just want to know, does some part of the x r overlap a given genomic region.