package biocaml
The OCaml Bioinformatics Library
Install
Dune Dependency
Authors
Maintainers
Sources
biocaml-0.11.2.tbz
sha256=fae219e66db06f81f3fd7d9e44717ccf2d6d85701adb12004ab4ae6d3359dd2d
sha512=f6abd60dac2e02777be81ce3b5acdc0db23b3fa06731f5b2d0b32e6ecc9305fe64f407bbd95a3a9488b14d0a7ac7c41c73a7e18c329a8f18febfc8fd50eccbc6
doc/src/biocaml.unix/sgr.ml.html
Source file sgr.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
type t = (string * int * float) list (* Stored in ascending order by (string,int) pairs. *) exception Bad of string let raise_bad msg = raise (Bad msg) let cmpsi (s1,i1,_) (s2,i2,_) = Stdlib.compare (s1,i1) (s2,i2) let of_list l = List.sort ~compare:cmpsi l let to_list t = t let of_chr_lists l = let ans = List.map ~f:(fun (a,l) -> List.map ~f:(fun (b,c) -> a,b,c) l) l in let ans = List.concat ans in List.sort ~compare:cmpsi ans let npartition_exn ~eq l = let open List in let insertl ll a = let rec loop prefix ll = match ll with | [] -> rev ([a]::prefix) | l::ll -> if eq a (hd_exn l) then (rev ((a::l)::prefix)) @ ll else loop (l::prefix) ll in loop [] ll in map ~f:rev (fold_left ~f:insertl ~init:[] l) let to_chr_lists t = let eq (s1,_,_) (s2,_,_) = String.(s1 = s2) in let ll = npartition_exn ~eq t in let ll = List.map ~f:(fun l -> let x, _, _ = List.hd_exn l in x, List.map ~f:(fun (_,b,c) -> b,c) l) ll in ll let of_channel ?(chr_map=Fun.id) ?(increment_bp=0) cin = let parse_line' delim line = match String.split line ~on:delim with | [c; i; f] -> chr_map c, int_of_string i + increment_bp, Float.of_string f | _ -> raise_bad "ill-formed line" in let parse_line line = try parse_line' '\t' line with Bad _ -> try parse_line' ' ' line with Bad msg -> failwith msg in In_channel.input_lines cin |> List.map ~f:parse_line let of_file ?(chr_map=Fun.id) ?(increment_bp=0) file = In_channel.with_file file ~f:(of_channel ~chr_map ~increment_bp) let to_channel ?(chr_map=Fun.id) ?(increment_bp=0) t cout = let f (s,i,v) = fprintf cout "%s\t%d\t%f\n" (chr_map s) (i+increment_bp) v in List.iter ~f t let to_file ?(chr_map=Fun.id) ?(increment_bp=0) t file = Out_channel.with_file file ~f:(to_channel ~chr_map ~increment_bp t)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>