text
stringlengths 0
601k
|
---|
let trace = ref false
|
let t_int parameters x = if Remanent_parameters . get_trace parameters || ! trace then Loggers . fprintf ( Remanent_parameters . get_logger parameters ) " % i " x
|
let t_string parameters x = if Remanent_parameters . get_trace parameters || ! trace then Loggers . fprintf ( Remanent_parameters . get_logger parameters ) " % s " x
|
let comp_pair ( a , b ) ( x , y ) = match ( a < x , a = x , b < y ) with true , _ , _ -> ( - 1 )
|
let rec list_it f l b = match l with t :: q -> list_it f q ( f t b )
|
let rec true_map x y =
|
let max_of_list parameters error list = match list with | [ ] -> Exception . warn parameters error __POS__ Exit None | t :: q -> error , Some ( List . fold_left max t q )
|
let sum_list list = List . fold_left ( fun a b -> a + b ) 0 list
|
let rec member x l = match l with [ ] -> false | a :: b -> if a = x then true else member x b ; ;
|
let rec member2 x l = match l with [ ] -> false ( | a , _ ) :: b -> if a = x then true else member2 x b ; ;
|
let rec all_differents liste = match liste with a :: b -> if ( member a b ) then false else ( all_differents b ) | [ ] -> true ; ;
|
let rec dolist l a = match l with t :: q -> ( dolist q ( t a ) ) | [ ] -> a ; ;
|
let concat liste1 liste2 = let rec aux liste1 liste2 = match liste1 with a :: b -> aux b ( a :: liste2 ) | [ ] -> liste2 in aux ( rev liste1 ) liste2 ; ;
|
let applati liste = let rec aux1 l rep = match l with a :: b -> aux1 b ( a :: rep ) | [ ] -> rep in let rec aux2 l rep = match l with a :: b -> aux2 b ( aux1 a rep ) | [ ] -> rep in rev ( aux2 liste [ ] ) ; ;
|
let rec forall p l = match l with a :: b -> if ( p a ) then ( forall p b ) else false | [ ] -> true ; ;
|
let rec correspondance parameters error ancien nouveau x = match ancien , nouveau with | a :: _ , p :: _ when a = x -> error , Some p | _ :: b , _ :: q -> correspondance parameters error b q x | [ ] , [ ] -> error , Some x | _ -> Exception . warn parameters error __POS__ Exit None
|
let transfert parameters error ancien nouveau liste = let rec aux parameters error l = match l with [ ] -> error , [ ] | a :: b -> let error , h = correspondance parameters error ancien nouveau a in let error , tl = aux parameters error b in error , h :: tl in aux parameters error liste ; ;
|
let tr parameters error ancien nouveau id = match ( transfert parameters error ancien nouveau [ id ] ) with error , [ res ] -> error , res | error , _ -> Exception . warn parameters error __POS__ Exit None
|
let paire_of_list liste1 liste2 rep = let rec aux1 x l2 rep = match l2 with a :: b -> aux1 x b ( ( x , a ) :: rep ) | [ ] -> rep in let rec aux2 l1 l2 rep = match l1 with a :: b -> aux2 b l2 ( aux1 a l2 rep ) | [ ] -> rep in aux2 liste1 liste2 rep ; ;
|
let produit_predicat p i j = match i , j with ( a , b ) , ( c , d ) -> ( ( p a c ) || ( ( a = c ) && ( p b d ) ) ) ; ;
|
let union_list p liste1 liste2 = let rec aux liste1 liste2 sol = match liste1 , liste2 with a :: b , t :: q when a = t -> aux b q ( t :: sol ) | a :: b , t :: _q when ( p a t ) -> aux b liste2 ( a :: sol ) | _a :: _b , t :: q -> aux liste1 q ( t :: sol ) | a :: b , [ ] -> aux b [ ] ( a :: sol ) | [ ] , a :: b -> aux b [ ] ( a :: sol ) | [ ] , [ ] -> ( rev sol ) in aux liste1 liste2 [ ]
|
let intersec_list p liste1 liste2 = let rec aux liste1 liste2 sol = match liste1 , liste2 with a :: b , t :: q -> if ( a = t ) then aux b q ( a :: sol ) else ( if ( p a t ) then aux b liste2 sol else aux liste1 q sol ) | _ -> ( rev sol ) in aux liste1 liste2 [ ]
|
let ajoute t liste = let rec aux liste rep = match liste with a :: b -> aux b ( ( concat t a ) :: rep ) | [ ] -> rep in aux ( rev liste ) [ ]
|
let flat_map f l = let rec aux l rep = match l with a :: b -> aux b ( ( f a ) @ rep ) | [ ] -> rep in aux ( rev l ) [ ]
|
let flat_map_zip f l = let rec aux l rep1 rep2 = match l with a :: b -> let ( c , d ) = f a in aux b ( c @ rep1 ) ( d @ rep2 ) | [ ] -> rep1 , rep2 in aux ( rev l ) [ ] [ ]
|
let produit_list liste1 liste2 = flat_map ( fun x -> ajoute x liste2 ) liste1
|
let rec mix_list liste = match liste with [ ] -> [ [ ] ] | t :: q -> produit_list t ( mix_list q )
|
let insert_list p x liste1 = let rec vide reste fait = match reste with a :: b -> vide b ( a :: fait ) [ ] | -> fait in let rec aux reste vue = match reste with a :: b -> if ( p a x ) then ( aux b ( a :: vue ) ) else ( vide ( x :: vue ) reste ) | [ ] -> vide ( x :: vue ) [ ] in aux liste1 [ ]
|
let list_of_table h = let liste = ref [ ] in ( Hashtbl . iter ( fun a -> fun b ( -> liste ( := a , b ) ( ::! liste ) ) ) h ; ! liste )
|
let copy_table h = let rep = Hashtbl . create 1 in ( Hashtbl . iter ( fun a -> fun b ( -> Hashtbl . add rep a b ) ) h ; rep )
|
let insert_sort p l k = let rec aux l rep = match l with | t :: q when ( p t k ) -> aux q ( t :: rep ) | t :: _q when t = k -> concat ( List . rev rep ) l | _ -> concat ( List . rev rep ) ( k :: l ) in aux l [ ]
|
let merge p l k = let rec aux l1 l2 rep = match l1 , l2 with t :: q , a :: _b when p t a -> aux q l2 ( t :: rep ) | t :: q , a :: b when p a t -> aux ( t :: q ) b ( a :: rep ) | t :: q , _a :: b -> aux q b ( t :: rep ) | t :: q , [ ] -> aux q l2 ( t :: rep ) | [ ] , a :: b -> aux l1 b ( a :: rep ) | _ -> ( List . rev rep ) in aux l k [ ]
|
let sub_list p l k = let rec aux l rep = match l with t :: q when t = k -> concat ( List . rev rep ) q in aux l [ ]
|
let vide f l = let rec aux l rep = match l with t :: q when ( f t ) -> aux q rep | t :: q -> aux q ( t :: rep ) | _ -> ( List . rev rep ) in aux l [ ]
|
let filtre f l = vide ( fun x -> not ( f x ) ) l
|
let rev l = let rec aux res sol = match res with [ ] -> sol | a :: b -> aux b ( a :: sol )
|
let flap_map parameters error f l = let n = Working_list_imperative . make ( Remanent_parameters . get_empty_hashtbl_size parameters ) in let rec aux l = match l with t :: q -> ( Working_list_imperative . push ( f t ) n ; aux q ) | [ ] -> ( ) in List . iter aux l ; error , Working_list_imperative . list n
|
let map_list ( f ' : a ' -> b ) ( l ' : a list ) = let rec aux ( l ' : a list ) ( rep ' : b list ) = match l with [ ] -> rep | a :: b -> ( try ( let r = ( f a ) in ( aux b ( r :: rep ) ) ) with _ -> ( aux b rep ) ) in aux ( List . rev l ) [ ] ; ;
|
let compte_list parameters error l = let a = Hashtbl . create ( Remanent_parameters . get_empty_hashtbl_size parameters ) in let get x = try ( Hashtbl . find a x ) with _ -> 0 in let inc x = let rep = get x in ( Hashtbl . remove a x ; List . iter ( fun x -> inc x ) l ; error , list_of_table a ; ;
|
let fst_option x = match x with | Some ( x , _ ) -> Some x | _ -> None
|
let snd_option x = match x with | Some ( _ , x ) -> Some x | _ -> None
|
let escape_label_in_dot s = Str . global_substitute ( Str . regexp " [ " ] " ) \\\\\\\
|
let make_id_compatible_with_dot_format parameters error string = let tab = Remanent_parameters . get_make_labels_compatible_with_dot parameters in let rec aux pos l = if pos < 0 then l else let char = String . get string pos in match Remanent_parameters_sig . CharMap . find_option char tab with | Some liste_char -> | None -> in let l = aux ( String . length string - 1 ) [ ] in error , String . concat " " ( List . rev_map ( String . make 1 ) ( List . rev l ) )
|
let sorted_parts_of_list n list = let list = List . sort ( fun a b -> compare b a ) list in let rec aux k list suffix output = if k = 0 then suffix :: output else match list with | h :: t -> | [ ] -> output in aux n list [ ] [ ]
|
let sort_list key parameter error list = let error , refined_list = List . fold_left ( fun ( error , refined_list ) a -> let error , key = key parameter error a in error , ( key , a ) :: refined_list ) ( error , [ ] ) list in let refined_sorted_list = List . sort ( fun ( a , _ ) ( b , _ ) -> compare b a ) refined_list in error , List . rev_map snd refined_sorted_list
|
let generic_installation ( ~ run_program : Machine . Make_fun . t ) ~ host ~ install_path ~ install_program ~ witness ~ url ? unarchived_directory ( ? archive_is_directory = true ) tool_name = let archive = Filename . basename url in let archive_kind = if Filename . check_suffix url " bz2 " then ` Tar " j " else if Filename . check_suffix url " gz " then ` Tar " z " else if Filename . check_suffix url " tar " then ` Tar " " else if Filename . check_suffix url " zip " then ` Zip else if Filename . check_suffix url " deb " then ` Deb else ` None in let open KEDSL in let unarchival = let open Program in let and_cd = if archive_is_directory then [ shf " cd % s " ( Option . value unarchived_directory ~ default ( : tool_name ^ " " ) ) ] * else [ ] in match archive_kind with | ` Tar tar_option -> chain ( [ shf " tar xvf % s % s " tar_option archive ; shf " rm - f % s " archive ; ] @ and_cd ) | ` Zip -> chain ( [ shf " unzip % s " archive ; shf " rm - f % s " archive ; ] @ and_cd ) | ` Deb -> chain [ exec [ " ar " ; " x " ; archive ] ; exec [ " tar " ; " xvfz " ; " data . tar . gz " ] ; exec [ " rm " ; " - f " ; " data . tar . gz " ] ; ] | ` None -> sh " echo Not - an - archive " in workflow_node ~ name ( : sprintf " Install % s " tool_name ) witness ~ edges [ : on_failure_activate ( rm_path ~ host install_path ) ; ] ~ make ( : run_program ~ requirements [ : ` Internet_access ; ` Self_identification [ " generic - instalation " ; tool_name ] ; ] Program . ( shf " mkdir - p % s " install_path && shf " cd % s " install_path && Workflow_utilities . Download . wget_program url && unarchival && install_program && sh " echo Done " ) )
|
let git_installation ( ~ run_program : Machine . Make_fun . t ) ~ host ~ install_path ~ install_program ~ witness ~ repository ~ recursive tool = let open KEDSL in let recursive = if recursive then " -- recursive " else " " in let version = ( Option . value_exn tool . Machine . Tool . Definition . version ~ msg " : Git_installable tool must have a verison " ) in let name = tool . Machine . Tool . Definition . name in workflow_node ~ name ( : sprintf " Install % s % s " name version ) witness ~ edges [ : on_failure_activate ( rm_path ~ host install_path ) ; ] ~ make ( : run_program ~ requirements [ : ` Internet_access ; ` Self_identification [ " git - instalation " ; name ] ; ] Program . ( shf " mkdir - p % s " install_path && shf " cd % s " install_path && shf " git clone % s % s " recursive repository && shf " cd % s " name && shf " git checkout % s " version && install_program && sh " echo Done " ) )
|
module Installable_tool = struct let noop = KEDSL . Program . sh " echo Nothing - done - here " type t = { tool_definition : Tool_def . t ; url : string ; install_program : path : string -> KEDSL . Program . t ; init_program : path : string -> KEDSL . Program . t ; witness : host : KEDSL . Host . t -> path : string -> KEDSL . unknown_product ; unarchived_directory : string option ; archive_is_directory : bool ; } let make ~ url ( ? install_program = fun ~ path -> noop ) ( ? init_program = fun ~ path -> noop ) ~ witness ( ? archive_is_directory = true ) ? unarchived_directory tool_definition = { tool_definition ; url ; install_program ; init_program ; witness ; unarchived_directory ; archive_is_directory } let render ~ run_program ~ host ~ install_tools_path tool = let path = install_tools_path // Tool_def . to_directory_name tool . tool_definition in let ensure = generic_installation ? unarchived_directory : tool . unarchived_directory ~ archive_is_directory : tool . archive_is_directory ~ run_program ~ host ~ install_path : path ~ install_program ( : tool . install_program ~ path ) ~ witness ( : tool . witness ~ host ~ path ) ~ url : tool . url ( tool . tool_definition . Tool_def . name ) in Machine . Tool . create tool . tool_definition ~ ensure ~ init ( : tool . init_program path ) end
|
module Git_installable_tool = struct let noop = KEDSL . Program . sh " echo Nothing - done - here " type t = { tool_definition : Tool_def . t ; repository : string ; recursive : bool ; install_program : path : string -> KEDSL . Program . t ; init_program : path : string -> KEDSL . Program . t ; witness : host : KEDSL . Host . t -> path : string -> KEDSL . unknown_product ; } let make ~ repository ( ? install_program = fun ~ path -> noop ) ( ? init_program = fun ~ path -> noop ) ( ? recursive = false ) ~ witness tool_definition = { tool_definition ; repository ; recursive ; install_program ; init_program ; witness ; } let render ~ run_program ~ host ~ install_tools_path tool = let path = install_tools_path // Tool_def . to_directory_name tool . tool_definition in let ensure = git_installation ~ run_program ~ host ~ install_path : path ~ install_program ( : tool . install_program ~ path ) ~ witness ( : tool . witness ~ host ~ path ) ~ repository : tool . repository ~ recursive : tool . recursive tool . tool_definition in Machine . Tool . create tool . tool_definition ~ ensure ~ init ( : tool . init_program path ) end
|
let add_to_dollar_path ~ path = KEDSL . Program . shf " export PATH =% s :$ PATH " path
|
let make_and_copy_bin bin = fun ~ path -> KEDSL . Program . ( sh " make " && shf " cp % s % s " bin path )
|
let witness_file bin = fun ~ host ~ path -> let p = KEDSL . single_file ~ host ( path // bin ) in object method is_done = p # is_done end
|
let witness_list l = fun ~ host ~ path -> KEDSL . list_of_files ~ host ( List . map l ~ f ( : fun bin -> path // bin ) ) |> fun p -> object method is_done = p # is_done end
|
let bwa = Installable_tool . make Machine . Tool . Default . bwa ~ url " : http :// downloads . sourceforge . net / project / bio - bwa / bwa - 0 . 7 . 10 . tar . bz2 " ~ install_program ( : make_and_copy_bin " bwa " ) ~ init_program : add_to_dollar_path ~ witness ( : witness_file " bwa " )
|
let freebayes = Git_installable_tool . make Machine . Tool . Default . freebayes ~ repository " : https :// github . com / ekg / freebayes . git " ~ recursive : true ~ install_program ( : fun ~ path -> KEDSL . Program . ( sh " make " && shf " cp - r bin % s " path ) ) ~ init_program ( : fun ~ path -> KEDSL . Program . ( shf " export PATH =% s / bin /:$ PATH " path ) ) ~ witness ( : witness_list [ " bin / freebayes " ; " bin / bamleftalign " ] )
|
let delly2 = Installable_tool . make Machine . Tool . Default . delly2 ~ url " : https :// github . com / dellytools / delly / releases / download / v0 . 7 . 7 / delly_v0 . 7 . 7_parallel_linux_x86_64bit " ~ install_program ( : fun ~ path -> KEDSL . Program . ( sh " mv delly_v0 . 7 . 7_parallel_linux_x86_64bit delly2 " && sh " chmod 777 delly2 " ) ) ~ archive_is_directory : false ~ init_program : add_to_dollar_path ~ witness ( : witness_file " delly2 " )
|
let sambamba = Installable_tool . make Machine . Tool . Default . sambamba ~ archive_is_directory : false ~ url " : https :// github . com / lomereiter / sambamba / releases / download / v0 . 6 . 5 / sambamba_v0 . 6 . 5_linux . tar . bz2 " ~ init_program : add_to_dollar_path ~ witness ( : witness_file " sambamba_v0 . 6 . 5 " )
|
let stringtie = Installable_tool . make Machine . Tool . Default . stringtie ~ url " : https :// github . com / gpertea / stringtie / archive / v1 . 2 . 2 . tar . gz " ~ install_program ( : make_and_copy_bin " stringtie " ) ~ init_program : add_to_dollar_path ~ witness ( : witness_file " stringtie " )
|
let vcftools = Installable_tool . make Machine . Tool . Default . vcftools ~ url " : http :// downloads . sourceforge . net / project /\ vcftools / vcftools_0 . 1 . 12b . tar . gz " ~ install_program ( : fun ~ path -> KEDSL . Program . ( sh " make " && shf " cp - r bin % s " path && shf " cp - r lib / perl5 / site_perl % s " path ) ) ~ witness ( : witness_file @@ " bin " // " vcftools " ) ~ init_program ( : fun ~ path -> KEDSL . Program . ( shf " export PATH =% s / bin /:$ PATH " path && shf " export PERL5LIB =$ PERL5LIB :% s / site_perl " / path ) )
|
let bedtools = Installable_tool . make Machine . Tool . Default . bedtools ~ url " : https :// github . com / arq5x / bedtools2 /\ archive / v2 . 23 . 0 . tar . gz " ~ install_program ( : fun ~ path -> KEDSL . Program . ( sh " make " && shf " cp - r bin % s " path ) ) ~ init_program ( : fun ~ path -> KEDSL . Program . ( shf " export PATH =% s / bin /:$ PATH " path ) ) ~ witness ( : witness_file @@ " bin " // " bedtools " )
|
let mosaik = let url = " https :// mosaik - aligner . googlecode . com / files / MOSAIK - 2 . 2 . 3 - source . tar " in Installable_tool . make Machine . Tool . Default . mosaik ~ url ~ unarchived_directory " : MOSAIK " * ~ init_program ( : fun ~ path -> KEDSL . Program . ( shf " export PATH =% s :$ PATH " path && shf " export MOSAIK_PE_ANN =% s / pe . ann " path && shf " export MOSAIK_SE_ANN =% s / se . ann " path ) ) ~ witness ( : witness_file " MosaikAligner " ) ~ install_program : KEDSL . Program . ( fun ~ path -> sh " make " && shf " cp networkFile /* pe . ann % s / pe . ann " path && shf " cp networkFile /* se . ann % s / se . ann " path && shf " cp bin /* % s " path )
|
let star = let url = " https :// github . com / alexdobin / STAR / archive / STAR_2 . 4 . 1d . tar . gz " in let star_binary = " STAR " in let star_binary_path = sprintf " bin / Linux_x86_64 /% s " star_binary in Installable_tool . make ~ url Machine . Tool . Default . star ~ init_program : add_to_dollar_path ~ unarchived_directory " : STAR " -* ~ install_program : KEDSL . Program . ( fun ~ path -> shf " cp % s % s " star_binary_path path ) ~ witness ( : witness_file star_binary )
|
let hisat tool = let open KEDSL in let url , hisat_binary = let open Machine . Tool . Default in match tool with | one when one = hisat -> " http :// ccb . jhu . edu / software / hisat / downloads / hisat - 0 . 1 . 6 - beta - Linux_x86_64 . zip " , " hisat " | two when two = hisat2 -> " ftp :// ftp . ccb . jhu . edu / pub / infphilo / hisat2 / downloads / hisat2 - 2 . 0 . 2 - beta - Linux_x86_64 . zip " , " hisat2 " | other -> failwithf " Can ' t install Hisat version : % s " ( Tool_def . to_string other ) in Installable_tool . make tool ~ url ~ witness ( : witness_file hisat_binary ) ~ install_program : KEDSL . Program . ( fun ~ path -> shf " mv hisat * % s " path ) ~ init_program : add_to_dollar_path
|
let kallisto = let url = " https :// github . com / pachterlab / kallisto / releases / download \ / v0 . 42 . 3 / kallisto_linux - v0 . 42 . 3 . tar . gz " in Installable_tool . make Machine . Tool . Default . kallisto ~ url ~ witness ( : witness_file " kallisto " ) ~ install_program : KEDSL . Program . ( fun ~ path -> shf " cp - r * % s " path ) ~ init_program : add_to_dollar_path
|
let samtools = let url = " https :// github . com / samtools / samtools / releases / download / 1 . 4 /\ samtools - 1 . 4 . tar . bz2 " in let samtools = " samtools " in let htslib = [ " bgzip " ; " tabix " ] in let install_program ~ path = let open KEDSL . Program in sh " make " && shf " cp % s % s " samtools path && sh " cd htslib " */ && sh " make " && shf " cp % s % s " ( String . concat htslib ~ sep " : " ) path && sh " echo Done " in let witness = witness_list ( samtools :: htslib ) in Installable_tool . make Machine . Tool . Default . samtools ~ url ~ install_program ~ init_program : add_to_dollar_path ~ witness
|
let bcftools = let url = " https :// github . com / samtools / bcftools / releases / download / 1 . 4 /\ bcftools - 1 . 4 . tar . bz2 " in let install_program ~ path = let open KEDSL . Program in sh " make " && shf " cp bcftools % s " path in let witness = witness_file " bcftools " in Installable_tool . make Machine . Tool . Default . bcftools ~ url ~ install_program ~ init_program : add_to_dollar_path ~ witness
|
let cufflinks = let url = " http :// cole - trapnell - lab . github . io / cufflinks / assets / downloads /\ cufflinks - 2 . 2 . 1 . Linux_x86_64 . tar . gz " in let witness = witness_file " cufflinks " in let install_program ~ path = KEDSL . Program . ( shf " cp * % s " path ) in Installable_tool . make Machine . Tool . Default . cufflinks ~ install_program ~ url ~ init_program : add_to_dollar_path ~ witness
|
let somaticsniper = let url = let deb_file = " somatic - sniper1 . 0 . 3_1 . 0 . 3_amd64 . deb " in sprintf " http :// apt . genome . wustl . edu / ubuntu / pool / main / s / somatic - sniper1 . 0 . 3 /% s " deb_file in let binary = " somaticsniper " in let binary_in_deb = " usr / bin / bam - somaticsniper1 . 0 . 3 " in let install_program ~ path = KEDSL . Program . ( shf " mv % s /% s % s /% s " path binary_in_deb path binary ) in Installable_tool . make Machine . Tool . Default . somaticsniper ~ install_program ~ url ~ witness ( : witness_file binary ) ~ init_program : add_to_dollar_path
|
let varscan = let url = " http :// downloads . sourceforge . net / project / varscan / VarScan . v2 . 3 . 5 . jar " in let jar = " VarScan . v2 . 3 . 5 . jar " in let witness = witness_file jar in let init_program ~ path = KEDSL . Program . ( shf " export VARSCAN_JAR =% s /% s " path jar ) in Installable_tool . make Machine . Tool . Default . varscan ~ url ~ init_program ~ witness
|
let get_broad_jar = Workflow_utilities . Download . get_tool_file ~ identifier " : broad - jar "
|
let mutect_tool ( ~ run_program : Machine . Make_fun . t ) ~ host ~ install_tools_path loc = let tool = Machine . Tool . Default . mutect in let open KEDSL in let install_path = install_tools_path // Tool_def . to_directory_name tool in let conda_env = Conda . ( setup_environment ~ python_version ` : Python_2 ~ base_packages [ ( " : java - jdk " , ` Version " 7 . 0 . 91 " ) ] install_path " mutect_env " ) in let conda_ensure = Conda . ( configured ~ run_program ~ host ~ conda_env ) in let conda_init = Conda . init_env ~ conda_env ( ) in let get_mutect = get_broad_jar ~ run_program ~ host ~ install_path loc in let edges = [ depends_on conda_ensure ; depends_on get_mutect ] in let ensure = workflow_node without_product ~ name " : MuTect setup " ~ edges in let init = Program . ( conda_init && shf " export mutect_HOME =% s " install_path ) in Machine . Tool . create tool ~ ensure ~ init
|
let gatk_tool ( ~ run_program : Machine . Make_fun . t ) ~ host ~ install_tools_path loc = let tool = Machine . Tool . Default . gatk in let open KEDSL in let install_path = install_tools_path // Tool_def . to_directory_name tool in let ensure = get_broad_jar ~ run_program ~ host ~ install_path loc in Machine . Tool . create tool ~ ensure ~ init : Program . ( shf " export GATK_JAR =% s " ensure # product # path )
|
let strelka = let url = " ftp :// strelka :% 27 % 27 @ ftp . illumina . com / v1 - branch / v1 . 0 . 14 /\ strelka_workflow - 1 . 0 . 14 . tar . gz " in let strelka_bin = " usr " // " bin " in let witness = witness_file @@ strelka_bin // " configureStrelkaWorkflow . pl " in let install_program ~ path = KEDSL . Program . ( shf " . / configure -- prefix =% s " ( path // " usr " ) && sh " make " && sh " chmod - R a + rx . " /* && sh " make install " ) in let init_program ~ path = KEDSL . Program . ( shf " export STRELKA_BIN =% s /% s " path strelka_bin ) in Installable_tool . make Machine . Tool . Default . strelka ~ url ~ init_program ~ install_program ~ witness
|
let virmid = let url = " http :// downloads . sourceforge . net / project / virmid / virmid - 1 . 1 . 1 . tar . gz " in let jar = " Virmid - 1 . 1 . 1 " // " Virmid . jar " in let init_program ~ path = KEDSL . Program . ( shf " export VIRMID_JAR =% s /% s " path jar ) in Installable_tool . make Machine . Tool . Default . virmid ~ url ~ init_program ~ unarchived_directory " . " : ~ witness ( : witness_file jar )
|
let muse = let url = " http :// bioinformatics . mdanderson . org / Software / MuSE / MuSEv1 . 0b " in let binary = " MuSEv1 . 0b " in let install_program ~ path = KEDSL . Program . ( shf " chmod + x % s /% s " path binary ) in let init_program ~ path = KEDSL . Program . ( shf " export muse_bin =% s /% s " path binary ) in Installable_tool . make Machine . Tool . Default . muse ~ url ~ install_program ~ init_program ~ witness ( : witness_file binary )
|
let fastqc = let url = " http :// www . bioinformatics . babraham . ac . uk / projects / fastqc / fastqc_v0 . 11 . 5 . zip " in let binary = " fastqc " in let binary_path path = path // binary in let init_program ~ path = KEDSL . Program . ( shf " export FASTQC_BIN =% s " ( binary_path path ) ) in Installable_tool . make Machine . Tool . Default . fastqc ~ url ~ witness ( : witness_file binary ) ~ install_program : KEDSL . Program . ( fun ~ path -> shf " cp - r * % s " path && shf " chmod + x % s " ( binary_path path ) ) ~ init_program ~ unarchived_directory " : FastQC " let samblaster = let binary = " samblaster " in Installable_tool . make Machine . Tool . Default . samblaster ~ url " : https :// github . com / GregoryFaust / samblaster / releases / download / v . 0 . 1 . 22 / samblaster - v . 0 . 1 . 22 . tar . gz " ~ install_program ( : make_and_copy_bin binary ) ~ init_program : add_to_dollar_path ~ witness ( : witness_file binary )
|
let default_tool_location msg ( ) : Workflow_utilities . Download . tool_file_location = ` Fail ( sprintf " No location provided for % s " msg )
|
let default_netmhc_config ( ) = Netmhc . ( create_netmhc_config ~ netmhc_loc ( : default_tool_location " NetMHC " ( ) ) ~ netmhcpan_loc ( : default_tool_location " NetMHCpan " ( ) ) ~ pickpocket_loc ( : default_tool_location " PickPocket " ( ) ) ~ netmhccons_loc ( : default_tool_location " NetMHCcons " ( ) ) ( ) )
|
let default_toolkit ~ run_program ~ host ~ install_tools_path ( ? mutect_jar_location = default_tool_location " Mutect " ) ( ? gatk_jar_location = default_tool_location " GATK " ) ( ? netmhc_config = default_netmhc_config ) ( ) = let install installable = Installable_tool . render ~ host installable ~ install_tools_path ~ run_program in let install_git installable = Git_installable_tool . render ~ host installable ~ install_tools_path ~ run_program in Machine . Tool . Kit . concat [ Machine . Tool . Kit . of_list [ mutect_tool ~ run_program ~ host ~ install_tools_path ( mutect_jar_location ( ) ) ; gatk_tool ~ run_program ~ host ~ install_tools_path ( gatk_jar_location ( ) ) ; install bwa ; install samtools ; install bcftools ; install bedtools ; install vcftools ; install strelka ; install somaticsniper ; install sambamba ; install varscan ; install muse ; install virmid ; install star ; install stringtie ; install cufflinks ; install @@ hisat Machine . Tool . Default . hisat ; install @@ hisat Machine . Tool . Default . hisat2 ; install mosaik ; install kallisto ; install fastqc ; install samblaster ; install_git freebayes ; install delly2 ; ] ; Biopam . default ~ run_program ~ host ~ install_path ( : install_tools_path // " biopam - kit " ) ( ) ; Python_package . default ~ run_program ~ host ~ install_path : ( install_tools_path // " python - tools " ) ( ) ; Bioconda . default ~ run_program ~ host ~ install_path : ( install_tools_path // " bioconda " ) ( ) ; Netmhc . default ~ run_program ~ host ~ install_path : ( install_tools_path // " netmhc - tools " ) ~ netmhc_config : ( netmhc_config ( ) ) ( ) ; ]
|
module Toploop : sig value print_location : Format . formatter -> Camlp4_import . Location . t -> unit ; value print_warning : Camlp4_import . Location . t -> Format . formatter -> Camlp4_import . Warnings . t -> unit ; value parse_toplevel_phrase : ref ( Lexing . lexbuf -> Camlp4_import . Parsetree . toplevel_phrase ) ; value parse_use_file : ref ( Lexing . lexbuf -> list Camlp4_import . Parsetree . toplevel_phrase ) ; value print_location fmt loc = Toploop . print_location fmt ( Obj . magic loc ) ; value parse_toplevel_phrase = Obj . magic Toploop . parse_toplevel_phrase ; value parse_use_file = Obj . magic Toploop . parse_use_file ; value print_warning loc fmt w = Toploop . print_warning ( Obj . magic loc ) fmt ( Obj . magic w ) ; end ;
|
module Ast2pt = Camlp4 . Struct . Camlp4Ast2OCamlAst . Make Ast ;
|
module Lexer = Camlp4 . Struct . Lexer . Make Token ; if Sys . interactive . val then Format . printf " \ tCamlp4 Parsing version % s \ n . " @ Camlp4_config . version else ( ) end ; let token_streams = ref [ ] in let cleanup lb = try token_streams . val := List . remove_assq lb token_streams . val with [ Not_found -> ( ) ] in fun lb -> let ( ) = Lazy . force initialization in let ( ) = Register . iter_and_take_callbacks ( fun ( _ , f ) -> f ( ) ) in let token_stream = match lookup lb token_streams . val with [ None -> let not_filtered_token_stream = Lexer . from_lexbuf lb in let token_stream = Gram . filter ( not_filtered not_filtered_token_stream ) in do { token_streams . val := [ ( lb , token_stream ) :: token_streams . val ] ; token_stream } | Some token_stream -> token_stream ] in try match token_stream with parser [ [ : ` ( EOI , _ ) ] : -> raise End_of_file | [ : ] : -> parse_fun token_stream ] with [ End_of_file | Sys . Break | ( Loc . Exc_located _ ( End_of_file | Sys . Break ) ) as x -> ( cleanup lb ; raise x ) | x -> let x = match x with [ Loc . Exc_located loc x -> do { Toploop . print_location Format . err_formatter ( Loc . to_ocaml_location loc ) ; x } | x -> x ] in do { cleanup lb ; Format . eprintf " [ @< 0 >% a ] . " @@ Camlp4 . ErrorHandler . print x ; raise Exit } ] ; match Gram . parse_tokens_after_filter Syntax . top_phrase token_stream with [ Some str_item -> in | None -> raise End_of_file ] ; let ( pl0 , eoi ) = loop ( ) where rec loop ( ) = let ( pl , stopped_at_directive ) = Gram . parse_tokens_after_filter Syntax . use_file token_stream in if stopped_at_directive <> None then match pl with [ [ <: str_item < # load $ str : s $ >> ] -> do { Topdirs . dir_load Format . std_formatter s ; loop ( ) } | [ <: str_item < # directory $ str : s $ >> ] -> do { Topdirs . dir_directory s ; loop ( ) } | _ -> ( pl , False ) ] else ( pl , True ) in let pl = if eoi then [ ] else loop ( ) where rec loop ( ) = let ( pl , stopped_at_directive ) = Gram . parse_tokens_after_filter Syntax . use_file token_stream in if stopped_at_directive <> None then pl @ loop ( ) else pl in List . map Ast2pt . phrase ( pl0 @ pl ) ; fun loc txt -> Toploop . print_warning ( Loc . to_ocaml_location loc ) Format . err_formatter ( Camlp4_import . Warnings . Camlp4 txt ) ;
|
let parse_toplevel_phrase = ref Parse . toplevel_phrase
|
let parse_use_file = ref Parse . use_file
|
let parse_mod_use_file name lb = let modname = String . capitalize_ascii ( Filename . remove_extension ( Filename . basename name ) ) in let items = List . concat ( List . map ( function Ptop_def s -> s | Ptop_dir _ -> [ ] ) ( ! parse_use_file lb ) ) in [ Ptop_def [ Str . module_ ( Mb . mk ( Location . mknoloc ( Some modname ) ) ( Mod . structure items ) ) ] ]
|
let max_printer_depth = ref 100
|
let max_printer_steps = ref 300
|
let toplevel_env = ref Env . empty
|
let backtrace = ref None
|
module type EVAL_BASE = sig val eval_ident : Ident . t -> Obj . t end
|
module MakeEvalPrinter ( E : EVAL_BASE ) = struct let rec eval_address = function | Env . Aident id -> E . eval_ident id | Env . Adot ( p , pos ) -> Obj . field ( eval_address p ) pos let eval_path find env path = match find path env with | addr -> eval_address addr | exception Not_found -> Misc . fatal_error ( " Cannot find address for : " ^ ( Path . name path ) ) let eval_module_path env path = eval_path Env . find_module_address env path let eval_value_path env path = eval_path Env . find_value_address env path let eval_extension_path env path = eval_path Env . find_constructor_address env path let eval_class_path env path = eval_path Env . find_class_address env path module Printer = Genprintval . Make ( Obj ) ( struct type valu = Obj . t exception Error let eval_address addr = try eval_address addr with Undefined_global _ -> raise Error let same_value v1 v2 = ( v1 == v2 ) end ) let print_untyped_exception ppf obj = ! print_out_value ppf ( Printer . outval_of_untyped_exception obj ) let outval_of_value env obj ty = Printer . outval_of_value ! max_printer_steps ! max_printer_depth ( fun _ _ _ -> None ) env obj ty let print_value env obj ppf ty = ! print_out_value ppf ( outval_of_value env obj ty ) let print_out_exception ppf exn outv = ! print_out_phrase ppf ( Ophr_exception ( exn , outv ) ) let print_exception_outcome ppf exn = if exn = Out_of_memory then Gc . full_major ( ) ; let outv = outval_of_value ! toplevel_env ( Obj . repr exn ) Predef . type_exn in print_out_exception ppf exn outv ; if Printexc . backtrace_status ( ) then match ! backtrace with | None -> ( ) | Some b -> print_string b ; backtrace := None type ( ' a , ' b ) gen_printer = ( ' a , ' b ) Genprintval . gen_printer = | Zero of ' b | Succ of ( ' a -> ( ' a , ' b ) gen_printer ) let install_printer = Printer . install_printer let install_generic_printer = Printer . install_generic_printer let install_generic_printer ' = Printer . install_generic_printer ' let remove_printer = Printer . remove_printer end
|
let toplevel_startup_hook = ref ( fun ( ) -> ( ) )
|
type event += | Startup | After_setup
|
let hooks = ref [ ]
|
let add_hook f = hooks := f :: ! hooks
|
let ( ) = add_hook ( function | Startup -> ! toplevel_startup_hook ( ) | _ -> ( ) )
|
let run_hooks hook = List . iter ( fun f -> f hook ) ! hooks
|
type evaluation_outcome = Result of Obj . t | Exception of exn
|
let record_backtrace ( ) = if Printexc . backtrace_status ( ) then backtrace := Some ( Printexc . get_backtrace ( ) )
|
let preprocess_phrase ppf phr = let phr = match phr with | Ptop_def str -> let str = Pparse . apply_rewriters_str ~ restore : true ~ tool_name " : ocaml " str in Ptop_def str | phr -> phr in if ! Clflags . dump_parsetree then Printast . top_phrase ppf phr ; if ! Clflags . dump_source then Pprintast . top_phrase ppf phr ; phr
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.