Skip to content

Commit 3ec5ed6

Browse files
committed
Add benchmark code for vcf-variant->protein-hgvs
1 parent 5ce83ce commit 3ec5ed6

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

bench/varity/vcf_to_hgvs_bench.clj

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(ns varity.vcf-to-hgvs-bench
2+
(:require [cljam.io.sequence :as cseq]
3+
[libra.bench :refer :all]
4+
[libra.criterium :as c]
5+
[varity.ref-gene :as rg]
6+
[varity.vcf-to-hgvs :as v2h]
7+
[varity.t-common :refer :all]))
8+
9+
(def variants
10+
[{:chr "chr7", :pos 55191822, :ref "T", :alt "G"}
11+
{:chr "chr1", :pos 247815239, :ref "AAGG", :alt "A"}
12+
{:chr "chr2", :pos 26254257, :ref "G", :alt "GACT"}
13+
{:chr "chr3", :pos 122740443, :ref "G", :alt "GAGA"}
14+
{:chr "chr2", :pos 47445589, :ref "CTTACTGAT", :alt "CCC"}
15+
{:chr "chr1", :pos 11796319, :ref "C", :alt "CGGCGGC"}
16+
{:chr "chr1", :pos 69567, :ref "A", :alt "AT"}
17+
{:chr "chr2", :pos 189011772, :ref "T", :alt "C"}])
18+
19+
(defbench ^:slow vcf-variant->protein-hgvs-bench
20+
(prepare-cavia!)
21+
(let [rgidx (rg/index (rg/load-ref-genes test-ref-gene-file))]
22+
(with-open [seq-rdr (cseq/reader test-ref-seq-file)]
23+
(is (c/quick-bench (doseq [v variants]
24+
(doall (v2h/vcf-variant->protein-hgvs v seq-rdr rgidx))))))))

project.clj

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
:deploy-repositories [["snapshots" {:url "https://clojars.org/repo/"
2626
:username [:env/clojars_username :gpg]
2727
:password [:env/clojars_password :gpg]}]]
28+
:libra {:bench-selectors {:default (complement :slow)
29+
:slow :slow
30+
:all (constantly true)}}
2831
:codox {:namespaces [#"^varity\.[\w\-]+$"]
2932
:output-path "docs"
3033
:source-uri "https://github.com/chrovis/varity/blob/{version}/{filepath}#L{line}"})

0 commit comments

Comments
 (0)