Learn to use tools from the Bioconductor project to perform analysis of genomic data. This is the fifth course in the Genomic Big Data Specialization from Johns Hopkins University.

Loading...

From the course by Johns Hopkins University

Bioconductor for Genomic Data Science

123 ratings

Learn to use tools from the Bioconductor project to perform analysis of genomic data. This is the fifth course in the Genomic Big Data Specialization from Johns Hopkins University.

From the lesson

Week Four

In this week, we will cover Getting data in Bioconductor, Rsamtools, oligo, limma, and minfi

- Kasper Daniel Hansen, PhDAssistant Professor, Biostatistics and Genetic Medicine

Bloomberg School of Public Health

In this session we will discuss a popular limma packet and

Â a little bit about some general concepts from statistical inference.

Â The limma packet says, the limma stands for linear models for micro rays.

Â It's a package that was developed for analysis of gene expression microrays, but

Â it fits a classic model

Â that we want to fit a lot of different types of genomic data.

Â So while a lot of the terminology limma has to do with microrays,

Â it really being used for a lot of different types of data.

Â I'm using it myself for my own research on DNA methylation.

Â Linear models is a general class of models that we use,

Â roughly speaking, for continuous data.

Â There's other types of,

Â there's a couple of other analysis packages that are very popular.

Â Bioconductor, that deals with count data.

Â Specifically, negative binomial models for count data.

Â These packages have names such as, PE Seek, PE Seek Two, and Estar.

Â Estar is from the same authors as the limma packets.

Â A lot of these models basically treat each feature.

Â We have a set of features, in this case here, let's think of them as genes,

Â and we want to find genes that are differentially expressed.

Â A thing that's very important in genomics is that we have learned that

Â borrowing information across genes is extremely beneficial.

Â So in most gene expression data sets where many genes,

Â say 20,000 or 30,000 different genes, we have relatively few samples.

Â Sometimes you have six samples, sometimes you have on the order of a hundred

Â samples, but we have far fewer samples than we have genes.

Â We are essentially asking the same question for all the genes.

Â We can get a better analysis by borrowing information across genes.

Â That's usually done using a statistical class of statistical methods known

Â as empirical base methods, and it typically has to do with modeling

Â the relationship between gene expression and variance of the gene.

Â This all gets a little bit technical, but the common theme here is that you

Â gain a lot of power and performance by using these empirical based techniques.

Â That is something that is a little bit special to genomics.

Â In all these cases, we have some data and

Â we have something we will call the design of the experiment.

Â The design of the experiment tells us something about what samples were run

Â at what times, which rules do they come from?

Â Are the samples paired?

Â Do we have additional comparative information at the sample wants you

Â to take into consideration such as sex sample or the age of the sample,

Â or the age of the person where you take the sample from?

Â And these are all encapsulated into something we in

Â statistical terms call a design matrix.

Â We will discuss a design matrix a little bit later in this session when

Â we can see an example.

Â So let's start off by loading in the limma packets and

Â load an example data set called leukemiasEset.

Â So we see here that leukemia used as an expression set, it has 60 samples.

Â And the interesting variable in this data set is

Â a variable called leukemia type Leukemia types, so

Â this data set here, profiled four common subsets of Leukemia.

Â We have ALL, AML, CLL and CML, and

Â then finally we have the reference group, that's NoL, it stands for Not Leukemia.

Â So these are patients that didn't have Leukemia.

Â We, in this session we will avoid discussing complicated designs and

Â we will just go through a very simple two group comparisons where we imagine we

Â are profiling examples from two different experimental groups and we want to find

Â genes that are different in express We got to select the LL group and the AOL group.

Â So let's subset the data.

Â So now that we subset the data, we can have a look at our variable of interest.

Â This is where the variable that encapsulates everything about the sign we

Â are interested in, in this toy example.

Â Note that leukemia type is a factor.

Â Oh, I didn't take it from our data.

Â It's been a factor.

Â It has five levels, and these levels represent

Â types of leukemia that are not present in our subset of the data.

Â That's going to confuse some of the model fitting functions.

Â So we're going to clean up the data a little bit,

Â we're going to recreate the leukemia type factor, and the effect of that is we

Â are going to get rid of the three levels for which we don't have any samples.

Â Look, we have the same variable list but

Â now we only have two levels instead of five levels.

Â The first level in a factor is always important.

Â It's the first level that's being used as a reference level.

Â This case here we have ALL as the reference level.

Â I'm not going to fix that.

Â Normally you would do that.

Â The implication of this is that the differential expression we're going to see

Â is genes That are differentially expressed

Â in patients that don't have leukemia relative to those who have ALL.

Â That's a little confusing.

Â A more natural thing is to talk about genes that are differentially expressed

Â in ALL relative to not having leukemia.

Â The first thing we're going to do when we fill a liver more or

Â less we set our design matrix, which encapsulates the design of the experiment.

Â Setting up a design matrix is a general statistical task and it takes quite

Â a while to become fully comfortable with it There's a great introduction to

Â this in the limma user's guide and if you need more help which is very likely,

Â you can ask at the support forum or you can consult a friendly local statistician.

Â I'm going to emphasize that setting up a design matrix for the new experiment

Â experiment usually does not require very much insight into genomics.

Â It's a statistical task that doesn't have much to do with genomics,

Â although we use it a lot.

Â So, let's have a little look at the design matrix so we can see what we have created.

Â It's a matrix where the number of rows is equal to the number of samples, and

Â we have two columns which describe two parameters in the model.

Â We have an intercept parameter.

Â In this case here, the interpretation, the intercept parameter is that this is

Â the average gene expression for a given gene across all our samples.

Â Sorry I crossed the ALL samples.

Â The second column, which is really the parameter we're interested in,

Â is the difference in gene expression between NOL and ALL.

Â If this parameter is equal to zero, it means that the gene is

Â not differently expressed because there's no difference between NOL and ALL.

Â So setting up model matrices and using this model matrix thing and

Â being sure that you interpret the coefficient correctly is, as I said,

Â a task that's completely beyond the scope of the session here.

Â So we'll continue this.

Â We see this example a lot.

Â This is probably the most common set up a two group comparison and

Â it's important to feel somewhat comfortable with it.

Â I'm going to note that what we're going to do here,

Â find the different expressed genes between two groups,

Â is we're going to do this with something that is very similar to doing it teaches.

Â Well let's wait on that for a moment.

Â Now we have the design, and

Â the first think we do in limma is we fit the basic model for the design.

Â So, in statistics, we separate the model from the hypothesis.

Â The model tells us in this case here, something about that we have

Â 24 samples and they have been, there are two groups of samples.

Â The hypothesis is that there's no difference

Â between the samples in the ALL group and the samples in the NOL group.

Â So we round LM fit which fits a linear model to all the genes separately.

Â So at this stage here, at the output of LM fit,

Â we've done nothing where we borrow information across genes.

Â That happens in the next step where he

Â does an empirical base estimation of the variability.

Â Now this is again, completely outside the scope to explain what this really does but

Â essentially it shows that the variability of a gene

Â is a mixture of a gene specific variability and

Â a variability where you assume or global variability where the global

Â variability assumes that all genes have the same variability.

Â Assuming that all genes have the same variability is clearly

Â not right biologically, but assuming, but

Â on the other hand, estimating the variables for each gene separately

Â means we are estimating a variability with only 12 samples in each group.

Â That's not a whole lot of data and what happens in the empirical base

Â step here is that we improve our variance estimation by forming this mixture.

Â Okay, so let's just do it and now we filled it and

Â we can look at the top different expressed genes.

Â So let's step back a little bit here.

Â Why is there only one list of different express genes?

Â That's because we have a design, where we have two group comparisons.

Â When you only have two groups and

Â you have no covariance there's only one comparison that's worth making.

Â That is asking whether or not the two groups have the same expression level.

Â So when I run this top table thing here, I don't have to explain what coefficient,

Â or what chest I'm interested in.

Â We're going to expand a little bit on this below.

Â So this here we have to get some columns out.

Â We get a lock fold change, which is a fold change between ALL and NOL.

Â We get a T statistic, we get a P value.

Â We get just an adjusted P value, which is adjusted for multiple testing.

Â That's usually what we're interested in.

Â We're also interested in the full chase estimate.

Â Now remember that our factor busted off so

Â that reference level is ALL which means that the fold

Â chains we have here is the fold chains from NOL to ALL.

Â So we can actually compute this by hand just to make sure the we have

Â the right interpretation.

Â So let's just get the first gene, and we're going to get the gene name so

Â we can look it up in our expression list,

Â this is really just like a feature name.

Â And now we're going to compute the expression for each,

Â the mean expression inside each group.

Â I do that with this little C apply command here which says I take my expression level

Â for only one gene, and I do a mean inside each level of the leukemia type thing.

Â So what could I get out of that?

Â This is the expression level in the two groups, ALL and NoL, and my

Â log fold change is NoL minus ALL, because of the reference level in the factor.

Â So again, this is a little bit where it's positive

Â because a gene is really actually, NoL and ALL is and isn't an OL.

Â Now, let's try to do this again.

Â So, what we've done here is really similar to a cheap statistic.

Â It's something known as a moderator gene statistic, because we have estimated

Â the variability of the data in a different way from a normal t statistic, where we

Â have utilized that we have many thousands of genes, and we utilize that information.

Â Now let's go back and refit this model here,

Â where we very specifically explain what contrast we are interested in.

Â So we set out a new model matrix we call design two that is very similar

Â to design one, but notice this -1 I have here.

Â Again, we won't go into details but

Â essentially it means that I get a new matrix where

Â the column names are slightly different.

Â And the true parameters in my model really what I get out of this

Â model matrix is that the first parameter is the expression level in ALL, and

Â the other parameter is the expression level in NoL.

Â Remember before, the design matrix had two parameters, and

Â it was expression in ALL and then the difference in expression from ALL to NoL.

Â I'm going to change the name of these, the columns of this thing here,

Â just because this is a little bit much to type.

Â I have ALL and Nol.

Â And now, I do the same thing as before, I fit it, but now,

Â I have to make a contrast.

Â So a contrast is a hypothesis, and

Â we're going to test, we're going to call this function called makeContrasts,

Â and I hope you can get a little feel for how it's run.

Â So I'm saying I want to have a contrast that's ALL minus NOL.

Â This is the opposite of what we did before,

Â we allow using NOL as the reference level.

Â I say I take my levels from this design matrix, and

Â I get a little this contrast matrix is really, quite simple, and

Â what this contrast test is whether or

Â not these two parameters with this linear combination is equal to zero.

Â So it's going to test whether ALL-Nol is equal to zero.

Â So now that I have a contrast I have to do something called contrast.fit and

Â then I've got to run my eBayes a module born from racing across genes,

Â and now I can look at my top table.

Â Now my top table here is relative to this specific

Â contrast I have inside my That I used in the contrast upfit.

Â So now note that I changed the sign of the log fold change, and

Â this here is essentially exactly the same as it did in the beginning it's just using

Â a slightly different setup.

Â It uses contrast instead of having the contrast implicit in the design matrix.

Â So I hope this is going to be a good beginning for

Â you to learn about design matrices and statistics, but

Â we're really not going to cover more on this in this class.

Â Coursera provides universal access to the worldâ€™s best education,
partnering with top universities and organizations to offer courses online.