Class: Ms::Mascot::Submit
- Inherits:
-
Tap::Mechanize::Request
- Object
- Tap::Mechanize::Request
- Ms::Mascot::Submit
- Includes:
- Validation
- Defined in:
- lib/ms/mascot/submit.rb
Overview
:startdoc::task submits a PMF or MS/MS search to Mascot
Submits a search request to Mascot using the mgf file and the search parameters in a static config file. Correctly formatting search config file is technical since it must contain the correct fields for Submit to recreate a Mascot HTTP search request.
The easiest way to capture search parameters in the correct format is to use TapHttpFrom the command line, invoke:
% tap server
Then visit ‘localhost:8080/capture/tutorial’ in a browser and apply the capture procedure to the Mascot search page. Once you have the .yml config file, use this command to submit a search.
% rap submit <mgf_file> --config <config_file> --: dump
A convenient aspect of this setup is that you can capure parameters once, then re-use them for a number of mgf files.
Note that the default Submit configuration uses parameters are typical for MS/MS searching of a human sample digested with trypsin. These values MUST be overridden and are only provided as a template (for those that want the adventure of manually making a config file).
Constant Summary collapse
- SUCCESS_REGEXP =
Matches a successful search response. After the match:
$1:: the result file
/<A HREF="\.\.\/cgi\/master_results\.pl\?file=(.*?)">Click here to see Search Report<\/A>/
- FAILURE_REGEXP =
Matches a failure response. After the match:
$1:: the failure
/<BR>(.*)/m
Constants included from Validation
Instance Method Summary collapse
-
#parse_response_body(body) ⇒ Object
Processes the response body.
- #process(mgf_file) ⇒ Object
Instance Method Details
#parse_response_body(body) ⇒ Object
Processes the response body. Returns the result file if the body indicates a success, or nil if the body indicates a failure.
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/ms/mascot/submit.rb', line 102 def parse_response_body(body) case body when SUCCESS_REGEXP log :success, $1 $1 when FAILURE_REGEXP log :failure, $1.gsub("<BR>", "\n") nil else raise "unparseable response: #{body}" end end |
#process(mgf_file) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/ms/mascot/submit.rb', line 83 def process(mgf_file) File.open(mgf_file) do |io| # set filename for upload params = config[:params].to_hash params['FILE'] = io # submit request page = super( :request_method => 'POST', :uri => uri, :params => params ) parse_response_body(page.body) end end |