diff --git a/contrib/rapidyaml/rapidyaml.hpp b/contrib/rapidyaml/rapidyaml.hpp index 404c03b..ef3cf20 100644 --- a/contrib/rapidyaml/rapidyaml.hpp +++ b/contrib/rapidyaml/rapidyaml.hpp @@ -73,7 +73,7 @@ // resulting in missing in arm-none-eabi-g++ // https://github.com/biojppm/rapidyaml/issues/193 #include - +#include diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt deleted file mode 100644 index d58a147..0000000 --- a/examples/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -INSTALL(FILES - segments.dawg - basic-dna.dawg - basic-dna-2.dawg - multiple-models.dawg - pseudogene.dawg - recombination.dawg - DESTINATION "${CMAKE_DATA_DIR}/examples") - diff --git a/examples/aa.dawg b/examples/aa.dawg deleted file mode 100644 index b5059e3..0000000 --- a/examples/aa.dawg +++ /dev/null @@ -1,88 +0,0 @@ -# Test aa evaluationary models - -Tree.Scale = 0.666 -Root.Length = 10000 -Root.Code = 2 -Root.Seq = "AATGCTTTTTTTTTTGGCCAAAATTTTGGGGAAATTGGCCCCCCACACACACATTTTTATATATGG" -Sim.Reps = 10 -Sim.Seed = 420 -Root.Seg = 0 - -[Indel] -Params.Ins = 1.039000, 50 -Model.Ins = "GEO" -Rate.Ins = 0.01 -Max.Ins = 50.0 -Params.Del = 1.039000, 50 -Model.Del = "POWER-LAW" -Rate.Del = 0.01 -Max.Del = 50.0 - -[[-]] -Tree.Tree = "(A:0.3, B:0.2)C;" -Subst.Model = "aagtr" -Subst.Freqs = -0.443, 0.3113, 0.3, 0.2, 0.888, 0.6520, 0.9112, 0.3323, 0.2998, 0.7171, -0.443, 0.3113, 0.3003, 0.211, 0.5588, 0.43520, 0.487112, 0.76323, 0.1998, 0.44171 -Subst.Params = -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171 -Subst.Rate.Model = "ZERO" - -[[-]] -Tree.Tree = "(D:0.3, E:0.2)C;" -Subst.Model = "equ" -Subst.Rate.Model = "CONST" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(F:0.3, G:0.2)C;" -Subst.Model = "lg" -Subst.Rate.Model = "ZERO" -Root.Seg = 2 - -[[-]] -Tree.Tree = "(H:0.3, I:0.2)C;" -Subst.Model = "wag" -Subst.Rate.Model = "GAMMA" -Subst.Rate.Params = 8.0 -Root.Seg = 1 - -[[-]] -Tree.Tree = "(J:0.3, K:0.2)C;" -Subst.Model = "wagstar" -Subst.Rate.Model = "CONST" - -[[-]] -Tree.Tree = "(L:0.3, M:0.2)C;" -Subst.Model = "jtt-dcmut" -Subst.Rate.Model = "ZERO" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(N:0.3, O:0.2)C;" -Subst.Model = "dayhoff-dcmut" -Subst.Rate.Model = "ZERO" -Root.Seg = 0 - -[[-]] -Tree.Tree = "(P:0.3, Q:0.2)C;" -Subst.Model = "molphy" -Subst.Rate.Model = "GAMMA" diff --git a/examples/aa.yaml b/examples/aa.yaml new file mode 100644 index 0000000..5e75a67 --- /dev/null +++ b/examples/aa.yaml @@ -0,0 +1,145 @@ +# Test aa evaluationary models + +sim: + reps: 10 + seed: 420 + +tree: + initial: + scale: 0.666 + abc: + tree: (A:0.3, B:0.2)C; + dec: + tree: (D:0.3, E:0.2)C; + fgc: + tree: (F:0.3, G:0.2)C; + hic: + tree: (H:0.3, I:0.2)C; + jkc: + tree: (J:0.3, K:0.2)C; + lmc: + tree: (L:0.3, M:0.2)C; + noc: + tree: (N:0.3, O:0.2)C; + pqc: + tree: (P:0.3, Q:0.2)C; + +parts: + initial: + length: 10000 + seq: AATGCTTTTTTTTTTGGCCAAAATTTTGGGGAAATTGGCCCCCCACACACACATTTTTATATATGG + code: 2 + +rules: + initial: + indel: + model: + ins: GEO + del: POWER-LAW + params: + ins: 1.039000, 50 + del: 1.039000, 50 + rate: + ins: 0.01 + del: 0.01 + max: + ins: 50.0 + del: 50.0 + aagtr: + subst: + model: aagtr + freqs: [0.443, 0.3113, 0.3, 0.2, 0.888, 0.6520, 0.9112, 0.3323, 0.2998, + 0.7171, 0.443, 0.3113, 0.3003, 0.211, 0.5588, 0.43520, 0.487112, + 0.76323, 0.1998, 0.44171] + params: [100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, + 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, + 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, + 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, + 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, + 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, + 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, + 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, + 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, + 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, + 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, + 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, + 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, + 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, + 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, + 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, + 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, + 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, + 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, + 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, + 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, + 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, + 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, + 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, + 22.3323, 48.2998, 33.7171] + rate.model: ZERO + eq: + subst: + model: equ + rate.model: CONST + lg: + subst: + model: lg + rate.model: ZERO + wag: + subst: + model: wag + rate: + model: GAMMA + params: 8.0 + wagstar: + subst: + model: wagstar + rate.model: CONST + jttdcmut: + subst: + model: jtt-dcmut + rate.model: ZERO + dayhoff: + subst: + model: dayhoff-dcmut + rate.model: ZERO + molphy: + subst: + model: molphy + rate.model: GAMMA + +regions: + initial: + tree: initial + part: initial + rule: initial + segment: 0 + aagtr: + tree: abc + rule: aagtr + equ: + tree: dec + rule: eq + segment: 1 + lg: + tree: fgc + rule: lg + segment: 2 + wag: + tree: hic + rule: wag + segment: 1 + wagstar: + tree: jkc + rule: wagstar + jtt: + tree: lmc + rule: jttdcmut + segment: 1 + dayhoff: + tree: noc + rule: dayhoff + segment: 0 + molphy: + tree: pqc + rule: molphy diff --git a/examples/basic-dna-2.dawg b/examples/basic-dna-2.dawg deleted file mode 100644 index c31960e..0000000 --- a/examples/basic-dna-2.dawg +++ /dev/null @@ -1,10 +0,0 @@ -# Example: Simulate DNA evolution along a tree -# Identical model as basic-dna.dawg - -Tree.Tree = "((Man:0.1,Monkey:0.1):0.2,Dawg:0.25);" -Subst.Model = "HKY" -Subst.Params = 2.0, 1.0 -Subst.Freqs = 0.3, 0.2, 0.2, 0.3 -Root.Length = 1000 -Sim.Reps = 10 - diff --git a/examples/basic-dna-zero-rate.dawg b/examples/basic-dna-zero-rate.dawg deleted file mode 100644 index d4c655d..0000000 --- a/examples/basic-dna-zero-rate.dawg +++ /dev/null @@ -1,35 +0,0 @@ -# Example: Simulate DNA evolution along a tree -# See readme.txt for an explanation on the structure of an input file. -# Simulation results are sent to stdout. - -## Tree Section ################################################################ -# -# Use a constant tree. - -[Tree] -Tree = "((Man:0.1,Monkey:0.1):0.2,Dawg:0.25);" - -## Subst Section ############################################################### -# -# Use an HKY substitution model with a transition rate of 2.0 and a transversion -# rate of 1.0. Allele frequences are 0.3 A, 0.2 C, 0.2 G, and 0.3 T. - -[Subst] -Model = "HKY" -Params = 2.0, 1.0 -Freqs = 0.3, 0.2, 0.2, 0.3 -Rate.Model = "ZERO" - -## Root Section ################################################################ -# -# Simulate a sequence that is 1000 nt long. - -[Root] -Length = 1000 - -## Sim Section ################################################################# -# -# Simulate 10 alignments - -[Sim] -Reps = 10 \ No newline at end of file diff --git a/examples/basic-dna-zero-rate.yaml b/examples/basic-dna-zero-rate.yaml new file mode 100644 index 0000000..d28607b --- /dev/null +++ b/examples/basic-dna-zero-rate.yaml @@ -0,0 +1,33 @@ +# Example: Simulate DNA evolution along a tree +# See readme.txt for an explanation on the structure of an input file. +# Simulation results are sent to stdout. + +sim: + reps: 10 # Simulate 10 alignments + +# Use a constant tree. +tree: + man_mon_daw: + tree: ((Man:0.1,Monkey:0.1):0.2,Dawg:0.25); + +parts: + part1: + length: 1000 # Simulate a sequence that is 1000 nt long + +# Use an HKY substitution model with a transition of 2.0 and a transversion rate +# of 1.0. Allele frequencies are 0.3 A, 0.2 C, 0.2 G, and 0.3 T. + +rules: + rule1: + subst: + model: HKY + params: [2.0, 1.0] + freqs: [0.3, 0.2, 0.2, 0.3] + rate: + model: ZERO + +regions: + region1: + tree: man_mon_daw + rule: rule1 + part: part1 diff --git a/examples/basic-dna.dawg b/examples/basic-dna.dawg deleted file mode 100644 index ed16b5d..0000000 --- a/examples/basic-dna.dawg +++ /dev/null @@ -1,35 +0,0 @@ -# Example: Simulate DNA evolution along a tree -# See readme.txt for an explanation on the structure of an input file. -# Simulation results are sent to stdout. - -## Tree Section ################################################################ -# -# Use a constant tree. - -[Tree] -Tree = "((Man:0.1,Monkey:0.1):0.2,Dawg:0.25);" - -## Subst Section ############################################################### -# -# Use an HKY substitution model with a transition rate of 2.0 and a transversion -# rate of 1.0. Allele frequences are 0.3 A, 0.2 C, 0.2 G, and 0.3 T. - -[Subst] -Model = "HKY" -Params = 2.0, 1.0 -Freqs = 0.3, 0.2, 0.2, 0.3 - -## Root Section ################################################################ -# -# Simulate a sequence that is 1000 nt long. - -[Root] -Length = 1000 - -## Sim Section ################################################################# -# -# Simulate 10 alignments - -[Sim] -Reps = 10 - diff --git a/examples/basic-dna.yaml b/examples/basic-dna.yaml new file mode 100644 index 0000000..4b13faf --- /dev/null +++ b/examples/basic-dna.yaml @@ -0,0 +1,29 @@ +# Example: Simulate DNA evolution along a tree +# Simulation results are sent to stdout. + +sim: + reps: 10 # Simulate 10 alignments + seed: 420 + +tree: + man_mon_daw: + tree: ((Man:0.1,Monkey:0.1):0.2,Dawg:0.25); + +parts: + segment: + length: 1000 # Simulate a sequence that is 1000 nt long + +# Use an HKY substitution model with a transition rate of 2.0 and a transversion +# rate of 1.0. Allele frequences are 0.3 A, 0.2 C, 0.2 G, 0.3 T. +rules: + initial: + subst: + model: HKY + params: [2.0, 1.0] + freqs: [0.3, 0.2, 0.2, 0.3] + +regions: + region_1: + tree: man_mon_daw + rule: initial + part: segment \ No newline at end of file diff --git a/examples/codon.dawg b/examples/codon.dawg deleted file mode 100644 index 82e7526..0000000 --- a/examples/codon.dawg +++ /dev/null @@ -1,100 +0,0 @@ -# Test codon evaluationary models - -# Tree.Scale = 0.99999 -Root.Length = 1000 -Root.Code = 1 -Root.Seq = "AATGCTTTTTTTTTTGGCCAA" -Sim.Reps = 10 -Sim.Seed = 42 -Root.Seg = 0 - -[Indel] -Params.Ins = 1.039000, 50 -Model.Ins = "GEO" -Rate.Ins = 0.01 -Max.Ins = 50.0 -Params.Del = 1.039000, 50 -Model.Del = "POWER-LAW" -Rate.Del = 0.01 -Max.Del = 50.0 - -[[-]] -Tree.Tree = "(D:0.3, E:0.2)C;" -Subst.Model = "codgtr" -# 2016 parameters -Subst.Params = -0.2, 0.3, 0.3, 0.2,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, 0.03, -2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, -2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, -2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03 -Subst.Rate.Model = "ZERO" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(L:0.3, M:0.2)C;" -Subst.Model = "codmg" -Subst.Rate.Model = "ZERO" -Root.Seq = "AATGCTTTTTTTGGGAATTTTAAAATT" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(J:0.3, K:0.2)C;" -Subst.Model = "codmg-equ" -Subst.Rate.Model = "ZERO" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(O:0.3, P:0.2)C;" -Subst.Model = "codmg-aap" -Subst.Rate.Model = "ZERO" -Subst.Freqs = -0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.87700, 0.93, -0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.44342, 0.800, 0.83, -0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.6645342, 0.6889, 0.63, -0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.8872342, 0.5833, 0.443, -0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.9019342, 0.7445, 0.33, -0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.00342, 0.1102, 0.002, -0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.8726, 0.0003, -0.333, 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.01918, 0.03 -Root.Seg = 0 - -[[-]] -Tree.Tree = "(H:0.3, I:0.2)C;" -Subst.Model = "codmg-cp" -Subst.Rate.Model = "ZERO" - -[[-]] -Tree.Tree = "(F:0.3, G:0.2)C;" -Subst.Model = "codgy" -Subst.Rate.Model = "ZERO" - -[[-]] -Tree.Tree = "(A:0.3, B:0.2)C;" -Subst.Model = "codgy-equ" -Subst.Rate.Model = "ZERO" diff --git a/examples/codon.yaml b/examples/codon.yaml new file mode 100644 index 0000000..7cc66fb --- /dev/null +++ b/examples/codon.yaml @@ -0,0 +1,141 @@ +# Test codon evaluationary models + +sim: + reps: 10 + seed: 42 + +tree: + dec: + tree: (D:0.3, E:0.2)C; + lmc: + tree: "(L:0.3, M:0.2)C;" + jkc: + tree: "(J:0.3, K:0.2)C;" + opc: + tree: "(O:0.3, P:0.2)C;" + hic: + tree: "(H:0.3, I:0.2)C;" + fgc: + tree: "(F:0.3, G:0.2)C;" + abc: + tree: "(A:0.3, B:0.2)C;" + +parts: + part1: + length: 1000 + code: 1 + seq: AATGCTTTTTTTTTTGGCCAA + part2: + seq: AATGCTTTTTTTGGGAATTTTAAAATT + +rules: + rule1: + indel: + model: + ins: GEO + del: POWER-LAW + params: + ins: 1.039000, 50 + del: 1.039000, 50 + rate: + ins: 0.01 + del: 0.01 + max: + ins: 50.0 + del: 50.0 + rule2: + subst: + model: codgtr + params: [0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0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2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, 0.2, 0.3, 0.3, 0.2, 0.2, 0.3, 0.3, 0.2, 0.03, 0.8, + 0.9, 0.8, 0.3, 0.4, 0.1, 0.9, 0.8, 0.3, 0.4, 0.1, 0.9, 0.8, 0.3, 0.4, 0.1, 0.77] + freqs: [2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, + 2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, + 2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, + 2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, + 2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, + 2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, + 2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03, + 2.0, 1.0, 3.0, 1.0, 1.0, 1.0, 0.2, 0.03] + rate.model: ZERO + rule3: + subst: + model: codmg + rate.model: ZERO + rule4: + subst: + model: codmg-equ + rate.model: ZERO + rule5: + subst: + model: codmg-aap + freqs: [0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.87700, 0.93, + 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.44342, 0.800, 0.83, + 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.6645342, 0.6889, 0.63, + 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.8872342, 0.5833, 0.443, + 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.9019342, 0.7445, 0.33, + 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.00342, 0.1102, 0.002, + 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.8726, 0.0003, + 0.333, 0.3342, 0.3342, 0.3342, 0.3342, 0.3342, 0.01918, 0.03] + rate.model: ZERO + rule6: + subst: + model: codmg-cp + rate.model: ZERO + rule7: + subst: + model: codgy + rate.model: ZERO + rule8: + subst: + model: codgy-equ + rate.model: ZERO + +regions: + reg1: + part: part1 + rule: rule1 + reg2: + tree: dec + rule: rule2 + segment: 1 + reg3: + tree: lmc + part: part2 + rule: rule3 + segment: 1 + reg4: + tree: jkc + rule: rule4 + segment: 1 + reg5: + tree: opc + rule: rule5 + segment: 0 + reg6: + tree: hic + rule: rule6 + reg7: + tree: fgc + rule: rule7 + reg8: + tree: abc + rule: rule8 diff --git a/examples/dna.dawg b/examples/dna.dawg deleted file mode 100644 index a084fc2..0000000 --- a/examples/dna.dawg +++ /dev/null @@ -1,59 +0,0 @@ -# Test dna evaluationary models - -Tree.Scale = 0.99999 -Root.Length = 100 -Root.Code = 1 -Root.Seq = "AATGCTTTTTTTTTTGGCCAA" -Sim.Reps = 10 -Sim.Seed = 42 -Root.Seg = 0 - -[[-]] -Tree.Tree = "(D:0.3, E:0.2)C;" -Subst.Model = "gtr" -Subst.Freqs = 0.2, 0.3, 0.3, 0.2 -Subst.Params = 2.0, 1.0, 3.0, 1.0, 1.0, 1.0 -Subst.Rate.Model = "ZERO" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(A:0.3, B:0.2)C;" -Subst.Model = "jc" -Subst.Rate.Model = "CONST" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(F:0.3, G:0.2)C;" -Subst.Model = "k2p" -Subst.Rate.Model = "ZERO" -Root.Seg = 3 - -[[-]] -Tree.Tree = "(H:0.3, I:0.2)C;" -Subst.Model = "hky" -Subst.Rate.Model = "ZERO" -Root.Seg = 2 - -[[-]] -Tree.Tree = "(J:0.3, K:0.2)C;" -Subst.Model = "f84" -Subst.Rate.Model = "ZERO" -Root.Seg = 5 - -[[-]] -Tree.Tree = "(L:0.3, M:0.2)C;" -Subst.Model = "f81" -Subst.Rate.Model = "ZERO" -Root.Seg = 6 - -[[-]] -Tree.Tree = "(N:0.3, O:0.2)C;" -Subst.Model = "tn" -Subst.Rate.Model = "ZERO" -Root.Seg = 7 - -[[-]] -Tree.Tree = "(P:0.3, Q:0.2)C;" -Subst.Model = "tn-f04" -Subst.Rate.Model = "ZERO" -Root.Seg = 8 diff --git a/examples/dna.yaml b/examples/dna.yaml new file mode 100644 index 0000000..d3b3d73 --- /dev/null +++ b/examples/dna.yaml @@ -0,0 +1,106 @@ +# Test dna evaluationary models + +sim: + reps: 10 + seed: 42 + +tree: + initial: + scale: 0.99999 + dec: + tree: (D:0.3, E:0.2)C; + abc: + tree: (A:0.3, B:0.2)C; + fgc: + tree: (F:0.3, G:0.2)C; + hic: + tree: (H:0.3, I:0.2)C; + jkc: + tree: (J:0.3, K:0.2)C; + lmc: + tree: (L:0.3, M:0.2)C; + noc: + tree: (N:0.3, O:0.2)C; + pqc: + tree: (P:0.3, Q:0.2)C; + +parts: + initial: + length: 100 + seq: AATGCTTTTTTTTTTGGCCAA + code: 1 + +rules: + gtr: + subst: + model: gtr + freqs: [0.2, 0.3, 0.3, 0.2] + params: [2.0, 1.0, 3.0, 1.0, 1.0, 1.0] + rate.model: ZERO + jc: + subst: + model: jc + rate.model: CONST + k2p: + subst: + model: k2p + rate.model: ZERO + hky: + subst: + model: hky + rate.model: ZERO + f84: + subst: + model: f84 + rate.model: ZERO + f81: + subst: + model: f81 + rate.model: ZERO + tn: + subst: + model: tn + rate.model: ZERO + tnf04: + subst: + model: tn-f04 + rate.model: ZERO + +regions: + reg0: + tree: initial + part: initial + segment: 0 + reg1: + tree: dec + rule: gtr + part: initial + segment: 1 + reg2: + tree: abc + rule: jc + segment: 1 + reg3: + tree: fgc + rule: k2p + segment: 3 + reg4: + tree: hic + rule: hky + segment: 2 + reg5: + tree: jkc + rule: f84 + segment: 5 + reg6: + tree: lmc + rule: f81 + segment: 6 + reg7: + tree: noc + rule: tn + segment: 7 + reg8: + tree: pqc + rule: tnf04 + segment: 8 diff --git a/examples/error.dawg b/examples/error.dawg deleted file mode 100644 index de38a94..0000000 --- a/examples/error.dawg +++ /dev/null @@ -1,59 +0,0 @@ -# Test using different sequence types in a single trick file -# Try to cause an error - -Tree.Scale = 4.99999 -Root.Length = 100 -Root.Code = 2 -Root.Seq = "GHAGCVFFYTDYSIGDGFCCMVMYC" -Sim.Reps = 10 -Sim.Seed = 42 -Root.Seg = 0 -Output.Markins=1 - -[[ProteinSequence]] -Tree.Tree = "(X:0.3, Y:0.2)Z;" -Subst.Model = "aagtr" -Subst.Freqs = -0.443, 0.3113, 0.3, 0.2, 0.888, 0.6520, 0.9112, 0.3323, 0.2998, 0.7171, -0.443, 0.3113, 0.3003, 0.211, 0.5588, 0.43520, 0.487112, 0.76323, 0.1998, 0.44171 -Subst.Params = -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, -100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171 -Subst.Rate.Model = "CONST" -Root.Seg = 1 -Root.Code=13 -[Indel] -Params.Ins = 1.039000, 50 -Model.Ins = "GEO" -Rate.Ins = 0.01 -Max.Ins = 50.0 -Params.Del = 1.039000, 50 -Model.Del = "POWER-LAW" -Rate.Del = 0.01 -Max.Del = 50.0 - -# [[DnaSequence]] -# Tree.Tree = "(A:0.3, B:0.2)Z;" -# Subst.Model = "gtr" -# Subst.Freqs = 0.2, 0.3, 0.3, 0.2 -# Subst.Params = 2.0, 1.0, 3.0, 1.0, 1.0, 1.0 -# Subst.Rate.Model = "ZERO" -# Root.Seg = 2 -# Root.Code = 4 diff --git a/examples/error.yaml b/examples/error.yaml new file mode 100644 index 0000000..47d9ede --- /dev/null +++ b/examples/error.yaml @@ -0,0 +1,95 @@ +# Test using different sequence types in a single trick file +# Try to cause an error + +sim: + reps: 10 + seed: 42 + +output: + markins: on + +tree: + xyz: + tree: (X:0.3, Y:0.2)Z; + scale: 4.99999 + abz: + tree: (A:0.3, B:0.2)Z; + scale: 4.99999 + +parts: + part0: + length: 100 + seq: GHAGCVFFYTDYSIGDGFCCMVMYC + code: 2 + protein_part: + code: 13 + dna_part: + length: 10 + code: 2 + +rules: + protein_rule: + subst: + model: aagtr + freqs: [0.443, 0.3113, 0.3, 0.2, 0.888, 0.6520, 0.9112, 0.3323, 0.2998, + 0.7171, 0.443, 0.3113, 0.3003, 0.211, 0.5588, 0.43520, 0.487112, + 0.76323, 0.1998, 0.44171] + params: [100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, + 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, + 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, + 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, + 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, + 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, + 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, + 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, + 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, + 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, + 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, + 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, + 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, + 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, + 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, + 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, + 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, + 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, + 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, + 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, + 49.9112, 22.3323, 48.2998, 33.7171, 100.443, 49.3113, 66.3, 10.2, + 40.888, 3.6520, 49.9112, 22.3323, 48.2998, 33.7171, 100.443, + 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, 22.3323, 48.2998, + 33.7171, 100.443, 49.3113, 66.3, 10.2, 40.888, 3.6520, 49.9112, + 22.3323, 48.2998, 33.7171] + rate: + model: CONST + indel: + model: + ins: GEO + del: POWER-LAW + params: + ins: 1.039000, 50 + del: 1.039000, 50 + rate: + ins: 0.01 + del: 0.01 + max: + ins: 50.0 + del: 50.0 + dna_rule: + subst: + model: gtr + freqs: [0.2, 0.3, 0.3, 0.2] + params: [2.0, 1.0, 3.0, 1.0, 1.0, 1.0] + rate: + model: ZERO + +regions: + region0: + part: part0 + protein_sequence: + tree: xyz + rule: protein_rule + part: protein_part + dna: + tree: abz + rule: dna_rule + part: dna_part diff --git a/examples/everything.yaml b/examples/everything.yaml new file mode 100644 index 0000000..e740087 --- /dev/null +++ b/examples/everything.yaml @@ -0,0 +1,85 @@ +# Example: Showcasing all parameters available in DAWG. +# DO NOT RUN! +# run `dawg --help-trick` for a detailed description on each parameter. + +# simulation parameters +sim: + reps: 2 + seed: [1, 2, 3] + +# output parameters +output: + block: + head: text at beginning of output + tail: text at end of output + before: text before every replicate + after: text after every replicate + between: text between replicates + file: output_file.fasta + split: true + append: existing_file.fasta + label: true + markins: true + keepempty: true + lowercase: true + rna: true + +# tree parameters +tree: + tree_name1: + tree: (A:0.3)D; + scale: 0.2 + +# parts - define parts to be associated to region(s) +parts: + part_name1: + length: 10 + seq: ACGT + code: 1 #https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi + gapoverlap: true + part_name2: + seq: CCGTC + + +# rules - parameters for substitution and indel models +rules: + rule_name1: + subst: + model: GTR + params: [2.0, 1.0, 3.0, 1.0, 1.0, 1.0] + freqs: [0.2, 0.3, 0.3, 0.2] + rate: + model: GAMMA + rate.params: 8.0 # alternative syntax to avoid extra indentation + indel: + model: + ins: POWER-LAW + del: POWER-LAW + params: + ins: 1.01, 50 + del: 1.01, 50 + rate: + ins: 0.01 + del: 0.01 + max: + ins: 50.0 + del: 50.0 + +# regions - tying parts and rules creating as many regions as needed +# - implicit inherits from previous section. +regions: + region_name1: + tree: tree_name1 + scale: 0.25 # overrides scale in tree section + rule: rule_name1 + part: part_name1 + seg: 1 + region_name2: + tree: tree_name1 + rule: rule_name1 + part: part_name2 + seg: 2 + region_name3: + inherits: region_name1 + seg: 3 + diff --git a/examples/mitochondria.dawg b/examples/mitochondria.dawg deleted file mode 100644 index 1ee1262..0000000 --- a/examples/mitochondria.dawg +++ /dev/null @@ -1,70 +0,0 @@ -# Test mitochondria root code -# Genetic codes -- https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi#SG2 -# 2 = The Vertevrate Mitochondrial Code - -Tree.Scale = 0.99999 -Root.Length = 100 -Root.Code = 2 -Root.Seq = "ACTTTGAATGGGATATTTTCATACACACCGTCTTTGAAGTGTACTGACCTCTTCATGATAATAGGTCTGGTCATGATATGCTACTTCTCTTAGCTGTCGTTCTAATCATCTGTTGGCACAACATTGCGTAATGGAAATGGATAACTTTTCTGTTTAGTTTGCTCTGTGGCTCTATCTAGAAAATTAAAGGATACAAAACTAATTAACCATTCTTATAAATCACTAAGCCAGCACAATGGTTTCTACTGCTGTCAGCCTTTATTTTCAATTTTTCTTAGTCCCCTAGCTTTTCCGTAAACACCGAACACTTCTCTCGTATGATTGGTGCAAACCGTTTGGTGAAAAAAAGCACATTTGCATATACAAAAAATTAACAAATCTATCATATAATAATTAAGATATAGAGTTCATGATCCTTGTGCCATTGATCAAGCCATCGGCGATGATGATAAACCTTTTATTGATACCTTTTTTACCTAGTATTTTTTGCAAATGCTTCATTGTTACACCTCCGAGGAATACTACGAGTGCAATATCCTCTGCAGCATGAAATGTCCCATTAGATCCGTCTATGGACCGTCTATTATTGCTCTTGATGCTTGCATTGATCTTTTTTGTAATGGTTCCCGGGACCCATATACTCTCTTCGATCGCATGTGAGTCTCCATATAACTGTTCAATTAAATCCTCCGTTTGAGAAACTCTAGGTTCTCTTGACAGTATAAAAGGCTGCTGCGAGGAATAATTATGGAACAAGATAGACCTATCATATAACATCTGAACCAGTCTCATTGTCAAGGGCACTACACCACTGTAAGCAAAAGTGGCTTCCGAGAAGTCATCGTTCTCATTTGTGATTTTATCGGCAGCATGCTCGTCTTCTATGGGTACTGTATTGAACCATTGTGAAATATAACGGTATTCTTTCTGTAATCTTGTTGACTTACTTGTTGTAATATGCAAATCAGTTTTTCCCGTTTTGCTAGTGAAAAATCCTAAGCCAATGATTCAAGTTGAAAGCATTTTTCAATGCCCCAAGAGTCGATCATAAAGGTTCTTAGATATTCATAATCCTTTTCTCGAAGTGAATTTTTACAAAGAGACAATAAACAGATTAATCTGAGAATCTTCTTTTGATCAACCTCGTACTGGTACTGCAACTCGAGTATAATATCTTCAATGTCGTTATTAAGTGTATTTCCCATCAAAATTTCCAGCTCTAACTCTAAGATTTTATTGAAAGATCCGTACTCTTCAGTCTCTACCACTTTCAAAACGTCGGATGATAAGGTTGTGTGATTTTTCAAAAAAGCTTGCCTTTGTTGCAAAGAACCTAAGGAATCAACGAATTCTTTGATTTCATGTACGCTCTCGGCTTTATGCCTTGTATCATATTGCGTTTGTAGTTCCTTTGCCAATTTATTTAACTGCGGCCCAATCGACCCAAAATTTAAAAATTTCAAATCATTCCATATTTTATCTTCCTTATAATTGAA" -Sim.Reps = 10 -Sim.Seed = 42 -Root.Seg = 0 - -[[-]] -Tree.Tree = "(D:0.3, E:0.2)C;" -Subst.Model = "gtr" -Subst.Freqs = 0.2, 0.3, 0.3, 0.2 -Subst.Params = 2.0, 1.0, 3.0, 1.0, 1.0, 1.0 -Subst.Rate.Model = "ZERO" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(A:0.3, B:0.2)C;" -Subst.Model = "jc" -Subst.Rate.Model = "CONST" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(F:0.3, G:0.2)C;" -Subst.Model = "k2p" -Subst.Rate.Model = "ZERO" -Root.Seg = 3 - -[[-]] -Tree.Tree = "(H:0.3, I:0.2)C;" -Subst.Model = "hky" -Subst.Rate.Model = "ZERO" -Root.Seg = 2 -[Indel] -Params.Ins = 1.039000, 50 -Model.Ins = "GEO" -Rate.Ins = 0.01 -Max.Ins = 50.0 -Params.Del = 1.039000, 50 -Model.Del = "POWER-LAW" -Rate.Del = 0.01 -Max.Del = 50.0 - -[[-]] -Tree.Tree = "(J:0.3, K:0.2)C;" -Subst.Model = "f84" -Subst.Rate.Model = "ZERO" -Root.Seg = 5 - -[[-]] -Tree.Tree = "(L:0.3, M:0.2)C;" -Subst.Model = "f81" -Subst.Rate.Model = "ZERO" -Root.Seg = 6 - -[[-]] -Tree.Tree = "(N:0.3, O:0.2)C;" -Subst.Model = "tn" -Subst.Rate.Model = "ZERO" -Root.Seg = 7 - -[[-]] -Tree.Tree = "(P:0.3, Q:0.2)C;" -Subst.Model = "tn-f04" -Subst.Rate.Model = "ZERO" -Root.Seg = 8 diff --git a/examples/mitochondria.yaml b/examples/mitochondria.yaml new file mode 100644 index 0000000..92fbef1 --- /dev/null +++ b/examples/mitochondria.yaml @@ -0,0 +1,121 @@ +# Test mitochondria root code +# Genetic codes -- https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi#SG2 +# 2 = The Vertevrate Mitochondrial Code + +sim: + reps: 10 + seed: 42 + +tree: + initial: + scale: 0.99999 + dec: + tree: (D:0.3, E:0.2)C; + abc: + tree: (A:0.3, B:0.2)C; + fgc: + tree: (F:0.3, G:0.2)C; + hic: + tree: (H:0.3, I:0.2)C; + jkc: + tree: (J:0.3, K:0.2)C; + lmc: + tree: (L:0.3, M:0.2)C; + noc: + tree: (N:0.3, O:0.2)C; + pqc: + tree: (P:0.3, Q:0.2)C; + +parts: + initial: + length: 100 + seq: ACTTTGAATGGGATATTTTCATACACACCGTCTTTGAAGTGTACTGACCTCTTCATGATAATAGGTCTGGTCATGATATGCTACTTCTCTTAGCTGTCGTTCTAATCATCTGTTGGCACAACATTGCGTAATGGAAATGGATAACTTTTCTGTTTAGTTTGCTCTGTGGCTCTATCTAGAAAATTAAAGGATACAAAACTAATTAACCATTCTTATAAATCACTAAGCCAGCACAATGGTTTCTACTGCTGTCAGCCTTTATTTTCAATTTTTCTTAGTCCCCTAGCTTTTCCGTAAACACCGAACACTTCTCTCGTATGATTGGTGCAAACCGTTTGGTGAAAAAAAGCACATTTGCATATACAAAAAATTAACAAATCTATCATATAATAATTAAGATATAGAGTTCATGATCCTTGTGCCATTGATCAAGCCATCGGCGATGATGATAAACCTTTTATTGATACCTTTTTTACCTAGTATTTTTTGCAAATGCTTCATTGTTACACCTCCGAGGAATACTACGAGTGCAATATCCTCTGCAGCATGAAATGTCCCATTAGATCCGTCTATGGACCGTCTATTATTGCTCTTGATGCTTGCATTGATCTTTTTTGTAATGGTTCCCGGGACCCATATACTCTCTTCGATCGCATGTGAGTCTCCATATAACTGTTCAATTAAATCCTCCGTTTGAGAAACTCTAGGTTCTCTTGACAGTATAAAAGGCTGCTGCGAGGAATAATTATGGAACAAGATAGACCTATCATATAACATCTGAACCAGTCTCATTGTCAAGGGCACTACACCACTGTAAGCAAAAGTGGCTTCCGAGAAGTCATCGTTCTCATTTGTGATTTTATCGGCAGCATGCTCGTCTTCTATGGGTACTGTATTGAACCATTGTGAAATATAACGGTATTCTTTCTGTAATCTTGTTGACTTACTTGTTGTAATATGCAAATCAGTTTTTCCCGTTTTGCTAGTGAAAAATCCTAAGCCAATGATTCAAGTTGAAAGCATTTTTCAATGCCCCAAGAGTCGATCATAAAGGTTCTTAGATATTCATAATCCTTTTCTCGAAGTGAATTTTTACAAAGAGACAATAAACAGATTAATCTGAGAATCTTCTTTTGATCAACCTCGTACTGGTACTGCAACTCGAGTATAATATCTTCAATGTCGTTATTAAGTGTATTTCCCATCAAAATTTCCAGCTCTAACTCTAAGATTTTATTGAAAGATCCGTACTCTTCAGTCTCTACCACTTTCAAAACGTCGGATGATAAGGTTGTGTGATTTTTCAAAAAAGCTTGCCTTTGTTGCAAAGAACCTAAGGAATCAACGAATTCTTTGATTTCATGTACGCTCTCGGCTTTATGCCTTGTATCATATTGCGTTTGTAGTTCCTTTGCCAATTTATTTAACTGCGGCCCAATCGACCCAAAATTTAAAAATTTCAAATCATTCCATATTTTATCTTCCTTATAATTGAA + code: 2 + +rules: + gtr: + subst: + model: gtr + freqs: [0.2, 0.3, 0.3, 0.2] + params: [2.0, 1.0, 3.0, 1.0, 1.0, 1.0] + rate.model: ZERO + jc: + subst: + model: jc + rate.model: CONST + k2p: + subst: + model: k2p + rate.model: ZERO + hky: + subst: + model: hky + rate.model: ZERO + indel: + model: + ins: GEO + del: POWER-LAW + params: + ins: 1.039000, 50 + del: 1.039000, 50 + rate: + ins: 0.01 + del: 0.01 + max: + ins: 50.0 + del: 50.0 + f84: + subst: + model: f84 + rate.model: ZERO + f81: + subst: + model: f81 + rate.model: ZERO + tn: + subst: + model: tn + rate.model: ZERO + tnf04: + subst: + model: tn-f04 + rate.model: ZERO + +regions: + reg0: + tree: initial + part: initial + segment: 0 + reg1: + tree: dec + rule: gtr + part: initial + segment: 1 + reg2: + tree: abc + rule: jc + segment: 1 + reg3: + tree: fgc + rule: k2p + segment: 3 + reg4: + tree: hic + rule: hky + segment: 2 + reg5: + tree: jkc + rule: f84 + segment: 5 + reg6: + tree: lmc + rule: f81 + segment: 6 + reg7: + tree: noc + rule: tn + segment: 7 + reg8: + tree: pqc + rule: tnf04 + segment: 8 diff --git a/examples/multiple-models.dawg b/examples/multiple-models.dawg deleted file mode 100644 index ebc9233..0000000 --- a/examples/multiple-models.dawg +++ /dev/null @@ -1,25 +0,0 @@ -# Example: How to simulate using multiple models on a tree. - -# Our phylogeny is ((Man:0.02,Monkey:0.02):0.1,(Katt:0.02,Dawg:0.02):0.1). -# And we want the primate branch to contain a signal of selection. -# We will thus partititon the simulation into multiple sections (tasks). -# -# Node names that begin with ~ are not printed in the alignment. - -Root.Length = 100 -Subst.Model = codmg -Subst.Freqs = 0.2, 0.3, 0.3, 0.2 - -[[Ancestor]] -Tree.Tree = (~PrimateA:0.01,(Katt:0.02,Dawg:0.02):0.1)~Root; -Subst.Params = 0.1, 1, 1, 1, 1, 1, 1 - -[[Adaptation]] -Tree.Tree = (~PrimateB:0.08)~PrimateA; -Subst.Params = 1.1, 1, 1, 1, 1, 1, 1 - - -[[Primates]] -Tree.Tree = ((Man:0.02,Monkey:0.02):0.01)~PrimateB; -Subst.Params = 0.1, 1, 1, 1, 1, 1, 1 - diff --git a/examples/multiple-models.yaml b/examples/multiple-models.yaml new file mode 100644 index 0000000..0eea01b --- /dev/null +++ b/examples/multiple-models.yaml @@ -0,0 +1,45 @@ +# Example: How to simulate using multiple models on a tree. + +# Our phylogeny is ((Man:0.02,Monkey:0.02):0.1,(Katt:0.02,Dawg:0.02):0.1). +# And we want the primate branch to contain a signal of selection. +# We will thus partititon the simulation into multiple sections (tasks). +# +# Node names that begin with ~ are not printed in the alignment. + +tree: + tree1: + tree: (~PrimateA:0.01,(Katt:0.02,Dawg:0.02):0.1)~Root; + tree2: + tree: (~PrimateB:0.08)~PrimateA; + tree3: + tree: ((Man:0.02,Monkey:0.02):0.01)~PrimateB; + +parts: + initial: + length: 100 + +rules: + ancestor: + subst: + model: codmg + freqs: [0.2, 0.3, 0.3, 0.2] + params: [0.1, 1, 1, 1, 1, 1, 1] + adaptation: + subst: + params: [1.1, 1, 1, 1, 1, 1, 1] + primates: + subst: + params: [0.1, 1, 1, 1, 1, 1, 1] + +regions: + ancestor: + tree: tree1 + part: initial + rule: ancestor + adaptation: + tree: tree2 + rule: adaptation + primates: + tree: tree3 + rule: primates + diff --git a/examples/pseudogene.dawg b/examples/pseudogene.dawg deleted file mode 100644 index f5876f8..0000000 --- a/examples/pseudogene.dawg +++ /dev/null @@ -1,20 +0,0 @@ -# Example: How to simulate using multiple models on a tree. - -# Our phylogeny is ((Man:0.1,Monkey:0.1):0.2,Dawg:0.25). And we want the -# primate lineage to contain a pseudogene. We will thus partititon the -# simulation into multiple sections (tasks). - -# NOT YET IMPLEMENTED - -[[Gene]] -Root.Length = 40 -Tree.Tree = (~Primate:0.1,Dawg:0.25); -Subst.Model = codmg -Subst.Params = 0.1, 1, 1, 1, 1, 1, 1 -Subst.Freqs = 0.2, 0.3, 0.3, 0.2 - -[[Pseudogene]] -Tree.Tree = ((Man:0.1,Monkey:0.1):0.1)~Primate; -Subst.Model = F81 -Subst.Freqs = 0.2, 0.3, 0.3, 0.2 - diff --git a/examples/pseudogene.yaml b/examples/pseudogene.yaml new file mode 100644 index 0000000..8f62791 --- /dev/null +++ b/examples/pseudogene.yaml @@ -0,0 +1,37 @@ +# Example: How to simulate using multiple models on a tree. + +# Our phylogeny is ((Man:0.1,Monkey:0.1):0.2,Dawg:0.25). And we want the +# primate lineage to contain a pseudogene. We will thus partititon the +# simulation into multiple sections (tasks). + +# NOT YET IMPLEMENTED + +tree: + dawg: + tree: (~Primate:0.1,Dawg:0.25); + man_monkey: + tree: ((Man:0.1,Monkey:0.1):0.1)~Primate; + +parts: + gene: + length: 40 + +rules: + codmg: + subst: + model: codmg + params: [0.1, 1, 1, 1, 1, 1, 1] + freqs: [0.2, 0.3, 0.3, 0.2] + f81: + subst: + model: f81 + freqs: [0.2, 0.3, 0.3, 0.2] + +regions: + gene: + tree: dawg + part: gene + rule: codmg + pseudogene: + tree: man_monkey + rule: f81 diff --git a/examples/recombination.dawg b/examples/recombination.dawg deleted file mode 100644 index 6d53628..0000000 --- a/examples/recombination.dawg +++ /dev/null @@ -1,17 +0,0 @@ -# Example: Specifying a recombination event and using autonamed sections - -[[-]] -Subst.Model = jc -Root.Segment = 1 -Root.Length = 60 -Tree.Tree = ((A:0.02,B:0.02):0.2,(C:0.02):0.2); - -[[-]] -Root.Code = 1 -Root.Segment = 0 -Root.Length = 60 -Tree.Tree = ((A:0.02):0.2,(B:0.02,C:0.02):0.2); - -[[-]] -Root.Segment = 2 - diff --git a/examples/recombination.yaml b/examples/recombination.yaml new file mode 100644 index 0000000..e21bad7 --- /dev/null +++ b/examples/recombination.yaml @@ -0,0 +1,32 @@ +# Example: Specifying a recombination event + +tree: + tree1: + tree: ((A:0.02,B:0.02):0.2,(C:0.02):0.2); + tree2: + tree: ((A:0.02):0.2,(B:0.02,C:0.02):0.2); + +parts: + part1: + length: 60 + part2: + length: 60 + code: 1 + +rules: + rule1: + subst: + model: jc + +regions: + region1: + tree: tree1 + part: part1 + rule: rule1 + segment: 1 + region2: + tree: tree2 + part: part2 + segment: 0 + region3: + segment: 2 diff --git a/examples/rna.dawg b/examples/rna.dawg deleted file mode 100644 index 90adb1e..0000000 --- a/examples/rna.dawg +++ /dev/null @@ -1,74 +0,0 @@ -# Test RNA evolutionary models - -Output.Rna = 1 -Output.lowercase = 1 -Output.markins = 1 -Output.keepempty = 0 -Tree.Tree = "(X:0.3, Y:0.2)D;" -Tree.Scale = 0.99999 -Root.Length = 100 -Root.Code = 2 -Root.Seq = "ACGTACGTTTAAAATTAAAAAAAAAAAAATTAAAAAAAAAAAAAAAAAAAAAAAAAAAAATTTTTTTTTGGGGGGGGGGGGGGGCCCCCCCCCCCCAATTA" -Sim.Reps = 4 -Sim.Seed = 42 -Root.Seg = 0 - -[Indel] -Params.Ins = 1.039000, 100 -Model.Ins = "GEO" -Rate.Ins = 0.1 -Max.Ins = 100.0 -Params.Del = 1.039000, 10 -Model.Del = "POWER-LAW" -Rate.Del = 0.01 -Max.Del = 10.0 - -[[-]] -Tree.Tree = "(D:0.3, E:0.2)C;" -Subst.Model = "gtr" -Subst.Freqs = 0.2, 0.3, 0.3, 0.2 -Subst.Params = 2.0, 1.0, 3.0, 1.0, 1.0, 1.0 -Subst.Rate.Model = "ZERO" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(A:0.3, B:0.2)C;" -Subst.Model = "jc" -Subst.Rate.Model = "CONST" -Root.Seg = 1 - -[[-]] -Tree.Tree = "(F:0.3, G:0.2)C;" -Subst.Model = "k2p" -Subst.Rate.Model = "ZERO" -Root.Seg = 3 - -[[-]] -Tree.Tree = "(H:0.3, I:0.2)C;" -Subst.Model = "hky" -Subst.Rate.Model = "ZERO" -Root.Seg = 2 - -[[-]] -Tree.Tree = "(J:0.3, K:0.2)C;" -Subst.Model = "f84" -Subst.Rate.Model = "ZERO" -Root.Seg = 5 - -[[-]] -Tree.Tree = "(L:0.3, M:0.2)C;" -Subst.Model = "f81" -Subst.Rate.Model = "ZERO" -Root.Seg = 6 - -[[-]] -Tree.Tree = "(N:0.3, O:0.2)C;" -Subst.Model = "tn" -Subst.Rate.Model = "ZERO" -Root.Seg = 7 - -[[-]] -Tree.Tree = "(P:0.3, Q:0.2)C;" -Subst.Model = "tn-f04" -Subst.Rate.Model = "ZERO" -Root.Seg = 8 diff --git a/examples/rna.yaml b/examples/rna.yaml new file mode 100644 index 0000000..4459e5a --- /dev/null +++ b/examples/rna.yaml @@ -0,0 +1,127 @@ +# Test RNA evaluationary models + +sim: + reps: 4 + seed: 42 + +output: + rna: true + lowercase: true + markins: true + keepemtpy: true + +tree: + xyd: + tree: (X:0.3, Y:0.2)D; + scale: 0.99999 + dec: + tree: (D:0.3, E:0.2)C; + abc: + tree: (A:0.3, B:0.2)C; + fgc: + tree: (F:0.3, G:0.2)C; + hic: + tree: (H:0.3, I:0.2)C; + jkc: + tree: (J:0.3, K:0.2)C; + lmc: + tree: (L:0.3, M:0.2)C; + noc: + tree: (N:0.3, O:0.2)C; + pqc: + tree: (P:0.3, Q:0.2)C; + +parts: + initial: + length: 100 + seq: ACGTACGTTTAAAATTAAAAAAAAAAAAATTAAAAAAAAAAAAAAAAAAAAAAAAAAAAATTTTTTTTTGGGGGGGGGGGGGGGCCCCCCCCCCCCAATTA + code: 2 + +rules: + initial: + indel: + model: + ins: GEO + del: POWER-LAW + params: + ins: 1.039000, 100 + del: 1.039000, 10 + rate: + ins: 0.1 + del: 0.01 + max: + ins: 100.0 + del: 10.0 + gtr: + subst: + model: gtr + freqs: [0.2, 0.3, 0.3, 0.2] + params: [2.0, 1.0, 3.0, 1.0, 1.0, 1.0] + rate.model: ZERO + jc: + subst: + model: jc + rate.model: CONST + k2p: + subst: + model: k2p + rate.model: ZERO + hky: + subst: + model: hky + rate.model: ZERO + f84: + subst: + model: f84 + rate.model: ZERO + f81: + subst: + model: f81 + rate.model: ZERO + tn: + subst: + model: tn + rate.model: ZERO + tnf04: + subst: + model: tn-f04 + rate.model: ZERO + +regions: + reg0: + tree: xyd + rule: initial + part: initial + segment: 0 + reg1: + tree: dec + rule: gtr + segment: 1 + reg2: + tree: abc + rule: jc + segment: 1 + reg3: + tree: fgc + rule: k2p + segment: 3 + reg4: + tree: hic + rule: hky + segment: 2 + reg5: + tree: jkc + rule: f84 + segment: 5 + reg6: + tree: lmc + rule: f81 + segment: 6 + reg7: + tree: noc + rule: tn + segment: 7 + reg8: + tree: pqc + rule: tnf04 + segment: 8 diff --git a/examples/segments.dawg b/examples/segments.dawg deleted file mode 100644 index 3a5ca79..0000000 --- a/examples/segments.dawg +++ /dev/null @@ -1,28 +0,0 @@ -# Example: Using sections simulate both coding and noncoding sequences - -# Use "_initial_" section to specify tree and reps -#Tree.Tree = "(A:0.3)D;" -Sim.Reps = 5 -Root.Segment = 1 -#Root.Length = 0 - -# "Noncoding" section to control segment 1 of the sequence -[[Noncoding]] -Tree.Tree = "(A:0.3)D;" -Root.Segment = 1 -Root.Length = 10 -Subst.Model = JC - -# "Coding" section to control segment 2 of the sequence -[[Coding]] -Root.Segment = 2 -Root.Length = 10 -Subst.Model = codmg -Subst.Params = 0.1, 1, 1, 1, 1, 1, 1 -Subst.Freqs = 0.2, 0.3, 0.3, 0.2 -# Root.Code = 100 - -# Another section to control segment 3. Clone parameters from "Noncoding" -# section. -[[Noncoding2 = Noncoding]] -Root.Segment = 3 diff --git a/examples/segments.yaml b/examples/segments.yaml new file mode 100644 index 0000000..64aeb0c --- /dev/null +++ b/examples/segments.yaml @@ -0,0 +1,38 @@ +# Example: Using sections simulate both coding and noncoding sequences + +sim: + reps: 5 + +parts: + noncoding: + length: 10 + coding: + length: 10 + +tree: + ad: + tree: (A:0.3)D; + +rules: + jukescantor: + subst: + model: JC + codonmg: + subst: + model: codmg + params: [0.1, 1, 1, 1, 1, 1, 1] + freqs: [0.2, 0.3, 0.3, 0.2] + +regions: + intron_1: + tree: ad + rule: jukescantor + part: noncoding + segment: 1 + exon: + rule: codonmg + part: coding + segment: 2 + intron_2: + inherits: intron_1 + segment: 3 diff --git a/src/include/dawg/trick.h b/src/include/dawg/trick.h index 21223b9..0a2a746 100644 --- a/src/include/dawg/trick.h +++ b/src/include/dawg/trick.h @@ -7,7 +7,10 @@ #include #include +#include +#include #include +#include #include #include #include @@ -18,8 +21,8 @@ namespace dawg { struct trick { struct section { - typedef std::vector value_type; - typedef std::map db_type; + using value_type = std::vector; + using db_type = std::map; std::string name; std::string inherits; db_type db; @@ -42,14 +45,14 @@ struct trick { inline void read_alias(const std::string& a, const std::string& b); }; - typedef std::vector
data_type; + using data_type = std::vector
; data_type data; static bool parse_file(trick& p, const char* cs); template bool parse(Iterator first, Iterator last); template - inline bool parse_stream(std::basic_istream& is); + bool parse_yaml(std::basic_istream& is); trick() { data.push_back(section()); @@ -89,7 +92,7 @@ inline void trick::section::get(const std::string& k, trick::section& r) const { r.name = k; r.inherits = "_nothing_"; r.db.clear(); - db_type::const_iterator first = db.lower_bound(k); + auto first = db.lower_bound(k); db_type::const_iterator last; for(last = first; last != db.end() && starts_with(last->first, k); ++last) { r.db.insert(r.db.end(), @@ -112,7 +115,7 @@ inline void trick::section::conv(const std::string& ss, unsigned int& r) { } inline void trick::section::conv(const std::string& ss, int& r) { - r = strtol(ss.c_str(), nullptr, 0); + r = std::stoi(ss.c_str(), nullptr, 0); } // A value is false if it is equal to 0, f, false, off, no, or blank diff --git a/src/include/dawg/trick_parse.h b/src/include/dawg/trick_parse.h index bb4b5c2..1418ba5 100644 --- a/src/include/dawg/trick_parse.h +++ b/src/include/dawg/trick_parse.h @@ -1,198 +1,181 @@ -#pragma once -#ifndef DAWG_TRICK_PARSE_H -#define DAWG_TRICK_PARSE_H -/**************************************************************************** - * Copyright (C) 2009-2010 Reed A. Cartwright, PhD * - ****************************************************************************/ - -#define BOOST_SPIRIT_USE_PHOENIX_V3 1 - -#include -#include -#include - -#include "dawg/trick.h" -#if SPIRIT_VERSION < 0x2020 -#error Spirit version 2.2 or greater required. -#endif - -#include -#include - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4127) -#endif - -#include - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#include -#include - -namespace dawg { - -namespace qi = boost::spirit::qi; -namespace standard = boost::spirit::standard; -namespace phoenix = boost::phoenix; - -namespace details { -using line_type = std::pair >; -typedef std::vector subsection_body_type; -typedef std::pair subsection_type; -typedef std::vector section_body_type; -typedef std::pair section_header_type; -typedef std::pair section_type; -typedef std::vector trick_raw_type; -} // namespace details - -template -struct white_space : qi::grammar { - white_space() : white_space::base_type(start) { - using qi::eoi; - using qi::eol; - using standard::char_; - using standard::space; - start = space | ('#' >> *(char_ - eol)); - } - qi::rule start; -}; - -template -struct trick_grammar - : qi::grammar { - trick_grammar() : trick_grammar::base_type(start) { - using qi::eol; - using qi::lexeme; - using qi::raw; - using standard::alnum; - using standard::char_; - using standard::graph; - using standard::print; - using standard::space; - - start = *section; - section = section_header || section_body; - section_header = "[[" >> id >> -('=' >> id) >> "]]"; - section_body = +subsection; - subsection = subsection_header || subsection_body; - subsection_header = '[' >> -id >> ']'; - subsection_body = +line; - line = id >> '=' >> (trick_string % ','); - id = lexeme[+(alnum | char_("._-"))]; - trick_string = - qqquoted_string | quoted_string | tree_string | bare_string; - bare_string = lexeme[+(graph - char_(",#\"[]=()"))]; - tree_string = lexeme[char_("(") >> +(char_ - ';') >> char_(";")]; - quoted_string = lexeme['"' >> *(print - '"') >> '"']; - qqquoted_string = lexeme["\"\"\"" >> *(char_ - "\"\"\"") >> "\"\"\""]; - } - - qi::rule start; - qi::rule section; - qi::rule - section_header; - qi::rule section_body; - qi::rule subsection; - qi::rule - subsection_body; - qi::rule line; - qi::rule subsection_header; - qi::rule id; - qi::rule trick_string; - qi::rule bare_string; - qi::rule tree_string; - qi::rule quoted_string; - qi::rule qqquoted_string; -}; - -template -bool trick::parse(Iterator first, Iterator last) { - using boost::algorithm::starts_with; - using boost::algorithm::to_lower; - details::trick_raw_type pyle; - white_space wasp; - trick_grammar > pyler; - bool r = qi::phrase_parse(first, last, pyler, wasp, pyle); - if(first != last || !r) return DAWG_ERROR("parsing failed."); - std::string header("_initial_"), subheader(""); - int autonum = 1; // TODO: What happens with multiple trick files? - section *psec = &data.front(); - for(details::trick_raw_type::const_iterator it = pyle.begin(); - it != pyle.end(); ++it) { - const details::section_type &sec = *it; - // if section header is not blank, we have a new section - if(!sec.first.first.empty()) { - data.push_back(section()); - psec = &data.back(); - // if section parent is blank, inherit from previous - psec->inherits = - sec.first.second.empty() ? header : sec.first.second; - // set new header and reset subheader - if(sec.first.first != "-") { - header = sec.first.first; - } else { - using boost::spirit::karma::generate; - using boost::spirit::karma::int_; - char x[16 + 12] = "Unnamed Section "; - char *p = x + 16; - generate(p, int_, autonum++); - *p = 0; - header = x; - } - psec->name = header; - subheader.clear(); - } - const details::section_body_type &body = sec.second; - for(details::section_body_type::const_iterator ssit = body.begin(); - ssit != body.end(); ++ssit) { - const std::string &h = ssit->first; - if(h.empty()) // if h is empty, clear subheader - subheader.clear(); - else if(starts_with(h, "..")) { // if h is '..', strip off tail - std::string hh = h; - do { // repeat as needed - size_t pos = subheader.rfind('.'); - subheader.erase((pos == std::string::npos) ? 0 : pos); - hh.erase(0, 2); - } while(starts_with(hh, "..")); - if(!subheader.empty() && !hh.empty()) subheader.append(1, '.'); - subheader.append(hh); - } else if(starts_with(h, - ".")) { // if h begins with a single period, - // append it to existing subheader - if(!subheader.empty() && h.size() > 1) - subheader.append(1, '.').append(h.begin() + 1, h.end()); - else - subheader.append(h); - } else { // set subheader - subheader = h; - } - // cycle through lines - for(details::subsection_body_type::const_iterator lit = - ssit->second.begin(); - lit != ssit->second.end(); ++lit) { - std::string hh(subheader); - if(!hh.empty()) hh.append(1, '.'); - hh.append(lit->first); - to_lower(hh); - psec->db[hh] = lit->second; - } - } - } - return true; -} - -template -inline bool trick::parse_stream(std::basic_istream &is) { - is.unsetf(std::ios::skipws); - boost::spirit::basic_istream_iterator first(is), last; - return parse(first, last); -} - -} // namespace dawg - -#endif // DAWG_TRICK_PARSE_H +#pragma once +#ifndef DAWG_TRICK_PARSE_H +#define DAWG_TRICK_PARSE_H +/**************************************************************************** + * Copyright (C) 2009-2010 Reed A. Cartwright, PhD * + * Copyright (C) 2022 Juan J. Garcia Mesa * + ****************************************************************************/ +#define RYML_SINGLE_HDR_DEFINE_NOW +#include +#include + +#include "dawg/trick.h" + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4127) +#endif + +#ifdef _MSC_VER +#pragma warning(pop) +#endif +namespace dawg { + +template +inline std::string slurp(std::basic_istream &is) { + if(!is) { + return {}; + } + std::string content; + is.seekg(0, std::ios::end); + content.resize(is.tellg()); + is.seekg(0, std::ios::beg); + is.read(&content[0], content.size()); + return content; +} + +inline std::string to_string(ryml::csubstr substr) { + return {substr.str, substr.len}; +} + +inline std::pair get_values( + const ryml::NodeRef &node, std::string &label) { + trick::section::value_type values; + // create key + std::string key = label + "." + dawg::to_string(node.key()); + if(node.num_children() == 0) { // single value + values = {dawg::to_string(node.val())}; + } else { // array of values + for(auto child : node.children()) { + values.emplace_back(dawg::to_string(child.val())); + } + } + + return std::make_pair(key, values); +} + +inline bool add_param(trick::section *sec, const ryml::NodeRef &node, + ryml::csubstr name = "") { + ryml::NodeRef label; + if(name == "") { + label = node; + } else { + if(!node.has_child(name)) { + return DAWG_ERROR(dawg::to_string(node.key()) + << " '" << dawg::to_string(name) + << "' not found."); + } + label = node.find_child(name); + } + + for(ryml::NodeRef const &subnode : label.children()) { + if(subnode.is_map()) { + for(ryml::NodeRef const &subsubnode : subnode.children()) { + if(subsubnode.is_map()) { + for(ryml::NodeRef const &item : subsubnode.children()) { + // create key + std::string key{dawg::to_string(subnode.key()) + "." + + dawg::to_string(subsubnode.key())}; + sec->db.insert(get_values(item, key)); + } + } else { + // create key + std::string key; + if(dawg::to_string(node.key()) == "parts") { + key = "root"; + } else { + key = dawg::to_string(subnode.key()); + } + sec->db.insert(get_values(subsubnode, key)); + } + } + } else { + // create key + std::string key; + if(dawg::to_string(node.key()) == "parts") { + key = "root"; + } else { + key = dawg::to_string(node.key()); + } + sec->db.insert(get_values(subnode, key)); + } + } + return true; +} + +inline void add_region(trick::section *sec, ryml::Tree &tree, + const ryml::NodeRef ®ion) { + sec->name.assign(dawg::to_string(region.key())); + + // segment position (sequential) + if(region.has_child("segment")) { + trick::section::value_type seg{ + dawg::to_string(region["segment"].val())}; + sec->db.insert_or_assign("root.segment", seg); + } + + // inherits + if(region.has_child("inherits")) { + sec->inherits = dawg::to_string(region["inherits"].val()); + } + + // trees + if(region.has_child("tree")) { + add_param(sec, tree["tree"], region["tree"].val()); + } + + // rules + if(region.has_child("rule")) { + add_param(sec, tree["rules"], region["rule"].val()); + } + + // parts + if(region.has_child("part")) { + add_param(sec, tree["parts"], region["part"].val()); + } + + // tree scale: set or override + if(region.has_child("scale")) { + trick::section::value_type scale{dawg::to_string(region["scale"].val())}; + sec->db.insert_or_assign("tree.scale", scale); + } +} + +template +bool trick::parse_yaml(std::basic_istream &is) { + // read and parse yaml config + std::string content{slurp(is)}; + ryml::Tree tree = ryml::parse_in_place(ryml::to_substr(content)); + ryml::NodeRef root = tree.rootref(); + section *psec = &data.front(); + + // first add simulation and output parameters + if(root.has_child("sim")) { + // add_global_param(psec, root["sim"]); + add_param(psec, root["sim"]); + } + + if(root.has_child("output")) { + // add_global_param(psec, root["output"]); + add_param(psec, root["output"]); + } + + // iterate through all regions + ryml::NodeRef regions = tree["regions"]; + for(ryml::NodeRef const ®ion : regions.children()) { + if(region != regions.first_child()) { + // add new empty section + std::string previous{data.back().name}; + data.push_back(section()); + data.back().inherits = previous; + psec = &data.back(); + } + + add_region(psec, tree, region); + } + return true; +} + +} // namespace dawg + +#endif // DAWG_TRICK_PARSE_H diff --git a/src/lib/parse.cpp b/src/lib/parse.cpp index 4eeb02d..4de8b23 100644 --- a/src/lib/parse.cpp +++ b/src/lib/parse.cpp @@ -17,12 +17,12 @@ using namespace dawg; bool trick::parse_file(trick &p, const char *cs) { bool ret; if(cs == nullptr || strcmp(cs, "") == 0 || strcmp(cs, "-") == 0) { - ret = p.parse_stream(std::cin); + ret = p.parse_yaml(std::cin); } else { std::ifstream is(cs); if(!is.is_open()) return DAWG_ERROR("unable to open input file '" << cs << "'"); - ret = p.parse_stream(is); + ret = p.parse_yaml(is); } if(!ret) return DAWG_ERROR("unable to parse input '" << cs << "'"); return true;