public SoftwareParam(Software[] software, CVLookUp cv, Dictionary<string, string> parameters)
     : base(null)
 {
     _count = software.Length;
     _cv = cv;
     _parameters = parameters;
     Value = software;
     Default = software;
 }
        public SoftwarePanel(Software[] value, CVLookUp cv, Dictionary<string, string> parameters)
        {
            MaxWidth = 800;
            _count = value.Length;
            _cv = cv;
            _parameters = parameters;

            defaultName = _cv.GetNameOfTerm("MS:1001583", "MS");
            defaultVersion = parameters.ContainsKey("Version") ? parameters["Version"] : null;

            InitializeComponent();

            Value = value;
        }
        public void AddSoftwareSetting(int id, string setting)
        {
            Software software;
            if (!_softwareMap.ContainsKey(id)){
                software = new Software(id);

                _softwareMap.Add(id, software);
            }
            else{
                software = _softwareMap[id];
            }

            software.AddSetting(setting);
        }
 public bool AddSoftwareParam(int id, Param param)
 {
     Software software;
     if (!_softwareMap.ContainsKey(id)){
         software = new Software(id){Param = param};
         _softwareMap.Add(id, software);
         return true;
     }
     software = _softwareMap[id];
     if (software.Param != null){
         return false;
     }
     software.Param = param;
     return true;
 }
        public Metadata CreateMetadataDefault(IMatrixData parameters, IMatrixData experiment, IMatrixData search)
        {
            Metadata mtd = new Metadata(new MZTabDescription(MzTabMode.Complete, MzTabType.Quantification));

            List<MsRunImpl> runs = null;
            List<StudyVariable> studyvariables = null;
            List<Assay> assays = null;
            List<Sample> samples = null;
            List<Instrument> instruments = null;
            GetExperminetValues(null, null, experiment, search, ref runs, ref studyvariables, ref assays, ref samples,
                                ref instruments);

            foreach (var msRun in runs){
                mtd.MsRunMap.Add(msRun.Id, msRun);
            }

            foreach (var studyvariable in studyvariables){
                mtd.StudyVariableMap.Add(studyvariable.Id, studyvariable);
            }

            foreach (var sample in samples){
                mtd.SampleMap.Add(sample.Id, sample);
            }

            foreach (var assay in assays){
                mtd.AssayMap.Add(assay.Id, assay);
            }

            foreach (var instrument in instruments){
                mtd.InstrumentMap.Add(instrument.Id, instrument);
            }

            SplitList<Lib.Model.Param> sampleProcessing = new SplitList<Lib.Model.Param>{
                cv.GetParam("enzyme digestion", "SEP"),
                cv.GetParam("reversed-phase chromatography", "SEP")
            };
            //sampleProcessing.Add(_cv.GetParam("ion-exchange chromatography", "SEP"));

            mtd.SampleProcessingMap.Add(1, sampleProcessing);

            var paramDict = MzTabMatrixUtils.ConvertToParamDict(parameters);

            string key = Constants.GetKeywordName(Utils.parameters.fixedMod, paramDict.Keys.ToArray());
            if (key != null){
                string[] values = paramDict[key].Split(';');
                foreach (var mod in values.Select(x => BaseLib.Mol.Tables.Modifications[x])){
                    int id = mtd.FixedModMap.Count + 1;
                    mtd.AddFixedModParam(id, cv.GetModificationParam(mod));
                    mtd.AddFixedModPosition(id, mod.Position.ToString());
                    mtd.AddFixedModSite(id, StringUtils.Concat(", ", mod.GetSiteArray()));
                }
            }

            key = Constants.GetKeywordName(Utils.parameters.variableMod, paramDict.Keys.ToArray());
            if (key != null){
                string[] values = paramDict[key].Split(';');
                foreach (var mod in values.Select(x => BaseLib.Mol.Tables.Modifications[x])){
                    int id = mtd.VariableModMap.Count + 1;
                    mtd.AddVariableModParam(id, cv.GetModificationParam(mod));
                    mtd.AddVariableModPosition(id, mod.Position.ToString());
                    mtd.AddVariableModSite(id, StringUtils.Concat(", ", mod.GetSiteArray()));
                }
            }

            string version = Constants.GetKeywordName(Utils.parameters.version, paramDict.Keys.ToArray());
            Software software = new Software(1){
                Param = cv.GetParam("MaxQuant", "MS", GetParameterString(parameters, version, null))
            };
            mtd.SoftwareMap.Add(software.Id, software);

            software = new Software(2){
                Param = cv.GetParam("Andromeda", "MS", GetParameterString(parameters, version, null))
            };
            mtd.SoftwareMap.Add(software.Id, software);

            if (assays.Count > 0){
                var tmp = ArrayUtils.UniqueValues(assays.Select(x => x.QuantificationReagent.Name).ToArray());
                if (tmp.Length == 1 && tmp.First().Equals("Unlabeled sample")){
                    mtd.QuantificationMethod = cv.GetParam("label-free proteingroup level quantitation", "MS");
                }
                else if (tmp.Any(x => x.Contains("SILAC"))){
                    mtd.QuantificationMethod = cv.GetParam("SILAC quantitation analysis", "MS");
                }
            }

            return mtd;
        }
 public override void Clear()
 {
     Value = new Software[_count];
 }