/usr/include/OpenMS/FORMAT/MascotInfile.h is in libopenms-dev 1.11.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | // --------------------------------------------------------------------------
// OpenMS -- Open-Source Mass Spectrometry
// --------------------------------------------------------------------------
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
//
// This software is released under a three-clause BSD license:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of any author or any participating institution
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
// For a full list of authors, refer to the file AUTHORS.
// --------------------------------------------------------------------------
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// --------------------------------------------------------------------------
// $Maintainer: Nico Pfeifer $
// $Authors: $
// --------------------------------------------------------------------------
#ifndef OPENMS_FORMAT_MASCOTINFILE_H
#define OPENMS_FORMAT_MASCOTINFILE_H
#include <OpenMS/KERNEL/MSExperiment.h>
#include <OpenMS/DATASTRUCTURES/String.h>
#include <OpenMS/SYSTEM/File.h>
#include <OpenMS/CONCEPT/ProgressLogger.h>
#include <OpenMS/KERNEL/StandardTypes.h>
#include <vector>
#include <fstream>
namespace OpenMS
{
/**
@brief Mascot input file adapter.
@deprecated Use MascotGenericFile.h instead, which uses DefaultParamHandler, is more up to date and avoids weird behaviors of this class (especially in terms of
MIME boundaries when writing MGF....
Creates a file that can be used for Mascot search from a peak list or a whole experiment.
@ingroup FileIO
*/
class OPENMS_DLLAPI MascotInfile :
public ProgressLogger
{
public:
/// constructor
MascotInfile();
/// constructor
virtual ~MascotInfile();
/// stores the peak list in a MascotInfile that can be used as input for MASCOT shell execution
void store(const String & filename, const PeakSpectrum & spec, DoubleReal mz, DoubleReal retention_time, String search_title);
/// stores the experiment data in a MascotInfile that can be used as input for MASCOT shell execution
void store(const String & filename, const MSExperiment<> & experiment, String search_title);
/** loads a Mascot Generic File into a PeakMap
@param filename file name which the map should be read from
@param exp the map which is filled with the data from the given file
@throw FileNotFound is thrown if the given file could not be found
*/
template <typename MapType>
void load(const String & filename, MapType & exp)
{
exp.reset();
if (!File::exists(filename))
{
throw Exception::FileNotFound(__FILE__, __LINE__, __PRETTY_FUNCTION__, filename);
}
std::ifstream is(filename.c_str());
std::vector<std::pair<double, double> > spec;
UInt charge(0);
double pre_mz(0), pre_int(0), rt(-1);
String title;
while (getNextSpectrum_(is, spec, charge, pre_mz, pre_int, rt, title))
{
typename MapType::SpectrumType spectrum;
for (std::vector<std::pair<double, double> >::const_iterator it = spec.begin(); it != spec.end(); ++it)
{
typename MapType::PeakType p;
p.setPosition(it->first);
p.setIntensity(it->second);
spectrum.push_back(p);
}
spectrum.setMSLevel(2);
spectrum.getPrecursors().resize(1);
spectrum.getPrecursors()[0].setMZ(pre_mz);
spectrum.getPrecursors()[0].setIntensity(pre_int);
spectrum.getPrecursors()[0].setCharge(charge);
spectrum.setRT(rt);
if (title != "")
{
spectrum.setMetaValue("TITLE", title);
title = "";
}
exp.addSpectrum(spectrum);
// clean up
spec.clear();
charge = 0;
pre_mz = 0;
pre_int = 0;
}
}
/// returns the boundary used for the MIME format
const String & getBoundary();
/// sets the boundary used for the MIME format.<br>By default a 22 character random string is used
void setBoundary(const String & boundary);
/// returns the DB to use
const String & getDB();
/// sets the DB to use (default: MSDB). See <mascot path>/config/mascot.dat in "Databases" section for possible settings
void setDB(const String & db);
/// returns the search type
const String & getSearchType();
/// sets the seach type (default: MIS). So far only MIS is supported!<br>Valid types are "MIS" (MS/MS Ion Search), "PMF" (Peptide Mass Fingerprint) , "SQ" (Sequence Query)
void setSearchType(const String & search_type);
/// returns the number of hits to report back
const String & getHits();
/// sets the number of hits to report back (default: 20)
void setHits(const String & hits);
/// returns the enzyme used for cleavage
const String & getCleavage();
/// sets the enzyme used for cleavage (default: Trypsin). <BR>See <mascot path>/config/enzymes for possible settings.
void setCleavage(const String & cleavage);
/// returns the used mass type ("Monoisotopic" or "Average")
const String & getMassType();
/// sets the used mass type "Monoisotopic" or "Average" (default: Monoisotopic)
void setMassType(const String & mass_type);
/// returns a vector containing the fixed modifications (default: none)
const std::vector<String> & getModifications();
/// sets the fixed modifications (default: none). <BR>See <mascot path>/config/mod_file for possible settings.
void setModifications(const std::vector<String> & mods);
/// returns a vector containing the variable modifications (default: none)
const std::vector<String> & getVariableModifications();
/// sets the fixed modifications (default: none). <BR>See <mascot path>/config/mod_file for possible settings.
void setVariableModifications(const std::vector<String> & mods);
/// returns the instrument type
const String & getInstrument();
/// sets the instrument type (Default: Default). <BR>Possible instruments: ESI-QUAD-TOF, MALDI-TOF-PSD, ESI-TRAP, ESI-QUAD, ESI-FTICR, MALDI-TOF-TOF, ESI-4SECTOR, FTMS-ECD, MALDI-QUAD-TOF, MALDI-QIT-TOF
void setInstrument(const String & instrument);
/// returns the number of allowed missed cleavages
UInt getMissedCleavages();
/// sets the number of allowed missed cleavages (default: 1)
void setMissedCleavages(UInt missed_cleavages);
/// returns the precursor mass tolerance
Real getPrecursorMassTolerance();
/// sets the precursor mass tolerance in Da (default: 2.0)
void setPrecursorMassTolerance(Real precursor_mass_tolerance);
/// returns the peak mass tolerance in Da
Real getPeakMassTolerance();
/// sets the peak mass tolerance in Da (default: 1.0)
void setPeakMassTolerance(Real ion_mass_tolerance);
/// returns the taxonomy
const String & getTaxonomy();
/// sets the taxonomy (default: All entries). <BR>See <mascot path>/config/taxonomy for possible settings.
void setTaxonomy(const String & taxonomy);
/// returns the Mascot form version
const String & getFormVersion();
/// sets the Mascot form version (default: 1.01)
void setFormVersion(const String & form_version);
/// returns the charges
const String & getCharges();
/// sets the charges (default: 1+, 2+ and 3+)
void setCharges(std::vector<Int> & charges);
protected:
/// parent mass
DoubleReal mz_;
/// charge states to use
String charges_;
/// the search title of the mascot search
String search_title_;
/// the DB to search in
String db_;
/// search type: MIS, SQ or PMF
String search_type_;
/// number of hits to report
String hits_;
/// Enzyme used for cleavage
String cleavage_;
/// Monoisotopic/average mass
String mass_type_;
/// fixed Modifications
std::vector<String> mods_;
/// variable Modifications
std::vector<String> variable_mods_;
/// the used instument
String instrument_;
/// number of missed cleavages
UInt missed_cleavages_;
/// precursor mass toerance in Da
Real precursor_mass_tolerance_;
/// m/z tolerance of ions in Da
Real ion_mass_tolerance_;
/// taxonomy
String taxonomy_;
/// form version
String form_version_;
/// the boundary used for the MIME format
String boundary_;
/// the retention time
DoubleReal retention_time_;
/// writes a parameter header
void writeParameterHeader_(const String & name, FILE * fp, bool line_break = true);
/// writes the full header
void writeHeader_(FILE * fp);
/// writes the spectrum
void writeSpectrum_(FILE * fp,
const String & filename,
const PeakSpectrum & peaks);
/// writes the MSExperiment
void writeMSExperiment_(FILE * fp,
const String & filename,
const MSExperiment<> & experiment);
bool getNextSpectrum_(std::istream & is, std::vector<std::pair<double, double> > & spectrum, UInt & charge, double & precursor_mz, double & precursor_int, double & rt, String & title);
};
} // namespace OpenMS
#endif // OPENMS_FORMAT_MASCOTINFILE_H
|