| 113 | } |
| 114 | |
| 115 | void MzTabModification::fromCellString(const String& s) |
| 116 | { |
| 117 | String lower = s; |
| 118 | lower.toLower().trim(); |
| 119 | if (lower == "null") |
| 120 | { |
| 121 | setNull(true); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | if (!lower.hasSubstring("-")) // no positions? simply use s as mod identifier |
| 126 | { |
| 127 | mod_identifier_.set(String(s).trim()); |
| 128 | } |
| 129 | else |
| 130 | { |
| 131 | String ss = s; |
| 132 | ss.trim(); |
| 133 | std::vector<String> fields; |
| 134 | ss.split("-", fields); |
| 135 | |
| 136 | if (fields.size() != 2) |
| 137 | { |
| 138 | throw Exception::ConversionError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, String("Can't convert to MzTabModification from '") + s); |
| 139 | } |
| 140 | mod_identifier_.fromCellString(fields[1].trim()); |
| 141 | |
| 142 | std::vector<String> position_fields; |
| 143 | fields[0].split("|", position_fields); |
| 144 | |
| 145 | for (Size i = 0; i != position_fields.size(); ++i) |
| 146 | { |
| 147 | Size spos = position_fields[i].find_first_of("["); |
| 148 | |
| 149 | if (spos == std::string::npos) // only position information and no parameter |
| 150 | { |
| 151 | pos_param_pairs_.emplace_back(position_fields[i].toInt(), MzTabParameter()); |
| 152 | } |
| 153 | else |
| 154 | { |
| 155 | // extract position part |
| 156 | Int pos = String(position_fields[i].begin(), position_fields[i].begin() + spos).toInt(); |
| 157 | |
| 158 | // extract [,,,] part |
| 159 | MzTabParameter param; |
| 160 | param.fromCellString(position_fields[i].substr(spos)); |
| 161 | pos_param_pairs_.emplace_back(pos, param); |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | bool MzTabModificationList::isNull() const |
| 169 | { |