text
stringlengths
0
601k
let optional_field tag value = if not ( Re . execp opt_field_tag_re tag ) tag then error " invalid TAG " tag sexp_of_string else Ok { tag ; value } value
let parse_optional_field_value s = match String . lsplit2 s ~ on : ' : ' with | None -> error " missing TYPE in optional field " s sexp_of_string | Some ( typ , value ) value -> match typ with | " A " -> if String . length value = 1 then optional_field_value_A value [ . 0 ] 0 else optional_field_value_err typ value | "...
let parse_optional_field s = match String . lsplit2 s ~ on : ' : ' with | None -> error " missing TAG in optional field " s sexp_of_string | Some ( tag , s ) s -> parse_optional_field_value s >>= fun value -> optional_field tag value
let parse_alignment ? ref_seqs line = match String . split ~ on : ' \ t ' ( line : Line . t :> string ) string with | qname :: flags :: rname :: pos :: mapq :: cigar :: rnext :: pnext :: tlen :: seq :: qual :: optional_fields -> ( parse_qname qname >>= fun qname -> parse_flags flags >>= fun flags -> parse_rname rname >...
let print_header_item_tag = function | ` HD -> " @ HD " | ` SQ -> " @ SQ " | ` RG -> " @ RG " | ` PG -> " @ PG " | ` CO -> " @ CO " | ` Other x -> sprintf " @% s " x
let print_tag_value ( tag , value ) value = sprintf " % s :% s " tag value
let print_tag_value ' = sprintf " % s :% s "
let print_header_version x = print_tag_value ' " VN " x
let print_sort_order x = print_tag_value ' " SO " ( match x with | ` Unknown -> " unknown " | ` Unsorted -> " unsorted " | ` Query_name -> " queryname " | ` Coordinate -> " coordinate " )
let print_group_order x = print_tag_value ' " GO " ( match x with | ` None -> " none " | ` Query -> " query " | ` Reference -> " reference " )
let print_header_line ( { version ; sort_order ; group_order } group_order : header_line ) header_line = sprintf " @ HD \ tVN :% s % s % s " version ( match sort_order with | None -> " " | Some x -> sprintf " \ t % s " ( print_sort_order x ) x ) ( match group_order with | None -> " " | Some x -> sprintf " \ t % s " ( p...
let print_ref_seq ( x : ref_seq ) ref_seq = sprintf " @ SQ \ tSN :% s \ tLN :% d % s % s % s % s " x . name x . length ( match x . assembly with None -> " " | Some x -> sprintf " \ tAS :% s " x ) x ( match x . md5 with None -> " " | Some x -> sprintf " \ tM5 :% s " x ) x ( match x . species with None -> " " | Some x ->...
let print_platform = function | ` Capillary -> " CAPILLARY " | ` LS454 -> " LS454 " | ` Illumina -> " ILLUMINA " | ` Solid -> " SOLID " | ` Helicos -> " HELICOS " | ` Ion_Torrent -> " IONTORRENT " | ` Pac_Bio -> " PACBIO "
let print_read_group ( x : read_group ) read_group = let s tag value = match value with | None -> " " | Some x -> sprintf " \ t % s :% s " tag x in sprintf " @ RG \ tID :% s % s % s % s % s % s % s % s % s % s % s % s " x . id ( s " CN " x . seq_center ) seq_center ( s " DS " x . description ) description ( s " DT " ( ...
let print_program ( x : program ) program = let s tag value = match value with | None -> " " | Some x -> sprintf " \ t % s :% s " tag x in sprintf " @ PG \ tID :% s % s % s % s % s % s " x . id ( s " PN " x . name ) name ( s " CL " x . command_line ) command_line ( s " PP " x . previous_id ) previous_id ( s " DS " x . ...
let print_other ( ( tag , l ) l : string * tag_value list ) list = sprintf " @% s % s " tag ( List . map l ~ f ( : fun ( x , y ) y -> sprintf " \ t % s :% s " x y ) y |> String . concat ~ sep " " : )
let print_qname = function Some x -> x | None -> " " *
let print_rname = function Some x -> x | None -> " " *
let print_pos = function Some x -> Int . to_string x | None -> " 0 "
let print_mapq = function Some x -> Int . to_string x | None -> " 255 "
let print_cigar_op = function | ` Alignment_match x -> sprintf " % dM " x | ` Insertion x -> sprintf " % dI " x | ` Deletion x -> sprintf " % dD " x | ` Skipped x -> sprintf " % dN " x | ` Soft_clipping x -> sprintf " % dS " x | ` Hard_clipping x -> sprintf " % dH " x | ` Padding x -> sprintf " % dP " x | ` Seq_match x...
let print_cigar = function | [ ] -> " " * | cigar_ops -> List . map cigar_ops ~ f : print_cigar_op |> String . concat ~ sep " " :
let print_rnext = function | None -> " " * | Some ` Equal_to_RNAME -> " " = | Some ( ` Value x ) x -> x
let print_pnext = function Some x -> Int . to_string x | None -> " 0 "
let print_tlen = function Some x -> Int . to_string x | None -> " 0 "
let print_seq = function Some x -> x | None -> " " *
let print_qual = function | [ ] -> " " * | quals -> List . map quals ~ f ( : fun x -> ok_exn ( Phred_score . to_char ~ offset ` : Offset33 x ) x ) |> String . of_char_list
let print_optional_field ( x : optional_field ) optional_field = let typ , value = match x . value with | ` A x -> ' A ' , Char . to_string x | ` i x -> ' i ' , Int64 . to_string x | ` f x -> ' f ' , Float . to_string x | ` Z x -> ' Z ' , x | ` H x -> ' H ' , x | ` B ( c , l ) l -> ' B ' , ( String . concat ~ sep " , "...
let print_alignment a = sprintf " % s \ t % s \ t % s \ t % s \ t % s \ t % s \ t % s \ t % s \ t % s \ t % s \ t % s \ t % s " ( print_qname a . qname ) qname ( print_flags a . flags ) flags ( print_rname a . rname ) rname ( print_pos a . pos ) pos ( print_mapq a . mapq ) mapq ( print_cigar a . cigar ) cigar ( print_r...
module MakeIO ( MakeIOFuture : Future . S ) S = struct open Future module Lines = struct include Lines include MakeIO ( MakeIOFuture ) MakeIOFuture end let read_header lines = let rec loop hdr : header Or_error . t Deferred . t = Pipe . peek_deferred lines >>= ( function | ` Eof -> return ( Ok hdr ) hdr | ` Ok line -> ...
let parse_header text = read_header ( Lines . of_string text ) text
module Filter = struct type t = [ ` String of string ] let of_string s = ` String s let to_string f = match f with | ` String s -> s module Defaults = struct let only_split_reads = of_string " cigar =~ . /^* N . " *$/ let drop_split_reads = of_string " cigar =~ [ /^ 0 - 9MIDSHPX ] " =*$/ end end
let view ( ~ run_with : Machine . t ) ~ bam ~ filter output_file_path = let open KEDSL in let name = sprintf " Sambamba . view % s % s " ( Filename . basename bam # product # path ) ( Filter . to_string filter ) in let clean_up = Remove . file ~ run_with output_file_path in let reference_build = bam # product # referen...
module Int = struct type t = int let arbitrary = QCheck . int let observable = QCheck . Observable . int let equal = Int . equal end
module String = struct type t = string let arbitrary = QCheck . small_printable_string let observable = QCheck . Observable . string let equal = String . equal end
module Float = struct type t = float let arbitrary = QCheck . float let observable = QCheck . Observable . float let equal = Float . equal end
module Unit = struct type t = unit let arbitrary = QCheck . unit let observable = QCheck . Observable . unit let equal = Unit . equal end
module type PACKAGE = sig module A : Model . T0 module B : Model . T0 module C : Model . T0 module D : Model . T0 module E : Model . T0 module F : Model . T0 module G : Model . T0 module H : Model . T0 end
module Pack1 = struct module A = Int module B = String module C = Float module D = String module E = Float module F = Int module G = String module H = Unit end
module type SMass = sig type t val encoding : t Data_encoding . t val zero : t val of_int : int -> t val mul : t -> t -> t val add : t -> t -> t val sub : t -> t -> t val ( = ) : t -> t -> bool val ( <= ) : t -> t -> bool val ( < ) : t -> t -> bool end
module type S = sig type mass type ' a t val create : ( ' a * mass ) list -> ' a t val sample : ' a t -> ( int_bound : int -> mass_bound : mass -> int * mass ) -> ' a val encoding : ' a Data_encoding . t -> ' a t Data_encoding . t end
module Make ( Mass : SMass ) : S with type mass = Mass . t = struct type mass = Mass . t type ' a t = { total : Mass . t ; support : ' a FallbackArray . t ; p : Mass . t FallbackArray . t ; alias : int FallbackArray . t ; } let rec init_loop total p alias small large = match ( small , large ) with | ( [ ] , _ ) -> List...
module Internal_for_tests = struct module Make = Make end
module Mass : SMass with type t = int64 = struct type t = int64 let encoding = Data_encoding . int64 let zero = 0L let of_int = Int64 . of_int let mul = Int64 . mul let add = Int64 . add let sub = Int64 . sub let ( = ) = Compare . Int64 . ( = ) let ( <= ) = Compare . Int64 . ( <= ) let ( < ) = Compare . Int64 . ( < ) e...
let configuration = { GapiConfig . default with GapiConfig . application_name ; GapiConfig . auth = GapiConfig . OAuth2 { GapiConfig . client_id ; client_secret } ; }
let scope = [ GapiTasksV1Service . scope ]
let authorization_url = GapiOAuth2 . authorization_code_url ~ redirect_uri ~ scope ~ response_type " : code " client_id
let ( ) = print_endline " Go to the following link in your browser " ; : print_endline authorization_url
let ( ) = print_endline " What is the authorization code " ?
let code = input_line stdin
let ( ) = GapiConversation . with_curl configuration ( fun session -> let response , session = GapiOAuth2 . get_access_token ~ client_id ~ client_secret ~ code ~ redirect_uri session in let access_token , refresh_token = match response with | GapiAuthResponse . OAuth2AccessToken token -> ( token . GapiAuthResponse . OA...
type ' a t = Int : int t | String : string t
let trois : type a . a t -> a = f
type t = | A
type t += | A
type t = { first : A . t ; second : B . t ; third : C . t }
let html_date_of_post p = match p . date with | None -> [ ] | Some d -> let date = let open Syndic . Date in let open ! Infix in sprintf " % s聽 % 02d , % d " ( string_of_month ( month d ) ) ( day d ) ( year d ) in [ ` Data date ]
let ( x : t ) = expr
let ( x : t list ) = exp
let ( x : t list ) = 1
let x : t = expr
let x , ( yyy : t ) = 1
let ( x , y ) = A . f ( )
let x , y = A . f ( )
let x , y , z = A . f ( )
let ( x , y ) , z = A . f ( )
let ( x : y :> u ) = 1
let x as y = 1
let ( x , y ) as z = ( 1 , 2 )
let X x = A . f ( )
let X ( x ) = A . f ( )
let ` X x = A . f ( )
let A . X x , A . Y ( y : t ) = f ( )
let A . X x , ( ` Y y : t ) = f ( )
let X ( x , y ) = A . f ( )
let X ( x , y ) = A . f ( )
let A . X ( x , y , z ) = A . f ( )
let A . X x = A . f ( )
let x : ( ' a , ' b ) t = A . f ( )
let x = ( x : X . t )
let x = ( val X : X . t )
let typecheck ast = ast_starts_with_as
let _ = ( x :: not_a_type )
let _ = ( x : ' a t )
let _ = ( x :> t )
let _ = ( let x : t = 1 in x )
let _ = ( 1 + let x : t = 1 in x )
let _ = ( 1 + 1 : int )
let _ = ( z : Map . t )
let _ = ( z x : Map . t )
let _ = ( z x : _ Map . t )
let _ = ( z x : ( ' a , int ) Map . t )
let _ = { first = x ; second = y ; third = z }
let ( ) = printf " ( v : t ) in strings ( expected : % g " n ; printf " ) "
let x = ref 1
let f x = ignore ( x + 1 )
let f ref c = 1
let f ( x , ( y , z ) ) = 1
let ( x , ( y , z ) ) = 1
let ( ( x , y ) : t ) = 1