示例#1
0
        public static SplitList<double> ParseDoubleList(string target)
        {
            SplitList<string> list = ParseStringList(MZTabConstants.BAR, target);

            SplitList<double> valueList = new SplitList<double>(MZTabConstants.BAR);
            foreach (string listItem in list){
                double value = ParseDouble(listItem);
                if (value.Equals(double.MinValue)){
                    valueList.Clear();
                    break;
                }
                valueList.Add(value);
            }

            return valueList;
        }
示例#2
0
        public static SplitList<SpectraRef> ParseSpectraRefList(Metadata metadata, string target)
        {
            SplitList<string> list = ParseStringList(MZTabConstants.BAR, target);
            SplitList<SpectraRef> refList = new SplitList<SpectraRef>(MZTabConstants.BAR);

            Regex regex = new Regex("ms_run\\[(\\d+)\\]:(.*)");

            foreach (string item in list){
                if (regex.IsMatch(item.Trim())){
                    int ms_file_id = int.Parse(regex.Match(item.Trim()).Groups[1].Value);
                    string reference = regex.Match(item.Trim()).Groups[2].Value;

                    MsRun msRun = metadata.MsRunMap[ms_file_id];
                    SpectraRef sref = msRun == null ? null : new SpectraRef(msRun, reference);

                    if (sref == null){
                        refList.Clear();
                        break;
                    }
                    refList.Add(sref);
                }
            }

            return refList;
        }
示例#3
0
        /**
         * A publication on this unit. PubMed ids must be prefixed by “pubmed:”,
         * DOIs by “doi:”. Multiple identifiers MUST be separated by “|”.
         */
        public static SplitList<PublicationItem> ParsePublicationItems(string target)
        {
            SplitList<string> list = ParseStringList(MZTabConstants.BAR, target);

            SplitList<PublicationItem> itemList = new SplitList<PublicationItem>(MZTabConstants.BAR);
            foreach (string pubList in list){
                var pub = ParseString(pubList);
                if (pub == null){
                    itemList.Clear();
                    break;
                }
                string[] items = pub.Split(new[]{"" + MZTabConstants.COLON}, StringSplitOptions.None);
                PublicationType type;
                if (items.Length != 2 || (type = PublicationItem.FindType(items[0].Trim())) == null){
                    itemList.Clear();
                    break;
                }
                string accession = items[1].Trim();
                PublicationItem item = new PublicationItem(type, accession);
                itemList.Add(item);
            }

            return itemList;
        }
示例#4
0
        /**
         * A list of '|' separated parameters
         */
        public static SplitList<Param> ParseParamList(string target)
        {
            SplitList<string> list = ParseStringList(MZTabConstants.BAR, target);

            SplitList<Param> paramList = new SplitList<Param>(MZTabConstants.BAR);
            foreach (string item in list){
                Param param = ParseParam(item);
                if (param == null){
                    paramList.Clear();
                    return paramList;
                }
                paramList.Add(param);
            }

            return paramList;
        }
示例#5
0
        public static SplitList<Modification> ParseModificationList(Section section, string target)
        {
            target = ParseString(target);
            if (target == null){
                return null;
            }

            SplitList<Modification> modList = new SplitList<Modification>(MZTabConstants.COMMA);
            if (target.Equals("0")){
                modList.Add(Modification.CreateNoModification(section));
                return modList;
            }

            target = translateCommaToTab(target);

            SplitList<string> list = ParseStringList(MZTabConstants.COMMA, target);

            foreach (string item in list){
                Modification mod = ParseModification(section, item.Trim());
                if (mod == null){
                    modList.Clear();
                    break;
                }
                modList.Add(mod);
            }

            return modList;
        }
示例#6
0
        /**
         * A '|' delimited list of GO accessions
         */
        public static SplitList<string> ParseGoTermList(string target)
        {
            SplitList<string> list = ParseStringList(MZTabConstants.COMMA, target);

            SplitList<string> goList = new SplitList<string>(MZTabConstants.COMMA);
            foreach (string listitem in list){
                var item = ParseString(listitem);
                if (item.StartsWith("GO:")){
                    goList.Add(item);
                }
                else{
                    goList.Clear();
                    break;
                }
            }

            return goList;
        }