Permalink
Browse files

added residue_contained? functionality, associated tests, and in-code…

… doco
  • Loading branch information...
1 parent 4c5fce7 commit 82219d2d2ef3b1cf1a34fc3a43d4a8ebbfa7c19d Ben J Woodcroft committed Apr 10, 2011
Showing with 45 additions and 1 deletion.
  1. +19 −1 lib/bio/transmembrane.rb
  2. +26 −0 test/test_transmembrane.rb
View
@@ -51,6 +51,16 @@ def best_overlap(another_transmembrane_protein)
def each
@transmembrane_domains.each{|t| yield t}
end
+
+ 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
end
class OrientedTransmembraneDomainProtein<TransmembraneProtein
@@ -138,8 +148,16 @@ def ==(other)
end
end
+ # From Predicting transmembrane protein topology with a hidden markov model: application to complete g
+ #
+ # Another signal shown to be associated with transmembrane helices is
+ # the abundance of positively charged residues in the part of the
+ # sequence on the cytoplasmic side of the membrane, “the positive inside
+ # rule” (von Heijne 1986) and (von Heijne 1994).
+ #
+ # So, inside means cytosolic. So outside_in means type I transmembrane domain protein
class OrientedTransmembraneDomain<TransmembraneDomainDefinition
- # The orientation can either be inside out (like a type II transmembrane domain protein)
+ # The orientation can either be inside out (like a type II transmembrane domain protein)
INSIDE_OUT = 'inside_out'
# Or outside in, like a type I transmembrane domain protein)
OUTSIDE_IN = 'outside_in'
View
@@ -116,5 +116,31 @@ def test_overlap_tmd
assert_equal 1, tmd1.overlap_length(tmd2)
assert_equal((3..3), tmd1.intersection(tmd2))
end
+
+ def test_residue_contained?
+ p = TransmembraneProtein.new
+
+ # test none
+ p.transmembrane_domains = []
+ assert_equal false, p.residue_number_contained?(5)
+
+ # test one
+ p.transmembrane_domains = [TransmembraneDomainDefinition.new(5,8)]
+ assert p.residue_number_contained?(5)
+ assert p.residue_number_contained?(6)
+ assert p.residue_number_contained?(8)
+ assert_equal false, p.residue_number_contained?(4)
+ assert_equal false, p.residue_number_contained?(9)
+
+ # test 3
+ p.transmembrane_domains = [
+ TransmembraneDomainDefinition.new(1,10),
+ TransmembraneDomainDefinition.new(90,100),
+ TransmembraneDomainDefinition.new(16,24),
+ ]
+ assert p.residue_number_contained?(5)
+ assert p.residue_number_contained?(95)
+ assert_equal false, p.residue_number_contained?(150)
+ end
end
end

0 comments on commit 82219d2

Please sign in to comment.