public override System.Collections.ArrayList HlaToLength4(LanlEpitope aLanlEpitope)
        {
            ArrayList rg = new ArrayList();

            rg.Add(aLanlEpitope.HlaToLength);
            return(rg);
        }
        public override ArrayList HlaToLength4(LanlEpitope aLanlEpitope)
        {
            Debug.Fail("Need code");
            ArrayList rg = new ArrayList();

            rg.Add(aLanlEpitope.HlaToLength);
            return(rg);
        }
 public override ArrayList HlaToLength4(LanlEpitope aLanlEpitope)
 {
     throw new Exception("The commented out version of this code requires an implict set of HLAs");
     //ArrayList rg = new ArrayList();
     //foreach (HlaToLength hlaToLength4 in FourDigitPossiblities(aLanlEpitope.HlaToLength))
     //{
     //    rg.Add(hlaToLength4);
     //}
     //return rg;
 }
예제 #4
0
        static public void DumpCollection(string fileSuffix, HlaResolution hlaResolution, ArrayList lanlEpitopeCollection)
        {
            string sOutputFile = string.Format(@"LanlEpitopeCollection{0}{1}.New.txt", fileSuffix, hlaResolution.ShortName);

            using (StreamWriter streamwriterOutputFile = File.CreateText(sOutputFile))
            {
                LanlEpitope.WriteHeaderLine(streamwriterOutputFile);
                foreach (LanlEpitope aLanlEpitope in lanlEpitopeCollection)
                {
                    aLanlEpitope.WriteLine(streamwriterOutputFile);
                }
            }
        }
예제 #5
0
        static private ArrayList MakeOneLonger(LanlEpitope modelLanlEpitope)
        {
            ArrayList rgExpanded = new ArrayList();

            for (int iPos = 0; iPos <= modelLanlEpitope.Epitope.Length; ++iPos)
            {
                LanlEpitope aLanlEpitope = new LanlEpitope();
                aLanlEpitope.Epitope = AddCharToString(modelLanlEpitope.Epitope, iPos, "#");
                aLanlEpitope.ProteinPositionNotCanonical = modelLanlEpitope.ProteinPositionNotCanonical;
                aLanlEpitope.SpeciesPattern = modelLanlEpitope.SpeciesPattern;
                aLanlEpitope.HlaToLength    = modelLanlEpitope.HlaToLength;
                aLanlEpitope.CaseWeight     = 1.0 / ((double)modelLanlEpitope.Epitope.Length + 1.0);
                aLanlEpitope.Source         = modelLanlEpitope;
                aLanlEpitope.Operator       = string.Format("I{0}", iPos + 1);
                rgExpanded.Add(aLanlEpitope);
            }

            return(rgExpanded);
        }
예제 #6
0
        //		static private void AddToHashtable(LanlEpitope aLanlEpitope, ref Hashtable rgExpanded)
        //		{
        //			if (rgExpanded.ContainsKey(aLanlEpitope.Epitope))
        //			{
        //				LanlEpitope previous = (LanlEpitope) rgExpanded[aLanlEpitope.Epitope];
        //				previous.CaseWeight += aLanlEpitope.CaseWeight;
        //
        //			}
        //			else
        //			{
        //				rgExpanded.Add(aLanlEpitope.Epitope, aLanlEpitope);
        //			}
        //	}

        static private ArrayList MakeOneLongerAtE1(LanlEpitope modelLanlEpitope)
        {
            Debug.Assert(modelLanlEpitope.Epitope.Length == 8);

            ArrayList rgExpanded = new ArrayList();

            int         iPos         = 0;
            LanlEpitope aLanlEpitope = new LanlEpitope();

            aLanlEpitope.Epitope = AddCharToString(modelLanlEpitope.Epitope, iPos, "#");
            aLanlEpitope.ProteinPositionNotCanonical = modelLanlEpitope.ProteinPositionNotCanonical;
            aLanlEpitope.SpeciesPattern = modelLanlEpitope.SpeciesPattern;
            aLanlEpitope.HlaToLength    = modelLanlEpitope.HlaToLength;
            aLanlEpitope.CaseWeight     = 1.0;
            aLanlEpitope.Source         = modelLanlEpitope;
            aLanlEpitope.Operator       = string.Format("I{0}", iPos + 1);
            rgExpanded.Add(aLanlEpitope);

            return(rgExpanded);
        }
예제 #7
0
        static private ArrayList MakeOneShorterAt4thTo8th(LanlEpitope modelLanlEpitope)
        {
            Debug.Assert(modelLanlEpitope.Epitope.Length == 10);

            ArrayList rgExpanded = new ArrayList();

            for (int iPos = 3; iPos <= 8; ++iPos)
            {
                LanlEpitope aLanlEpitope = new LanlEpitope();
                aLanlEpitope.Epitope = RemoveCharFromString(modelLanlEpitope.Epitope, iPos);
                aLanlEpitope.ProteinPositionNotCanonical = modelLanlEpitope.ProteinPositionNotCanonical;
                aLanlEpitope.SpeciesPattern = modelLanlEpitope.SpeciesPattern;
                aLanlEpitope.HlaToLength    = modelLanlEpitope.HlaToLength;
                aLanlEpitope.CaseWeight     = 1.0 / 6.0;
                aLanlEpitope.Source         = modelLanlEpitope;
                aLanlEpitope.Operator       = string.Format("D{0}", iPos + 1);
                rgExpanded.Add(aLanlEpitope);
            }

            return(rgExpanded);
        }
예제 #8
0
        static public ArrayList GetLanlCollection(string fileSuffix, HlaResolution hlaResolution)
        {
            //Load up known epitopes
            ArrayList lanlEpitopeCollection = new ArrayList();

            if (fileSuffix == "ignore")
            {
                return(lanlEpitopeCollection);
            }

            string sInputFileName = LanlFile(fileSuffix, hlaResolution);

            Dictionary <string, bool> rgSeenIt = new Dictionary <string, bool>();

            using (StreamReader streamreaderInputFile = Predictor.OpenResource(sInputFileName))
            {
                string sLine = streamreaderInputFile.ReadLine();
                SpecialFunctions.CheckCondition(sLine == PreferedHeader || sLine == @"Epitope,Protein,Hxb2locstart,Hxb2locend,Species,HLA" || sLine == @"Epitope,Protein,Hxb2locstart,Hxb2locend,Species,Hla,length"); //!!!raise error
                while ((sLine = streamreaderInputFile.ReadLine()) != null)
                {
                    if (sLine == "")
                    {
                        continue;
                    }

                    string[] rgField = sLine.Split(',', '\t');
                    SpecialFunctions.CheckCondition(rgField.Length == 7 || rgField.Length == 6); //!!!raise error

                    string aaSequence = rgField[0];
                    SpecialFunctions.CheckCondition(aaSequence.IndexOf('?') < 0); //!!!raise error

                    if (rgField.Length == 7)
                    {
                        int iLength = int.Parse(rgField[6]);
                        SpecialFunctions.CheckCondition(aaSequence.Length == iLength); //!!!raise error
                    }

                    string hlaCollection = rgField[5];
                    SpecialFunctions.CheckCondition(hlaCollection != ""); //!!!raise error

                    string species = rgField[4];
                    if (species.IndexOf("human") < 0)
                    {
                        Debug.WriteLine("Skipping non-human epitope: " + species);
                        continue;
                    }

                    foreach (HlaToLength aHlaToLength in HlaCollection(hlaCollection, hlaResolution))
                    {
                        LanlEpitope aLanlEpitope = new LanlEpitope();
                        aLanlEpitope.Epitope = aaSequence;       //!!!const
                        string sProtein = rgField[1];            //!!!const
                        int    aa1      = int.Parse(rgField[2]); //!!!could raise error //!!!const
                        aLanlEpitope.ProteinPositionNotCanonical = new ProteinPosition(sProtein, aa1);
                        //!!!add an assert about the species pattern being one that we can work with
                        aLanlEpitope.SpeciesPattern = "human";
                        //!!!would be good to assert that this matches pattern - no "HLA*" or " "
                        aLanlEpitope.HlaToLength = aHlaToLength;

                        string key = aLanlEpitope.Key();
                        if (!rgSeenIt.ContainsKey(key))
                        {
                            rgSeenIt.Add(key, true);
                            lanlEpitopeCollection.Add(aLanlEpitope);
                        }
                    }
                }
            }

            LanlEpitope.ReportNormalizedInputWithNoDup(lanlEpitopeCollection, fileSuffix, hlaResolution);


            lanlEpitopeCollection = FilterAndDuplicateAccordingToSuffix(lanlEpitopeCollection, fileSuffix);

            DumpCollection(fileSuffix, hlaResolution, lanlEpitopeCollection);

            return(lanlEpitopeCollection);
        }
 abstract public System.Collections.ArrayList HlaToLength4(LanlEpitope aLanlEpitope);