private void TestInterpolation( PairR[] pairs, float expectedR, Int32 indexOfInterpolatedR ) { InterpolateR target = new InterpolateR(pairs); Int32 subjectTag1 = pairs[indexOfInterpolatedR].SubjectTag1; Int32 subjectTag2 = pairs[indexOfInterpolatedR].SubjectTag2; float? actualRV1 = target.Interpolate(subjectTag1, subjectTag2); Assert.AreEqual(expectedR, actualRV1, "The interpolated R should be correct."); float actualRV2 = pairs[indexOfInterpolatedR].R.Value; Assert.AreEqual(expectedR, actualRV2, "The interpolated R should be correct."); }
private float? CalculateRFull( ) { if ( !_drValue.IsRPass1Null() ) return (float?)_drValue.RPass1; DataColumn dcPass1 = _dsLinks.tblRelatedValues.RPass1Column; PairR[] pairs = PairR.BuildRelatedPairsOfGen2Sibs(dcPass1, _drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2, _drLeft.ExtendedID, _dsLinks); InterpolateR interpolate = new InterpolateR(pairs); float? newR = interpolate.Interpolate(_drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2); if ( newR.HasValue ) return newR; else if ( _rImplicit.HasValue ) return _rImplicit; else return RCoefficients.SiblingAmbiguous; }
private float? CalculateRImplicitMother( MarkerEvidence babyDaddyDeathDate, MarkerEvidence babyDaddyAlive, MarkerEvidence babyDaddyInHH, MarkerEvidence babyDaddyLeftHHDate, MarkerEvidence babyDaddyDistanceFromHH ) { if ( !_drValue.IsRImplicitPass1Null() ) return (float?)_drValue.RImplicitPass1; DataColumn dcPass1 = _dsLinks.tblRelatedValues.RImplicitPass1Column; PairR[] pairs = PairR.BuildRelatedPairsOfGen2Sibs(dcPass1, _drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2, _drLeft.ExtendedID, _dsLinks); InterpolateR interpolate = new InterpolateR(pairs); float? newRImplicit = interpolate.Interpolate(_drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2); if ( newRImplicit.HasValue ) { return newRImplicit; } else { if ( babyDaddyDeathDate == MarkerEvidence.Supports ) return RCoefficients.SiblingFull; else if ( babyDaddyDeathDate == MarkerEvidence.Unlikely ) return RCoefficients.SiblingHalf; else if ( babyDaddyInHH == MarkerEvidence.Supports ) return RCoefficients.SiblingFull; else if ( babyDaddyInHH == MarkerEvidence.Unlikely ) return RCoefficients.SiblingHalf; else if ( babyDaddyLeftHHDate == MarkerEvidence.Supports ) return RCoefficients.SiblingFull; else if ( babyDaddyLeftHHDate == MarkerEvidence.Unlikely ) return RCoefficients.SiblingHalf; else if ( babyDaddyAlive == MarkerEvidence.Unlikely ) return RCoefficients.SiblingHalf; else if ( babyDaddyDistanceFromHH == MarkerEvidence.Unlikely ) return RCoefficients.SiblingHalf; else if ( HasLargeMetaphoricalDistance(pairs) ) return RCoefficients.SiblingHalf; else return null; } }
private float? CalculateRExplicit( ) { if ( !_drValue.IsRExplicitPass1Null() ) return (float?)_drValue.RExplicitPass1; DataColumn dcPass1 = _dsLinks.tblRelatedValues.RExplicitPass1Column; PairR[] pairs = PairR.BuildRelatedPairsOfGen2Sibs(dcPass1, _drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2, _drLeft.ExtendedID, _dsLinks); InterpolateR interpolate = new InterpolateR(pairs); float? newRExplicit = interpolate.Interpolate(_drLeft.SubjectTag_S1, _drLeft.SubjectTag_S2); return RGen2Pass1.ExplicitAgreementWithTwins((Tristate)_drValue.IsMz, (MultipleBirth)_drValue.MultipleBirthIfSameSex, newRExplicit); }