Skip to content

Instantly share code, notes, and snippets.

@ipurusho
Last active September 28, 2016 19:41
Show Gist options
  • Save ipurusho/e58b95957fd227b1442c263386a1f8da to your computer and use it in GitHub Desktop.
Save ipurusho/e58b95957fd227b1442c263386a1f8da to your computer and use it in GitHub Desktop.

###Download modified RRHO scripts Obtain the modified R scripts from https://gist.github.com/ipurusho/8e4beef4fb51c2485c9f and source it in your R environment.

###Prepare the data Create two separate matrices, one for P value and one for log fold change from your differential analysis. The rows should be genes and the columns should be the comparisons (column order should be consistent between the two matrices). For example:

P.vals = as.data.frame(cbind(Comparison1 = Comparison1[intersect.genes,"P.Value"],
                             Comparison2 = Comparison2[intersect.genes,"P.Value"],
                             Comparison3 = Comparison3[intersect.genes,"P.Value"]))
                             
logfc = as.data.frame(cbind(Comparison1 = Comparison1[intersect.genes,"logFC"],
                             Comparison2 = Comparison2[intersect.genes,"logFC"],
                             Comparison3 = Comparison3[intersect.genes,"logFC"]))

Now we outline the RRHO comparisons we want to make, via a String array, and pass it to the generate.rrho function. For example:

comparisons <- rbind(c("Comparison1","Comparison2"),
                     c("Comparison2","Comparison2"),
                     c("Comparison1","Comparison3"))

Here we are making 3 RRHOs, using differential comparisons "Comparison1" (x-axis) vs "Comparison2" (y-axis), "Comparison2" (x-axis) vs "Comparison3" (y-axis), and so on.

Now we will invoke the generate.rrho wrapper as follows:

generate.rrho(P.vals,logfc,comparisons,"/path/to/output/directory")

This will perform all the RRHO comparisons with the same -log10 scale, such that they are comparable to one another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment