Skip to content

Instantly share code, notes, and snippets.

@mikelove
Created June 9, 2024 11:03
Show Gist options
  • Save mikelove/698cb13403a10f25596a406cb7cf2407 to your computer and use it in GitHub Desktop.
Save mikelove/698cb13403a10f25596a406cb7cf2407 to your computer and use it in GitHub Desktop.
Speed testing plyranges joins at various numbers of features 1e3 to 1e6
chr1 248956422
chr2 242193529
chr3 198295559
chr4 190214555
chr5 181538259
chr6 170805979
chr7 159345973
chr8 145138636
chr9 138394717
chr10 133797422
chr11 135086622
chr12 133275309
chr13 114364328
chr14 107043718
chr15 101991189
chr16 90338345
chr17 83257441
chr18 80373285
chr19 58617616
chr20 64444167
chr21 46709983
chr22 50818468
lens <- c("1000","10000","100000","1000000")
for (i in lens) {
system(paste0("export TEST_SEED=1"))
system(paste0("granges random-bed --sort --num ",i," hg38_seqlens.tsv > random_bed_",i,"_A.bed"))
system(paste0("export TEST_SEED=2"))
system(paste0("granges random-bed --sort --num ",i," hg38_seqlens.tsv > random_bed_",i,"_B.bed"))
}
library(plyranges)
granges_a_3 <- read_bed("random_bed_1000_A.bed")
granges_b_3 <- read_bed("random_bed_1000_B.bed")
granges_a_4 <- read_bed("random_bed_10000_A.bed")
granges_b_4 <- read_bed("random_bed_10000_B.bed")
granges_a_5 <- read_bed("random_bed_100000_A.bed")
granges_b_5 <- read_bed("random_bed_100000_B.bed")
granges_a_6 <- read_bed("random_bed_1000000_A.bed")
granges_b_6 <- read_bed("random_bed_1000000_B.bed")
library(microbenchmark)
microbenchmark(
list=list(
ply3 = bquote( join_overlap_inner(granges_a_3, granges_b_3) ),
ply4 = bquote( join_overlap_inner(granges_a_4, granges_b_4) ),
ply5 = bquote( join_overlap_inner(granges_a_5, granges_b_5) ),
ply6 = bquote( join_overlap_inner(granges_a_6, granges_b_6) )
), times=10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment