Class: Protein

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProtein

Returns a new instance of Protein.



52
53
54
# File 'lib/protk/protein.rb', line 52

def initialize()

end

Instance Attribute Details

#group_numberObject

Returns the value of attribute group_number.



8
9
10
# File 'lib/protk/protein.rb', line 8

def group_number
  @group_number
end

#group_probabilityObject

Returns the value of attribute group_probability.



9
10
11
# File 'lib/protk/protein.rb', line 9

def group_probability
  @group_probability
end

#n_indistinguishable_proteinsObject

Returns the value of attribute n_indistinguishable_proteins.



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

def n_indistinguishable_proteins
  @n_indistinguishable_proteins
end

#peptidesObject

Returns the value of attribute peptides.



15
16
17
# File 'lib/protk/protein.rb', line 15

def peptides
  @peptides
end

#percent_coverageObject

Returns the value of attribute percent_coverage.



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

def percent_coverage
  @percent_coverage
end

#probabilityObject

Returns the value of attribute probability.



10
11
12
# File 'lib/protk/protein.rb', line 10

def probability
  @probability
end

#protein_nameObject

Returns the value of attribute protein_name.



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

def protein_name
  @protein_name
end

#sequenceObject

Returns the value of attribute sequence.



11
12
13
# File 'lib/protk/protein.rb', line 11

def sequence
  @sequence
end

Class Method Details

.from_protxml(xmlnode) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/protk/protein.rb', line 35

def from_protxml(xmlnode)
	prot=new()
	groupnode = xmlnode.parent
	prot.group_probability = groupnode['probability'].to_f
	prot.group_number = groupnode['group_number'].to_i
	prot.probability = xmlnode['probability'].to_f
	prot.protein_name = xmlnode['protein_name']
	prot.n_indistinguishable_proteins = xmlnode['n_indistinguishable_proteins'].to_i
	prot.percent_coverage = xmlnode['percent_coverage'].to_f

	peptide_nodes = xmlnode.find('protxml:peptide','protxml:http://regis-web.systemsbiology.net/protXML')
	prot.peptides = peptide_nodes.collect { |e| Peptide.from_protxml(e) }
	prot
end

Instance Method Details

#representative_peptidesObject

Return just one peptide for each unique sequence choosing the peptide with highest probability



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/protk/protein.rb', line 58

def representative_peptides()
	best_peptides={}
	self.peptides.each do |peptide|
		seq = peptide.sequence
		if best_peptides[seq].nil?
			best_peptides[seq]=peptide				
		else
			best_peptides[seq]=peptide if peptide.nsp_adjusted_probability > best_peptides[seq].nsp_adjusted_probability
		end
	end

	best_peptides.values
end