| 27 | XTandemXMLFile::~XTandemXMLFile() = default; |
| 28 | |
| 29 | void XTandemXMLFile::load(const String& filename, ProteinIdentification& protein_identification, vector<PeptideIdentification>& peptide_ids, ModificationDefinitionsSet& mod_def_set) |
| 30 | { |
| 31 | // File name for error message in XMLHandler |
| 32 | file_ = filename; |
| 33 | mod_def_set_ = mod_def_set; |
| 34 | |
| 35 | // reset everything, in case "load" is called multiple times: |
| 36 | is_protein_note_ = is_spectrum_note_ = skip_protein_acc_update_ = false; |
| 37 | peptide_hits_.clear(); |
| 38 | protein_hits_.clear(); |
| 39 | current_protein_ = tag_ = previous_seq_ = ""; |
| 40 | current_charge_ = 0; |
| 41 | current_id_ = current_start_ = current_stop_ = 0; |
| 42 | spectrum_ids_.clear(); |
| 43 | |
| 44 | enforceEncoding_("ISO-8859-1"); |
| 45 | parse_(filename, this); |
| 46 | |
| 47 | DateTime now = DateTime::now(); |
| 48 | String date_string = now.getDate(); |
| 49 | String identifier("XTandem_" + date_string); |
| 50 | //vector<String> accessions; |
| 51 | |
| 52 | // convert mapping id -> peptide_hits into peptide hits list |
| 53 | peptide_ids.clear(); |
| 54 | for (map<UInt, vector<PeptideHit> >::iterator it = peptide_hits_.begin(); it != peptide_hits_.end(); ++it) |
| 55 | { |
| 56 | PeptideIdentification id; |
| 57 | id.setScoreType("XTandem"); |
| 58 | id.setHigherScoreBetter(true); |
| 59 | id.setIdentifier(identifier); |
| 60 | id.setSpectrumReference( spectrum_ids_[it->first]); |
| 61 | |
| 62 | id.getHits().swap(it->second); |
| 63 | id.assignRanks(); |
| 64 | peptide_ids.push_back(id); |
| 65 | } |
| 66 | |
| 67 | protein_identification.getHits().swap(protein_hits_); |
| 68 | |
| 69 | // E-values |
| 70 | protein_identification.setHigherScoreBetter(false); |
| 71 | protein_identification.assignRanks(); |
| 72 | protein_identification.setScoreType("XTandem"); |
| 73 | protein_identification.setSearchEngine("XTandem"); |
| 74 | |
| 75 | // TODO version of XTandem ???? is not available from performance param section of outputfile (to be parsed) |
| 76 | // TODO Date of search, dito |
| 77 | protein_identification.setDateTime(now); |
| 78 | protein_identification.setIdentifier(identifier); |
| 79 | |
| 80 | // TODO search parameters are also available |
| 81 | |
| 82 | // mods may be changed, copy them back: |
| 83 | mod_def_set = mod_def_set_; |
| 84 | } |
| 85 | |
| 86 | void XTandemXMLFile::startElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname, const Attributes& attributes) |
nothing calls this directly
no test coverage detected