class Bio::Transmembrane::TransmembraneProtein
Attributes
name[RW]
transmembrane_domains[RW]
Public Class Methods
new()
click to toggle source
# File lib/bio/transmembrane.rb, line 40 def initialize # default no domains to empty array not nil @transmembrane_domains = [] end
Public Instance Methods
average_length()
click to toggle source
# File lib/bio/transmembrane.rb, line 49 def average_length @transmembrane_domains.inject(0){|sum,cur| sum+cur.length}.to_f/@transmembrane_domains.length.to_f end
best_overlap(another_transmembrane_protein)
click to toggle source
return the pair of transmembrane domains that overlaps the best (ie for the longest period)
# File lib/bio/transmembrane.rb, line 76 def best_overlap(another_transmembrane_protein) max = @transmembrane_domains.pairs(another_transmembrane_protein.transmembrane_domains).collect {|t1,t2| [t1.overlap_length(t2), [t1,t2]] }.max {|a,b| a[0] <=> b[0]} max[0] == 0 ? nil : max[1] end
each() { |t| ... }
click to toggle source
# File lib/bio/transmembrane.rb, line 83 def each @transmembrane_domains.each{|t| yield t} end
has_domain?()
click to toggle source
# File lib/bio/transmembrane.rb, line 61 def has_domain? !@transmembrane_domains.empty? end
maximum_length()
click to toggle source
# File lib/bio/transmembrane.rb, line 57 def maximum_length @transmembrane_domains.max.length end
minimum_length()
click to toggle source
# File lib/bio/transmembrane.rb, line 53 def minimum_length @transmembrane_domains.min.length end
multiple_transmembrane_domains?()
click to toggle source
# File lib/bio/transmembrane.rb, line 65 def multiple_transmembrane_domains? @transmembrane_domains.length > 1 end
overlaps(another_transmembrane_protein)
click to toggle source
# File lib/bio/transmembrane.rb, line 69 def overlaps(another_transmembrane_protein) @transmembrane_domains.pairs(another_transmembrane_protein.transmembrane_domains).collect {|t1,t2| t1.intersection(t2) == () ? nil : [t1,t2] }.reject {|a| a.nil?} end
push(transmembrane_domain)
click to toggle source
# File lib/bio/transmembrane.rb, line 45 def push(transmembrane_domain) @transmembrane_domains.push transmembrane_domain end
residue_number_contained?(residue_number)
click to toggle source
# File lib/bio/transmembrane.rb, line 87 def residue_number_contained?(residue_number) contained = false @transmembrane_domains.each do |tmd| if tmd.start <= residue_number and tmd.stop >= residue_number contained = true end end contained end