public MarkerGen1Summary( MarkerEvidence sameGeneration, MarkerEvidence shareBiomom, MarkerEvidence shareBiodad, MarkerEvidence shareBiograndparent )
 {
     _sameGeneration = sameGeneration;
     _shareBiomom = shareBiomom;
     _shareBiodad = shareBiodad;
     _shareBiograndparent = shareBiograndparent;
 }
 public static Tristate TranslateEvidenceToTristate( MarkerEvidence source1, MarkerEvidence source2 )
 {
     if ( _green.Contains(source1) && _green.Contains(source2) ) return Tristate.Yes;
     else if ( _red.Contains(source1) && _red.Contains(source2) ) return Tristate.No;
     else if ( _yellow.Contains(source1) ) return TranslateEvidenceToTristate(source2);
     else if ( _yellow.Contains(source2) ) return TranslateEvidenceToTristate(source1);
     else if ( (_green.Contains(source1) && _red.Contains(source2)) || (_green.Contains(source2) && _red.Contains(source1)) ) return Tristate.DoNotKnow;
     else throw new ArgumentOutOfRangeException("The 'TranslateEvidenceToTristate' function was not designed to accommodate these two values of MarkerEvidence.");
 }
 public static Tristate TranslateEvidenceToTristate( MarkerEvidence evidence )
 {
     switch ( evidence ) {
         case MarkerEvidence.StronglySupports:
         case MarkerEvidence.Supports:
             return Tristate.Yes;
         case MarkerEvidence.Consistent:
         case MarkerEvidence.Ambiguous:
         case MarkerEvidence.Irrelevant:
         case MarkerEvidence.Missing:
             return Tristate.DoNotKnow;
         case MarkerEvidence.Unlikely:
         case MarkerEvidence.Disconfirms:
             return Tristate.No;
         default:
             throw new ArgumentOutOfRangeException("evidence", evidence, "This function does not support this value of MarkerEvidence.");
     }
 }
        private void AddMarkerRow( Int16 extendedID, Int32 relatedID, MarkerType markerType, Int16 surveyYear, MarkerEvidence mzEvidence, MarkerEvidence sameGenerationEvidence, MarkerEvidence biomomEvidence, MarkerEvidence biodadEvidence, MarkerEvidence biograndparentEvidence )
        {
            LinksDataSet.tblMarkerGen1Row drNew = _dsLinks.tblMarkerGen1.NewtblMarkerGen1Row();
            drNew.ExtendedID = extendedID;
            drNew.RelatedID = relatedID;
            drNew.MarkerType = Convert.ToByte(markerType);
            drNew.SurveyYear = surveyYear;
            drNew.MzEvidence = Convert.ToByte(mzEvidence);
            drNew.SameGeneration = Convert.ToByte(sameGenerationEvidence);
            drNew.ShareBiomomEvidence = Convert.ToByte(biomomEvidence);
            drNew.ShareBiodadEvidence = Convert.ToByte(biodadEvidence);
            drNew.ShareBioGrandparentEvidence = Convert.ToByte(biograndparentEvidence);

            _dsLinks.tblMarkerGen1.AddtblMarkerGen1Row(drNew);
        }
 private Tristate ImplicitShareBioparent( MarkerEvidence inHH1979, MarkerEvidence deathAge )
 {
     if ( deathAge == MarkerEvidence.StronglySupports )
         return Tristate.Yes;
     else if ( inHH1979 == MarkerEvidence.StronglySupports )
         return Tristate.Yes;
     else if ( deathAge == MarkerEvidence.Disconfirms )
         return Tristate.No;
     else if ( inHH1979 == MarkerEvidence.Disconfirms )
         return Tristate.No;
     else
         return Tristate.DoNotKnow;
 }
 private float? CalculateRExplicitSingleSibVersion( MarkerEvidence biomom, MarkerEvidence biodad )
 {
     if ( biomom == MarkerEvidence.Missing || biodad == MarkerEvidence.Missing ) {
         return null;
     }
     else if ( biomom == MarkerEvidence.Supports && biodad == MarkerEvidence.Supports ) { //if ( !OverridesGen1.RosterAndExplicit.Contains(subjectTag) ) { //   Trace.Assert(roster.ShareBiomom != MarkerEvidence.Disconfirms); //   Trace.Assert(roster.ShareBiodad != MarkerEvidence.Disconfirms);//}
         return RCoefficients.SiblingFull;
     }
     else if ( biomom == MarkerEvidence.Disconfirms && biodad == MarkerEvidence.Supports ) {//Trace.Assert(roster.ShareBiomom != MarkerEvidence.Disconfirms); //Trace.Assert(roster.ShareBiodad != MarkerEvidence.Disconfirms);
         return RCoefficients.SiblingHalf;
     }
     else if ( biomom == MarkerEvidence.Supports && biodad == MarkerEvidence.Disconfirms ) { //if ( !OverridesGen1.RosterAndExplicit.Contains(subjectTag) ) { //   Trace.Assert(roster.ShareBiomom != MarkerEvidence.Disconfirms);//   Trace.Assert(roster.ShareBiodad != MarkerEvidence.Disconfirms); //}
         return RCoefficients.SiblingHalf;
     }
     //else if ( biomom.ShareBiomom == MarkerEvidence.Disconfirms && biodad.ShareBiodad == MarkerEvidence.Disconfirms ) {
     //   return RCoefficients.NotRelated;//The could still be cousins or something else
     //}
     else {
         return null; //The could still be cousins or something else
     }
 }
        private Int32 AddMarkerRow( Int16 extendedID, Int32 relatedID, MarkerType markerType, Int16? surveyYear, MarkerEvidence mzEvidence, MarkerEvidence biodadEvidence, bool fromMother )
        {
            lock ( _dsLinks.tblMarkerGen2 ) {
                //if ( !surveyYear.HasValue ) return 0;

                LinksDataSet.tblMarkerGen2Row drNew = _dsLinks.tblMarkerGen2.NewtblMarkerGen2Row();
                drNew.ExtendedID = extendedID;
                drNew.RelatedID = relatedID;
                drNew.MarkerType = (byte)markerType;

                if ( surveyYear.HasValue ) drNew.SurveyYear = surveyYear.Value;
                else drNew.SetSurveyYearNull();

                drNew.MzEvidence = (byte)mzEvidence;
                drNew.ShareBiodadEvidence = (byte)biodadEvidence;
                drNew.FromMother = fromMother;

                _dsLinks.tblMarkerGen2.AddtblMarkerGen2Row(drNew);
            }
            return 1;
        }
        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? CalculateRImplicitSubject( MarkerEvidence fatherAlive, MarkerEvidence fatherInHH, MarkerEvidence fatherDistanceFromHH )
        {
            //else if ( babyDaddyDeathDate == MarkerEvidence.StronglySupports ) return RCoefficientsSibling.SiblingFull;
            //else if ( babyDaddyDeathDate == MarkerEvidence.Disconfirms ) return RCoefficientsSibling.SiblingHalf;
            if ( fatherAlive == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            //else if ( babyDaddyLeftHHDate == MarkerEvidence.StronglySupports ) return RCoefficientsSibling.SiblingFull;
            //else if ( babyDaddyLeftHHDate == MarkerEvidence.Disconfirms ) return RCoefficientsSibling.SiblingHalf;
            else if ( fatherInHH == MarkerEvidence.StronglySupports ) return RCoefficients.SiblingFull;
            else if ( fatherInHH == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            else if ( fatherDistanceFromHH == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            //else if ( babyDaddyAsthma == MarkerEvidence.Disconfirms ) return RCoefficientsSibling.SiblingHalf;

            //if ( babyDaddyDeathDate == MarkerEvidence.Supports ) return RCoefficientsSibling.SiblingFull;
            //else if ( babyDaddyDeathDate == MarkerEvidence.Unlikely ) return RCoefficientsSibling.SiblingHalf;
            else if ( fatherInHH == MarkerEvidence.Supports ) return RCoefficients.SiblingFull;
            else if ( fatherInHH == MarkerEvidence.Unlikely ) return RCoefficients.SiblingHalf;
            //else if ( babyDaddyLeftHHDate == MarkerEvidence.Supports ) return RCoefficientsSibling.SiblingFull;
            //else if ( babyDaddyLeftHHDate == MarkerEvidence.Unlikely ) return RCoefficientsSibling.SiblingHalf;
            else if ( fatherAlive == MarkerEvidence.Unlikely ) return RCoefficients.SiblingHalf;
            else if ( fatherDistanceFromHH == MarkerEvidence.Unlikely ) return RCoefficients.SiblingHalf;
            //else if ( HasLargeMetaphoricalDistance(pairs) ) return RCoefficientsSibling.SiblingHalf;
            else return null;
        }
 public MarkerGen2Summary( Int16 surveyYear, MarkerEvidence mzEvidence, MarkerEvidence shareBiodad )
 {
     _surveyYear = surveyYear;
     _mzEvidence = mzEvidence;
     _shareBiodad = shareBiodad;
 }
        private float? CalculateRImplicitPass1( MarkerEvidence babyDaddyDeathDate, MarkerEvidence babyDaddyAlive, MarkerEvidence babyDaddyInHH, MarkerEvidence babyDaddyLeftHHDate,
			MarkerEvidence babyDaddyDistanceFromHH, MarkerEvidence babyDaddyAsthma )
        {
            if ( IsMZ == BaseAssembly.Tristate.Yes ) return RCoefficients.MzTrue;
            else if ( IsMZ == BaseAssembly.Tristate.DoNotKnow ) return RCoefficients.MzAmbiguous;
            else if ( MultipleBirthIfSameSex == BaseAssembly.MultipleBirth.Twin ) return RCoefficients.SiblingFull;
            else if ( MultipleBirthIfSameSex == BaseAssembly.MultipleBirth.Trip ) return RCoefficients.SiblingFull;
            else if ( MultipleBirthIfSameSex == BaseAssembly.MultipleBirth.DoNotKnow ) throw new InvalidOperationException("There shouldn't be any 'MultipleBirth.DoNotKnow' relationships.");
            else if ( babyDaddyDeathDate == MarkerEvidence.StronglySupports ) return RCoefficients.SiblingFull;
            else if ( babyDaddyDeathDate == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            else if ( babyDaddyAlive == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            else if ( babyDaddyLeftHHDate == MarkerEvidence.StronglySupports ) return RCoefficients.SiblingFull;
            else if ( babyDaddyLeftHHDate == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            else if ( babyDaddyInHH == MarkerEvidence.StronglySupports ) return RCoefficients.SiblingFull;
            else if ( babyDaddyInHH == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            else if ( babyDaddyDistanceFromHH == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            else if ( babyDaddyAsthma == MarkerEvidence.Disconfirms ) return RCoefficients.SiblingHalf;
            else return null;
        }
 private Tristate ImplicitShareBioparent( MarkerEvidence alwaysWithBothBioparents, MarkerEvidence inHH1980, MarkerEvidence inHH1978, MarkerEvidence inHH1977, MarkerEvidence inHH1976, MarkerEvidence birthCountry, MarkerEvidence birthState,
     MarkerEvidence birthYearAskedIn1988, MarkerEvidence birthYearAskedIn1987 )
 {
     if( inHH1980 == MarkerEvidence.StronglySupports )
         return Tristate.Yes;
     else if( inHH1980 == MarkerEvidence.Disconfirms )
         return Tristate.No;
     else if( inHH1978 == MarkerEvidence.StronglySupports )
         return Tristate.Yes;
     else if( inHH1978 == MarkerEvidence.Disconfirms )
         return Tristate.No;
     else if( inHH1977 == MarkerEvidence.StronglySupports )
         return Tristate.Yes;
     else if( inHH1977 == MarkerEvidence.Disconfirms )
         return Tristate.No;
     else if( inHH1976 == MarkerEvidence.StronglySupports )
         return Tristate.Yes;
     else if( inHH1976 == MarkerEvidence.Disconfirms )
         return Tristate.No;
     else if( birthCountry == MarkerEvidence.Disconfirms )
         return Tristate.No;
     else if( birthState == MarkerEvidence.Disconfirms )
         return Tristate.No;
     else if( alwaysWithBothBioparents == MarkerEvidence.StronglySupports )
         return Tristate.Yes;
     else if( birthYearAskedIn1988 == MarkerEvidence.Disconfirms )
         return Tristate.No;
     //else if ( birthYearAskedIn1988 == MarkerEvidence.Supports )
     //   return Tristate.Yes;
     else if( birthYearAskedIn1987 == MarkerEvidence.Disconfirms )
         return Tristate.No;
     //else if ( birthYearAskedIn1987 == MarkerEvidence.Supports )
     //   return Tristate.Yes;
     //else if ( birthYearAskedIn1988 == MarkerEvidence.Unlikely )
     //   return Tristate.No;
     //else if ( birthYearAskedIn1987 == MarkerEvidence.Unlikely )
     //   return Tristate.No;
     else
         return Tristate.DoNotKnow;
 }
 private void BiodadInHH( MarkerEvidence expected, TrendComparisonInteger comparison )
 {
     MarkerEvidence actual = DetermineShareBabyDaddy.InHH(comparison);
     Assert.AreEqual(expected, actual, "The determination should be correct.");
 }
 private void Date( MarkerEvidence expected, ITrendComparison comparison )
 {
     MarkerEvidence actual = DetermineShareBabyDaddy.Date(comparison);
     Assert.AreEqual(expected, actual, "The determination should be correct.");
 }