internal static HlaIGenotype Union(params HlaIGenotype[] hlaIGenotypes) { HlaI A1 = new HlaI(HlaILocus.A); HlaI A2 = new HlaI(HlaILocus.A); HlaI B1 = new HlaI(HlaILocus.B); HlaI B2 = new HlaI(HlaILocus.B); HlaI C1 = new HlaI(HlaILocus.C); HlaI C2 = new HlaI(HlaILocus.C); foreach (var geno in hlaIGenotypes) { A1.ParseInto(geno.AAlleles.Item1.ToString()); A2.ParseInto(geno.AAlleles.Item2.ToString()); B1.ParseInto(geno.BAlleles.Item1.ToString()); B2.ParseInto(geno.BAlleles.Item2.ToString()); C1.ParseInto(geno.CAlleles.Item1.ToString()); C2.ParseInto(geno.CAlleles.Item2.ToString()); } var result = new HlaIGenotype(A1, A2, B1, B2, C1, C2); return(result); }
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); } }