static public Hla TrimToHla2(Hla hlaIn) { string hlaName = hlaIn.ToString(); SpecialFunctions.CheckCondition(hlaName.Length >= 3, string.Format("Expected hla name to have length of at least 3 (a class and two digits), but it is '{0}'.", hlaName)); Hla hlaOut = SingletonSpecification.HlaFactoryNoConstraints.GetGroundInstance(hlaName.Substring(0, 3)); return(hlaOut); }
//static PatchPatternFactory PatchPatternFactory = PatchPatternFactory.GetFactory("strings"); //private static PatchPattern CreateStringPatchPattern(string peptide) //{ // PatchPatternBuilder aPatchPatternBuilder = PatchPatternFactory.GetBuilder(); // aPatchPatternBuilder.AppendGroundDisjunct(peptide); // PatchPattern patchPattern = aPatchPatternBuilder.ToPatchPattern(); // return patchPattern; //} public double Predict(NEC nec, Hla hla, bool modelOnly, out string source) { Debug.Assert(HlaFactory.IsGroundOrAbstractInstance(hla.ToString())); // real assert SpecialFunctions.CheckCondition(nec.N.Length == SampleNEC.N.Length && nec.E.Length == SampleNEC.E.Length && nec.C.Length == SampleNEC.C.Length, string.Format("Length of peptide must be {0},{1},{2}", SampleNEC.N.Length, SampleNEC.E.Length, SampleNEC.C.Length)); Pair <NEC, Hla> necAndHla = new Pair <NEC, Hla>(nec, hla); List <Pair <string, Hla> > sourceAndOriginalHlaCollection = ListAllSourcesContainingThisMerAndHlaToLength(necAndHla); source = SpecialFunctions.Join("+", sourceAndOriginalHlaCollection); //Will be "" if list is empty double probability = (sourceAndOriginalHlaCollection.Count == 0 || modelOnly) ? probability = (double)Logistic.EvaluateViaCache(necAndHla) : 1.0; return(probability); }