Class: Mspire::Mzml::CV

Inherits:
Object
  • Object
show all
Defined in:
lib/mspire/mzml/cv.rb

Constant Summary collapse

IMS =
self.new("IMS",  "Imaging MS Ontology", "http://www.maldi-msi.org/download/imzml/imagingMS.obo", "0.9.1")
MS =
self.new('MS', "Proteomics Standards Initiative Mass Spectrometry Ontology", "http://psidev.cvs.sourceforge.net/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo", "3.29.0")
UO =

the version for UO doesn’t really exist: seen files where they use the download date: DD:MM:YYY. I’m going to use the save date in the header.

self.new("UO", "Unit Ontology", "http://obo.cvs.sourceforge.net/*checkout*/obo/obo/ontology/phenotype/unit.obo", "12:10:2011")
DEFAULT_CVS =
[MS, UO, IMS]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, full_name, uri, version = nil) ⇒ CV

Returns a new instance of CV.



18
19
20
# File 'lib/mspire/mzml/cv.rb', line 18

def initialize(id, full_name, uri, version=nil)
  @id, @full_name, @uri, @version = id, full_name, uri, version
end

Instance Attribute Details

#full_nameObject

(required) The usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).



12
13
14
# File 'lib/mspire/mzml/cv.rb', line 12

def full_name
  @full_name
end

#idObject

(required) The short label to be used as a reference tag with which to refer to this particular Controlled Vocabulary source description (e.g., from the cvLabel attribute, in CVParamType elements).



10
11
12
# File 'lib/mspire/mzml/cv.rb', line 10

def id
  @id
end

#uriObject

(required) The URI for the resource.



14
15
16
# File 'lib/mspire/mzml/cv.rb', line 14

def uri
  @uri
end

#versionObject

(optional) The version of the CV from which the referred-to terms are drawn.



16
17
18
# File 'lib/mspire/mzml/cv.rb', line 16

def version
  @version
end

Class Method Details

.from_xml(xml) ⇒ Object



37
38
39
# File 'lib/mspire/mzml/cv.rb', line 37

def self.from_xml(xml)
  self.new(xml[:id], xml[:fullName], xml[:URI], xml[:version])
end

.list_xml(objs, builder) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/mspire/mzml/cv.rb', line 29

def self.list_xml(objs, builder)
  # we don't extend Mzml::List because of custom name below
  builder.cvList(count: objs.size) do |cvl_n|
    objs.each {|obj| obj.to_xml(cvl_n) }
  end
  builder
end

Instance Method Details

#to_xml(builder) ⇒ Object



22
23
24
25
26
27
# File 'lib/mspire/mzml/cv.rb', line 22

def to_xml(builder)
  atts = {id: @id, fullName: @full_name, :URI => @uri}
  atts[:version] = @version if @version
  builder.cv( atts )
  builder
end