bio-velvet 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/bio-velvet/graph.rb +15 -5
- data/spec/graph_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 953480e0459b37d83bc28cc4de57646835477ba6
|
4
|
+
data.tar.gz: 0fd1add0b0d8e1bcf941f7bf40694be1a68b64af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f716cefd3baf3db0afdde4cb55edc9c45fade3c92113ce62265747644b12f8200c4c840b8db34ba8ee9e8fa2a4edd7255c3ae0c457822f96fcef2cdb9f1b323
|
7
|
+
data.tar.gz: e40b20acd894c260fc352d1516ed3817e90f8e8e0d0609861656d0e626bf440227d5f5c5a25b2869a5bd117c9cf8197b738c564865e8b85c27e746e24f03bfd3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/lib/bio-velvet/graph.rb
CHANGED
@@ -160,7 +160,7 @@ module Bio
|
|
160
160
|
nr.offset_from_start_of_node = row[1].to_i
|
161
161
|
nr.start_coord = row[2].to_i
|
162
162
|
nr.direction = current_node_direction
|
163
|
-
current_node.short_reads ||=
|
163
|
+
current_node.short_reads ||= NodedReadArray.new
|
164
164
|
current_node.short_reads.push nr
|
165
165
|
next
|
166
166
|
end
|
@@ -271,9 +271,6 @@ module Bio
|
|
271
271
|
end
|
272
272
|
|
273
273
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
274
|
# A container class for a list of Node objects. Can index with 1-offset
|
278
275
|
# IDs, so that they line up with the identifiers in velvet Graph files,
|
279
276
|
# yet respond sensibly to NodeArray#length, etc.
|
@@ -373,6 +370,19 @@ module Bio
|
|
373
370
|
end
|
374
371
|
end
|
375
372
|
|
373
|
+
class NodedReadArray < Array
|
374
|
+
def get_read_by_id(read_id)
|
375
|
+
# Construct hash if not already done
|
376
|
+
if @read_id_to_short_read_id.nil?
|
377
|
+
@read_id_to_short_read_id = {}
|
378
|
+
each do |short_read|
|
379
|
+
@read_id_to_short_read_id[short_read.read_id] = short_read
|
380
|
+
end
|
381
|
+
end
|
382
|
+
@read_id_to_short_read_id[read_id]
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
376
386
|
class Node
|
377
387
|
include Bio::Velvet::Logging
|
378
388
|
|
@@ -648,7 +658,7 @@ module Bio
|
|
648
658
|
nr.offset_from_start_of_node = row[1].to_i
|
649
659
|
nr.start_coord = row[2].to_i
|
650
660
|
nr.direction = current_node_direction
|
651
|
-
current_node.short_reads ||=
|
661
|
+
current_node.short_reads ||= NodedReadArray.new
|
652
662
|
current_node.short_reads.push nr
|
653
663
|
next
|
654
664
|
end
|
data/spec/graph_spec.rb
CHANGED
@@ -461,4 +461,11 @@ ACTATGCTGGTATTTCACTTCCAGGTACAGG'.gsub(/\n/,''))
|
|
461
461
|
graph.neighbours_into_start(graph.nodes[3]) == [graph.nodes[1]]
|
462
462
|
graph.neighbours_into_start(graph.nodes[4]) == []
|
463
463
|
end
|
464
|
+
|
465
|
+
it 'should use NodedReadArray' do
|
466
|
+
graph = Bio::Velvet::Graph.parse_from_file File.join(TEST_DATA_DIR, 'short_node_LastGraph')
|
467
|
+
graph.nodes[1].short_reads.kind_of?(Bio::Velvet::Graph::NodedReadArray).should == true
|
468
|
+
first = graph.nodes[1].short_reads[0]
|
469
|
+
graph.nodes[1].short_reads.get_read_by_id(first.read_id).should == first
|
470
|
+
end
|
464
471
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-velvet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben J Woodcroft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bio-logger
|