# Relationship based on pedigree

Relationship between individuals can be calculated using the pedigree information. A pedigree can be illustrated in many ways, the common diagram is demonstrated as below.

The process of calculating relationship (r) involves following steps

Walking through pedigree from the ancestors to the current generation in pedigree

• r for a individual him/her -self is calculated as 1 + r(father, mother), if the parents (faterh, mother) are not related, r fir this person is 1
• r between two individuals (A and B) is calculated as this, say, A’s parents are AF and AM,  B’s parents are BF and BM, then

r(A,B) = 0.5 * (r(A, BF) + r (A,BM) )  or r(A,B)  = 0.5 * (r(B,AF) + r(B,AM) )

that is, average relationship between A and B’s parents

here are two examples of pedigrees and their relationship matrics

As you can see, in normal societies, relationship between parent-children is 0.5, 0.25 for between grandparent and grandchildren, 0.5 for between full siblings and 0.25 for half-siblings.  In an incest case,  the Fritzl case, the relationship between Josef Fritzl and Elisabeth Fritzl’s children is 0.75, and the relationship between Elisabeth Fritzl’s children is 0.625.

Well, here is another pedigree, you may dare to work out the relationship by yourself. good luck!!

AND you may be interested in shoot the relationship matrix of British Royal Family (click it to enlarge or check out the pdf version)

you may use my simple perl script  to do calculation

#!/usr/bin/perl

# read in pedigree information
# stored as
# individual afther mother
# 1 0 0
# 2 0 0
# 3 1 2

open (PED, “<./PED.TXT”) or die “open PED.TXT error \$!\n”;
my (%s,%d, %NRM, @ID);
#do {<PED>} until \$. ==1 or eof;

while (<PED>) {
s/^\s+//;
chomp;
@a=split;
\$s{\$a[0]} = \$a[1];
\$d{\$a[0]} = \$a[2];
push @ID, \$a[0];
}
close (PED);

# calculate numerical relationship

%NRM=0;
foreach my \$i (0 .. \$#ID ) {
my \$I=\$ID[\$i];
my \$IS = \$s{\$I}; # father of I
my \$ID = \$d{\$I}; # mother of I
my \$x = sprintf “%f”, \$NRM{\$IS}{\$ID};
my \$max=0;
\$NRM{\$I}{\$I} = 1.0 + 0.5 * \$x;
foreach my \$j (\$i+1 .. \$#ID ) {
my \$J=\$ID[\$j];

my \$JS = \$s{\$J};
my \$JD = \$d{\$J};
my \$sr=sprintf “%f”, \$NRM{\$I}{\$JS};
my \$dr=sprintf “%f”, \$NRM{\$I}{\$JD};
my \$x = 0.5 * (\$sr + \$dr);
\$NRM{\$I}{\$J} = \$x;
\$NRM{\$J}{\$I} = \$NRM{\$I}{\$J};
print “\$I \$J \$NRM{\$I}{\$I} \$NRM{\$I}{\$J}\n”;
}
}
open (NRM, “>NRM.PED.TXT”);
foreach my \$i (0 .. \$#ID ) {
my \$I = \$ID[\$i];
my @a;
push @a, \$I;
foreach my \$j (0 .. \$#ID ) {
my \$J =\$ID[\$j];
my \$x;
\$x=sprintf “%.4f”, \$NRM{\$I}{\$J};
push @a, \$x;
}
printf NRM “%s\n”, join ” “, @a;
}
close (NRM);
exit 0;

The example pedigree

1 0 0
2 0 0
3 0 0
4 0 0
5 0 0
6 0 0
7 0 0
8 7 6
9 4 1
10 8 2
11 4 3
12 8 5
13 8 9
14 8 10
15 8 11
16 8 12
17 16 15
18 14 13
19 17 18

The Sample result

Advertisements