Class: Bio::Velvet::Underground::Graph::Node
- Inherits:
-
Object
- Object
- Bio::Velvet::Underground::Graph::Node
- Defined in:
- lib/bio-velvet_underground/graph.rb
Instance Attribute Summary collapse
-
#internal_node_struct ⇒ Object
Returns the value of attribute internal_node_struct.
Instance Method Summary collapse
- #coverages ⇒ Object
- #ends_of_kmers_of_node ⇒ Object
- #ends_of_kmers_of_twin_node ⇒ Object
- #fwd_short_reads ⇒ Object
-
#initialize(graph, node_struct) ⇒ Node
constructor
A new instance of Node.
- #length_alone ⇒ Object
- #node_id ⇒ Object
- #rev_short_reads ⇒ Object
- #short_reads ⇒ Object
- #twin ⇒ Object
Constructor Details
#initialize(graph, node_struct) ⇒ Node
Returns a new instance of Node.
77 78 79 80 |
# File 'lib/bio-velvet_underground/graph.rb', line 77 def initialize(graph, node_struct) @graph = graph @internal_node_struct = node_struct end |
Instance Attribute Details
#internal_node_struct ⇒ Object
Returns the value of attribute internal_node_struct.
75 76 77 |
# File 'lib/bio-velvet_underground/graph.rb', line 75 def internal_node_struct @internal_node_struct end |
Instance Method Details
#coverages ⇒ Object
90 91 92 93 94 95 |
# File 'lib/bio-velvet_underground/graph.rb', line 90 def coverages [ @internal_node_struct[:virtualCoverage1], @internal_node_struct[:virtualCoverage2], ] end |
#ends_of_kmers_of_node ⇒ Object
97 98 99 100 101 102 103 104 105 |
# File 'lib/bio-velvet_underground/graph.rb', line 97 def ends_of_kmers_of_node seq = [] key = %w(A C G T) 0.upto(length_alone-1) do |i| n = Bio::Velvet::Underground.getNucleotideInNode(@internal_node_struct, i) seq.push key[n] end return seq.join end |
#ends_of_kmers_of_twin_node ⇒ Object
107 108 109 |
# File 'lib/bio-velvet_underground/graph.rb', line 107 def ends_of_kmers_of_twin_node twin.ends_of_kmers_of_node end |
#fwd_short_reads ⇒ Object
121 122 123 124 125 126 127 128 129 130 |
# File 'lib/bio-velvet_underground/graph.rb', line 121 def fwd_short_reads array_start_pointer = Bio::Velvet::Underground.getNodeReads @internal_node_struct, @graph.internal_graph_struct num_short_reads = Bio::Velvet::Underground.getNodeReadCount @internal_node_struct, @graph.internal_graph_struct short_reads = (0...num_short_reads).collect do |i| # Use the fact that FFI pointers can do pointer arithmetic pointer = array_start_pointer+(i*Bio::Velvet::Underground::ShortReadMarker.size) NodedRead.new Bio::Velvet::Underground::ShortReadMarker.new(pointer), true end return short_reads end |
#length_alone ⇒ Object
86 87 88 |
# File 'lib/bio-velvet_underground/graph.rb', line 86 def length_alone @internal_node_struct[:length] end |
#node_id ⇒ Object
82 83 84 |
# File 'lib/bio-velvet_underground/graph.rb', line 82 def node_id @internal_node_struct[:ID] end |
#rev_short_reads ⇒ Object
132 133 134 |
# File 'lib/bio-velvet_underground/graph.rb', line 132 def rev_short_reads twin.fwd_short_reads end |
#short_reads ⇒ Object
136 137 138 139 140 141 142 143 |
# File 'lib/bio-velvet_underground/graph.rb', line 136 def short_reads reads = fwd_short_reads rev_short_reads.each do |read| read.direction = false reads.push read end return reads end |
#twin ⇒ Object
111 112 113 114 115 116 117 118 119 |
# File 'lib/bio-velvet_underground/graph.rb', line 111 def twin return @twin unless @twin.nil? twin_pointer = Bio::Velvet::Underground.getTwinNode(@internal_node_struct) @twin = Bio::Velvet::Underground::Graph::Node.new( @graph, Bio::Velvet::Underground::NodeStruct.new(twin_pointer) ) end |