rhagenson/relped

Allow demographic information

Closed this issue · 7 comments

As originally stated by @ThatLionLady, it would be useful to be able to state parent-offspring directionality based on age or be able to apply additional formatting based on sex.

My thought is another CSV of style:

  ID, Sex, Age
527,    M,   29
...

It might also then be possible that we could infer parental pairs via an unrelated male and female both leading to a closely related individual of either sex.

Point of warning: When demographic information disagrees with relatedness/relational distance calls, the latter should be preferred and a warning about the disagreement returned to the user. This scenario is possible in the case of belief that two individuals are PO, when according to relatedness they are FS. When the two agree, there should be some visual difference in the pedigree to denote that the expected was the same as observed -- perhaps boxing such relationships together would suffice?

Female nodes should be circular, male nodes should be square, and unknowns are diamonds.

Must convene with @ThatLionLady and discuss how the demographic input should be formatted. Would want to roughly match the format already commonly used to track this information as best I can.

@ThatLionLady agreed that the format for this demographic input should be:

ID Sex Age
(uint;string) (M;F;U;Male;Female;Unknown) (uint)

TODO:

  • Implement CLI argument
  • Write "union type" for sex -- (Male | Female | Unknown)
  • Modify the pedigree known nodes' shape based on sex to be circular (F), square (M), record (U) (completely unknown/inferred individuals are diamonds)
  • Determine way to rank all of the same age the same in the pedigree

For addressing the final point of ranking all of the same age the same in the pedigree (indented to help organize the connections more cleanly) -- gographviz does not already have a way to do it, but the same to do it in Graphviz directly is

{rank=same <label 1> <label 2> <label 3>}

so if I build a map of basically Age -> array of IDs, then add the rank statements into the mix prior to writing the output file I should be able to get this information included.

Current head of a pedigree DOT is:

graph pedigree {
	mincross=2.0;
	rankdir=TB;
	ratio=auto;
	splines=ortho;
        ...
}

Re-exploring a way to rank all of the same age the same. Rather than { rank=same; <label 1>, <label 2>, <label 3> } as I am using right now, I think a better way would be to create subgraphs (labeled based on age) containing all of a particular age then connect adjacent (with gaps) ages with invisible edges style = invis

This will have the effect of boxing all of the same age together and implicitly sets `rank="same``.

Another route is use of the group attribute where things in the same group are aligned on the perpendicular axis (i.e., LR alignment if rankdir="TB").

I reopened this issue when a new issue should have been used to denote extension of the idea here. See #20 for continuation.