コード例 #1
0
ファイル: OneKGenItem.cs プロジェクト: zhouhufeng/Nirvana
        public string GetVcfString()
        {
            var freq = ComputingUtilities.ComputeFrequency(AllAlleleNumber, AllAlleleCount) ?? "";
            var ancestralAlleleString = AncestralAllele ?? "";

            return(freq + ";" + ancestralAlleleString);
        }
コード例 #2
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);

            jsonObject.AddIntValue("allAn", AllAlleleNumber);
            jsonObject.AddIntValue("afrAn", AfrAlleleNumber);
            jsonObject.AddIntValue("amrAn", AmrAlleleNumber);
            jsonObject.AddIntValue("easAn", EasAlleleNumber);
            jsonObject.AddIntValue("eurAn", EurAlleleNumber);
            jsonObject.AddIntValue("sasAn", SasAlleleNumber);

            jsonObject.AddIntValue("allAc", AllAlleleCount);
            jsonObject.AddIntValue("afrAc", AfrAlleleCount);
            jsonObject.AddIntValue("amrAc", AmrAlleleCount);
            jsonObject.AddIntValue("easAc", EasAlleleCount);
            jsonObject.AddIntValue("eurAc", EurAlleleCount);
            jsonObject.AddIntValue("sasAc", SasAlleleCount);

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
コード例 #3
0
        public string GetJsonString()
        {
            var sb         = StringBuilderCache.Acquire();
            var jsonObject = new JsonObject(sb);

            jsonObject.AddIntValue("coverage", Coverage);
            if (HasFailedFilters)
            {
                jsonObject.AddBoolValue("failedFilter", 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);

            return(StringBuilderCache.GetStringAndRelease(sb));
        }
コード例 #4
0
        public GnomadItem(IChromosome chromosome,
                          int position,
                          string refAllele,
                          string alternateAllele,
                          int?depth,
                          int?allAlleleNumber, int?afrAlleleNumber, int?amrAlleleNumber, int?easAlleleNumber,
                          int?finAlleleNumber, int?nfeAlleleNumber, int?othAlleleNumber, int?asjAlleleNumber, int?sasAlleleNumber,
                          int?allAlleleCount, int?afrAlleleCount, int?amrAlleleCount, int?easAlleleCount, int?finAlleleCount, int?nfeAlleleCount, int?othAlleleCount, int?asjAlleleCount, int?sasAlleleCount,
                          int?allHomCount, int?afrHomCount, int?amrHomCount, int?easHomCount,
                          int?finHomCount, int?nfeHomCount, int?othHomCount, int?asjHomCount, int?sasHomCount,
                          bool hasFailedFilters)
        {
            Chromosome      = chromosome;
            Start           = position;
            ReferenceAllele = refAllele;
            AlternateAllele = alternateAllele;

            if (depth != null && allAlleleNumber != null)
            {
                Coverage = ComputingUtilities.GetCoverage(depth.Value, allAlleleNumber.Value);
            }

            AllAlleleNumber = allAlleleNumber;
            AfrAlleleNumber = afrAlleleNumber;
            AmrAlleleNumber = amrAlleleNumber;
            EasAlleleNumber = easAlleleNumber;
            FinAlleleNumber = finAlleleNumber;
            NfeAlleleNumber = nfeAlleleNumber;
            OthAlleleNumber = othAlleleNumber;
            AsjAlleleNumber = asjAlleleNumber;
            SasAlleleNumber = sasAlleleNumber;

            AllAlleleCount = allAlleleCount;
            AfrAlleleCount = afrAlleleCount;
            AmrAlleleCount = amrAlleleCount;
            EasAlleleCount = easAlleleCount;
            FinAlleleCount = finAlleleCount;
            NfeAlleleCount = nfeAlleleCount;
            OthAlleleCount = othAlleleCount;
            AsjAlleleCount = asjAlleleCount;
            SasAlleleCount = sasAlleleCount;

            AllHomCount = allHomCount;
            AfrHomCount = afrHomCount;
            AmrHomCount = amrHomCount;
            EasHomCount = easHomCount;
            FinHomCount = finHomCount;
            NfeHomCount = nfeHomCount;
            OthHomCount = othHomCount;
            AsjHomCount = asjHomCount;
            SasHomCount = sasHomCount;

            HasFailedFilters = hasFailedFilters;

            RemoveAlleleNumberZero();
        }
コード例 #5
0
ファイル: TopMedItem.cs プロジェクト: wangdi2014/Nirvana
        public string GetJsonString()
        {
            var sb         = new StringBuilder();
            var jsonObject = new JsonObject(sb);

            jsonObject.AddStringValue("allAf", ComputingUtilities.ComputeFrequency(_alleleNum, _alleleCount), false);
            jsonObject.AddIntValue("allAn", _alleleNum);
            jsonObject.AddIntValue("allAc", _alleleCount);
            jsonObject.AddIntValue("allHc", _homCount);
            if (_failedFilter)
            {
                jsonObject.AddBoolValue("failedFilter", true);
            }

            return(sb.ToString());
        }
コード例 #6
0
        public GnomadItem(IChromosome chromosome,
                          int position,
                          string refAllele,
                          string alternateAllele,
                          int?depth,
                          int?allAlleleNumber, int?afrAlleleNumber, int?amrAlleleNumber, int?easAlleleNumber,
                          int?finAlleleNumber, int?nfeAlleleNumber, int?othAlleleNumber, int?asjAlleleNumber, int?sasAlleleNumber,
                          int?maleAlleleNumber, int?femaleAlleleNumber,
                          int?allAlleleCount, int?afrAlleleCount, int?amrAlleleCount, int?easAlleleCount, int?finAlleleCount, int?nfeAlleleCount, int?othAlleleCount, int?asjAlleleCount, int?sasAlleleCount,
                          int?maleAlleleCount, int?femaleAlleleCount,
                          int?allHomCount, int?afrHomCount, int?amrHomCount, int?easHomCount,
                          int?finHomCount, int?nfeHomCount, int?othHomCount, int?asjHomCount, int?sasHomCount,
                          int?maleHomCount, int?femaleHomCount,
                          int?controlsAllAlleleNumber,
                          int?controlsAllAlleleCount,
                          bool hasFailedFilters,
                          bool isLcr,
                          GnomadDataType dataType)
        {
            Chromosome = chromosome;
            Position   = position;
            RefAllele  = refAllele;
            AltAllele  = alternateAllele;

            Depth = depth;
            if (depth != null && allAlleleNumber != null && allAlleleNumber.Value > 0)
            {
                Coverage = ComputingUtilities.GetCoverage(depth.Value, allAlleleNumber.Value);
            }

            AllAlleleNumber = allAlleleNumber;
            AfrAlleleNumber = afrAlleleNumber;
            AmrAlleleNumber = amrAlleleNumber;
            EasAlleleNumber = easAlleleNumber;
            FinAlleleNumber = finAlleleNumber;
            NfeAlleleNumber = nfeAlleleNumber;
            OthAlleleNumber = othAlleleNumber;
            AsjAlleleNumber = asjAlleleNumber;
            SasAlleleNumber = sasAlleleNumber;

            MaleAlleleNumber   = maleAlleleNumber;
            FemaleAlleleNumber = femaleAlleleNumber;
            MaleHomCount       = maleHomCount;

            AllAlleleCount = allAlleleCount;
            AfrAlleleCount = afrAlleleCount;
            AmrAlleleCount = amrAlleleCount;
            EasAlleleCount = easAlleleCount;
            FinAlleleCount = finAlleleCount;
            NfeAlleleCount = nfeAlleleCount;
            OthAlleleCount = othAlleleCount;
            AsjAlleleCount = asjAlleleCount;
            SasAlleleCount = sasAlleleCount;

            MaleAlleleCount   = maleAlleleCount;
            FemaleAlleleCount = femaleAlleleCount;
            FemaleHomCount    = femaleHomCount;

            AllHomCount = allHomCount;
            AfrHomCount = afrHomCount;
            AmrHomCount = amrHomCount;
            EasHomCount = easHomCount;
            FinHomCount = finHomCount;
            NfeHomCount = nfeHomCount;
            OthHomCount = othHomCount;
            AsjHomCount = asjHomCount;
            SasHomCount = sasHomCount;

            //controls
            ControlsAllAlleleNumber = controlsAllAlleleNumber;
            ControlsAllAlleleCount  = controlsAllAlleleCount;

            HasFailedFilters      = hasFailedFilters;
            IsLowComplexityRegion = isLcr;
            DataType = dataType;

            RemoveAlleleNumberZero();
        }
コード例 #7
0
ファイル: ExacItem.cs プロジェクト: zhouhufeng/Nirvana
        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));
        }