Skip to content

Backtrace output

Kamil S. Jaron edited this page May 21, 2018 · 3 revisions

For cases where ability to reconstruct coalescence is desired, we implemented a type of simulation output backtrace. For the further explanation I will number a parental haplotypes by 0 and 1.

Every individual is every generation represented by a single line that contain an information about a deme and index where it has born (the first column), deme/index of birthplace of its parents (the second and third columns for parents of haplotype 0 and 1 respectively). All the other columns carry the information about recombination events that have let to creation of its genotype sorted primary by chromosome number and secondary by haplotype order (0/1). The header is not written in the output, however if it would be, it will look like this : IND PARENT_h0 PARENT_h1 CH1h0 CH1h1 CH2h0 CH2h1 .... The generations are divided by a comment line # that includes number of individuals, numbers and sizes of chromosomes in the simulation and numbers of selected loci.

The deme/index of individuals is represented by three values separated by , : Dx,Dy,Di where Dx,Dy are Cartesian coordinates of birthdeme. The x coordinates are negative on the left hybrid zone population, the A population and positive on the right side of the hybrid zone neighboring with population B. All recombination events are assumed to start from haplotype 0, if the recombination have started by the haplotype 1, a chiasma 0 will be added at the very beginning. The reparation of information in blocks is using comma (,) the separation of fields is using tab (\t). To reconstruct coalescence it would be smart to reverse the order of lines before parsing this format.

The output is expected to be reversed for building a coalescence (tail -r output.tsv or tac output.tsv could do the job).

An example of the output:

dx,dy,di dx,dy,di dx,dy,di c1,c2,c3 c1 ~ c1,c2 ...
...
# individuals = 1024
0,0,6 -1,0,3 1,0,7 32,55,1926 18 ~ 0,32 ...
...
# individuals = 1536

The interpretation of the last line is that the sixth individual of deme one is product of third individual from deme two and the seventh individual of deme one (parents lived in the previous generation) and that the first chromosome from the first parent (haplotype 0) is product of 0 - 32 of parent one h0, 32 - 55 of parent one h1, 55 - 1926 of h0 of parent one and 1926 - end of chromosome of h1 of parent one. The first chromosome from the parent two is 0 - 18 from h0 and 18 on from h1. Etc.

The formatting is somewhat similar to the type block output, but instead of block state it stores a the genealogy information (who is parent of who) and all the recombination events. And mainly instead of producing a file per save it produces a file per simulation.

Clone this wiki locally