| 97 | } |
| 98 | |
| 99 | void InspectInfile::store(const String& filename) |
| 100 | { |
| 101 | if (!FileHandler::hasValidExtension(filename, FileTypes::TSV)) |
| 102 | { |
| 103 | throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filename, "invalid file extension, expected '" + FileTypes::typeToName(FileTypes::TSV) + "'"); |
| 104 | } |
| 105 | |
| 106 | ofstream ofs(filename.c_str()); |
| 107 | if (!ofs) |
| 108 | { |
| 109 | throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filename); |
| 110 | } |
| 111 | stringstream file_content; |
| 112 | |
| 113 | file_content << "spectra," << spectra_ << "\n"; |
| 114 | |
| 115 | if (!db_.empty()) |
| 116 | { |
| 117 | file_content << "db," << db_ << "\n"; |
| 118 | } |
| 119 | if (!enzyme_.empty()) |
| 120 | { |
| 121 | file_content << "protease," << enzyme_ << "\n"; |
| 122 | } |
| 123 | if (blind_ != 2) |
| 124 | { |
| 125 | file_content << "blind," << blind_ << "\n"; |
| 126 | } |
| 127 | //mod,+57,C,fix,carbamidomethylation |
| 128 | for (std::map<String, vector<String> >::iterator mods_i = PTMname_residues_mass_type_.begin(); mods_i != PTMname_residues_mass_type_.end(); ++mods_i) |
| 129 | { |
| 130 | // fix", "cterminal", "nterminal", and "opt |
| 131 | mods_i->second[2].toLower(); |
| 132 | if (mods_i->second[2].hasSuffix("term")) |
| 133 | { |
| 134 | mods_i->second[2].append("inal"); |
| 135 | } |
| 136 | file_content << "mod," << mods_i->second[1] << "," << mods_i->second[0] << "," << mods_i->second[2] << "," << mods_i->first << "\n"; |
| 137 | } |
| 138 | |
| 139 | if (modifications_per_peptide_ > -1) |
| 140 | { |
| 141 | file_content << "mods," << modifications_per_peptide_ << "\n"; |
| 142 | } |
| 143 | if (maxptmsize_ >= 0) |
| 144 | { |
| 145 | file_content << "maxptmsize," << maxptmsize_ << "\n"; |
| 146 | } |
| 147 | if (precursor_mass_tolerance_ >= 0) |
| 148 | { |
| 149 | file_content << "PM_tolerance," << precursor_mass_tolerance_ << "\n"; |
| 150 | } |
| 151 | if (peak_mass_tolerance_ >= 0) |
| 152 | { |
| 153 | file_content << "IonTolerance," << peak_mass_tolerance_ << "\n"; |
| 154 | } |
| 155 | if (multicharge_ != 2) |
| 156 | { |