text
stringlengths
0
601k
let str_script_extensions key ( out_fmt : out_fmt ) u = String . concat " , " ( List . map ( strf " % a " Uucp . Script . pp ) ( key u ) )
let all_keys = [ ` P " Age " , str Uucp . Age . ( pp , age ) ; ` P " Alphabetic " , str_bool Uucp . Alpha . is_alphabetic ; ` P " Block " , str Uucp . Block . ( pp , block ) ; ` P " Line_Break " , str Uucp . Break . ( pp_line , line ) ; ` P " Grapheme_Cluster_Break " , str Uucp . Break . ( pp_grapheme_cluster , graphem...
let compare_key ( k0 , _ ) ( k1 , _ ) = match k0 , k1 with
let eq_key k ( k ' , _ ) = match k ' with String . ( compare ( lowercase_ascii k ) ( lowercase_ascii k ' ) = 0 )
let exist_key k = List . exists ( eq_key k ) all_keys
let find_key k = List . find ( eq_key k ) all_keys
let key_id ( k , _ ) = match k with ` P k | ` N k | ` H k -> k
let list_keys ( ) = let keys = List . sort compare_key all_keys in let pr_key_name ( n , _ ) = match n with | ` P k -> Printf . printf " % s ( UCD ) \ n " k | ` N k -> Printf . printf " % s \ n " k | ` H k -> Printf . printf " % s ( Uucp library heuristic ) \ n " k in List . iter pr_key_name keys
let get_keys keys = try Ok ( List . map find_key keys ) with let _ , not = List . partition exist_key keys in match not with | [ p ] -> Error ( strf " Unknown key : % s " p ) | ps -> Error ( strf " Unknown keys : % s " ( String . concat " , " ps ) )
let default_keys = [ " Name " ; " Uchar " ; " Age " ; " Block " ; " Script " ; " Script_extensions " ; " General_Category " ; " Decomposition_Mapping " ; " UTF - 8 " ; " UTF - 16BE " ; " UTF - 16LE " ]
let case_keys = [ " Lowercase " ; " Uppercase " ; " Cased " ; " Case_ignorable " ; " Lowercase_Mapping " ; " Uppercase_Mapping " ; " Titlecase_Mapping " ; " Case_Folding " ; " NFKC_Casefold " ]
let cjk_keys = [ " Ideographic " ; " IDS_Binary_Operator " ; " IDS_Trinary_Operator " ; " Radical " ; " Unified_Ideograph " ]
let emoji_keys = [ " Emoji " ; " Emoji_Presentation " ; " Emoji_Modifier " ; " Emoji_Modifier_Base " ; " Emoji_Component " ; " Extended_Pictographic " ]
let id_keys = [ " ID_Start " ; " ID_Continue " ; " XID_Start " ; " XID_Continue " ; " Pattern_Syntax " ; " Pattern_White_Space " ]
let num_keys = [ " ASCII_Hex_Digit " ; " Hex_Digit " ; " Numeric_Type " ; " Numeric_Value " ]
let output_key out_fmt uchar ( k , str ) = match out_fmt . no_labels with let l = match k with ` P k | ` N k | ` H k -> k in Printf . printf " % s : % s \ n " l ( str out_fmt uchar )
let query_keys keys out_fmt uchar = match get_keys keys with
let ucharinfo cmd keys spec_fmt out_fmt uspec = match cmd with match uspec with | None -> log_err " No character specified . " ; 1 | Some uspec -> match parse_spec spec_fmt uspec with | None -> log_err ( strf " Could not parse % s from ' % s ' \ n " %! ( str_of_spec_fmt spec_fmt ) ( esc_non_ascii uspec ) ) ; 1 | Some u...
let cmd = let doc = " List available keys . " in let list_keys = ` List_keys , Arg . info [ " l " ; " key - list " ] ~ doc in let doc = " Output supported Unicode version . " in let unicode_version = ` Unicode_version , Arg . info [ " unicode - version " ] ~ doc in Arg . ( value & vflag ` Query [ unicode_version ; list...
let spec_fmt = let spec_fmt = [ " UTF - 8 " , ` UTF_8 ; " UTF - 16BE " , ` UTF_16BE ; " UTF - 16LE " , ` UTF_16LE ; " uchar - esc " , ` Uchar_esc ; " bytes - esc " , ` Bytes_esc ; " guess " , ` Guess ] in let doc = strf " The character specification format . ( $ docv ) must be one of % s . See CHARACTER SPECIFICATION f...
let out_fmt = let no_labels = let doc = " Output key values without labels . " in Arg . ( value & flag & info [ " n " ; " no - labels " ] ~ doc ) in let raw_bytes = let doc = " Output byte sequences unescaped . " in Arg . ( value & flag & info [ " b " ; " raw - bytes " ] ~ doc ) in let ascii = let doc = " Output inform...
let keys = let all = let doc = " Output value of all keys in alphabetic order . " in Arg . ( value & flag & info [ " all " ] ~ doc ) in let default = let doc = " Output default information . " in Arg . ( value & flag & info [ " d " ; " default " ] ~ doc ) in let case = let doc = " Output values of Unicode case keys . "...
let uspec = let doc = " The character specification . See CHARACTER SPECIFICATION for details . " in Arg . ( value & pos 0 ( some string ) None & info [ ] ~ doc ~ docv " : UCHAR " )
let doc = " Query Unicode character information "
let exits = Term . exit_info 1 ~ doc " : if the character specification is invalid . " :: Term . exit_info 2 ~ doc " : if a key doesn ' t exist . " :: Term . default_exits
let man = [ ` S Manpage . s_description ; ` P " ( $ mname ) outputs information about an Unicode character specified on the command line . " ; ` P " The information to output is selected by specifying keys , use the ( $ b , - l ) option to list them . By default the tool outputs a selection of keys for a character . To...
let ucharinfo = Term . ( const ucharinfo $ cmd $ keys $ spec_fmt $ out_fmt $ uspec ) , Term . info " ucharinfo " ~ version " :%% VERSION " %% ~ doc ~ exits ~ man
let ( ) = Term . ( exit_status @@ eval ucharinfo )
type ' a tbl = ' a Tbl31 . tbl
type ' a t = ' a tbl
let get tbl u = Tbl31 . get tbl ( UChar . uint_code u ) u
module type Type = sig type elt type t = elt tbl val get : elt tbl -> UChar . t -> elt val of_map : elt -> elt UMap . t -> t end
module Make ( H : Hashtbl . HashedType ) HashedType = struct module T31 = Tbl31 . Make ( H ) H type elt = T31 . elt type t = H . t tbl let get = get let of_map v m = T31 . of_map v ( UMap . imap_of_umap m ) m end
module Bool = struct type t = Tbl31 . Bool . t let get tbl u = Tbl31 . Bool . get tbl ( UChar . uint_code u ) u let of_set s = Tbl31 . Bool . of_set ( USet . iset_of_uset s ) s end
module Bits = struct type t = Tbl31 . Bits . t let get tbl u = Tbl31 . Bits . get tbl ( UChar . uint_code u ) u let of_map v m = Tbl31 . Bits . of_map v ( UMap . imap_of_umap m ) m end
module Bytes = struct type t = Tbl31 . Bytes . t let get tbl u = Tbl31 . Bytes . get tbl ( UChar . uint_code u ) u let of_map v m = Tbl31 . Bytes . of_map v ( UMap . imap_of_umap m ) m end
module Char = struct type t = Tbl31 . Char . t let get tbl u = Tbl31 . Char . get tbl ( UChar . uint_code u ) u let of_map v m = Tbl31 . Char . of_map v ( UMap . imap_of_umap m ) m end
type variable_option = [ ` Blanked | ` Non_ignorable | ` Shifted | ` Shift_Trimmed ]
type precision = [ ` Primary | ` Secondary | ` Tertiary | ` Quaternary ]
module type Type = sig type text type index val compare : ? locale : string -> ? prec : precision -> ? variable : variable_option -> text -> text -> int val sort_key : ? locale : string -> ? prec : precision -> ? variable : variable_option -> text -> string val compare_with_key : ? locale : string -> ? prec : precision...
module Make ( Config : ConfigInt . Type ) Type ( Text : UnicodeString . Type ) Type = struct module Unidata = Unidata . Make ( MakeConfig ) MakeConfig module UCharInfo = UCharInfo . Make ( MakeConfig ) MakeConfig let logical_order_exception_tbl = UCharInfo . load_property_tbl ` Logical_Order_Exception let is_logical_or...
type t = ( int32 , int32_elt , c_layout ) c_layout Array1 . t
let rec validate_aux ( a : t ) t i = if i >= Array1 . dim a then ( ) else match Int32 . to_int ( Int32 . shift_right a { . i } i 31 ) 31 with 0 -> validate_aux a ( i + 1 ) 1 | _ -> raise Malformed_code
let validate ( a : t ) t = validate_aux a 0
let look ( a : t ) t i : UChar . t = UChar . chr_of_uint ( Int32 . to_int a { . i } i ) i
let length ( a : t ) t = Array1 . dim a
let next _ i = i + 1
let prev _ i = i - 1
let move ( _ : t ) t i c = i + c
let first _ = 0
let last ( a : t ) t = Array1 . dim a - 1
let out_of_range ( a : t ) t i = i < 0 || i >= Array1 . dim a
let compare_index _ i j = i - j
let nth ( _ : t ) t c = c
let get ( a : t ) t c = look a c
let rec iter_aux proc ( a : t ) t i = if i >= Array1 . dim a then ( ) else begin proc ( look a i ) i ; iter_aux proc a ( i + 1 ) 1 end
let iter proc ( a : t ) t = iter_aux proc a 0
let init len f = let a = Array1 . create int32 c_layout len in for i = 0 to len - 1 do a { . i } i <- Int32 . of_int ( UChar . uint_code ( f i ) i ) i done ; a
module Buf = struct type buf = { init_size : int ; mutable pos : index ; mutable contents : t } t let create n = let contents = Array1 . create int32 c_layout n in { init_size = n ; pos = 0 ; contents = contents } contents let clear buf = buf . pos <- 0 let reset buf = buf . contents <- Array1 . create int32 c_layout b...
let compare ( a : t ) t ( b : t ) t = match Array1 . dim a - Array1 . dim b with 0 -> Pervasives . compare a b | sgn -> sgn
type genome = [ ` dm3 | ` droSim1 | ` hg18 | ` hg19 | ` hg38 | ` mm8 | ` mm9 | ` mm10 | ` sacCer2 ]
let string_of_genome = function | ` dm3 -> " dm3 " | ` droSim1 -> " droSim1 " | ` hg18 -> " hg18 " | ` hg19 -> " hg19 " | ` hg38 -> " hg38 " | ` mm8 -> " mm8 " | ` mm9 -> " mm9 " | ` mm10 -> " mm10 " | ` sacCer2 -> " sacCer2 "
let genome_of_string = function | " dm3 " -> Some ` dm3 | " droSim1 " -> Some ` droSim1 | " hg18 " -> Some ` hg18 | " hg19 " -> Some ` hg19 | " hg38 " -> Some ` hg38 | " mm8 " -> Some ` mm8 | " mm9 " -> Some ` mm9 | " mm10 " -> Some ` mm10 | " sacCer2 " -> Some ` sacCer2 | _ -> None method format : [ ` twobit ] inherit...
let img = [ docker_image ~ account " : pveber " ~ name " : ucsc - kent " ~ tag " : 330 " ( ) ]
type chromosome_sequences = [ ` ucsc_chromosome_sequences ] directory
let chromosome_sequence org chr = let org = string_of_genome org in let url = sprintf " ftp :// hgdownload . cse . ucsc . edu / goldenPath /% s / chromosomes /% s . fa . gz " org chr in let descr = sprintf " ucsc_gb . chromosome_sequence ( % s , % s ) " org chr in Workflow . shell ~ descr [ Bistro_unix . Cmd . wget ~ d...
let chromosome_sequences org = let org = string_of_genome org in let url = sprintf " ftp :// hgdownload . cse . ucsc . edu / goldenPath /% s / chromosomes " /* org in Workflow . shell ~ descr ( : sprintf " ucsc_gb . chromosome_sequences ( % s ) " org ) [ mkdir_p dest ; cd dest ; Bistro_unix . Cmd . wget ( Workflow . st...
let genome_sequence org = let chr_seqs = chromosome_sequences org in Workflow . shell ~ descr " : ucsc_gb . genome_sequence " [ cmd " bash " [ opt " - c " string " ' shopt - s nullglob ; cat $ 0 { / chr . ? fa , chr . ?? fa , chr . ??? fa , chr . ???? fa } > $ 1 ' " ; dep chr_seqs ; dest ] ]
let genome_2bit_sequence_dir org = let org = string_of_genome org in let url = sprintf " ftp :// hgdownload . cse . ucsc . edu / goldenPath /% s / bigZips /% s . 2bit " org org in Workflow . shell ~ descr ( : sprintf " ucsc_gb . 2bit_sequence ( % s ) " org ) [ mkdir dest ; cd dest ; Bistro_unix . Cmd . wget ( Workflow ...
let genome_2bit_sequence org = Workflow . select ( genome_2bit_sequence_dir org ) [ ( string_of_genome org ) ^ " . 2bit " ]
let twoBitToFa twobits bed = Workflow . shell ~ descr " : ucsc_gb . twoBitToFa " ~ img [ cmd " twoBitToFa " [ opt ' " - bed " dep bed ; dep twobits ; dest ] ]
let faToTwoBit fa = Workflow . shell ~ descr " : ucsc_gb . faToTwoBit " ~ img [ cmd " faToTwoBit " [ dep fa ; dest ] ]
let fetchChromSizes org = Workflow . shell ~ descr " : ucsc_gb . fetchChromSizes " ~ img [ cmd " fetchChromSizes " ~ stdout : dest [ string ( string_of_genome org ) ; ] ]
let bedClip org bed = Workflow . shell ~ descr " : ucsc_gb . bedClip " ~ img [ cmd " bedClip - verbose = 2 " [ dep bed ; dep org ; dest ; ] ]
let bedGraphToBigWig org bg = let tmp = seq [ tmp ; string " / sorted . bedGraph " ] in Workflow . shell ~ descr " : bedGraphToBigWig " ~ img [ cmd " sort " ~ stdout : tmp [ string " - k1 , 1 " ; string " - k2 , 2n " ; dep bg ; ] ; cmd " bedGraphToBigWig " [ tmp ; dep ( fetchChromSizes org ) ; dest ; ] ]
let bedToBigBed_command org bed = let tmp = seq [ tmp ; string " / sorted . bed " ] in let sort = cmd " sort " ~ stdout : tmp [ string " - k1 , 1 " ; string " - k2 , 2n " ; dep bed ; ] in let bedToBigBed = cmd " bedToBigBed " [ tmp ; dep ( fetchChromSizes org ) ; dest ; ] in [ sort ; bedToBigBed ]
let bedToBigBed org = let f bed = Workflow . shell ~ descr " : ucsc_gb . bedToBigBed " ~ img ( bedToBigBed_command org bed ) in function | ` bed3 bed -> f bed | ` bed5 bed -> f bed
let bedToBigBed_failsafe org = let f bed = let test = cmd " test " [ string " ! - s " ; dep bed ] in let touch = cmd " touch " [ dest ] in let cmd = or_list [ and_list [ test ; touch ] ; and_list ( bedToBigBed_command org bed ) ; ] in Workflow . shell ~ img [ cmd ] in function | ` bed3 bed -> f bed | ` bed5 bed -> f be...
module Lift_over = struct class type chain_file = object inherit regular_file_t method format : [ ` lift_over_chain_file ] end type ' a output = [ ` ucsc_lift_over of ' a ] directory let chain_file ~ org_from ~ org_to = let org_from = string_of_genome org_from and org_to = string_of_genome org_to in let url = sprintf "...
type assembly = [ ` dm3 | ` droSim1 | ` hg18 | ` hg19 | ` hg38 | ` mm8 | ` mm9 | ` mm10 | ` sacCer2 ]
let string_of_assembly = function | ` dm3 -> " dm3 " | ` droSim1 -> " droSim1 " | ` hg18 -> " hg18 " | ` hg19 -> " hg19 " | ` hg38 -> " hg38 " | ` mm8 -> " mm8 " | ` mm9 -> " mm9 " | ` mm10 -> " mm10 " | ` sacCer2 -> " sacCer2 "
type track_attribute = [ | ` name of string | ` description of string | ` type_ of track_type | ` visibility of [ ` hide | ` full | ` dense | ` pack | ` squish ] | ` color of color | ` itemRgb of bool | ` colorByStrand of color * color | ` useScore of bool | ` group of string | ` priority of int | ` db of assembly | ` ...
let string_of_track_type = function | ` bam -> " bam " | ` bedDetail -> " bedDetail " | ` bedGraph -> " bedGraph " | ` bigBed -> " bigBed " | ` bigWig -> " bigWig " | ` broadPeak -> " broadPeak " | ` narrowPeak -> " narrowPeak " | ` array -> " array " | ` vcf -> " vcf " | ` wig -> " wig "
let unparse_track_attribute buf = function | ` name n -> bprintf buf " name " =\% s " " \ n | ` description d -> bprintf buf " description " =\% s " " \ d | ` type_ t -> bprintf buf " type =% s " ( string_of_track_type t ) t | ` visibility v -> let v = match v with | ` full -> " full " | ` dense -> " dense " | ` hide -...
let track_line opts = let buf = Buffer . create 1024 in bprintf buf " track " ; List . iter ~ f ( : unparse_track_attribute buf ) buf opts ; Buffer . contents buf
type url_param = [ | ` pix of int | ` hgt_labelWidth of int | ` textSize of int ]
let base db = main_server ^ " / cgi - bin / hgTracks ? db " = ^ ( string_of_assembly db ) db
let string_of_position ( chr , maybe_pos ) maybe_pos = chr ^ ( match maybe_pos with | None -> " " | Some ( a , b ) b -> sprintf " :% d -% d " a b )
let encode_url_param = function | ` pix n -> sprintf " pix =% d " n | ` hgt_labelWidth n -> sprintf " hgt . labelWidth =% d " n | ` textSize n -> sprintf " textSize =% d " n
let encode_url_params xs = List . map ~ f : encode_url_param xs |> String . concat ~ sep " " :&
let custom_track_url ( ? params = [ ] ) ~ db ~ position ~ data_url ( ) = sprintf " % s & position =% s & hgt . customText =% s % s " ( base db ) db ( string_of_position position ) position data_url ( encode_url_params params ) params
let bigData_custom_track_url ( ? params = [ ] ) ~ db ~ position ~ track ( ) = let escaped_custom_text = Uri . pct_encode ~ component ` : Query ( track_line track ) track in sprintf " % s & position =% s & hgct_customText =% s % s " ( base db ) db ( string_of_position position ) position escaped_custom_text ( encode_url...
type fs = { fs_id : string ; fs_name : string ; fs_supports_unix_owners : bool ; fs_can_mount : bool ; fs_can_create : bool ; fs_max_label_len : int ; fs_supports_label_rename : bool ; fs_supports_online_label_rename : bool ; fs_supports_fsck : bool ; fs_supports_online_fsck : bool ; fs_supports_resize_enlarge : bool ;...
type job = { job_device : UDisks_device . t ; job_in_progress : bool ; job_is_cancellable : bool ; job_id : string ; job_num_tasks : int ; job_cur_task : int ; job_cur_task_id : string ; job_cur_task_percentage : float ; }
let daemon ( ) = let % lwt bus = OBus_bus . system ( ) in return ( OBus_peer . make bus " org . freedesktop . UDisks " )
let proxy daemon = OBus_proxy . make daemon [ " org " ; " freedesktop " ; " UDisks " ]
let make_device context path = UDisks_device . of_proxy ( OBus_proxy . make ( OBus_context . sender context ) path )
let make_adapter context path = UDisks_adapter . of_proxy ( OBus_proxy . make ( OBus_context . sender context ) path )
let make_expander context path = UDisks_expander . of_proxy ( OBus_proxy . make ( OBus_context . sender context ) path )
let make_port context path = UDisks_port . of_proxy ( OBus_proxy . make ( OBus_context . sender context ) path )