| 245 | } |
| 246 | |
| 247 | void SpectraIDViewTab::proteinCellClicked_(int row, int column) |
| 248 | { |
| 249 | //TODO maybe highlight/filter all PepHits that may provide evidence for this protein (or at least that are top scorer) |
| 250 | if (row < 0 || column < 0) |
| 251 | return; |
| 252 | |
| 253 | if (row >= protein_table_widget_->rowCount() || column >= protein_table_widget_->columnCount()) |
| 254 | { |
| 255 | throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "invalid cell clicked.", String(row) + " " + column); |
| 256 | } |
| 257 | |
| 258 | // Open browser with accession when clicked on the accession column on a row |
| 259 | if (column == ProteinClmn::ACCESSION) |
| 260 | { |
| 261 | // This stores the complete accession, eg, "tr|A9GID7|A9GID7_SORC5" |
| 262 | QString accession = protein_table_widget_->item(row, ProteinClmn::ACCESSION)->data(Qt::DisplayRole).toString(); |
| 263 | // As with the current logic, we have only one accession per row, we can directly use that accession |
| 264 | // while opening the window instead of showing another widget that lists all accessions |
| 265 | openUniProtSiteWithAccession_(accession); |
| 266 | } |
| 267 | |
| 268 | // |
| 269 | // Check if Qt WebEngineWidgets is installed on user's machine and if so, |
| 270 | // open a new window to visualize protein sequence |
| 271 | #ifdef QT_WEBENGINEWIDGETS_LIB |
| 272 | if (column == ProteinClmn::SEQUENCE) |
| 273 | { |
| 274 | // store the current sequence clicked from the FULL_PROTEIN_SEQUENCE column. This column(hidden by default) |
| 275 | // stores the full protein sequence |
| 276 | QString protein_sequence = protein_table_widget_->item(row, ProteinClmn::FULL_PROTEIN_SEQUENCE)->data(Qt::DisplayRole).toString(); |
| 277 | // store the accession as string, eg: tr|P02769|ALBU_BOVIN |
| 278 | QString current_accession = protein_table_widget_->item(row, ProteinClmn::ACCESSION)->data(Qt::DisplayRole).toString(); |
| 279 | |
| 280 | // extract the part of accession , eg: P02769 |
| 281 | QString accession_num; |
| 282 | try |
| 283 | { |
| 284 | accession_num = extractNumFromAccession_(current_accession); |
| 285 | } |
| 286 | catch (Exception::InvalidValue&) |
| 287 | { |
| 288 | // TODO: print in status(?) that accession format is not supported |
| 289 | } |
| 290 | |
| 291 | auto item_pepid = table_widget_->item(row, Clmn::ID_NR); |
| 292 | |
| 293 | if (item_pepid) |
| 294 | { |
| 295 | |
| 296 | //array to store object of start-end positions, sequence and mod data of peptides; |
| 297 | QJsonArray peptides_data; |
| 298 | |
| 299 | //use data from the protein_to_peptide_id_map map and store the start/end position to the QJsonArray |
| 300 | for (auto pep_id_ptr : protein_to_peptide_id_map[current_accession]) |
| 301 | { |
| 302 | const vector<PeptideHit>& pep_hits = pep_id_ptr->getHits(); |
| 303 | |
| 304 | //store start and end positions |
nothing calls this directly
no test coverage detected