In this session we will discuss our covers of the g ranges class from the genome ranges packets. But first we're going to make a slight detour and discuss a nuclear class in find article data frame but with a capital d and a capital f. [COUGH] Why do we need a new class for this? Let's take an example. Construct an r ranges, and a data frame. A cabizal D dataframe works like a classic R dataframe but it allows many types of objects of arbitrary type as long as they have a length attribute to be stored in them. So the way, so for example it allows you to store i ranges inside them. You construct them with the characters DF, you have an i range here called ir, and let's say we have a score here that's three random normal variables. So it prints nicely. We can see we have an IRange that's a single column with the IRange and we can do the standard subsetting. This here gives us a specific IRange of length 1. And we can use the dollar operator as we are used to. This is in contrast to what happens with a classic data frame. If we started to do this with a classic data frame. [SOUND] And we put an IRange inside here. We'll see that it works, but it really gives us three different columns. It does really keep the things together. So data frames or capital data frames that are slightly more versatile. And for this reason, they are used in various places by conductor nowadays. Let's depart from the count data frames and return to the g ranges. Over here in the code here I have little construction of g ranges. And nothing must have happened. I just like, I typed in g-ranges. And g-ranges can have something called values. So they can have additional columns. This is unlike I-ranges, containing data and different things. So the entire set of columns is called values or element meta data or it's called values and that's equal to a data frame with values in it. An example is going to make this much clearer. So now I have a metadata column with a score. I could have had additional columns. It gets filled out and I can access it with the values of the G-ranges. I can also use Mcols that's basically anonymous. Even more convenient ways I can use the dollar operator to access a different column. So I can do something like GR dollar score. I can even use that to assign a new thing. Let's say score two is equal to score / 3. And now I have two different columns. This is highly useful. The main work horse of the G range's class and the I range's ecosystem in my opinion is the find over left function. And that works as we would expect for G ranges as well. And it takes care of bookkeeping such as strand and chromosome. So let's get a new g ranges. Which has, does have the old g ranges. They have the same ranges right but what's different is the seq names of the chromosomes and the strand. Let's try to do a find overlaps between those two things. [SOUND] Okay we have a couple of overlaps here. And you'll see out of the output that the star strand overlaps with the plus strand and the star strand also overlaps with the minus strand. It's possible to do this same query where you completely ignore a strand. In this case it's going to keep give by using the ignore strand argument to the function. We get the same output because there are no places where we don't have an overlap because incompatible strands. ignore.strand = TRUE for example allows elements on the positive strand to overlap elements on the negative strand. A very common use case is we have a GRange and we want to only select ranges from the GRange that overlaps some other elements. And for that, we have a convenience function called subset by overlaps. It's basically constructed using find overlaps. So let's take our original g range. Say, let's do a subsetByOverlaps of gr and gr2. Okay, everything overlaps. That was not too exciting. Let's turn them around and see here that when we ask for the ranges in GR2, we don't have any overlap with the range that's on chromosome two. So we return an object with only two ranges in them. This is a very convenient function, I use this a lot. Next, we'll discuss another convenience function, which is called make g range from data frame. The idea is that we often find that we have classic odd data frames, that store objects that looks a little bit like genomic ranges, and we want to convert them into genomic ranges. So, let's make one of those, let's take a D F, I'd say that's data frame, chromosome, we have something called chromosome, chromosome one, we have start, this is like one two three, we have inputs as four through six, we have a stall which again is like some some random numbers. So classic R data frame. We can convert that into a g range by calling makeGRangesFromDataFrame. Note here that the score column gets dropped. That's a default. You can say keep.extra.columns equals true. And you keep this extra column, so great usage. You can do a lot with GRanges and in the accompanying document I have a little bit of code, or a little bit of discussion about two classic use cases, and some pseudocode that attacks these use cases using the functionality we introduced in G-ranges. So why can I say I use this packet basically every day I do computation pitalitry and it has transformed my work flow.