public void SetAlleles(IList <string> alleleStrings) { IList <Allele> alleles = new List <Allele> (alleleStrings.Count); for (int i = 0; i < alleleStrings.Count; i++) { alleles.Add(Allele.Create(alleleStrings [i], i == 0)); } SetAlleles(alleles); }
/// <summary> /// parse a single allele, given the allele list </summary> /// <param name="alleles"> the alleles available </param> /// <param name="alt"> the allele to parse </param> /// <param name="lineNo"> the line number for this record </param> private static void parseSingleAltAllele(IList <Allele> alleles, string alt, int lineNo) { checkAllele(alt, false, lineNo); Allele allele = Allele.Create(alt, false); if (!allele.NoCall) { alleles.Add(allele); } }
/// <summary> /// parse out the alleles </summary> /// <param name="reference"> the reference base </param> /// <param name="alts"> a string of alternates to break into alleles </param> /// <param name="lineNo"> the line number for this record </param> /// <returns> a list of alleles, and a pair of the shortest and longest sequence </returns> protected internal static IList <Allele> parseAlleles(string reference, string alts, int lineNo) { IList <Allele> alleles = new List <Allele> (2); // we are almost always biallelic // ref checkAllele(reference, true, lineNo); Allele refAllele = Allele.Create(reference, true); alleles.Add(refAllele); if (alts.IndexOf(",") == -1) // only 1 alternatives, don't call string split { parseSingleAltAllele(alleles, alts, lineNo); } else { foreach (string alt in alts.Split(VCFConstants.COMMA_AS_CHAR_ARRAY, StringSplitOptions.RemoveEmptyEntries)) { parseSingleAltAllele(alleles, alt, lineNo); } } return(alleles); }