FileHandler#
- class pyopenms.FileHandler#
Bases:
objectCython implementation of _FileHandler
Documentation is available at http://www.openms.de/current_doxygen/html/classOpenMS_1_1FileHandler.html
- __init__()#
Cython signature: void FileHandler()
Methods
Cython signature: void FileHandler()
Cython signature: String computeFileHash(const String & filename)
Cython signature: PeakFileOptions getOptions() Access to the options for loading/storing
Cython signature: int getType(const String & filename)
Cython signature: FileType getTypeByContent(const String & filename)
Cython signature: FileType getTypeByFileName(const String & filename)
Cython signature: bool hasValidExtension(const String & filename, FileType type_)
Cython signature: bool isSupported(FileType type_)
Cython signature: bool loadExperiment(String, MSExperiment &)
Cython signature: bool loadFeatures(String, FeatureMap &)
Cython signature: void setOptions(PeakFileOptions) Sets options for loading/storing
Cython signature: void storeExperiment(String, MSExperiment)
Cython signature: String stripExtension(String file)
Cython signature: String swapExtension(String filename, FileType new_type)
- computeFileHash()#
Cython signature: String computeFileHash(const String & filename)
- getOptions()#
Cython signature: PeakFileOptions getOptions() Access to the options for loading/storing
- getType()#
Cython signature: int getType(const String & filename)
- getTypeByContent()#
Cython signature: FileType getTypeByContent(const String & filename)
- getTypeByFileName()#
Cython signature: FileType getTypeByFileName(const String & filename)
- hasValidExtension()#
Cython signature: bool hasValidExtension(const String & filename, FileType type_)
- loadExperiment()#
Cython signature: bool loadExperiment(String, MSExperiment &)
- Parameters
filename – The file name of the file to load
exp – The experiment to load the data into
force_type – Forces to load the file with that file type. If no type is forced, it is determined from the extension (or from the content if that fails)
log – Progress logging mode
rewrite_source_file – Set’s the SourceFile name and path to the current file. Note that this looses the link to the primary MS run the file originated from
compute_hash – If source files are rewritten, this flag triggers a recomputation of hash values. A SHA1 string gets stored in the checksum member of SourceFile
- Returns
true if the file could be loaded, false otherwise
- Raises
Exception: FileNotFound is thrown if the file could not be opened
- Raises
Exception: ParseError is thrown if an error occurs during parsing
- Parameters
filename – The name of the file to store the data in
exp – The experiment to store
log – Progress logging mode
- Raises
Exception: UnableToCreateFile is thrown if the file could not be written
- Parameters
filename – The file name of the file to load
map – The FeatureMap to load the data into
force_type – Forces to load the file with that file type. If no type is forced, it is determined from the extension (or from the content if that fails)
- Returns
true if the file could be loaded, false otherwise
- Raises
Exception: FileNotFound is thrown if the file could not be opened
- Raises
Exception: ParseError is thrown if an error occurs during parsing
- loadFeatures()#
Cython signature: bool loadFeatures(String, FeatureMap &)
- Parameters
filename – The file name of the file to load
map – The FeatureMap to load the data into
force_type – Forces to load the file with that file type. If no type is forced, it is determined from the extension (or from the content if that fails)
- Returns
true if the file could be loaded, false otherwise
- Raises
Exception: FileNotFound is thrown if the file could not be opened
- Raises
Exception: ParseError is thrown if an error occurs during parsing
- setOptions()#
Cython signature: void setOptions(PeakFileOptions) Sets options for loading/storing
- storeExperiment()#
Cython signature: void storeExperiment(String, MSExperiment)
- Parameters
filename – The name of the file to store the data in
exp – The experiment to store
log – Progress logging mode
- Raises
Exception: UnableToCreateFile is thrown if the file could not be written
- Parameters
filename – The file name of the file to load
map – The FeatureMap to load the data into
force_type – Forces to load the file with that file type. If no type is forced, it is determined from the extension (or from the content if that fails)
- Returns
true if the file could be loaded, false otherwise
- Raises
Exception: FileNotFound is thrown if the file could not be opened
- Raises
Exception: ParseError is thrown if an error occurs during parsing
- stripExtension()#
Cython signature: String stripExtension(String file)
- swapExtension()#
Cython signature: String swapExtension(String filename, FileType new_type)