Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] FileConverter FeatureXML to OMS #17

Open
wants to merge 4 commits into
base: idfile-integration
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/topp/FileConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@
#include <OpenMS/FORMAT/IBSpectraFile.h>
#include <OpenMS/FORMAT/SqMassFile.h>
#include <OpenMS/FORMAT/CachedMzML.h>
#include <OpenMS/FORMAT/OMSFile.h>
#include <OpenMS/DATASTRUCTURES/StringListUtils.h>
#include <OpenMS/APPLICATIONS/TOPPBase.h>
#include <OpenMS/KERNEL/ConversionHelper.h>
#include <OpenMS/KERNEL/ChromatogramTools.h>

#include <OpenMS/FORMAT/DATAACCESS/MSDataWritingConsumer.h>
#include <OpenMS/FORMAT/DATAACCESS/MSDataCachedConsumer.h>
#include <OpenMS/METADATA/ID/IdentificationDataConverter.h>




using namespace OpenMS;
Expand Down Expand Up @@ -125,6 +129,7 @@ using namespace std;
@ref OpenMS::KroenikFile "kroenik"
@ref OpenMS::EDTAFile "edta"
@ref OpenMS::SqMassFile "sqmass"
@ref OpenMS::OMSFile "oms"

@note See @ref TOPP_IDFileConverter for similar functionality for protein/peptide identification file formats.

Expand Down Expand Up @@ -338,7 +343,7 @@ class TOPPFileConverter :
String method("none,ensure,reassign");
setValidStrings_("UID_postprocessing", ListUtils::create<String>(method));

vector<String> output_formats = {"mzML", "mzXML", "cachedMzML", "mgf", "featureXML", "consensusXML", "edta", "mzData", "dta2d", "csv", "sqmass"};
vector<String> output_formats = {"mzML", "mzXML", "cachedMzML", "mgf", "featureXML", "consensusXML", "edta", "mzData", "dta2d", "csv", "sqmass","oms"};
registerOutputFile_("out", "<file>", "", "Output file");
setValidFormats_("out", output_formats);
registerStringOption_("out_type", "<type>", "", "Output file type -- default: determined from file extension or content\nNote: that not all conversion paths work or make sense.", false, true);
Expand Down Expand Up @@ -504,7 +509,8 @@ class TOPPFileConverter :
fh.loadFeatures(in, fm, in_type);
fm.sortByPosition();
if ((out_type != FileTypes::FEATUREXML) &&
(out_type != FileTypes::CONSENSUSXML))
(out_type != FileTypes::CONSENSUSXML) &&
(out_type != FileTypes::OMS))
{
// You will lose information and waste memory. Enough reasons to issue a warning!
writeLog_("Warning: Converting features to peaks. You will lose information! Mass traces are added, if present as 'num_of_masstraces' and 'masstrace_intensity' (X>=0) meta values.");
Expand Down Expand Up @@ -880,6 +886,15 @@ class TOPPFileConverter :
SqMassFile sqm;
sqm.store(out, exp);
}
else if (out_type == FileTypes::OMS)
{
if (in_type != FileTypes::FEATUREXML)
{
OPENMS_LOG_ERROR << "Incompatible input data: FileConverter can only convert featureXML files to oms format.";
return INCOMPATIBLE_INPUT_DATA;
}
OMSFile().store(out, fm);
oliveralka marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
writeLog_("Unknown output file type given. Aborting!");
Expand Down