class Bio::Velvet::Graph::Arc
Attributes
begin_node_direction[RW]
true for forwards direction, false for reverse
begin_node_id[RW]
end_node_direction[RW]
true for forwards direction, false for reverse
end_node_id[RW]
multiplicity[RW]
Public Instance Methods
begin_node_forward?()
click to toggle source
# File lib/bio-velvet/graph.rb, line 503 def begin_node_forward? @begin_node_direction end
connects_beginning_to_beginning?(first_node_id, second_node_id)
click to toggle source
Returns true if this arc connects the start of the first node to the start of the second node, else false
# File lib/bio-velvet/graph.rb, line 534 def connects_beginning_to_beginning?(first_node_id, second_node_id) (first_node_id == @begin_node_id and second_node_id == @end_node_id and @begin_node_direction == false and @end_node_direction == true) or (first_node_id == @end_node_id and second_node_id = @begin_node_id and @begin_node_direction == false and @end_node_direction == true) end
connects_beginning_to_end?(first_node_id, second_node_id)
click to toggle source
Returns true if this arc connects the start of the first node to the start of the second node, else false
# File lib/bio-velvet/graph.rb, line 543 def connects_beginning_to_end?(first_node_id, second_node_id) (first_node_id == @begin_node_id and second_node_id == @end_node_id and @begin_node_direction == false and @end_node_direction == false) or (first_node_id == @end_node_id and second_node_id = @begin_node_id and @begin_node_direction == true and @end_node_direction == true) end
connects_end_to_beginning?(first_node_id, second_node_id)
click to toggle source
Returns true if this arc connects the end of the first node to the start of the second node, else false
# File lib/bio-velvet/graph.rb, line 513 def connects_end_to_beginning?(first_node_id, second_node_id) # ARC $START_NODE $END_NODE $MULTIPLICITY #Note: this one line implicitly represents an arc from node A to B and #another, with same multiplicity, from -B to -A. (first_node_id == @begin_node_id and second_node_id == @end_node_id and @begin_node_direction == true and @end_node_direction == true) or (first_node_id == @end_node_id and second_node_id = @begin_node_id and @begin_node_direction == false and @end_node_direction == false) end
connects_end_to_end?(first_node_id, second_node_id)
click to toggle source
Returns true if this arc connects the end of the first node to the end of the second node, else false
# File lib/bio-velvet/graph.rb, line 525 def connects_end_to_end?(first_node_id, second_node_id) (first_node_id == @begin_node_id and second_node_id == @end_node_id and @begin_node_direction == true and @end_node_direction == false) or (first_node_id == @end_node_id and second_node_id = @begin_node_id and @begin_node_direction == true and @end_node_direction == false) end
connects_to_beginning?(node_id)
click to toggle source
Return true if this arc connects the beginning of the node, else false
# File lib/bio-velvet/graph.rb, line 552 def connects_to_beginning?(node_id) (node_id == @begin_node_id and !@begin_node_direction) or (node_id == @end_node_id and @end_node_direction) end
connects_to_end?(node_id)
click to toggle source
Return true if this arc connects the end of the node, else false
# File lib/bio-velvet/graph.rb, line 559 def connects_to_end?(node_id) (node_id == @begin_node_id and @begin_node_direction) or (node_id == @end_node_id and !@end_node_direction) end
directions_opposing?()
click to toggle source
# File lib/bio-velvet/graph.rb, line 492 def directions_opposing? if (@begin_node_direction == true and @end_node_direction == false) or (@begin_node_direction == false and @end_node_direction == true) return true elsif [true,false].include?(@begin_node_direction) and [true,false].include?(@end_node_direction) return false else raise Exception, "Node directions not set! Cannot tell whether directions are opposing" end end
end_node_forward?()
click to toggle source
# File lib/bio-velvet/graph.rb, line 507 def end_node_forward? @end_node_forward end
to_s()
click to toggle source
# File lib/bio-velvet/graph.rb, line 564 def to_s str = '' str += '-' if @begin_node_direction == false str += @begin_node_id.to_s str += ' ' str += '-' if @end_node_direction == false str += @end_node_id.to_s str += ' ' str += @multiplicity.to_s str end