Created
July 17, 2017 09:48
-
-
Save blahah/b8090130b00fd1ce699aa921a4618d51 to your computer and use it in GitHub Desktop.
Example of BUSCO results to upset plots
This file contains 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
# example of loading busco sample data, preparing gene set data, and making plots | |
# if necessary, uncomment to install dependencies | |
# install.packages("readr") | |
# install.packages("UpSetR") | |
library(readr) | |
# function to load BUSCO results and label the first two columns | |
load_busco <- function(path) { | |
df <- read_tsv(path, col_names = FALSE) | |
colnames(df) <- c('gene', 'status') | |
df | |
} | |
tiscar <- load_busco('./data/busco_output/full_table_TiscarSM28_BUSCO') | |
tokyo <- load_busco('./data/busco_output/full_table_Tokyo1_BUSCO') | |
# calculate uniqe non-missing genes for each dataset | |
tiscar_set <- unique(tiscar[tiscar$status != 'Missing',]$gene) | |
tokyo_set <- unique(tokyo[tokyo$status != 'Missing',]$gene) | |
# make a list labelling the sets | |
genesets <- list( | |
tiscar = tiscar_set, | |
tokyo = tokyo_set | |
) | |
library(UpSetR) | |
# plot | |
upset(fromList(genesets), nsets=2, order.by="freq") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment