/// <summary>
        /// Create an object using the contents of the corresponding MzIdentML object
        /// </summary>
        /// <param name="sip"></param>
        /// <param name="idata"></param>
        public SpectrumIdentificationProtocolObj(SpectrumIdentificationProtocolType sip, IdentDataObj idata)
            : base(idata)
        {
            Id   = sip.id;
            Name = sip.name;
            AnalysisSoftwareRef = sip.analysisSoftware_ref;

            _searchType             = null;
            _additionalSearchParams = null;
            _enzymes             = null;
            _threshold           = null;
            _databaseTranslation = null;

            ModificationParams = new IdentDataList <SearchModificationObj>(1);
            MassTables         = new IdentDataList <MassTableObj>(1);
            FragmentTolerances = new IdentDataList <CVParamObj>(1);
            ParentTolerances   = new IdentDataList <CVParamObj>(1);
            DatabaseFilters    = new IdentDataList <FilterInfo>(1);

            if (sip.SearchType != null)
            {
                _searchType = new ParamObj(sip.SearchType, IdentData);
            }
            if (sip.AdditionalSearchParams != null)
            {
                _additionalSearchParams = new ParamListObj(sip.AdditionalSearchParams, IdentData);
            }
            if (sip.ModificationParams?.Count > 0)
            {
                ModificationParams.AddRange(sip.ModificationParams, mp => new SearchModificationObj(mp, IdentData));
            }
            if (sip.Enzymes != null)
            {
                _enzymes = new EnzymeListObj(sip.Enzymes, IdentData);
            }
            if (sip.MassTable?.Count > 0)
            {
                MassTables.AddRange(sip.MassTable, mt => new MassTableObj(mt, IdentData));
            }
            if (sip.FragmentTolerance?.Count > 0)
            {
                FragmentTolerances.AddRange(sip.FragmentTolerance, ft => new CVParamObj(ft, IdentData));
            }
            if (sip.ParentTolerance?.Count > 0)
            {
                ParentTolerances.AddRange(sip.ParentTolerance, pt => new CVParamObj(pt, IdentData));
            }
            if (sip.Threshold != null)
            {
                _threshold = new ParamListObj(sip.Threshold, IdentData);
            }
            if (sip.DatabaseFilters?.Count > 0)
            {
                DatabaseFilters.AddRange(sip.DatabaseFilters, df => new FilterInfo(df, IdentData));
            }
            if (sip.DatabaseTranslation != null)
            {
                _databaseTranslation = new DatabaseTranslationObj(sip.DatabaseTranslation, IdentData);
            }
        }
Exemple #2
0
        /// <summary>
        ///     Create an object using the contents of the corresponding MzIdentML object
        /// </summary>
        /// <param name="sip"></param>
        /// <param name="idata"></param>
        public SpectrumIdentificationProtocolObj(SpectrumIdentificationProtocolType sip, IdentDataObj idata)
            : base(idata)
        {
            Id = sip.id;
            Name = sip.name;
            AnalysisSoftwareRef = sip.analysisSoftware_ref;

            _searchType = null;
            _additionalSearchParams = null;
            _modificationParams = null;
            _enzymes = null;
            _massTables = null;
            _fragmentTolerances = null;
            _parentTolerances = null;
            _threshold = null;
            _databaseFilters = null;
            _databaseTranslation = null;

            if (sip.SearchType != null)
                _searchType = new ParamObj(sip.SearchType, IdentData);
            if (sip.AdditionalSearchParams != null)
                _additionalSearchParams = new ParamListObj(sip.AdditionalSearchParams, IdentData);
            if ((sip.ModificationParams != null) && (sip.ModificationParams.Count > 0))
            {
                ModificationParams = new IdentDataList<SearchModificationObj>();
                foreach (var mp in sip.ModificationParams)
                    ModificationParams.Add(new SearchModificationObj(mp, IdentData));
            }
            if (sip.Enzymes != null)
                _enzymes = new EnzymeListObj(sip.Enzymes, IdentData);
            if ((sip.MassTable != null) && (sip.MassTable.Count > 0))
            {
                MassTables = new IdentDataList<MassTableObj>();
                foreach (var mt in sip.MassTable)
                    MassTables.Add(new MassTableObj(mt, IdentData));
            }
            if ((sip.FragmentTolerance != null) && (sip.FragmentTolerance.Count > 0))
            {
                FragmentTolerances = new IdentDataList<CVParamObj>();
                foreach (var ft in sip.FragmentTolerance)
                    FragmentTolerances.Add(new CVParamObj(ft, IdentData));
            }
            if (sip.ParentTolerance != null)
            {
                ParentTolerances = new IdentDataList<CVParamObj>();
                foreach (var pt in sip.ParentTolerance)
                    ParentTolerances.Add(new CVParamObj(pt, IdentData));
            }
            if (sip.Threshold != null)
                _threshold = new ParamListObj(sip.Threshold, IdentData);
            if ((sip.DatabaseFilters != null) && (sip.DatabaseFilters.Count > 0))
            {
                DatabaseFilters = new IdentDataList<FilterInfo>();
                foreach (var df in sip.DatabaseFilters)
                    DatabaseFilters.Add(new FilterInfo(df, IdentData));
            }
            if (sip.DatabaseTranslation != null)
                _databaseTranslation = new DatabaseTranslationObj(sip.DatabaseTranslation, IdentData);
        }