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

111 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 3

This week we will cover modeling non-continuous outcomes (like binary or count data), hypothesis testing, and multiple hypothesis testing.

- Jeff Leek, PhDAssociate Professor, Biostatistics

Bloomberg School of Public Health

So permutation is one of the most widely used tools in genomics, and so

Â I'm going to show you a little bit about how to do permutations in R.

Â But there's actually a whole literature devoted to how to do this depending on

Â which exact problem you're working on,

Â the permutations key might be a little bit more complicated.

Â So here again I'm just going to load up the usual settings for

Â the plots, and I'm going to load the library that I'm going to be using here.

Â And then I'm going to load the data in this case again from the bottomly

Â experiment where I'm collecting information on the bottomly data set.

Â And then extracting out the p data, the e data, and the f data, so

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

Â So again I'm going to do some transformation of the data and

Â some filtering.

Â So I'm going to transform the data onto the log2 scale and

Â I'm going to remove the lowly expressed genes.

Â And so the first thing that you could do we talked about when calculating

Â statistics is you could calculate the statistics using the rowttests function.

Â So here I'm going to do that for this strain variable, and so

Â I can look at this, the observed statistics calculated from

Â doing that by making a histogram.

Â And so there's the distribution of the observed statistics.

Â And then if I want to do permutation,

Â the first thing I might need to do is set the seed.

Â So the reason we set seed is to basically make sure that the random numbers,

Â the pseudo random numbers, like the generator's the same every time.

Â So whenever you're using permutation or any other randomization based algorithms

Â you need to set the seed when you're doing a reproducible document so

Â that it's always the same numbers that come out.

Â So you need to pass it some number, here I'm using 135,

Â it can be any positive integer.

Â And so then I'm going to define the string variable to be the p

Â data string variable and then to permute I just use the sample command.

Â So what that does is it just scrambles up the order.

Â So if I look at the strain command or strain variable, it's in this order.

Â If I do strain0, I get a slightly different order for the strains.

Â So for example, you can see here the third element,

Â they're not the same between the original and the permuted version.

Â So it does that at random.

Â And so then I can basically recalculate the statistics, but

Â now using the permuted sample labels.

Â So when I do that I get something that you would expect.

Â So you've broken the relationship between the strain variable, ideally, and

Â the expression data and so

Â hopefully you would get statistics that are a little bit smaller.

Â Because you've basically broken that relationship.

Â And so the one thing that happens that's interesting here is that at least for

Â this one permutation, you see the statistics are mostly positive.

Â So that's likely, when that happens that's often because there's a covariate

Â that you haven't modeled.

Â And so you might want to repeat the calculation over and

Â over to see if you get something different on different permutations.

Â And so another way to see that is you can look at the quantiles of these statistics.

Â So if I look at the quantiles of the permuted statistics,

Â I can see that they tend to be positive.

Â And then if I look at the quantiles of the observed statistics they're sort of

Â more symmetric.

Â And so that could be a sign that there's a batch effect or something, so that when

Â I permute, the batch ends up being kind of correlated with this permuted strain.

Â And it looks like there's an association signal when there isn't necessarily one.

Â So that's how you permute in R.

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