OpenMS
Loading...
Searching...
No Matches
MascotRemoteQuery.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Chris Bielow $
6// $Authors: Andreas Bertsch, Daniel Jameson, Chris Bielow, Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12
13#include <string>
14#include <vector>
15
16typedef void CURL;
17
18namespace OpenMS
19{
31 {
32public:
33
38 OPENMS_DLLAPI MascotRemoteQuery();
39
41 OPENMS_DLLAPI MascotRemoteQuery& operator=(const MascotRemoteQuery& rhs) = delete;
42
44 OPENMS_DLLAPI MascotRemoteQuery(const MascotRemoteQuery& rhs) = delete;
45
47 OPENMS_DLLAPI ~MascotRemoteQuery() override;
49
51 OPENMS_DLLAPI void setQuerySpectra(const String& exp);
52
54 OPENMS_DLLAPI const std::string& getMascotXMLResponse() const;
55
57 OPENMS_DLLAPI const std::string& getMascotXMLDecoyResponse() const;
58
60 OPENMS_DLLAPI bool hasError() const;
61
63 OPENMS_DLLAPI const String& getErrorMessage() const;
64
66 OPENMS_DLLAPI String getSearchIdentifier() const;
67
69 OPENMS_DLLAPI void setExportDecoys(const bool b);
70
72 OPENMS_DLLAPI void run();
73
74protected:
75
76 OPENMS_DLLAPI void updateMembers_() override;
77
78private:
79
81 void login(CURL* curl);
82
84 void execQuery(CURL* curl);
85
87 std::string getResults(CURL* curl, const std::string& results_path);
88
90 std::string httpGet(CURL* curl, const std::string& path);
91
93 std::string httpPost(CURL* curl, const std::string& path, const std::string& body, const std::string& content_type);
94
96 std::string buildUrl(const std::string& path) const;
97
99 OPENMS_DLLAPI String getSearchIdentifierFromFilePath(const String& path) const;
100
102 std::string removeHostName(const std::string& url) const;
103
104 // Input / Output data
106 std::string mascot_xml_;
107 std::string mascot_decoy_xml_;
108
109 // Internal data structures
112
118 bool requires_login_ = false;
120 bool use_ssl_ = false;
124 Int to_ = 1500;
125
126 bool export_decoys_ = false;
127 };
128
129}
void CURL
Definition MascotRemoteQuery.h:16
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
Class which handles the communication between OpenMS and the Mascot server.
Definition MascotRemoteQuery.h:31
void login(CURL *curl)
login to Mascot server
void run()
Execute the full Mascot workflow synchronously (login -> query -> export results).
std::string mascot_decoy_xml_
Definition MascotRemoteQuery.h:107
MascotRemoteQuery()
default constructor
bool export_decoys_
Definition MascotRemoteQuery.h:126
String getSearchIdentifier() const
returns the search number
std::string getResults(CURL *curl, const std::string &results_path)
download result file and process response
String query_spectra_
Definition MascotRemoteQuery.h:105
String search_identifier_
Definition MascotRemoteQuery.h:111
String boundary_
boundary string that will be embedded into the HTTP requests
Definition MascotRemoteQuery.h:122
String server_path_
Path on mascot server.
Definition MascotRemoteQuery.h:114
String error_message_
Definition MascotRemoteQuery.h:110
std::string httpPost(CURL *curl, const std::string &path, const std::string &body, const std::string &content_type)
perform an HTTP POST with the given body and content type, return the response body
std::string httpGet(CURL *curl, const std::string &path)
perform an HTTP GET and return the response body
bool hasError() const
predicate which returns true if an error occurred during the query
std::string removeHostName(const std::string &url) const
Remove host name information from a url.
MascotRemoteQuery & operator=(const MascotRemoteQuery &rhs)=delete
assignment operator
void setQuerySpectra(const String &exp)
sets the query spectra, given in MGF file format
String getSearchIdentifierFromFilePath(const String &path) const
Extract search identifier from .dat file path.
Int to_
Timeout after these many seconds.
Definition MascotRemoteQuery.h:124
void execQuery(CURL *curl)
execute query (upload file)
std::string buildUrl(const std::string &path) const
build full URL from a path
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
~MascotRemoteQuery() override
destructor
const String & getErrorMessage() const
returns the error message, if hasError can be used to check whether an error has occurred
const std::string & getMascotXMLDecoyResponse() const
returns the Mascot XML response which contains the decoy identifications (note: setExportDecoys must ...
bool use_ssl_
Use SSL connection.
Definition MascotRemoteQuery.h:120
const std::string & getMascotXMLResponse() const
returns the Mascot XML response which contains the identifications
bool requires_login_
Login required.
Definition MascotRemoteQuery.h:118
void setExportDecoys(const bool b)
request export of decoy summary and decoys (note: internal decoy search must be enabled in the MGF fi...
String host_name_
Hostname of the mascot server.
Definition MascotRemoteQuery.h:116
MascotRemoteQuery(const MascotRemoteQuery &rhs)=delete
copy constructor
std::string mascot_xml_
Definition MascotRemoteQuery.h:106
A more convenient string class.
Definition String.h:34
int Int
Signed integer type.
Definition Types.h:72
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19