示例#1
0
        private void SetDetailTabSequence(Sample s, char type, string segment, int splitIdx, ref ResultsTabProperties tabProperty)
        {
            var dbValueObj = s.GetType()
                             .GetProperty(type + "_" + segment)            // A_HA に コンセンサス配列が入って居る
                             .GetValue(s);
            var dbValue = dbValueObj == null ? string.Empty : dbValueObj.ToString();
            var seqs    = dbValue.Split(ConstantValues.DbDelimiter);

            var detailseq = seqs.Length < 3 ? string.Empty :  seqs.ElementAt(splitIdx).ToUpper();

            tabProperty.GetType()
            .GetProperty(segment + detailTabSequence)                     // HAseq
            .SetValue(tabProperty, detailseq);

            // inc-N
            var nuc  = detailseq.TrimStart(nucleotideN).TrimEnd(nucleotideN);
            var incN = nuc.Contains(nucleotideN) ? nucleotideN.ToString() : string.Empty;

            // var nucChars = "[^AGCTN]";
            var altNucsMath = Regex.Matches(nuc, @"[^AGCTN]"); // IUPAC のときはR 表示?

            incN += altNucsMath.Any() ?  "R" : string.Empty;
            tabProperty.GetType()
            .GetProperty(segment + detailTabIncludeN)                     // HAinc
            .SetValue(tabProperty, incN);

            // tablet 起動時のパラメータ
            tabProperty.GetType()
            .GetProperty(segment + detailTabAlign)                                                                               // HAalign
            .SetValue(tabProperty,
                      type + ConstantValues.ViewDelimiter + segment + ConstantValues.ViewDelimiter + (splitIdx + 1).ToString()); // A-HA-1
        }
示例#2
0
        private void SetDetailTab(Sample s, char type, string segment, KeyValuePair <string, string> divid, int splitIdx, ref ResultsTabProperties tabProperty)
        {
            // Sample Property ; COVER_RATIO_A_HA とか
            var dbPropartyName = divid.Value + type + "_" + segment; // COVER_RATIO_A_HA とか
            var dbValueObj     = s.GetType().GetProperty(dbPropartyName).GetValue(s);
            var dbValue        = dbValueObj == null ? string.Empty : dbValueObj.ToString();

            if (string.IsNullOrEmpty(dbValue) ||
                dbValue.Split(ConstantValues.DbDelimiter).Length <= splitIdx ||
                string.IsNullOrEmpty(dbValue.Split(ConstantValues.DbDelimiter).ElementAt(splitIdx)) ||
                dbValue.Split(ConstantValues.DbDelimiter).ElementAt(splitIdx) == "0")
            {  // DB の中に 値を持っていない。
                switch (divid.Key)
                {
                case detailTabRatio:
                case detailTabAverage:
                    dbValue = ConstantValues.DbDefaultFloatValue;
                    break;

                case detailTabSequence:
                case detailTabIncludeN:
                    dbValue = string.Empty;
                    break;

                case detailTabCds:
                    dbValue = ConstantValues.ViewDelimiter;
                    break;
                }
                // default value set.
                tabProperty.GetType().GetProperty(segment + divid.Key)
                .SetValue(tabProperty, dbValue);
                return;
            }

            // db に正常値。
            tabProperty.GetType().GetProperty(segment + divid.Key)
            .SetValue(tabProperty,
                      dbValue.Split(ConstantValues.DbDelimiter).ElementAt(splitIdx));
        }