static public HlaToLength GetInstanceABMixed(string hlaPattern) { HlaToLength aHlaToLength = new HlaToLength(); aHlaToLength.HlaResolution = HlaResolution.ABMixed; if (HlaResolution.TwoDigitHlaPatternIsOK(hlaPattern)) { aHlaToLength._hlaClass = hlaPattern.Substring(0, 1); aHlaToLength._hlaNumberToLength = int.Parse(hlaPattern.Substring(1)); SpecialFunctions.CheckCondition(aHlaToLength._hlaClass != "B" || aHlaToLength._hlaNumberToLength != 15); //!!!raise error SpecialFunctions.CheckCondition(aHlaToLength._hlaClass != "A" || aHlaToLength._hlaNumberToLength != 68); //!!!raise error } else { HlaToLength hlaToLengthFour = GetInstanceFour(hlaPattern); int twoDigits = hlaToLengthFour.TwoDigits(); if ((twoDigits == 15 && hlaToLengthFour.HlaClass == "B") || (twoDigits == 68 && hlaToLengthFour.HlaClass == "A")) { aHlaToLength._hlaClass = hlaToLengthFour.HlaClass; aHlaToLength._hlaNumberToLength = hlaToLengthFour._hlaNumberToLength; } else { aHlaToLength._hlaClass = hlaToLengthFour.HlaClass; aHlaToLength._hlaNumberToLength = twoDigits; } } return(aHlaToLength); }
static public HlaToLength GetInstance(string hlaPattern, HlaResolution hlaResolution) { HlaToLength aHlaToLength = hlaResolution.GetHlaLengthInstance(hlaPattern); SpecialFunctions.CheckCondition(aHlaToLength != null); return(aHlaToLength); }
public override HlaToLength GetHlaLengthInstance(string hlaPattern) { if (!HlaPatternIsOK(hlaPattern)) { return(null); } return(HlaToLength.GetInstanceFour(hlaPattern)); }
private static System.Collections.Generic.IEnumerable <HlaToLength> HlaCollection(string hlaCollection, HlaResolution hlaResolution) { foreach (string sHlaPattern in hlaCollection.Split('/')) { HlaToLength hlaToLength = HlaToLength.GetInstanceOrNull(sHlaPattern, hlaResolution); SpecialFunctions.CheckCondition(hlaToLength != null); //!!!raise error yield return(hlaToLength); } }
static internal HlaToLength GetInstanceFour(string hlaPattern) { HlaToLength aHlaToLength = new HlaToLength(); aHlaToLength.HlaResolution = HlaResolution.Four; aHlaToLength._hlaClass = hlaPattern.Substring(0, 1); SpecialFunctions.CheckCondition(hlaPattern.Length == 5, String.Format("Expected 4-digit HLA (not {0})", hlaPattern)); aHlaToLength._hlaNumberToLength = int.Parse(hlaPattern.Substring(hlaPattern.Length - 4)); return(aHlaToLength); }
public override HlaToLength GetHlaLengthInstance(string hlaPattern) { if (!HlaPatternIsOK(hlaPattern)) { Debug.Fail("fix up"); return(null); } return(HlaToLength.GetInstanceABMixed(hlaPattern)); }
public override HlaGroup PossibleHlaGroup(HlaToLength hlaToLength) { if (IsA68OrB15(hlaToLength)) { return(HlaGroup.GetInstance(hlaToLength.HlaClass, hlaToLength.HlaNumberToLength)); } else { return(HlaGroup.GetInstance(hlaToLength.HlaClass, hlaToLength.HlaNumberToLength * 100)); } }
public static MerAndHlaToLength GetInstance(string aaSequence, HlaToLength aHlaToLength, KmerDefinition kmerDefinition) { SpecialFunctions.CheckCondition(aaSequence.Length > 0 && char.IsUpper(aaSequence[0])); //Spot check that all upper MerAndHlaToLength aMerAndHlaToLength = new MerAndHlaToLength(); aMerAndHlaToLength.Mer = aaSequence; aMerAndHlaToLength.HlaToLength = aHlaToLength; //aMerAndHlaToLength.Study = study; aMerAndHlaToLength.KmerDefinition = kmerDefinition; return(aMerAndHlaToLength); }
public override string HlaToLengthString(HlaToLength hlaToLength) { if (IsA68OrB15(hlaToLength)) { return(string.Format("{0}{1:0000}", hlaToLength.HlaClass, hlaToLength.HlaNumberToLength)); } else { return(string.Format("{0}{1:00}", hlaToLength.HlaClass, hlaToLength.HlaNumberToLength)); } }
public override bool Equals(object obj) { HlaToLength other = obj as HlaToLength; if ((other as object) == null) { return(false); } else { bool b = other._hlaNumberToLength == _hlaNumberToLength && other._hlaClass == _hlaClass && other.HlaResolution == HlaResolution; return(b); } }
static internal HlaToLength GetInstanceTwo(string hlaPattern) { HlaToLength aHlaToLength = new HlaToLength(); aHlaToLength.HlaResolution = HlaResolution.Two; if (HlaResolution.TwoDigitHlaPatternIsOK(hlaPattern)) { aHlaToLength._hlaClass = hlaPattern.Substring(0, 1); aHlaToLength._hlaNumberToLength = int.Parse(hlaPattern.Substring(1)); } else { HlaToLength hlaToLengthFour = GetInstanceFour(hlaPattern); aHlaToLength._hlaClass = hlaToLengthFour.HlaClass; aHlaToLength._hlaNumberToLength = hlaToLengthFour.TwoDigits(); } return(aHlaToLength); }
public override string HlaToLengthString(HlaToLength hlaToLength) { return(string.Format("{0}{1:0000}", hlaToLength.HlaClass, hlaToLength.HlaNumberToLength)); }
public abstract string HlaToLengthString(HlaToLength hlaToLength);
static public HlaToLength GetInstanceOrNull(HlaGroup hlaGroup, HlaResolution hlaResolution) { HlaToLength hlaToLength = HlaToLength.GetInstanceOrNull(hlaGroup.ToString(), hlaResolution); return(hlaToLength); }
public bool Consistant(HlaGroup hlaGroup) { bool b = (this == HlaToLength.GetInstanceOrNull(hlaGroup, HlaResolution)); return(b); }
public abstract string HlaToLengthStringWithLeading0(HlaToLength hlaToLength);
public abstract HlaGroup PossibleHlaGroup(HlaToLength hlaToLength);
private bool IsA68OrB15(HlaToLength hlaToLength) { return(IsA68(hlaToLength) || IsB15(hlaToLength)); }
public override HlaGroup PossibleHlaGroup(HlaToLength hlaToLength) { return(HlaGroup.GetInstance(hlaToLength.HlaClass, hlaToLength.HlaNumberToLength)); }
public override string HlaToLengthStringWithLeading0(HlaToLength hlaToLength) { return(string.Format("{0}{1}", hlaToLength.HlaClass, hlaToLength.HlaNumberToLength)); }
private bool IsA68(HlaToLength hlaToLength) { return(hlaToLength.HlaClass == "A" && TwoDigits(hlaToLength.HlaNumberToLength) == 68); }
//!!!some code in common with BMixed internal bool IsB15(HlaToLength hlaToLength) { return(hlaToLength.HlaClass == "B" && TwoDigits(hlaToLength.HlaNumberToLength) == 15); }