Commit daf6fca8 authored by Louis Duchemin's avatar Louis Duchemin
Browse files

Autoformat

parent 8bbf97e0
......@@ -2,10 +2,12 @@ open Core_kernel
open Bistro
open Bistro.Shell_dsl
class type relatedness_matrix = object
inherit text
method format : [`gemma_relatedness_matrix]
end
class type relatedness_matrix =
object
inherit text
method format : [ `gemma_relatedness_matrix ]
end
let%pworkflow genotype_of_fasta fasta =
let module G = Reviewphiltrans_toolbox.Gemma in
......@@ -13,72 +15,51 @@ let%pworkflow genotype_of_fasta fasta =
let%pworkflow phenotype_of_tree nhx =
let open Phylogenetics in
let module U = Reviewphiltrans_toolbox.Utils in
let module U = Reviewphiltrans_toolbox.Utils in
let collect_leaves t =
let rec node condition t acc =
match t with
| Tree.Node n ->
List1.fold_right n.branches ~init:acc ~f:branch
match t with
| Tree.Node n -> List1.fold_right n.branches ~init:acc ~f:branch
| Leaf _ -> condition :: acc
and branch (Tree.Branch b) acc =
node (snd b.data) b.tip acc
in
and branch (Tree.Branch b) acc = node (snd b.data) b.tip acc in
node 0 t []
in
let leaves =
U.tree_from_file [%path nhx]
|> collect_leaves
in
let write_phenotypes leaves oc =
List.iter leaves ~f:(fprintf oc "%d\n")
in
let leaves = U.tree_from_file [%path nhx] |> collect_leaves in
let write_phenotypes leaves oc = List.iter leaves ~f:(fprintf oc "%d\n") in
Out_channel.with_file [%dest] ~f:(write_phenotypes leaves)
let template_of_lmm lmm =
int (
match lmm with
| `Wald -> 1
| `LRT -> 2
| `Score -> 3
| `All -> 4
)
let template_of_lmm lmm =
int (match lmm with `Wald -> 1 | `LRT -> 2 | `Score -> 3 | `All -> 4)
let univariate_lmm ~lmm ~genotype ~phenotype ~relatedness_matrix =
Workflow.shell ~descr:"gemma.univariate_lmm"
[
cmd "gemma"
[
opt "-g" dep genotype;
opt "-p" dep phenotype;
opt "-lmm" template_of_lmm lmm;
opt "-k" dep relatedness_matrix;
opt "-outdir" Fn.id tmp;
];
cmd "cp" [ tmp // "result.assoc.txt"; dest ];
]
let univariate_lmm ~lmm ~genotype ~phenotype ~relatedness_matrix =
Workflow.shell ~descr:"gemma.univariate_lmm" [
cmd "gemma" [
opt "-g" dep genotype ;
opt "-p" dep phenotype ;
opt "-lmm" template_of_lmm lmm ;
opt "-k" dep relatedness_matrix ;
opt "-outdir" Fn.id tmp ;
] ;
cmd "cp" [
tmp // "result.assoc.txt" ;
dest ;
] ;
]
let template_of_mode m =
int (
match m with
| `Centered -> 1
| `Standardized -> 2
)
let template_of_mode m = int (match m with `Centered -> 1 | `Standardized -> 2)
let relatedness_filename = function
| `Centered -> "result.cXX.txt"
| `Standardized -> "result.sXX.txt"
let calculate_relatedness_matrix ~mode ~genotype ~phenotype =
Workflow.shell ~descr:"gemma.calculate_relatedness_matrix" [
cmd "gemma" [
opt "-g" dep genotype ;
opt "-p" dep phenotype ;
opt "-gk" template_of_mode mode ;
opt "-outdir" Fn.id tmp ;
] ;
cmd "cp" [
tmp // (relatedness_filename mode) ;
dest ;
] ;
]
\ No newline at end of file
Workflow.shell ~descr:"gemma.calculate_relatedness_matrix"
[
cmd "gemma"
[
opt "-g" dep genotype;
opt "-p" dep phenotype;
opt "-gk" template_of_mode mode;
opt "-outdir" Fn.id tmp;
];
cmd "cp" [ tmp // relatedness_filename mode; dest ];
]
open Bistro
open File_formats
class type relatedness_matrix = object
inherit text
method format : [`gemma_relatedness_matrix]
end
class type relatedness_matrix =
object
inherit text
method format : [ `gemma_relatedness_matrix ]
end
val genotype_of_fasta : aminoacid_fasta file -> bimbam file
val phenotype_of_tree : nhx file -> bimbam file
val calculate_relatedness_matrix :
mode:[`Centered | `Standardized] ->
mode:[ `Centered | `Standardized ] ->
genotype:bimbam file ->
phenotype:bimbam file ->
relatedness_matrix file
val univariate_lmm :
lmm:[ `Wald | `LRT | `Score | `All ] ->
genotype:bimbam file ->
phenotype:bimbam file ->
relatedness_matrix file
relatedness_matrix:relatedness_matrix file ->
text file
val univariate_lmm :
lmm:[`Wald | `LRT | `Score | `All ] ->
genotype: bimbam file ->
phenotype: bimbam file ->
relatedness_matrix: relatedness_matrix file ->
text file
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment