An introduction to the statistics behind the most popular genomic data science projects. This is the sixth course in the Genomic Big Data Science Specialization from Johns Hopkins University.

Loading...

From the course by Johns Hopkins University

Statistics for Genomic Data Science

109 ratings

An introduction to the statistics behind the most popular genomic data science projects. This is the sixth course in the Genomic Big Data Science Specialization from Johns Hopkins University.

From the lesson

Module 1

This course is structured to hit the key conceptual ideas of normalization, exploratory analysis, linear modeling, testing, and multiple testing that arise over and over in genomic studies.

- Jeff Leek, PhDAssociate Professor, Biostatistics

Bloomberg School of Public Health

Often to visualize or model genomic data is you need to make some

Â data transformations that put it on a more appropriate scale or

Â a scale that's easier to interpret.

Â So the first thing I'm going to do just like always is I'm going to set up

Â the plotting parameters to be the plotting parameters that I like and

Â then I'm going to load the packages that are necessary for this tutorial, and

Â then, I'm going to load in a data set here.

Â And so, again, I'm going to load in the bodymap data set,

Â just like I have several times.

Â So the basic idea is I'm going to connect to a particular URL, here.

Â Then I'm going to load the file from the connection, close the connection, and

Â then set up some of the variables.

Â I'm going to make the variable name a little bit shorter and

Â extract the phenotype data, the expression data, and the feature data.

Â If you followed previous lectures, you'll see how I've done that in each of those.

Â And so, now the first thing that I'm going to do is I'm going to start looking

Â at some plots.

Â So, first thing you do is you can look at a plot of just some sort of simulated,

Â normal data.

Â So this plot is a plot that you would sort of typically see in nice distribution.

Â But then if you look at the histogram of data from say the first sample,

Â from the expression data set, and if I

Â make that histogram I can see almost all of the values are equal to zero.

Â If I increase the number of bins in the histogram,

Â you can see,it's really almost all the values are almost exactly zero with

Â just a few values that are very, very large.

Â And so the first thing that you might do is you might

Â do some kind of transformation.

Â The one transformation is to put things on the log scale and

Â so the log scale basically puts things on a multiplicative

Â scale that makes it a little bit easier for you to visualize the data.

Â So often when you have highly skewed count data it's a very common transformation for

Â people to apply.

Â And so if I do that you can see a little bit better the distribution.

Â But this is a little bit deceiving.

Â One of the reasons you can see the distribution better is because when I

Â apply the log to this dataset, the log of zero is actually undefined.

Â So if I look at the minimum of the log these values I can see it's negative

Â infinity, and so, actually if I look at the quantiles of that distribution

Â I can see that it can't calculate them very well because basically

Â you have these values that are in negative infinity for

Â almost all the values, because you mostly have zeros in the data set.

Â And so the first thing that you can do to sort of avoid that problem

Â is that you can, instead of having a count of zero, you can just add a small number,

Â add one, that won't effect any of the big counts,

Â and it'll make the log transformation defined for all the rest of them.

Â So if I do the histogram of the log of the counts plus one,

Â now I can see this distribution.

Â You get the zeroes back, so you get this big spike of zeroes, and

Â then you can see the distribution to the right hand side.

Â So the other thing that people do is instead of the log transform, they often

Â do the log two transform, so that's just a different base for the transform.

Â And so the reason why they do that is that they want to be able to basically

Â compare two values, and when they compare two values on the log two transform,

Â if you take the difference of those values,

Â it's sort of equivalent to the log of the full change.

Â And so now when you compare the two values to each other,

Â if you get an increase of one it's sort of like a doubling of the data size.

Â And so that's a useful metric for measuring how related two things are.

Â And so then the next thing that you might want to do is you might want to say,

Â well even once I've done this sort of transform I see

Â almost all the values over here are still stuck right near zero.

Â So it's very hard to see.

Â One thing that you could do is you could just zoom in.

Â So here I'm going to make that same histogram I did a minute ago but

Â now I'm going to set the x limits to be between one and 15.

Â So that's going to basically ignore the zeroes and

Â just make the histogram out here between one and 15.

Â And so when I do that I can see here that

Â the nice part of the distribution, but again, I've sort of ignored those zeros.

Â So we can actually count up for each row or

Â each gene, how many values are equal to zero.

Â So I'm going to take the row sums

Â of the number of times that the expression data is equal to zero.

Â And so, when I do that, I can see that there's a lot of

Â the genes that have basically all zeroes that are like almost every value is zero,

Â and then there's a few where almost all the values are non-zero.

Â So one thing I can do is I can remove the low value genes.

Â So one way to do that is by just taking the mean for each row and

Â saying if the mean is less than some number, here I'm picking five,

Â you can pick a different number.

Â We'll say it's too low.

Â It's a low gene.

Â So there are 41,000 where it is too low and 11,000 where it's not.

Â And then what I can do is filter the data set.

Â Data Frame.

Â And I can say only keep the ones that are not low gene.

Â So the bang or exclamation point here means not low genes.

Â Means it's going to flip this around so it'll say true for

Â all the genes that are above the threshold.

Â And so now I've got a new data set which I've filtered out which actually

Â has only the 11,000 genes or so that have an average count greater than some value.

Â The average isn't always necessarily great for

Â count data because you often have these really high values.

Â So if I look at a summary of the e-data.

Â So, for example, for this sample almost all the values are equal to zero,

Â but the mean is relatively high because you have this gigantic maximum value,

Â but you can see the median isn't as affected.

Â So the median is just the 50th percentile, so even if you have like one

Â gigantic value but all zeroes it will be a little bit more robust to that, and

Â so people often do this filtering based on the median.

Â So you can actually use the row medians command to find all those genes that

Â have a row median count less than five, so when the median count is less than five.

Â And then if I make a table of those low genes versus the low genes for the mean k,

Â so you can see that most of the time they're both true at the same time.

Â But sometimes, when the mean is still high,

Â the median is low, and so we still filter some more of those out.

Â And so then if I basically make a second filtered data set,

Â it's those that are filtered out based on their median values by saying,

Â not the low genes on the median scale.

Â Then if I look at the dimensions of that,

Â I can see that it's now dimensions that are a little bit smaller than the one I

Â did when I filtered on the basis of the mean.

Â So, once I've done that sort of filtering,

Â then the transform plots also are a little bit easier to see,

Â because you've basically removed all those genes that had really low values.

Â And so the histogram will still have some zeroes here, but

Â you've filtered out a lot of the ones that are exactly zero and so

Â the histogram makes it a little bit easier to see.

Â So that's a little bit about transforms and filtering low count observations.

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