|  | OpenMS
    2.6.0
    | 
 
 
  
  
 
Go to the documentation of this file.
   75     template <
typename MapType>
 
   95       std::ifstream in(filename.c_str());
 
   97       UInt spectrum_number = 0;
 
  102       bool first_spec(
true);
 
  105       Size line_number = 0;
 
  107       while (getline(in, line, 
'\n'))
 
  112         if (line.empty()) 
continue;
 
  135           std::vector<String> split;
 
  136           line.
split(
' ', split);
 
  137           if (split.size() != 4)
 
  139             throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, 
"line (" + 
String(line_number) + 
") '" + line  + 
"' should contain four values, got " + 
String(split.size()) + 
"!", 
"");
 
  166         std::vector<String> split;
 
  167         line.
split(
' ', split);
 
  168         if (split.size() != 2)
 
  170           throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, 
"line (" + 
String(line_number) + 
") '" + line  + 
"' should contain two values, got " + 
String(split.size()) + 
"!", 
"");
 
  180           throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, 
"ConversionError: line (" + 
String(line_number) + 
") '" + line  + 
"' does not contain two numbers!", 
"");
 
  
void reset()
Resets all internal values.
A more convenient string class.
Definition: String.h:59
File not found exception.
Definition: Exception.h:523
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
Invalid conversion exception.
Definition: Exception.h:362
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: Peak1D.h:112
String & simplify()
merges subsequent whitespaces to one blank character
void load(const String &filename, MapType &exp)
Definition: MS2File.h:76
static bool exists(const String &file)
Method used to test if a file exists.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
void setLoadedFilePath(const String &file_name)
set the file_name_ according to absolute path of the file loaded from preferably done whilst loading
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
void setPosition(PositionType const &position)
Mutable access to the position.
Definition: Peak1D.h:151
bool split(const char splitter, std::vector< String > &substrings, bool quote_protect=false) const
Splits a string into substrings using splitter as delimiter.
void clear(bool clear_meta_data)
Clears all data and meta data.
void setMSLevel(UInt ms_level)
Sets the MS level.
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
Parse Error exception.
Definition: Exception.h:622
static bool readable(const String &file)
Return true if the file exists and is readable.
MS2 input file adapter.
Definition: MS2File.h:64
void setLoadedFileType(const String &file_name)
set the file_type according to the type of the file loaded from (see FileHandler::Type) preferably do...
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
File not readable exception.
Definition: Exception.h:537
void setNativeID(const String &native_id)
sets the native identifier for the spectrum, used by the acquisition software.