示例#1
0
        public string GetJsonString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            jsonObject.AddStringValue("chromosome", Chromosome.EnsemblName);
            jsonObject.AddIntValue("begin", Start);
            jsonObject.AddIntValue("end", End);
            jsonObject.AddStringValue("variantType", VariantType.ToString());

            jsonObject.AddStringValue("id", Id);
            jsonObject.AddIntValue("allAn", _allAlleleNumber);
            jsonObject.AddIntValue("allAc", _allAlleleCount);
            jsonObject.AddDoubleValue("allAf", _allAlleleFrequency, "0.######");
            jsonObject.AddDoubleValue("afrAf", _afrAlleleFrequency, "0.######");
            jsonObject.AddDoubleValue("amrAf", _amrAlleleFrequency, "0.######");
            jsonObject.AddDoubleValue("eurAf", _eurAlleleFrequency, "0.######");
            jsonObject.AddDoubleValue("easAf", _easAlleleFrequency, "0.######");
            jsonObject.AddDoubleValue("sasAf", _sasAlleleFrequency, "0.######");

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#2
0
        public string GetJsonString()
        {
            if (AnnotatedVariants == null || AnnotatedVariants.Length == 0)
            {
                return(null);
            }

            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            sb.Append(JsonObject.OpenBrace);

            var originalChromName = Position.VcfFields[0];

            jsonObject.AddStringValue("chromosome", originalChromName);
            jsonObject.AddIntValue("position", Position.Start);

            if (IsShortTandemRepeat())
            {
                jsonObject.AddStringValue("repeatUnit", Position.InfoData.RepeatUnit);
                jsonObject.AddIntValue("refRepeatCount", Position.InfoData.RefRepeatCount);
            }

            jsonObject.AddIntValue("svEnd", Position.InfoData.End);
            jsonObject.AddStringValue("refAllele", Position.RefAllele);
            jsonObject.AddStringValues("altAlleles", Position.AltAlleles);

            jsonObject.AddDoubleValue("quality", Position.Quality);

            jsonObject.AddStringValues("filters", Position.Filters);

            jsonObject.AddIntValues("ciPos", Position.InfoData.CiPos);
            jsonObject.AddIntValues("ciEnd", Position.InfoData.CiEnd);
            jsonObject.AddIntValue("svLength", Position.InfoData.SvLength);

            jsonObject.AddDoubleValue("strandBias", Position.InfoData.StrandBias, JsonCommon.FrequencyRoundingFormat);
            jsonObject.AddIntValue("jointSomaticNormalQuality", Position.InfoData.JointSomaticNormalQuality);
            jsonObject.AddDoubleValue("recalibratedQuality", Position.InfoData.RecalibratedQuality);
            jsonObject.AddIntValue("copyNumber", Position.InfoData.CopyNumber);
            jsonObject.AddBoolValue("colocalizedWithCnv", Position.InfoData.ColocalizedWithCnv);


            jsonObject.AddStringValue("cytogeneticBand", CytogeneticBand);

            if (Position.Samples != null && Position.Samples.Length > 0)
            {
                jsonObject.AddStringValues("samples", Position.Samples.Select(s => s.GetJsonString()), false);
            }

            if (SupplementaryIntervals != null && SupplementaryIntervals.Any())
            {
                AddSuppIntervalToJsonObject(jsonObject);
            }

            jsonObject.AddStringValues("variants", AnnotatedVariants.Select(v => v.GetJsonString(originalChromName)), false);

            sb.Append(JsonObject.CloseBrace);
            return(StringBuilderCache.GetStringAndRelease(sb));
        }
        private static string GetHeader(IProvider geneAnnotationProvider)
        {
            var sb         = new StringBuilder();
            var jsonObject = new JsonObject(sb);

            sb.Append(JsonObject.OpenBrace);
            jsonObject.AddStringValue("annotator", "Nirvana " + CommandLineUtilities.Version);
            jsonObject.AddStringValue("creationTime", Date.CurrentTimeStamp);
            jsonObject.AddIntValue("schemaVersion", SaCommon.SchemaVersion);
            jsonObject.AddObjectValues("dataSources", geneAnnotationProvider.DataSourceVersions);
            sb.Append(JsonObject.CloseBrace);

            return(sb.ToString());
        }
示例#4
0
        public void SerializeJson(StringBuilder sb)
        {
            var jsonObject = new JsonObject(sb);

            sb.Append(JsonObject.OpenBrace);
            jsonObject.AddStringValue("id", ID);
            jsonObject.AddStringValue("isAlleleSpecific", IsAlleleSpecific, false);
            jsonObject.AddStringValue("refAllele", RefAllele);
            jsonObject.AddStringValue("altAllele", AltAllele);
            jsonObject.AddStringValue("gene", Gene);
            jsonObject.AddIntValue("sampleCount", SampleCount);
            jsonObject.AddObjectValues("studies", Studies);
            sb.Append(JsonObject.CloseBrace);
        }
示例#5
0
        public string GetJsonString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            jsonObject.AddStringValue("chromosome", Chromosome.EnsemblName);
            jsonObject.AddIntValue("begin", Start);
            jsonObject.AddIntValue("end", End);
            jsonObject.AddStringValue("variantType", VariantType.ToString());

            jsonObject.AddStringValue("id", Id);
            jsonObject.AddIntValue("sampleSize", SampleSize);
            if (ObservedGains != 0)
            {
                jsonObject.AddIntValue("observedGains", ObservedGains);
            }
            if (ObservedLosses != 0)
            {
                jsonObject.AddIntValue("observedLosses", ObservedLosses);
            }
            jsonObject.AddDoubleValue("variantFreqAll", VariantFreqAll, "0.#####");

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#6
0
        public string GetJsonString()
        {
            var sb = StringBuilderCache.Acquire();

            var jsonObject = new JsonObject(sb);

            jsonObject.AddStringValue("id", Id);
            jsonObject.AddStringValue("refAllele", string.IsNullOrEmpty(RefAllele) ? "-" : RefAllele);
            jsonObject.AddStringValue("altAllele", SaUtilsCommon.ReverseSaReducedAllele(AltAllele));
            jsonObject.AddStringValue("gene", Gene);
            jsonObject.AddIntValue("sampleCount", SampleCount);

            jsonObject.AddStringValue("cancerTypesAndCounts", GetJsonStringFromDict("cancerType", GetCancerTypeCounts()), false);
            jsonObject.AddStringValue("cancerSitesAndCounts", GetJsonStringFromDict("cancerSite", GetTissueCounts()), false);

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#7
0
        public override string ToString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            sb.Append(JsonObject.OpenBrace);

            jsonObject.AddIntValue("mimNumber", MimNumber);
            jsonObject.AddStringValue("description", _description?.Replace(@"\'", @"'"));
            if (_phenotypes.Count > 0)
            {
                jsonObject.AddObjectValues("phenotypes", _phenotypes);
            }
            sb.Append(JsonObject.CloseBrace.ToString());

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#8
0
        public string GetJsonString()
        {
            var sb = StringBuilderCache.Acquire();

            var jsonObject = new JsonObject(sb);

            jsonObject.AddStringValue("id", Id);
            jsonObject.AddStringValue("isAlleleSpecific", IsAlleleSpecific, false);
            jsonObject.AddStringValue("refAllele", string.IsNullOrEmpty(ReferenceAllele) ? "-" : ReferenceAllele);
            jsonObject.AddStringValue("altAllele",
                                      SupplementaryAnnotationUtilities.ReverseSaReducedAllele(AlternateAllele));
            jsonObject.AddStringValue("gene", Gene);
            jsonObject.AddIntValue("sampleCount", SampleCount);

            jsonObject.AddStringValues("cancerTypes", GetJsonStrings(GetCancerTypeCounts()), false);
            jsonObject.AddStringValues("tissues", GetJsonStrings(GetTissueCounts()), false);

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#9
0
        public string GetJsonString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            sb.Append(JsonObject.OpenBrace);
            JsonSchema.TotalItems++;
            JsonSchema.CountKeyIfAdded(jsonObject.AddIntValue("mimNumber", _mimNumber), "mimNumber");
            JsonSchema.CountKeyIfAdded(jsonObject.AddStringValue("geneName", string.IsNullOrEmpty(_geneName) ? null : JsonConvert.SerializeObject(_geneName), false), "geneName");
            //Serialized string has the double quote at the beginning and the end
            JsonSchema.CountKeyIfAdded(jsonObject.AddStringValue("description", string.IsNullOrEmpty(_description) ? null : JsonConvert.SerializeObject(_description), false), "description");
            if (_phenotypes.Count > 0)
            {
                JsonSchema.CountKeyIfAdded(jsonObject.AddObjectValues("phenotypes", _phenotypes), "phenotypes");
            }
            sb.Append(JsonObject.CloseBrace);

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#10
0
        public string GetJsonString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            jsonObject.AddIntValue("coverage", Coverage);
            if (HasFailedFilters)
            {
                jsonObject.AddBoolValue("failedFilter", true);
            }
            if (IsLowComplexityRegion)
            {
                jsonObject.AddBoolValue("lowComplexityRegion", true);
            }

            jsonObject.AddStringValue("allAf", ComputingUtilities.ComputeFrequency(AllAlleleNumber, AllAlleleCount), false);
            jsonObject.AddIntValue("allAn", AllAlleleNumber);
            jsonObject.AddIntValue("allAc", AllAlleleCount);
            jsonObject.AddIntValue("allHc", AllHomCount);

            jsonObject.AddStringValue("afrAf", ComputingUtilities.ComputeFrequency(AfrAlleleNumber, AfrAlleleCount), false);
            jsonObject.AddIntValue("afrAn", AfrAlleleNumber);
            jsonObject.AddIntValue("afrAc", AfrAlleleCount);
            jsonObject.AddIntValue("afrHc", AfrHomCount);

            jsonObject.AddStringValue("amrAf", ComputingUtilities.ComputeFrequency(AmrAlleleNumber, AmrAlleleCount), false);
            jsonObject.AddIntValue("amrAn", AmrAlleleNumber);
            jsonObject.AddIntValue("amrAc", AmrAlleleCount);
            jsonObject.AddIntValue("amrHc", AmrHomCount);

            jsonObject.AddStringValue("easAf", ComputingUtilities.ComputeFrequency(EasAlleleNumber, EasAlleleCount), false);
            jsonObject.AddIntValue("easAn", EasAlleleNumber);
            jsonObject.AddIntValue("easAc", EasAlleleCount);
            jsonObject.AddIntValue("easHc", EasHomCount);

            jsonObject.AddStringValue("finAf", ComputingUtilities.ComputeFrequency(FinAlleleNumber, FinAlleleCount), false);
            jsonObject.AddIntValue("finAn", FinAlleleNumber);
            jsonObject.AddIntValue("finAc", FinAlleleCount);
            jsonObject.AddIntValue("finHc", FinHomCount);

            jsonObject.AddStringValue("nfeAf", ComputingUtilities.ComputeFrequency(NfeAlleleNumber, NfeAlleleCount), false);
            jsonObject.AddIntValue("nfeAn", NfeAlleleNumber);
            jsonObject.AddIntValue("nfeAc", NfeAlleleCount);
            jsonObject.AddIntValue("nfeHc", NfeHomCount);

            jsonObject.AddStringValue("asjAf", ComputingUtilities.ComputeFrequency(AsjAlleleNumber, AsjAlleleCount), false);
            jsonObject.AddIntValue("asjAn", AsjAlleleNumber);
            jsonObject.AddIntValue("asjAc", AsjAlleleCount);
            jsonObject.AddIntValue("asjHc", AsjHomCount);

            jsonObject.AddStringValue("sasAf", ComputingUtilities.ComputeFrequency(SasAlleleNumber, SasAlleleCount), false);
            jsonObject.AddIntValue("sasAn", SasAlleleNumber);
            jsonObject.AddIntValue("sasAc", SasAlleleCount);
            jsonObject.AddIntValue("sasHc", SasHomCount);

            jsonObject.AddStringValue("othAf", ComputingUtilities.ComputeFrequency(OthAlleleNumber, OthAlleleCount), false);
            jsonObject.AddIntValue("othAn", OthAlleleNumber);
            jsonObject.AddIntValue("othAc", OthAlleleCount);
            jsonObject.AddIntValue("othHc", OthHomCount);

            jsonObject.AddStringValue("maleAf", ComputingUtilities.ComputeFrequency(MaleAlleleNumber, MaleAlleleCount), false);
            jsonObject.AddIntValue("maleAn", MaleAlleleNumber);
            jsonObject.AddIntValue("maleAc", MaleAlleleCount);
            jsonObject.AddIntValue("maleHc", MaleHomCount);

            jsonObject.AddStringValue("femaleAf", ComputingUtilities.ComputeFrequency(FemaleAlleleNumber, FemaleAlleleCount), false);
            jsonObject.AddIntValue("femaleAn", FemaleAlleleNumber);
            jsonObject.AddIntValue("femaleAc", FemaleAlleleCount);
            jsonObject.AddIntValue("femaleHc", FemaleHomCount);

            //controls
            //jsonObject.AddIntValue("controlsCoverage", ControlsCoverage);
            jsonObject.AddStringValue("controlsAllAf", ComputingUtilities.ComputeFrequency(ControlsAllAlleleNumber, ControlsAllAlleleCount), false);
            jsonObject.AddIntValue("controlsAllAn", ControlsAllAlleleNumber);
            jsonObject.AddIntValue("controlsAllAc", ControlsAllAlleleCount);

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#11
0
        public override string ToString()
        {
            // return if this is a reference site
            // ReSharper disable once AssignNullToNotNullAttribute
            if (!AnnotatedAlternateAlleles.Any())
            {
                return(null);
            }

            var sb         = new StringBuilder();
            var jsonObject = new JsonObject(sb);

            if (NeedsVariantComma)
            {
                sb.Append(JsonObject.Comma);
                sb.Append('\n');
            }
            else
            {
                NeedsVariantComma = true;
            }

            // data section
            sb.Append(JsonObject.OpenBrace);

            // ==========
            // positional
            // ==========

            jsonObject.AddStringValue(ChromosomeTag, ReferenceName);
            jsonObject.AddStringValue(RefAlleleTag, ReferenceAllele);
            jsonObject.AddIntValue(PositionTag, ReferenceBegin);
            jsonObject.AddStringValues("ciPos", CiPos, false);
            jsonObject.AddStringValues("ciEnd", CiEnd, false);
            jsonObject.AddIntValue("svLength", SvLength);

            jsonObject.AddStringValue("quality", Quality, false);
            jsonObject.AddStringValues("filters", Filters);
            jsonObject.AddStringValues("altAlleles", AlternateAlleles);
            jsonObject.AddStringValue("strandBias", StrandBias, false);
            jsonObject.AddStringValue("jointSomaticNormalQuality", JointSomaticNormalQuality, false);
            jsonObject.AddStringValue("recalibratedQuality", RecalibratedQuality, false);
            jsonObject.AddStringValue("copyNumber", CopyNumber, false);

            jsonObject.AddStringValue("cytogeneticBand", CytogeneticBand);
            jsonObject.AddBoolValue("colocalizedWithCnv", ColocalizedWithCnv, true, TrueTag);

            if (AnnotatedSamples != null)
            {
                jsonObject.AddStringValues(SamplesTag, AnnotatedSamples.Select(s => s.ToString()).ToArray(), false);
            }

            if (SupplementaryIntervals != null && SupplementaryIntervals.Any())
            {
                jsonObject.AddStringValues(StructuralVariantsTag, SupplementaryIntervals.Select(s => s.ToString()).ToArray(), false);
            }

            jsonObject.AddStringValues(VariantsTag, AnnotatedAlternateAlleles.Select(v => v.ToString()).ToArray(), false);

            sb.Append(JsonObject.CloseBrace.ToString());
            return(sb.ToString());
        }
示例#12
0
        public string GetJsonString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            jsonObject.AddStringValue("ancestralAllele", AncestralAllele);
            jsonObject.AddStringValue("allAf", ComputingUtilities.ComputeFrequency(AllAlleleNumber, AllAlleleCount), false);
            jsonObject.AddStringValue("afrAf", ComputingUtilities.ComputeFrequency(AfrAlleleNumber, AfrAlleleCount), false);
            jsonObject.AddStringValue("amrAf", ComputingUtilities.ComputeFrequency(AmrAlleleNumber, AmrAlleleCount), false);
            jsonObject.AddStringValue("easAf", ComputingUtilities.ComputeFrequency(EasAlleleNumber, EasAlleleCount), false);
            jsonObject.AddStringValue("eurAf", ComputingUtilities.ComputeFrequency(EurAlleleNumber, EurAlleleCount), false);
            jsonObject.AddStringValue("sasAf", ComputingUtilities.ComputeFrequency(SasAlleleNumber, SasAlleleCount), false);

            if (AllAlleleNumber != null)
            {
                jsonObject.AddIntValue("allAn", AllAlleleNumber.Value);
            }
            if (AfrAlleleNumber != null)
            {
                jsonObject.AddIntValue("afrAn", AfrAlleleNumber.Value);
            }
            if (AmrAlleleNumber != null)
            {
                jsonObject.AddIntValue("amrAn", AmrAlleleNumber.Value);
            }
            if (EasAlleleNumber != null)
            {
                jsonObject.AddIntValue("easAn", EasAlleleNumber.Value);
            }
            if (EurAlleleNumber != null)
            {
                jsonObject.AddIntValue("eurAn", EurAlleleNumber.Value);
            }
            if (SasAlleleNumber != null)
            {
                jsonObject.AddIntValue("sasAn", SasAlleleNumber.Value);
            }

            if (AllAlleleCount != null)
            {
                jsonObject.AddIntValue("allAc", AllAlleleCount.Value);
            }
            if (AfrAlleleCount != null)
            {
                jsonObject.AddIntValue("afrAc", AfrAlleleCount.Value);
            }
            if (AmrAlleleCount != null)
            {
                jsonObject.AddIntValue("amrAc", AmrAlleleCount.Value);
            }
            if (EasAlleleCount != null)
            {
                jsonObject.AddIntValue("easAc", EasAlleleCount.Value);
            }
            if (EurAlleleCount != null)
            {
                jsonObject.AddIntValue("eurAc", EurAlleleCount.Value);
            }
            if (SasAlleleCount != null)
            {
                jsonObject.AddIntValue("sasAc", SasAlleleCount.Value);
            }

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#13
0
        public string GetJsonString(string originalChromName)
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            // data section
            sb.Append(JsonObject.OpenBrace);

            jsonObject.AddStringValue("vid", Variant.VariantId);
            jsonObject.AddStringValue("chromosome", originalChromName);
            jsonObject.AddIntValue("begin", Variant.Start);
            jsonObject.AddIntValue("end", Variant.End);
            jsonObject.AddBoolValue("isReferenceMinorAllele", Variant.IsRefMinor);

            if (!Variant.IsRefMinor)
            {
                jsonObject.AddStringValue("refAllele",
                                          string.IsNullOrEmpty(Variant.RefAllele) ? "-" : Variant.RefAllele);
                jsonObject.AddStringValue("altAllele",
                                          string.IsNullOrEmpty(Variant.AltAllele) ? "-" : Variant.AltAllele);
            }
            else
            {
                jsonObject.AddStringValue("refAllele",
                                          string.IsNullOrEmpty(Variant.AltAllele) ? "-" : Variant.AltAllele);
            }

            var variantType = GetVariantType(Variant.Type);

            jsonObject.AddStringValue("variantType", variantType.ToString());
            jsonObject.AddBoolValue("isDecomposedVariant", Variant.IsDecomposed);
            if (variantType.ToString() != "SNV")
            {
                jsonObject.AddBoolValue("isRecomposedVariant", Variant.IsRecomposed);
            }
            jsonObject.AddStringValue("hgvsg", HgvsgNotation);

            jsonObject.AddDoubleValue("phylopScore", PhylopScore);

            if (RegulatoryRegions?.Count > 0)
            {
                jsonObject.AddObjectValues("regulatoryRegions", RegulatoryRegions);
            }
            if (SupplementaryAnnotations.Count > 0)
            {
                AddSAstoJsonObject(jsonObject);
            }
            foreach (var pluginData in PluginDataSet)
            {
                jsonObject.AddStringValue(pluginData.Name, pluginData.GetJsonString(), false);
            }

            if (OverlappingGenes.Count > 0)
            {
                jsonObject.AddStringValues("overlappingGenes", OverlappingGenes);
            }
            if (OverlappingTranscripts.Count > 0)
            {
                jsonObject.AddObjectValues("overlappingTranscripts", OverlappingTranscripts);
            }

            if (EnsemblTranscripts?.Count > 0 || RefSeqTranscripts?.Count > 0)
            {
                jsonObject.AddGroupedObjectValues("transcripts", TranscriptLabels, RefSeqTranscripts, EnsemblTranscripts);
            }

            sb.Append(JsonObject.CloseBrace);
            return(StringBuilderCache.GetStringAndRelease(sb));
        }
示例#14
0
        /// <summary>
        /// returns a string representation of our variant
        /// </summary>
        public override string ToString()
        {
            var sb         = new StringBuilder();
            var jsonObject = new JsonObject(sb);

            // data section
            sb.Append(JsonObject.OpenBrace);

            // ==========
            // positional
            // ==========

            jsonObject.AddStringValue(AncestralAlleleTag, AncestralAllele);

            if (!IsReferenceMinor)
            {
                jsonObject.AddStringValue(AltAlleleTag, string.IsNullOrEmpty(AltAllele) ? "-" : AltAllele);
                jsonObject.AddStringValue(RefAlleleTag, string.IsNullOrEmpty(RefAllele) ? "-" : RefAllele);
            }
            else
            {
                jsonObject.AddStringValue(RefAlleleTag, string.IsNullOrEmpty(RefAllele) ? "-" : RefAllele);
            }

            jsonObject.AddIntValue(BeginTag, ReferenceBegin);
            jsonObject.AddStringValue(ChromosomeTag, ReferenceName);

            jsonObject.AddStringValue(PhylopScoreTag, PhylopScore, false);
            jsonObject.AddStringValues(DbsnpTag, DbSnpIds);
            jsonObject.AddIntValue(EndTag, ReferenceEnd);
            jsonObject.AddStringValue(GlobalMinorAlleleTag, GlobalMinorAllele);
            jsonObject.AddStringValue(GmafTag, GlobalMinorAlleleFrequency, false);
            jsonObject.AddBoolValue(IsReferenceMinorAlleleTag, true, IsReferenceMinor, "true");
            jsonObject.AddStringValue(VariantTypeTag, VariantType);
            jsonObject.AddStringValue(VidTag, VariantId);

            // regulatory regions
            if (RegulatoryRegions.Count > 0)
            {
                jsonObject.AddObjectValues(RegulatoryRegionsTag, RegulatoryRegions);
            }

            // ClinVar & COSMIC
            if (ClinVarEntries.Count > 0)
            {
                jsonObject.AddObjectValues(ClinVarTag, ClinVarEntries);
            }
            if (CosmicEntries.Count > 0)
            {
                jsonObject.AddObjectValues(CosmicTag, CosmicEntries);
            }
            // Custom annotations
            if (CustomItems.Count > 0)
            {
                AddCustomeItems(jsonObject);
            }

            // Custom Intervals
            // if (CustomIntervals.Count > 0) jsonObject.AddObjectValues(CustomIntervals[0].Type, CustomIntervals);
            if (CustomIntervals.Count > 0)
            {
                AddCustomeIntervals(jsonObject);
            }


            // =================
            // Overlapping Genes
            // =================

            if (OverlappingGenes.Count > 0)
            {
                jsonObject.AddStringValues(OverlappingGenesTag, OverlappingGenes.ToArray());
            }

            // =================
            // Overlapping Transcripts
            // =================
            if (SvOverlappingTranscripts.Any())
            {
                jsonObject.AddObjectValues(OverlappingTranscriptsTag, SvOverlappingTranscripts);
            }

            // ==========
            // transcript
            // ==========

            var hasRefSeq  = RefSeqTranscripts.Any();
            var hasEnsembl = EnsemblTranscripts.Any();

            if (hasRefSeq || hasEnsembl)
            {
                jsonObject.OpenObject(TranscriptsTag);
                jsonObject.Reset();

                if (hasRefSeq)
                {
                    jsonObject.AddStringValues(RefseqTag, RefSeqTranscripts.Select(t => t.ToString()), false);
                }
                if (hasEnsembl)
                {
                    jsonObject.AddStringValues(EnsemblTag, EnsemblTranscripts.Select(t => t.ToString()), false);
                }

                jsonObject.CloseObject();
            }

            // =======
            // allelic
            // =======

            jsonObject.Reset(true);

            jsonObject.AddStringValue(OneKgAllTag, AlleleFrequencyAll, false);
            jsonObject.AddStringValue(OneKgAfrTag, AlleleFrequencyAfrican, false);
            jsonObject.AddStringValue(OneKgAmrTag, AlleleFrequencyAdMixedAmerican, false);
            jsonObject.AddStringValue(OneKgEasTag, AlleleFrequencyEastAsian, false);
            jsonObject.AddStringValue(OneKgEurTag, AlleleFrequencyEuropean, false);
            jsonObject.AddStringValue(OneKgSasTag, AlleleFrequencySouthAsian, false);


            jsonObject.AddStringValue(OneKgAllAnTag, OneKgAlleleNumberAll, false);
            jsonObject.AddStringValue(OneKgAfrAnTag, OneKgAlleleNumberAfrican, false);
            jsonObject.AddStringValue(OneKgAmrAnTag, OneKgAlleleNumberAmerican, false);
            jsonObject.AddStringValue(OneKgEasAnTag, OneKgAlleleNumberEastAsian, false);
            jsonObject.AddStringValue(OneKgEurAnTag, OneKgAlleleNumberEuropean, false);
            jsonObject.AddStringValue(OneKgSasAnTag, OneKgAlleleNumberSouthAsian, false);

            jsonObject.AddStringValue(OneKgAllAcTag, OneKgAlleleCountAll, false);
            jsonObject.AddStringValue(OneKgAfrAcTag, OneKgAlleleCountAfrican, false);
            jsonObject.AddStringValue(OneKgAmrAcTag, OneKgAlleleCountAmerican, false);
            jsonObject.AddStringValue(OneKgEasAcTag, OneKgAlleleCountEastAsian, false);
            jsonObject.AddStringValue(OneKgEurAcTag, OneKgAlleleCountEuropean, false);
            jsonObject.AddStringValue(OneKgSasAcTag, OneKgAlleleCountSouthAsian, false);


            jsonObject.AddStringValue(EvsCoverageTag, EvsCoverage, false);
            jsonObject.AddStringValue(EvsSamplesTag, EvsSamples, false);
            jsonObject.AddStringValue(EvsAllTag, EvsAlleleFrequencyAll, false);
            jsonObject.AddStringValue(EvsAfrTag, EvsAlleleFrequencyAfricanAmerican, false);
            jsonObject.AddStringValue(EvsEurTag, EvsAlleleFrequencyEuropeanAmerican, false);


            jsonObject.AddStringValue(ExacCoverageTag, ExacCoverage, false);
            jsonObject.AddStringValue(ExacAllTag, ExacAlleleFrequencyAll, false);
            jsonObject.AddStringValue(ExacAfrTag, ExacAlleleFrequencyAfrican, false);
            jsonObject.AddStringValue(ExacAmrTag, ExacAlleleFrequencyAmerican, false);
            jsonObject.AddStringValue(ExacEasTag, ExacAlleleFrequencyEastAsian, false);
            jsonObject.AddStringValue(ExacFinTag, ExacAlleleFrequencyFinish, false);
            jsonObject.AddStringValue(ExacNfeTag, ExacAlleleFrequencyNonFinish, false);
            jsonObject.AddStringValue(ExacOthTag, ExacAlleleFrequencyOther, false);
            jsonObject.AddStringValue(ExacSasTag, ExacAlleleFrequencySouthAsian, false);

            jsonObject.AddStringValue(ExacAllAnTag, ExacAlleleNumberAll, false);
            jsonObject.AddStringValue(ExacAfrAnTag, ExacAlleleNumberAfrican, false);
            jsonObject.AddStringValue(ExacAmrAnTag, ExacAlleleNumberAmerican, false);
            jsonObject.AddStringValue(ExacEasAnTag, ExacAlleleNumberEastAsian, false);
            jsonObject.AddStringValue(ExacFinAnTag, ExacAlleleNumberFinish, false);
            jsonObject.AddStringValue(ExacNfeAnTag, ExacAlleleNumberNonFinish, false);
            jsonObject.AddStringValue(ExacOthAnTag, ExacAlleleNumberOther, false);
            jsonObject.AddStringValue(ExacSasAnTag, ExacAlleleNumberSouthAsian, false);

            jsonObject.AddStringValue(ExacAllAcTag, ExacAlleleCountAll, false);
            jsonObject.AddStringValue(ExacAfrAcTag, ExacAlleleCountAfrican, false);
            jsonObject.AddStringValue(ExacAmrAcTag, ExacAlleleCountAmerican, false);
            jsonObject.AddStringValue(ExacEasAcTag, ExacAlleleCountEastAsian, false);
            jsonObject.AddStringValue(ExacFinAcTag, ExacAlleleCountFinish, false);
            jsonObject.AddStringValue(ExacNfeAcTag, ExacAlleleCountNonFinish, false);
            jsonObject.AddStringValue(ExacOthAcTag, ExacAlleleCountOther, false);
            jsonObject.AddStringValue(ExacSasAcTag, ExacAlleleCountSouthAsian, false);
            sb.Append(JsonObject.CloseBrace);
            return(sb.ToString());
        }
示例#15
0
        public string GetJsonString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            jsonObject.AddIntValue("coverage", Coverage);
            jsonObject.AddStringValue("allAf", ComputingUtilities.ComputeFrequency(AllAlleleNumber, AllAlleleCount), false);
            jsonObject.AddStringValue("afrAf", ComputingUtilities.ComputeFrequency(AfrAlleleNumber, AfrAlleleCount), false);
            jsonObject.AddStringValue("amrAf", ComputingUtilities.ComputeFrequency(AmrAlleleNumber, AmrAlleleCount), false);
            jsonObject.AddStringValue("easAf", ComputingUtilities.ComputeFrequency(EasAlleleNumber, EasAlleleCount), false);
            jsonObject.AddStringValue("finAf", ComputingUtilities.ComputeFrequency(FinAlleleNumber, FinAlleleCount), false);
            jsonObject.AddStringValue("nfeAf", ComputingUtilities.ComputeFrequency(NfeAlleleNumber, NfeAlleleCount), false);
            jsonObject.AddStringValue("sasAf", ComputingUtilities.ComputeFrequency(SasAlleleNumber, SasAlleleCount), false);
            jsonObject.AddStringValue("othAf", ComputingUtilities.ComputeFrequency(OthAlleleNumber, OthAlleleCount), false);

            if (AllAlleleNumber != null)
            {
                jsonObject.AddIntValue("allAn", AllAlleleNumber.Value);
            }
            if (AfrAlleleNumber != null)
            {
                jsonObject.AddIntValue("afrAn", AfrAlleleNumber.Value);
            }
            if (AmrAlleleNumber != null)
            {
                jsonObject.AddIntValue("amrAn", AmrAlleleNumber.Value);
            }
            if (EasAlleleNumber != null)
            {
                jsonObject.AddIntValue("easAn", EasAlleleNumber.Value);
            }
            if (FinAlleleNumber != null)
            {
                jsonObject.AddIntValue("finAn", FinAlleleNumber.Value);
            }
            if (NfeAlleleNumber != null)
            {
                jsonObject.AddIntValue("nfeAn", NfeAlleleNumber.Value);
            }
            if (SasAlleleNumber != null)
            {
                jsonObject.AddIntValue("sasAn", SasAlleleNumber.Value);
            }
            if (OthAlleleNumber != null)
            {
                jsonObject.AddIntValue("othAn", OthAlleleNumber.Value);
            }

            if (AllAlleleCount != null)
            {
                jsonObject.AddIntValue("allAc", AllAlleleCount.Value);
            }
            if (AfrAlleleCount != null)
            {
                jsonObject.AddIntValue("afrAc", AfrAlleleCount.Value);
            }
            if (AmrAlleleCount != null)
            {
                jsonObject.AddIntValue("amrAc", AmrAlleleCount.Value);
            }
            if (EasAlleleCount != null)
            {
                jsonObject.AddIntValue("easAc", EasAlleleCount.Value);
            }
            if (FinAlleleCount != null)
            {
                jsonObject.AddIntValue("finAc", FinAlleleCount.Value);
            }
            if (NfeAlleleCount != null)
            {
                jsonObject.AddIntValue("nfeAc", NfeAlleleCount.Value);
            }
            if (SasAlleleCount != null)
            {
                jsonObject.AddIntValue("sasAc", SasAlleleCount.Value);
            }
            if (OthAlleleCount != null)
            {
                jsonObject.AddIntValue("othAc", OthAlleleCount.Value);
            }

            return(StringBuilderCache.GetStringAndRelease(sb));
        }