private static string ExtractDbId(IAnnotatedVariant annotatedVariant, string idField) { var dbSnp = new VcfField(); var nonDbsnpIds = GetNonDbsnpIds(idField); if (nonDbsnpIds != null) { foreach (var nonDbsnpId in nonDbsnpIds) { dbSnp.Add(nonDbsnpId); } } foreach (var altAllele in annotatedVariant.AnnotatedAlternateAlleles) { if (altAllele.DbSnpIds == null) { continue; } foreach (var id in altAllele.DbSnpIds) { dbSnp.Add(id); } } return(dbSnp.GetString("")); }
public void EmptyDbSnp() { var dbSnpField = new VcfField(); var expected = "."; var observed = dbSnpField.GetString(""); Assert.Equal(expected, observed); }
private void AddInfoField(string infoField, IAnnotatedVariant annotatedVariant, StringBuilder sb) { var infoEntries = new VcfField(); if (!string.IsNullOrEmpty(infoField)) { infoEntries.Add(infoField); } ExtractInfo(annotatedVariant as UnifiedJson, infoEntries); infoField = infoEntries.GetString(""); // remove . if (infoField == ".") { infoField = ""; } sb.Append(infoField); var csqs = new List <CsqEntry>(); ExtractCsqs(annotatedVariant as UnifiedJson, csqs); if (csqs.Count != 0) { if (infoField.Length > 0) { sb.Append(";"); } } // append CSQ tags using delegate from annotator sb.Append(GetCsqtAndCsqrVcfInfo(csqs)); if (csqs.Count == 0 && infoField.Length == 0) { sb.Append("."); } }