Ejemplo n.º 1
0
 private void ParseLocusAndCheckAgainstExisting(string hlaStr, string locusStr)
 {
     if (string.IsNullOrEmpty(locusStr))
     {
         Helper.CheckCondition <ParseException>((int)Locus >= 1, "No locus has been specified. Please specify A, B or C.");
     }
     else
     {
         HlaILocus locus = MBT.Escience.Parse.Parser.Parse <HlaILocus>(locusStr);
         if ((int)Locus == 0)    // Locus hasn't been initialized
         {
             Locus = locus;
         }
         else
         {
             Helper.CheckCondition <ParseException>(Locus == locus, "Can't parse {0}. Locus {1} doesn't match existing locus {2}.", hlaStr, locus, Locus);
         }
     }
 }
Ejemplo n.º 2
0
        private static HlaI ParseHla(HlaILocus locus, string hlaString, HlaI otherCopyAtSameLocusOrNull = null)
        {
            Helper.CheckCondition <ParseException>(!string.IsNullOrWhiteSpace(hlaString), "Blank entries are not allowed. Use ? for missing or - for homozygous (second column of locus only).");

            switch (hlaString)
            {
            case "?":
                return(null);

            case "-":
                Helper.CheckCondition <ParseException>(otherCopyAtSameLocusOrNull != null, "Can't mark the first column as homozygous. Only A2, B2 or C2 can be marked with -.");
                return(otherCopyAtSameLocusOrNull);

            default:
                HlaI hla = new HlaI(locus);
                hla.ParseInto(hlaString);
                return(hla);
            }
        }
Ejemplo n.º 3
0
 public HlaI(HlaILocus locus)
     : this()
 {
     Locus = locus;
 }