Class: ProteinGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/protk/protein_group.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProteinGroup

Returns a new instance of ProteinGroup.



64
65
66
# File 'lib/protk/protein_group.rb', line 64

def initialize()

end

Instance Attribute Details

#group_numberObject

Returns the value of attribute group_number.



12
13
14
# File 'lib/protk/protein_group.rb', line 12

def group_number
  @group_number
end

#group_probabilityObject

Returns the value of attribute group_probability.



13
14
15
# File 'lib/protk/protein_group.rb', line 13

def group_probability
  @group_probability
end

#proteinsObject

Returns the value of attribute proteins.



14
15
16
# File 'lib/protk/protein_group.rb', line 14

def proteins
  @proteins
end

Class Method Details

.from_mzid(groupnode, mzid_doc, minprob = 0) ⇒ Object

Note: This is hacked together to work for a specific PeptideShaker output type Refactor and properly respect cvParams for real conversion



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/protk/protein_group.rb', line 38

def from_mzid(groupnode,mzid_doc,minprob=0)

	group=new()

	group.group_number=groupnode.attributes['id'].split("_").last.to_i+1
	group.group_probability=mzid_doc.get_cvParam(groupnode,"MS:1002470").attributes['value'].to_f

	# require 'byebug';byebug

	protein_nodes=mzid_doc.get_proteins_for_group(groupnode)



	group_members = protein_nodes.select do |e| 
		mzid_doc.get_protein_probability(e)>=minprob
	end

	group.proteins = group_members.collect { |e| Protein.from_mzid(e,mzid_doc) }

	group
end

Instance Method Details

#as_protxmlObject



68
69
70
71
72
73
74
75
# File 'lib/protk/protein_group.rb', line 68

def as_protxml()
	node = XML::Node.new('protein_group')
   	node["group_number"] = self.group_number.to_s
   	# require 'byebug';byebug
   	node["group_probability"] = (self.group_probability * 0.01).to_s
   	self.proteins.each { |prot| node << prot.as_protxml }
   	node
end