/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this Racket program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 250,000 | 2.53 | 2.53 | 53,676 | 542 | 0% 0% 0% 100% |
| 2,500,000 | 21.92 | 21.99 | 157,112 | 542 | 0% 0% 0% 100% |
| 25,000,000 | 225.97 | 226.51 | 1,419,356 | 542 | 0% 0% 0% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read k-nucleotide benchmark to see what this program should do.
Welcome to Racket v5.3.4.
#lang racket/base ;;; The Computer Language Benchmarks Game ;;; http://benchmarksgame.alioth.debian.org/ ;;; contributed by Matthew Flatt (define (all-counts len dna) (let ([table (make-hasheq)] [seq (make-string len)]) (for ([s (in-range (- (string-length dna) len) -1 -1)]) (string-copy! seq 0 dna s (+ s len)) (let ([key (string->symbol seq)]) (let ([cnt (hash-ref table key 0)]) (hash-set! table key (add1 cnt))))) table)) (define (write-freqs table) (let* ([content (hash-map table cons)] [total (exact->inexact (apply + (map cdr content)))]) (for ([a (sort content > #:key cdr)]) (printf "~a ~a\n" (car a) (real->decimal-string (* 100 (/ (cdr a) total)) 3))))) (define (write-one-freq table key) (let ([cnt (hash-ref table key 0)]) (printf "~a\t~a\n" cnt key))) (define dna (let ([in (current-input-port)]) ;; Skip to ">THREE ..." (regexp-match #rx#"(?m:^>THREE.*$)" in) (let ([s (open-output-string)]) ;; Copy everything but newlines to s: (for ([l (in-bytes-lines in)]) (write-bytes l s)) ;; Extract the string from s: (string-upcase (get-output-string s))))) ;; 1-nucleotide counts: (write-freqs (all-counts 1 dna)) (newline) ;; 2-nucleotide counts: (write-freqs (all-counts 2 dna)) (newline) ;; Specific sequences: (for ([seq '("GGT" "GGTA" "GGTATT" "GGTATTTTAATT" "GGTATTTTAATTTATAGT")]) (write-one-freq (all-counts (string-length seq) dna) (string->symbol seq)))
Mon, 13 May 2013 05:18:57 GMT COMMAND LINE: /usr/local/src/racket-5.3.4/bin/racket knucleotide.racket 0 < knucleotide-input25000000.txt PROGRAM OUTPUT: A 30.295 T 30.151 C 19.800 G 19.754 AA 9.177 TA 9.132 AT 9.131 TT 9.091 CA 6.002 AC 6.001 AG 5.987 GA 5.984 CT 5.971 TC 5.971 GT 5.957 TG 5.956 CC 3.917 GC 3.911 CG 3.909 GG 3.902 1471758 GGT 446535 GGTA 47336 GGTATT 893 GGTATTTTAATT 893 GGTATTTTAATTTATAGT