| 66 | } |
| 67 | |
| 68 | String MzTabModification::toCellString() const |
| 69 | { |
| 70 | if (isNull()) |
| 71 | { |
| 72 | return "null"; |
| 73 | } |
| 74 | else |
| 75 | { |
| 76 | String pos_param_string; |
| 77 | |
| 78 | for (Size i = 0; i != pos_param_pairs_.size(); ++i) |
| 79 | { |
| 80 | pos_param_string += pos_param_pairs_[i].first; |
| 81 | |
| 82 | // attach MzTabParameter if available |
| 83 | if (!pos_param_pairs_[i].second.isNull()) |
| 84 | { |
| 85 | pos_param_string += pos_param_pairs_[i].second.toCellString(); |
| 86 | } |
| 87 | |
| 88 | // add | as separator (except for last one) |
| 89 | if (i < pos_param_pairs_.size() - 1) |
| 90 | { |
| 91 | pos_param_string += String("|"); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // quick sanity check |
| 96 | if (mod_identifier_.isNull()) |
| 97 | { |
| 98 | throw Exception::ConversionError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, String("Modification or Substitution identifier MUST NOT be null or empty in MzTabModification")); |
| 99 | } |
| 100 | |
| 101 | String res; |
| 102 | // only add '-' if we have position information |
| 103 | if (!pos_param_string.empty()) |
| 104 | { |
| 105 | res = pos_param_string + "-" + mod_identifier_.toCellString(); |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | res = mod_identifier_.toCellString(); |
| 110 | } |
| 111 | return res; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void MzTabModification::fromCellString(const String& s) |
| 116 | { |