MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / loadExperiment

Method loadExperiment

src/openms/source/FORMAT/FileHandler.cpp:671–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

669 }
670
671 bool FileHandler::loadExperiment(const String& filename, PeakMap& exp, FileTypes::Type force_type, ProgressLogger::LogType log, const bool rewrite_source_file, const bool compute_hash)
672 {
673 // setting the flag for hash recomputation only works if source file entries are rewritten
674 OPENMS_PRECONDITION(rewrite_source_file || !compute_hash, "Can't compute hash if no SourceFile written");
675
676 //determine file type
677 FileTypes::Type type;
678 if (force_type != FileTypes::UNKNOWN)
679 {
680 type = force_type;
681 }
682 else
683 {
684 try
685 {
686 type = getType(filename);
687 }
688 catch ( Exception::FileNotFound& )
689 {
690 return false;
691 }
692 }
693
694 // load right file
695 switch (type)
696 {
697 case FileTypes::DTA:
698 exp.reset();
699 exp.resize(1);
700 DTAFile().load(filename, exp[0]);
701 break;
702
703 case FileTypes::DTA2D:
704 {
705 DTA2DFile f;
706 f.getOptions() = options_;
707 f.setLogType(log);
708 f.load(filename, exp);
709 }
710 break;
711
712 case FileTypes::MZXML:
713 {
714 MzXMLFile f;
715 f.getOptions() = options_;
716 f.setLogType(log);
717 f.load(filename, exp);
718 }
719 break;
720
721 case FileTypes::MZDATA:
722 {
723 MzDataFile f;
724 f.getOptions() = options_;
725 f.setLogType(log);
726 f.load(filename, exp);
727 }
728 break;

Callers 15

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
testFileHandlerFunction · 0.95
run_MSExperiment_copyMethod · 0.95
run_fileformats_ioMethod · 0.95
addDataFileMethod · 0.80
metadataFileDialogMethod · 0.80

Calls 15

getTypeFunction · 0.85
ChromatogramToolsClass · 0.85
setLogTypeMethod · 0.80
setNameOfFileMethod · 0.80
setPathToFileMethod · 0.80
setFileTypeMethod · 0.80
setChecksumMethod · 0.80
StringClass · 0.50
resetMethod · 0.45
resizeMethod · 0.45
loadMethod · 0.45
emptyMethod · 0.45

Tested by 10

testFileHandlerFunction · 0.76
run_MSExperiment_copyMethod · 0.76
run_fileformats_ioMethod · 0.76
main_Method · 0.64
getExperimentFunction · 0.64