Esempio n. 1
0
/// <summary>
/// Get TargetSummaryOptions from QueryTable criteria values
/// </summary>
/// <param name="targetSumTable"></param>
/// <returns></returns>

        public static TargetSummaryOptions GetFromQueryTable(
            QueryTable targetSumTable)
        {
            QueryTable           qt  = targetSumTable;
            TargetSummaryOptions tso = GetFromMdbAssayOptionsColumn(qt);

            if (tso == null)
            {
                tso = new TargetSummaryOptions();                          // use default values
            }
            if (qt == null)
            {
                return(tso);
            }

            if (qt.Query != null)
            {
                tso.CidCriteria = qt.Query.KeyCriteria;
            }
            else
            {
                tso.CidCriteria = qt.KeyQueryColumn.Criteria;              // keep in variable criteria form
            }
            tso.TargetList           = GetListFromColCriteria(qt, MultiDbAssayDataNames.GeneSymbol);
            tso.GeneFamilies         = GetListFromColCriteria(qt, MultiDbAssayDataNames.GeneFamily);
            tso.AssayTypesToInclude  = GetListFromColCriteria(qt, MultiDbAssayDataNames.AssayType);
            tso.AssayModesToInclude  = GetListFromColCriteria(qt, MultiDbAssayDataNames.AssayMode);
            tso.ResultTypesToInclude = GetListFromColCriteria(qt, MultiDbAssayDataNames.ResultType);

            //string criteria = qt.GetQueryColumnByName("top_lvl_rslt").Criteria;
            //tso.UseTopLevelResultTypeOnly = Lex.IsNullOrEmpty(criteria) || Lex.Contains(criteria, "'Y'");

            return(tso);
        }
Esempio n. 2
0
/// <summary>
/// Get any existing target summary options from option column
/// </summary>
/// <param name="qt"></param>
/// <returns></returns>

        public static TargetSummaryOptions GetFromMdbAssayOptionsColumn(
            QueryTable qt)
        {
            TargetSummaryOptions tso = null;

            if (qt == null)
            {
                return(null);
            }
            QueryColumn qc = qt.GetQueryColumnByName(MultiDbAssayDataNames.MultiDbViewOptions);

            if (qc == null)
            {
                return(null);
            }

            ParsedSingleCriteria psc = MqlUtil.ParseSingleCriteria(qc.Criteria);

            if (psc == null)
            {
                return(null);
            }
            string tsoString = Lex.RemoveSingleQuotes(psc.Value);

            if (Lex.IsNullOrEmpty(tsoString))
            {
                return(null);
            }

            tso = TargetSummaryOptions.Deserialize(tsoString);
            return(tso);
        }
Esempio n. 3
0
/// <summary>
/// Deserialize
/// </summary>
/// <param name="serializedForm"></param>
/// <returns></returns>

        public static TargetSummaryOptions Deserialize(string serializedForm)
        {
            XmlMemoryStreamTextReader mstr = new XmlMemoryStreamTextReader(serializedForm);
            XmlTextReader             tr   = mstr.Reader;

            tr.Read();
            tr.MoveToContent();

            TargetSummaryOptions p = Deserialize(tr);

            mstr.Close();
            return(p);
        }
Esempio n. 4
0
/// <summary>
/// Deserialize from XmlTextReader
/// </summary>
/// <param name="tr"></param>
/// <returns></returns>

        public static TargetSummaryOptions Deserialize(XmlTextReader tr)
        {
            TargetSummaryOptions p = new TargetSummaryOptions();

            if (!Lex.Eq(tr.Name, "MultiDbViewerPrefs") &&             // new name
                !Lex.Eq(tr.Name, "TargetResultsViewerParms"))         // old name
            {
                throw new Exception("\"MultiDbViewerPrefs\" element not found");
            }

            XmlUtil.GetStringAttribute(tr, "DbName", ref p.DbName);
            XmlUtil.GetStringAttribute(tr, "CidCriteria", ref p.CidCriteria);
            XmlUtil.GetStringAttribute(tr, "TargetList", ref p.TargetList);
            XmlUtil.GetStringAttribute(tr, "GeneFamilies", ref p.GeneFamilies);
            if (Lex.Contains(p.GeneFamilies, "Ion, channel"))             // fixup
            {
                p.GeneFamilies = Lex.Replace(p.GeneFamilies, "Ion, channel", "Ion channel");
            }

            if (Lex.Contains(p.GeneFamilies, "Nuclear, hormone, receptor"))
            {
                p.GeneFamilies = Lex.Replace(p.GeneFamilies, "Nuclear, hormone, receptor", "Nuclear hormone receptor");
            }

            XmlUtil.GetStringAttribute(tr, "AssayTypesToInclude", ref p.AssayTypesToInclude);
            XmlUtil.GetStringAttribute(tr, "AssayTypesToInclude", ref p.AssayTypesToInclude);
            XmlUtil.GetStringAttribute(tr, "ResultTypesToInclude", ref p.ResultTypesToInclude);
            XmlUtil.GetBoolAttribute(tr, "UseTopLevelResultTypeOnly", ref p.UseTopLevelResultTypeOnly);

            XmlUtil.GetBoolAttribute(tr, "TargetsWithActivesOnly", ref p.TargetsWithActivesOnly);
            XmlUtil.GetStringAttribute(tr, "CrcUpperBound", ref p.CrcUpperBound);
            XmlUtil.GetStringAttribute(tr, "SpLowerBound", ref p.SpLowerBound);
            XmlUtil.GetBoolAttribute(tr, "UseMeans", ref p.UseMeans);

            XmlUtil.GetBoolAttribute(tr, "IncludeStructures", ref p.IncludeStructures);
            XmlUtil.GetStringAttribute(tr, "FilterableTargets", ref p.FilterableTargets);

            XmlUtil.GetStringAttribute(tr, "TargetMap", ref p.TargetMapName);
            XmlUtil.GetStringAttribute(tr, "UserMapNames", ref p.UserMapNames);

            XmlUtil.GetStringAttribute(tr, "OutputFormat", ref p.PreferredView);
            XmlUtil.GetBoolAttribute(tr, "FormatForMobius", ref p.FormatForMobius);
            XmlUtil.GetBoolAttribute(tr, "ShowAdvancedDialog", ref p.ShowAdvancedDialog);

            return(p);
        }