Class: Ms::Mascot::Formats::Xml
- Inherits:
-
Object
- Object
- Ms::Mascot::Formats::Xml
- Defined in:
- lib/ms/mascot/formats/xml.rb
Defined Under Namespace
Modules: Utils
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
Instance Method Summary collapse
- #format_parameters ⇒ Object
- #header ⇒ Object
- #hits ⇒ Object
-
#initialize(xml) ⇒ Xml
constructor
A new instance of Xml.
- #modifications ⇒ Object
- #peptides(protein) ⇒ Object
- #proteins(hit) ⇒ Object
- #search_parameters ⇒ Object
Constructor Details
#initialize(xml) ⇒ Xml
Returns a new instance of Xml.
30 31 32 33 34 |
# File 'lib/ms/mascot/formats/xml.rb', line 30 def initialize(xml) xml = xml.read if xml.respond_to?(:read) xml = xml.sub(%q{xmlns="http://www.matrixscience.com/xmlns/schema/mascot_search_results_2"}, "") @doc = Nokogiri::XML(xml) end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
28 29 30 |
# File 'lib/ms/mascot/formats/xml.rb', line 28 def doc @doc end |
Instance Method Details
#format_parameters ⇒ Object
48 49 50 |
# File 'lib/ms/mascot/formats/xml.rb', line 48 def format_parameters doc.xpath("/mascot_search_results/format_parameters") end |
#header ⇒ Object
36 37 38 |
# File 'lib/ms/mascot/formats/xml.rb', line 36 def header doc.at("/mascot_search_results/header") end |
#hits ⇒ Object
52 53 54 |
# File 'lib/ms/mascot/formats/xml.rb', line 52 def hits doc.xpath("/mascot_search_results/hits/hit") end |
#modifications ⇒ Object
40 41 42 |
# File 'lib/ms/mascot/formats/xml.rb', line 40 def modifications doc.xpath("/mascot_search_results/variable_mods/modification") end |
#peptides(protein) ⇒ Object
60 61 62 |
# File 'lib/ms/mascot/formats/xml.rb', line 60 def peptides(protein) protein.xpath("peptide") end |
#proteins(hit) ⇒ Object
56 57 58 |
# File 'lib/ms/mascot/formats/xml.rb', line 56 def proteins(hit) hit.xpath("protein") end |
#search_parameters ⇒ Object
44 45 46 |
# File 'lib/ms/mascot/formats/xml.rb', line 44 def search_parameters doc.xpath("/mascot_search_results/search_parameters") end |