private static List <string> GetSignificances(XElement interpretations)
        {
            if (interpretations == null || interpretations.IsEmpty)
            {
                return(null);
            }

            var significanceList = new List <string>();

            foreach (var interpretation in interpretations.Elements(InterpretationTag))
            {
                var type = interpretation.Attribute(TypeTag)?.Value;
                if (type == null || type != "Clinical significance")
                {
                    continue;
                }

                var significanceString = interpretation.Element(DescriptionTag)?.Value.ToLower();
                if (significanceString == null)
                {
                    continue;
                }

                var significances = ClinVarCommon.GetSignificances(significanceString, null);
                foreach (var significance in significances)
                {
                    if (!ClinVarCommon.ValidPathogenicity.Contains(significance))
                    {
                        throw new InvalidDataException($"Invalid clinical significance found. Observed: {significance}");
                    }
                    significanceList.Add(significance);
                }
            }
            return(significanceList);
        }
Example #2
0
        public string GetJsonString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            jsonObject.AddStringValue("id", $"{_accession}.{_version}");
            jsonObject.AddStringValue("reviewStatus", ClinVarCommon.ReviewStatusStrings[_reviewStatus]);
            jsonObject.AddStringValues("significance", _significances);
            jsonObject.AddStringValue("refAllele", ClinVarCommon.NormalizeAllele(RefAllele));
            jsonObject.AddStringValue("altAllele", ClinVarCommon.NormalizeAllele(AltAllele));
            jsonObject.AddStringValue("lastUpdatedDate", _lastUpdatedDate.ToString("yyyy-MM-dd"));

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
Example #3
0
        private void GetClinicalSignificance(XElement xElement)
        {
            if (xElement == null || xElement.IsEmpty)
            {
                return;
            }

            _reviewStatus = xElement.Element(ReviewStatusTag)?.Value;
            var description = xElement.Element(DescriptionTag)?.Value;
            var explanation = xElement.Element(ExplanationTag)?.Value;

            _significances = ClinVarCommon.GetSignificances(description, explanation);

            ValidateSignificance(_significances);
        }