Beispiel #1
0
        /// <summary>
        /// Convert TargetAssayAttributes values into an value object array
        /// </summary>
        /// <param name="voLength"></param>
        /// <param name="voi"></param>
        /// <returns></returns>

        public object[] ToValueObject(
            int voLength,
            TargetAssayAttrsFieldPositionMap voi)
        {
            object[] vo = new object[voLength];

            ToValueObject(vo, voi);
            return(vo);
        }
Beispiel #2
0
        /// <summary>
        /// Convert a value objectarray into a new TargetAssayAttributes
        /// </summary>
        /// <param name="vo"></param>
        /// <param name="voMap"></param>
        /// <returns></returns>

        public static AssayAttributes FromValueObjectNew(
            object[] vo,
            TargetAssayAttrsFieldPositionMap voMap)
        {
            AssayAttributes row = new AssayAttributes();

            row.FromValueObject(vo, voMap);
            return(row);
        }
Beispiel #3
0
        public void ToValueObject(
            object[] vo,
            TargetAssayAttrsFieldPositionMap voi)
        {
            AssayAttributes row = this;

            SetVo(vo, voi.Id.Voi, row.Id);

            SetVo(vo, voi.TargetSymbol.Voi, row.GeneSymbol);
            SetVo(vo, voi.TargetId.Voi, row.GeneId);
            SetVo(vo, voi.TargetDescription.Voi, row.GeneDescription);
            SetVo(vo, voi.GeneFamily.Voi, row.GeneFamily);
            SetVo(vo, voi.GeneFamilyTargetSymbol.Voi, row.GeneFamilyTargetSymbol);

            SetVo(vo, voi.AssayType.Voi, row.AssayType);
            SetVo(vo, voi.AssayMode.Voi, row.AssayMode);

            if (Lex.IsNullOrEmpty(row.AssayLink))             // if no link info use simple string value
            {
                SetVo(vo, voi.AssayName.Voi, row.AssayName);
            }
            else
            {
                StringMx sx = new StringMx(row.AssayName);
                sx.Hyperlink = row.AssayLink;
                SetVo(vo, voi.AssayName.Voi, sx);
            }

            SetVo(vo, voi.AssayDesc.Voi, row.AssayDesc);
            SetVo(vo, voi.AssayDatabase.Voi, row.AssayDatabase);
            SetVo(vo, voi.AssayLocation.Voi, row.AssaySource);
            SetVo(vo, voi.AssayId2.Voi, row.AssayId2);
            SetVo(vo, voi.AssayIdNbr.Voi, row.AssayIdNbr);
            SetVo(vo, voi.AssayIdTxt.Voi, row.AssayIdTxt);
            SetVo(vo, voi.ResultTypeUnits.Voi, row.ResultTypeUnits);
            SetVo(vo, voi.ResultTypeConcUnits.Voi, row.ResultTypeConcUnits);

            SetVo(vo, voi.AssayMetaTableName.Voi, row.AssayMetaTableName);
            SetVo(vo, voi.AssayStatus.Voi, row.AssayStatus);
            SetVo(vo, voi.AssayGeneCount.Voi, row.GeneCount);

            SetVo(vo, voi.ResultTypeConcType.Voi, row.ResultTypeConcType);
            SetVo(vo, voi.ResultName.Voi, row.ResultName);
            SetVo(vo, voi.ResultTypeId2.Voi, row.ResultTypeId2);
            SetVo(vo, voi.ResultTypeIdNbr.Voi, row.ResultTypeIdNbr);
            SetVo(vo, voi.ResultTypeIdTxt.Voi, row.ResultTypeIdTxt);
            SetVo(vo, voi.TopLevelResult.Voi, row.TopLevelResult);

            SetVo(vo, voi.Remapped.Voi, row.Remapped);
            SetVo(vo, voi.Multiplexed.Voi, row.Multiplexed);
            SetVo(vo, voi.Reviewed.Voi, row.Reviewed);
            SetVo(vo, voi.ProfilingAssay.Voi, row.ProfilingAssay);
            SetVo(vo, voi.CompoundsAssayed.Voi, row.CompoundsAssayed);

            SetVo(vo, voi.ResultCount.Voi, row.ResultCount);
            SetVo(vo, voi.AssayUpdateDate.Voi, row.AssayUpdateDate);
            SetVo(vo, voi.AssociationSource.Voi, row.AssociationSource);
            SetVo(vo, voi.AssociationConflict.Voi, row.AssociationConflict);

            SetVo(vo, voi.TargetMapX.Voi, row.TargetMapX);
            SetVo(vo, voi.TargetMapY.Voi, row.TargetMapY);
            SetVo(vo, voi.TargetMapZ.Voi, row.TargetMapZ);
            return;
        }
Beispiel #4
0
        /// <summary>
        /// Convert a value objectarray into a TargetAssayAttributes
        /// </summary>
        /// <param name="vo"></param>
        /// <param name="voMap"></param>
        /// <returns></returns>

        public void FromValueObject(
            object[] vo,
            TargetAssayAttrsFieldPositionMap voMap)
        {
            string key;

            AssayAttributes row = this;

            row.Id = GetIntVo(vo, voMap.Id.Voi);

            row.GeneSymbol             = GetStringVo(vo, voMap.TargetSymbol.Voi);
            row.GeneId                 = GetIntVo(vo, voMap.TargetId.Voi);
            row.GeneDescription        = GetStringVo(vo, voMap.TargetDescription.Voi);
            row.GeneFamily             = GetStringVo(vo, voMap.GeneFamily.Voi);
            row.GeneFamilyTargetSymbol = GetStringVo(vo, voMap.GeneFamilyTargetSymbol.Voi);

            row.AssayType = GetStringVo(vo, voMap.AssayType.Voi);
            row.AssayMode = GetStringVo(vo, voMap.AssayMode.Voi);

            object obj = GetObjectVo(vo, voMap.AssayName.Voi);

            if (obj != null)
            {
                if (obj is string)
                {
                    row.AssayName = (string)obj;
                }
                else if (obj is StringMx)
                {
                    StringMx sx = obj as StringMx;
                    row.AssayName = sx.Value;

                    if (sx.DbLink.Contains(","))
                    {
                        string mtName = sx.DbLink.Replace(",", "_").ToUpper();
                        row.AssayMetaTableName = mtName;
                    }
                }
            }

            row.AssayDesc     = GetStringVo(vo, voMap.AssayDesc.Voi);
            row.AssayDatabase = GetStringVo(vo, voMap.AssayDatabase.Voi);
            row.AssaySource   = GetStringVo(vo, voMap.AssayLocation.Voi);
            row.AssayId2      = GetIntVo(vo, voMap.AssayId2.Voi);
            row.AssayIdNbr    = GetIntVo(vo, voMap.AssayIdNbr.Voi);
            row.AssayIdTxt    = GetStringVo(vo, voMap.AssayIdTxt.Voi);

            string txt = GetStringVo(vo, voMap.AssayMetaTableName.Voi);

            if (txt != null)
            {
                row.AssayMetaTableName = txt;
            }

            row.AssayStatus = GetStringVo(vo, voMap.AssayStatus.Voi);
            row.GeneCount   = GetIntVo(vo, voMap.AssayGeneCount.Voi);

            row.ResultName          = GetStringVo(vo, voMap.ResultName.Voi);
            row.ResultTypeId2       = GetIntVo(vo, voMap.ResultTypeId2.Voi);
            row.ResultTypeIdNbr     = GetIntVo(vo, voMap.ResultTypeIdNbr.Voi);
            row.ResultTypeIdTxt     = GetStringVo(vo, voMap.ResultTypeIdTxt.Voi);
            row.ResultTypeConcType  = GetStringVo(vo, voMap.ResultTypeConcType.Voi);
            row.ResultTypeUnits     = GetStringVo(vo, voMap.ResultTypeUnits.Voi);
            row.ResultTypeConcUnits = GetStringVo(vo, voMap.ResultTypeConcUnits.Voi);
            row.TopLevelResult      = GetStringVo(vo, voMap.TopLevelResult.Voi);

            row.Remapped         = GetStringVo(vo, voMap.Remapped.Voi);
            row.Multiplexed      = GetStringVo(vo, voMap.Multiplexed.Voi);
            row.Reviewed         = GetStringVo(vo, voMap.Reviewed.Voi);
            row.ProfilingAssay   = GetStringVo(vo, voMap.ProfilingAssay.Voi);
            row.CompoundsAssayed = GetIntVo(vo, voMap.CompoundsAssayed.Voi);

            row.ResultCount         = GetIntVo(vo, voMap.ResultCount.Voi);
            row.AssayUpdateDate     = GetDateVo(vo, voMap.AssayUpdateDate.Voi);
            row.AssociationSource   = GetStringVo(vo, voMap.AssociationSource.Voi);
            row.AssociationConflict = GetStringVo(vo, voMap.AssociationConflict.Voi);

            row.TargetMapX = GetDoubleVo(vo, voMap.TargetMapX.Voi);
            row.TargetMapY = GetDoubleVo(vo, voMap.TargetMapY.Voi);
            row.TargetMapZ = GetDoubleVo(vo, voMap.TargetMapZ.Voi);

            // Complete assignment any missing assay database and/or assay id information

            AssayDict tad = AssayDict.Instance;             // dict used for various lookups

            if (Lex.IsNullOrEmpty(row.AssayIdTxt) && row.AssayId2 == NullValue.NullNumber)
            {             // try to assign from assay name
                if (!Lex.IsNullOrEmpty(row.AssayName) && tad != null)
                {
                    key = row.AssayName.Trim().ToUpper();
                    if (tad.AssayNameMap.ContainsKey(key))
                    {
                        AssayAttributes taa = tad.AssayNameMap[key];
                        row.AssayDatabase = taa.AssayDatabase;
                        row.AssayId2      = taa.AssayId2;
                        row.AssayIdNbr    = taa.AssayIdNbr;
                        row.AssayIdTxt    = taa.AssayIdTxt;
                    }
                }
            }

            else if (Lex.IsNullOrEmpty(row.AssayIdTxt))
            {
                row.AssayIdTxt = row.AssayId2.ToString();
            }

            else if (row.AssayId2 == NullValue.NullNumber)
            {
                int.TryParse(row.AssayIdTxt, out row.AssayId2);
            }

            // Complete any missing target information if target dict is available

            if (tad != null)
            {
                if (Lex.IsNullOrEmpty(row.GeneSymbol) && row.GeneId == NullValue.NullNumber)                 // assign target from assay info
                {
                    if (!Lex.IsNullOrEmpty(row.AssayDatabase) && !Lex.IsNullOrEmpty(row.AssayIdTxt))
                    {
                        key = row.AssayDatabase.ToUpper() + "-" + row.AssayIdTxt.ToUpper();

                        if (tad.DatabaseAssayIdMap.ContainsKey(key))
                        {
                            row.GeneSymbol = tad.DatabaseAssayIdMap[key].GeneSymbol;
                            row.GeneId     = tad.DatabaseAssayIdMap[key].GeneId;
                        }
                    }
                }

                else if (Lex.IsNullOrEmpty(row.GeneSymbol))                 // assign symbol from targetid
                {
                    if (tad.TargetIdMap.ContainsKey(row.GeneId))
                    {
                        row.GeneSymbol = tad.TargetIdMap[row.GeneId].GeneSymbol;
                    }
                }

                else if (row.GeneId == NullValue.NullNumber)                 // assign targetId from symbol
                {
                    string geneSymbol = row.GeneSymbol.ToUpper();
                    if (tad.TargetSymbolMap.ContainsKey(geneSymbol))
                    {
                        //geneSymbol = "EPHB1"; // debug
                        //geneSymbol = "AKT3"; // debug
                        row.GeneId = tad.TargetSymbolMap[geneSymbol].GeneId;
                    }
                }
            }

            return;
        }