public ModificationPanel(Mod[] value, CVLookUp cv)
        {
            _count = value.Length;
            _type = value.Length > 0 && value.First() != null ? value.First().Element : MetadataElement.FIXED_MOD;
            _cv = cv;

            InitializeComponent();

            Value = value;
        }
        protected internal IndexedElement(MetadataElement element, int id)
        {
            if (element == null){
                throw new ArgumentNullException("element");
            }
            if (id <= 0){
                throw new IndexOutOfRangeException("id value should great than 0!");
            }

            this.element = element;
            this.id = id;
        }
        /**
         * subElementName should include elementName.
         * For example: assay_quantification_mod
         */
        public static MetadataSubElement FindSubElement(MetadataElement element, string subElementName)
        {
            if (element == null || subElementName == null){
                return null;
            }

            MetadataSubElement subElement;
            try{
                subElement =
                    All.First(
                        x =>
                        x.Element.Name.Equals(element.Name, StringComparison.CurrentCultureIgnoreCase) &&
                        x.SubName.Equals(subElementName, StringComparison.CurrentCultureIgnoreCase));
            }
            catch (ArgumentNullException){
                subElement = null;
            }
            catch (InvalidOperationException){
                subElement = null;
            }

            return subElement;
        }
示例#4
0
        public static List<IndexedElement> ParseIndexedElementList(string target, MetadataElement element)
        {
            SplitList<string> list = ParseStringList(MZTabConstants.COMMA, target);

            List<IndexedElement> indexedElementList = new List<IndexedElement>();
            foreach (string item in list){
                IndexedElement indexedElement = ParseIndexedElement(item, element);
                if (indexedElement == null){
                    indexedElementList.Clear();
                    return indexedElementList;
                }
                indexedElementList.Add(indexedElement);
            }
            return indexedElementList;
        }
示例#5
0
 public static IndexedElement ParseIndexedElement(string target, MetadataElement element)
 {
     target = ParseString(target);
     if (target == null){
         return null;
     }
     Regex regex = new Regex(element + "\\[(\\d+)\\]");
     if (regex.IsMatch(target)){
         int id = int.Parse(regex.Match(target).Groups[1].Value);
         return new IndexedElement(element, id);
     }
     return null;
 }
示例#6
0
 public Mod(MetadataElement element, int id)
     : base(element, id)
 {
 }
 private MetadataSubElement(MetadataElement element, string subName)
 {
     _element = element;
     _subName = subName;
 }
 /**
  * element.getName_propertyName.
  * @see uk.ac.ebi.pride.jmztab.model.MetadataElement#getName()
  */
 public static MetadataProperty FindProperty(MetadataElement element, string propertyName)
 {
     if (element == null || propertyName == null){
         return null;
     }
     MetadataProperty property;
     try{
         property =
             All.First(
                 x =>
                 x.Element.Name.Equals(element.Name, StringComparison.CurrentCultureIgnoreCase) &&
                 x.Name.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
     }
     catch (ArgumentNullException){
         property = null;
     }
     catch (InvalidOperationException){
         property = null;
     }
     return property;
 }
 private MetadataProperty(MetadataSubElement subElement, string name)
 {
     _element = subElement.Element;
     _subElement = subElement;
     _name = name;
 }
 private MetadataProperty(MetadataElement element, string name)
 {
     _element = element;
     _subElement = null;
     _name = name;
 }
示例#11
0
        private MetadataProperty checkProperty(MetadataElement element, string propertyName)
        {
            if (string.IsNullOrEmpty(propertyName)){
                return null;
            }

            MetadataProperty property = MetadataProperty.FindProperty(element, propertyName);
            if (property == null){
                MZTabError error = new MZTabError(FormatErrorType.MTDDefineLabel, _lineNumber,
                                                  element.Name + "-" + propertyName);
                throw new MZTabException(error);
            }

            return property;
        }
示例#12
0
        private List<IndexedElement> checkIndexedElementList(string defineLabel, string valueLabel,
                                                             MetadataElement element)
        {
            List<IndexedElement> indexedElementList = MZTabUtils.ParseIndexedElementList(valueLabel, element);
            if (indexedElementList == null || indexedElementList.Count == 0){
                MZTabError error = new MZTabError(FormatErrorType.IndexedElement, _lineNumber,
                                                  Error_Header + defineLabel, valueLabel);
                throw new MZTabException(error);
            }

            return indexedElementList;
        }
 public bool Match(MetadataElement element)
 {
     return element.Name.Equals(Name);
 }