Created
October 4, 2016 18:29
-
-
Save rmflight/95ec91f5c5df22621f3d1063e8582770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > library(UpSetR) | |
| > library(org.Hs.eg.db) | |
| > all_genes <- keys(org.Hs.eg.db) | |
| > n_gene <- c(2000, 500, 1000, 900) | |
| > # create a list, where each entry is the vector of Gene IDs that were diff | |
| > # expressed in that condition | |
| > # this is creating a random set of gene .... [TRUNCATED] | |
| > # give them names so we know what is what | |
| > names(diff_genes) <- c("A", "B", "C", "D") | |
| > # what does this look like? A list, where each one is a different set of genes | |
| > str(diff_genes) | |
| List of 4 | |
| $ A: chr [1:2000] "728586" "406999" "56160" "105377483" ... | |
| $ B: chr [1:500] "54752" "389249" "101929386" "778" ... | |
| $ C: chr [1:1000] "399511" "342371" "347422" "66002" ... | |
| $ D: chr [1:900] "158800" "106480800" "51179" "105374729" ... | |
| > length(intersect(diff_genes[[1]], diff_genes[[2]])) | |
| [1] 18 | |
| > # use the fromList function to get it into the right shape | |
| > compare_data <- fromList(diff_genes) | |
| > # plot it! | |
| > upset(compare_data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(UpSetR) | |
| library(org.Hs.eg.db) | |
| all_genes <- keys(org.Hs.eg.db) | |
| n_gene <- c(2000, 500, 1000, 900) | |
| # create a list, where each entry is the vector of Gene IDs that were diff | |
| # expressed in that condition | |
| # this is creating a random set of genes in each list entry | |
| diff_genes <- lapply(n_gene, function(x){ | |
| sample(all_genes, x) | |
| }) | |
| # give them names so we know what is what | |
| names(diff_genes) <- c("A", "B", "C", "D") | |
| # what does this look like? A list, where each one is a different set of genes | |
| str(diff_genes) | |
| length(intersect(diff_genes[[1]], diff_genes[[2]])) | |
| # use the fromList function to get it into the right shape | |
| compare_data <- fromList(diff_genes) | |
| # plot it! | |
| upset(compare_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment