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)); } }
//!!!rename Class to Locus //!!!rename HLa to HlaAllele static public HlaGroup GetInstance(string hlaClass, int hlaNumber) { string name = CreateName(hlaClass, hlaNumber); if (SingletonHlaCollection.ContainsKey(name)) { return(SingletonHlaCollection[name]); } HlaGroup hlaGroup = new HlaGroup(hlaClass, hlaNumber); SingletonHlaCollection.Add(hlaGroup.ToString(), hlaGroup); return(hlaGroup); }
internal static string XHlaGroupString(HlaGroup hlaGroup) { int twoDigits = hlaGroup.TwoDigits(); if (twoDigits == 15) { return(hlaGroup.ToString()); } else { return(string.Format("{0}{1:00}", hlaGroup.HlaClass, twoDigits)); } }
public string Evaluate(KmerDefinition kmerDefinition, string featureString, bool isPositive, int rowId, int groupId, string sOperator, string[] rgKmer, HlaGroup hlaGroup /*, int lengthOfOriginalLanlEpitopeOrLongMin*/) { for (int iProperty = 0; iProperty < AAPropertyCollection.Length; ++iProperty) { string sAAProperty = (string)AAPropertyCollection[iProperty]; if (featureString.StartsWith(sAAProperty)) { char chBEA; int iPos = GetPos(kmerDefinition, featureString, out chBEA); SpecialFunctions.CheckCondition(iPos != -1); //!!! raise error string sAminoAcid = rgKmer[iPos]; bool? goalValue = GoalValue(sAminoAcid, iProperty); switch (goalValue) { case true: return("1"); case false: return("0"); case null: return("#"); } } } //!!!switch to switch if (featureString == "RowId") { return(rowId.ToString()); } if (featureString == "Operator") { return(sOperator); } if (featureString == "GroupId") { return(groupId.ToString()); } if (featureString == "Immunogenic") { return(isPositive ? "1" : "0"); } //if (featureString == "KmerLength") //{ // Debug.Assert(lengthOfOriginalLanlEpitopeOrLongMin != int.MinValue); // return lengthOfOriginalLanlEpitopeOrLongMin.ToString(); //} if (featureString.StartsWith("amino")) { char chBEA; int iPos = GetPos(kmerDefinition, featureString, out chBEA); SpecialFunctions.CheckCondition(iPos != -1); //!!! raise error string sAminoAcid = rgKmer[iPos]; string sGoalValue = AANumberAsGoalValue(sAminoAcid); return(sGoalValue); } //if(featureString == "HLA") //HLA,HLA2digits,HLALetter //HLA-A*0201,HLA-A*02,A //{ // string sGoalValue = string.Format("HLA-{0}*{1:0000}", hlaGroup.HlaClass, hlaGroup.HlaNumber); // return sGoalValue; //} //if(featureString == "HLA2digits") //HLA,HLA2digits,HLALetter //HLA-A*0201,HLA-A*02,A //{ // string sGoalValue = string.Format("HLA-{0}*{1:00}",hlaGroup.HlaClass, hlaGroup.TwoDigits()); // return sGoalValue; //} //else if(featureString == "HLALetter") //HLA,HLA2digits,HLALetter //HLA-A*0201,HLA-A*02,A //{ // return hlaGroup.HlaClass; //} //if (featureString == "HLAHarvard") //HLA,HLA2digits,HLALetter //HLA-A*0201,HLA-A*02,A //{ // return BMixedHlaResolution.HlaGroupString(hlaGroup); //} //if (featureString.StartsWith(OldStyleEpitopeTrainingData.HlaHarvardFeatureString)) //!!!const //{ // string goal = featureString.Substring(OldStyleEpitopeTrainingData.HlaHarvardFeatureString.Length); // string value = BMixedHlaResolution.HlaGroupString(hlaGroup); // return (goal == value) ? "1" : "0"; //} //if (featureString == "Supertype") //HLA,HLA2digits,HLALetter //HLA-A*0201,HLA-A*02,A //{ // return SupertypeMapping.HlaGroupString(hlaGroup); //} Debug.Assert(false); //!!!need code return(null); }
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 override HlaGroup PossibleHlaGroup(HlaToLength hlaToLength) { return(HlaGroup.GetInstance(hlaToLength.HlaClass, hlaToLength.HlaNumberToLength)); }