scbi_ace 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ === 0.0.6 2012-07-25
2
+
3
+ Added documentation
4
+
5
+ === 0.0.5 2012-07-24
6
+
7
+ Added AceParser
8
+
9
+ === 0.0.1 2010-10-06
10
+
11
+ * Initial release
@@ -0,0 +1,15 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/scbi_ace.rb
7
+ script/console
8
+ script/destroy
9
+ script/generate
10
+ test/test_helper.rb
11
+ test/test_scbi_ace.rb
12
+ lib/scbi_ace/indexed_ace_file.rb
13
+ lib/scbi_ace/ace_parser.rb
14
+ lib/scbi_ace/contig.rb
15
+ lib/scbi_ace/read.rb
@@ -0,0 +1,7 @@
1
+
2
+ For more information on scbi_ace, see http://scbi_ace.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
@@ -0,0 +1,90 @@
1
+ = scbi_ace
2
+
3
+ * http://www.scbi.uma.es/downloads
4
+
5
+ == DESCRIPTION:
6
+
7
+ scbi_ace is a ruby gem to read and parse ACE files containing contigs. It automatically indexes the input ace file to improve random access to contigs.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Indexes ace files to provide fast random access to individual contigs
12
+ * Parses the text representation in ACE format to Contigs and Reads objects
13
+ * Generates the text representation
14
+
15
+ == SYNOPSIS:
16
+
17
+ To get the text that defines a contig by its name:
18
+
19
+ require 'scbi_ace'
20
+
21
+ ace=IndexedAceFile.new(File.join(File.dirname(__FILE__),'test.ace'))
22
+
23
+ puts ace.read_contig('Contig1')
24
+
25
+ ace.close
26
+
27
+
28
+ To parse all contigs in an ACE file
29
+
30
+ require 'scbi_ace'
31
+
32
+ ace=AceParser.new(filename)
33
+
34
+ ace.each_contig do |contig|
35
+ puts contig.name
36
+ puts contig.reads.count
37
+ end
38
+
39
+ ace.close
40
+
41
+ To parse one contig in an ACE file
42
+
43
+ require 'scbi_ace'
44
+
45
+ ace=AceParser.new(filename)
46
+
47
+ contig=ace.read_contig('Contig1')
48
+ puts contig.name
49
+ puts contig.reads.count
50
+
51
+ # to get next contig (nil if none available)
52
+ contig2 = ace.next_contig
53
+ puts contig2.name
54
+ puts contig2.reads.count
55
+
56
+ ace.close
57
+
58
+
59
+ == REQUIREMENTS:
60
+
61
+ None
62
+
63
+ == INSTALL:
64
+
65
+ * gem install scbi_ace
66
+
67
+ == LICENSE:
68
+
69
+ (The MIT License)
70
+
71
+ Copyright (c) 2010 Noe Fernandez & Dario Guerrero
72
+
73
+ Permission is hereby granted, free of charge, to any person obtaining
74
+ a copy of this software and associated documentation files (the
75
+ 'Software'), to deal in the Software without restriction, including
76
+ without limitation the rights to use, copy, modify, merge, publish,
77
+ distribute, sublicense, and/or sell copies of the Software, and to
78
+ permit persons to whom the Software is furnished to do so, subject to
79
+ the following conditions:
80
+
81
+ The above copyright notice and this permission notice shall be
82
+ included in all copies or substantial portions of the Software.
83
+
84
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
85
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
86
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
87
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
88
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
89
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
90
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/scbi_ace'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'scbi_ace' do
14
+ self.developer 'Noe Fernandez & Dario Guerrero', 'noefp@uma.es , dariogf@gmail.com'
15
+ self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
+ self.rubyforge_name = self.name # TODO this is default value
17
+ # self.extra_deps = [['activesupport','>= 2.0.2']]
18
+
19
+ end
20
+
21
+ require 'newgem/tasks'
22
+ Dir['tasks/**/*.rake'].each { |t| load t }
23
+
24
+ # TODO - want other tests/tasks run by default? Add them to the list
25
+ # remove_task :default
26
+ # task :default => [:spec, :features]
@@ -0,0 +1,11 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ $: << File.join(File.dirname(__FILE__),File.basename(__FILE__,File.extname(__FILE__)))
5
+
6
+ require 'indexed_ace_file'
7
+ require 'ace_parser'
8
+
9
+ module ScbiAce
10
+ VERSION = '0.0.6'
11
+ end
@@ -0,0 +1,226 @@
1
+ # Description: This class provided the methods to parse and write an ACE file and to add contigs to the Ace
2
+ # ---- Author: Noe Fernandez Pozo
3
+ # ------ Date: 31-May-2011
4
+
5
+ require 'contig'
6
+ require 'indexed_ace_file'
7
+
8
+ class AceParser < IndexedAceFile
9
+
10
+ # attr_accessor :name,:contigs,:reads_count
11
+
12
+ def initialize(ace_file)
13
+ super(ace_file)
14
+
15
+ # @ace_file = File.open(ace_file)
16
+ # reads_count = @ace_file.readline.sub(/^AS\s+\d+\s+/,'')
17
+
18
+ end
19
+
20
+ def close
21
+ super
22
+ # @ace_file.close
23
+ end
24
+
25
+ def next_contig
26
+
27
+ res=super()
28
+
29
+ if !res.nil?
30
+ contig = parse_contig(res)
31
+ end
32
+
33
+ return contig
34
+ end
35
+
36
+ def read_contig(contig_name)
37
+ res=super(contig_name)
38
+
39
+ if !res.nil?
40
+ contig = parse_contig(res)
41
+ end
42
+
43
+ return contig
44
+ end
45
+
46
+ def write_ace(contigs)
47
+
48
+ ace_to_print = []
49
+ reads_count=0
50
+ contigs.map {|c| reads_count+=c.reads.count}
51
+
52
+ ace_to_print.push "AS #{contigs.count} #{reads_count}"
53
+
54
+ contigs.each do |contig|
55
+ #---------------------------------------------- CO
56
+ ace_to_print.push "CO #{contig.name} #{contig.length} #{contig.reads_num} #{contig.bs_num} #{contig.orientation}"
57
+ ace_to_print.push contig.fasta.scan(/.{1,60}/m)
58
+
59
+ #---------------------------------------------- BQ
60
+ ace_to_print.push "\nBQ"
61
+ seq_qual = contig.qual.split(" ")
62
+ count = 0
63
+ qv_line = ''
64
+ seq_qual.each do |qv|
65
+ count+=1
66
+ qv_line << "#{qv} "
67
+ if (count % 60 == 0)
68
+ ace_to_print.push qv_line
69
+ qv_line = ''
70
+ end
71
+ end
72
+
73
+ ace_to_print.push ""
74
+ #---------------------------------------------- AF
75
+ af_array = []
76
+ contig.reads.each_value do |read|
77
+ ace_to_print.push "AF #{read.name} #{read.orientation} #{read.start_in_consensus}"
78
+ af_array.push read.name
79
+ end
80
+
81
+ #---------------------------------------------- BS
82
+ bs_array = []
83
+ contig.reads.each_value do |read|
84
+ bs_array = bs_array + read.bs
85
+ end
86
+
87
+ bs_array.sort!{|a,b| a['padded_start_consensus'].to_i<=>b['padded_start_consensus'].to_i}
88
+ bs_array.each do |bs_hash|
89
+ ace_to_print.push "BS #{bs_hash['padded_start_consensus']} #{bs_hash['padded_end_consensus']} #{bs_hash['read_name']}"
90
+ end
91
+
92
+ #----------------------------------------------- RD
93
+ af_array.each do |name|
94
+ contig.reads[name]
95
+ ace_to_print.push "\nRD #{name} #{contig.reads[name].padded_bases_num} #{contig.reads[name].item_num} #{contig.reads[name].tag_num}"
96
+ ace_to_print.push contig.reads[name].fasta.scan(/.{1,60}/m)
97
+ ace_to_print.push "\nQA #{contig.reads[name].qual_clip_start} #{contig.reads[name].qual_clip_end} #{contig.reads[name].align_clip_start} #{contig.reads[name].align_clip_end}"
98
+ ace_to_print.push "DS"
99
+ end
100
+ end
101
+
102
+ return ace_to_print.join("\n")
103
+
104
+ end
105
+
106
+ # def add_contig(contig_name,contig_length,reads_num,bs_num,orientation)
107
+ # contig= Contig.new(contig_name,contig_length,reads_num,bs_num,orientation)
108
+ #
109
+ # # @contigs.push contig
110
+ # return contig
111
+ #
112
+ # end
113
+
114
+ def parse_contig(contig_lines)
115
+ contig = nil
116
+ read = nil
117
+ save_fasta = false
118
+ save_read_fasta = false
119
+ save_qual = false
120
+ contig_fasta = ''
121
+ read_fasta = ''
122
+ contig_qual = ''
123
+ bs = {}
124
+
125
+ # my_ace = File.open(@ace_file)
126
+ # @reads_count = my_ace.readline.sub(/^AS\s+\d+\s+/,'')
127
+
128
+ contig_lines.split("\n").each do |line|
129
+ # @ace_file.each do |line|
130
+ line.chomp!
131
+ #---------------------------------------------- contig fasta
132
+ if (save_fasta)
133
+ if !(line =~ /^./)
134
+ contig.add_fasta(contig_fasta)
135
+ save_fasta = false
136
+ contig_fasta = ''
137
+ end
138
+ contig_fasta << line
139
+ end
140
+ #---------------------------------------------- contig qual
141
+ if (save_qual)
142
+ if !(line =~ /^./)
143
+ contig.add_qual(contig_qual)
144
+ save_qual = false
145
+ contig_qual = ''
146
+ end
147
+ contig_qual << line
148
+ end
149
+ #---------------------------------------------- read fasta
150
+ if (save_read_fasta)
151
+ if !(line =~ /^./)
152
+ read.add_fasta(read_fasta)
153
+ save_read_fasta = false
154
+ read_fasta = ''
155
+ end
156
+ read_fasta << line
157
+ end
158
+
159
+ #---------------------------------------------- CO
160
+ if (line =~ /^CO\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/)
161
+ contig_name = $1
162
+ contig_length = $2
163
+ reads_num = $3
164
+ bs_num = $4
165
+ orientation = $5
166
+ save_fasta = true
167
+ # contig = add_contig(contig_name,contig_length,reads_num,bs_num,orientation)
168
+ contig= Contig.new(contig_name,contig_length,reads_num,bs_num,orientation)
169
+ end
170
+
171
+ #---------------------------------------------- BQ
172
+ if (line =~ /^BQ/)
173
+ save_qual = true
174
+ end
175
+
176
+ #---------------------------------------------- AF
177
+ if (line =~ /^AF\s+([^\s]+)\s+([A-Z])\s+([^\s]+)/)
178
+ read_name = $1
179
+ orientation = $2
180
+ start_consensus = $3
181
+
182
+ contig.add_read(read_name,orientation,start_consensus)
183
+ end
184
+
185
+ #---------------------------------------------- BS
186
+ if (line =~ /^BS\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/)
187
+ padded_start_consensus = $1
188
+ padded_end_consensus = $2
189
+ read_name = $3
190
+
191
+ bs['padded_start_consensus'] = padded_start_consensus
192
+ bs['padded_end_consensus'] = padded_end_consensus
193
+ bs['read_name'] = read_name
194
+
195
+ read = contig.reads[read_name]
196
+ read.add_bs(bs)
197
+ bs = {}
198
+ end
199
+
200
+ #---------------------------------------------- RD
201
+ if (line =~ /^RD\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/)
202
+ read_name = $1
203
+ padded_bases_num = $2
204
+ item_num = $3
205
+ tag_num = $4
206
+ save_read_fasta = true
207
+
208
+ read = contig.reads[read_name]
209
+ read.add_data(padded_bases_num,item_num,tag_num)
210
+ end
211
+
212
+ #---------------------------------------------- QA
213
+ if (line =~ /^QA\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/)
214
+ qual_clip_start = $1
215
+ qual_clip_end = $2
216
+ align_clip_start = $3
217
+ align_clip_end = $4
218
+
219
+ read.add_qual_clipping(qual_clip_start, qual_clip_end, align_clip_start, align_clip_end)
220
+ end
221
+ end
222
+
223
+ return contig
224
+ end
225
+
226
+ end
@@ -0,0 +1,49 @@
1
+ # Description: This class provided the methods to access to the Contig data and to add reads to the Contig
2
+ # ---- Author: Noe Fernandez Pozo
3
+ # ------ Date: 31-May-2011
4
+
5
+ require 'read'
6
+
7
+ class Contig
8
+
9
+ attr_accessor :name,:length,:reads_num,:bs_num,:orientation,:reads,:reads_names,:fasta,:qual
10
+
11
+ def initialize(name,length,reads_num,bs_num,orientation)
12
+
13
+ @name = name
14
+ @length = length
15
+ @reads_num = reads_num
16
+ @bs_num = bs_num
17
+ @orientation = orientation
18
+
19
+ @reads = {}
20
+ @reads_names = []
21
+
22
+ @fasta = ''
23
+ @qual = ''
24
+ end
25
+
26
+ def add_read(read_name,orientation,start_consensus)
27
+ read= Read.new(read_name,orientation,start_consensus)
28
+ @reads_names << read_name
29
+ @reads[read_name] = read
30
+ return read
31
+ end
32
+
33
+ def add_fasta(fasta)
34
+ @fasta = fasta
35
+ end
36
+
37
+ def add_qual(qual)
38
+ @qual = qual
39
+ end
40
+
41
+ def get_read(read_name)
42
+ return @reads[read_name]
43
+ end
44
+
45
+ def get_read_names
46
+ return @reads_names
47
+ end
48
+
49
+ end
@@ -0,0 +1,154 @@
1
+
2
+ class ContigNotFountException < RuntimeError
3
+ end
4
+
5
+ class IndexedAceFile
6
+
7
+ READ_REG_EXP= /^([^\s]+)\s+([^\s]+)\s+([^\s]+)/
8
+
9
+ attr_reader :ace_file_name
10
+
11
+ def initialize(ace_file_name)
12
+ #@ace_file = File.open(ace_file_name)
13
+ @ace_file_name = ace_file_name
14
+
15
+ index_file_name=ace_file_name+'.scbi_index'
16
+
17
+ if !File.exists?(index_file_name)
18
+ create_index_file(index_file_name)
19
+ end
20
+
21
+ @index_file = File.open(index_file_name)
22
+
23
+ end
24
+
25
+ def self.open(ace_file_name)
26
+ return new(ace_file_name)
27
+ end
28
+
29
+ def next_contig
30
+ contig = nil
31
+
32
+ if !@index_file.eof?
33
+ line = @index_file.readline
34
+
35
+ e=line.chomp
36
+
37
+ # parse params
38
+ if e=~ READ_REG_EXP
39
+ length=$3.to_i
40
+ offset=$2.to_i
41
+
42
+ #puts line
43
+ contig = File.read(@ace_file_name,length,offset)
44
+ end
45
+ end
46
+
47
+ return contig
48
+ end
49
+
50
+
51
+ def each_contig
52
+
53
+ @index_file.pos=0
54
+
55
+ begin
56
+ contig = next_contig
57
+
58
+ if !contig.nil?
59
+ yield contig
60
+ end
61
+
62
+ end while !contig.nil?
63
+
64
+ end
65
+
66
+ # read a contig by its name
67
+ def read_contig(contig_name)
68
+ res = nil
69
+ @index_file.pos=0
70
+
71
+ @index_file.grep(/^#{contig_name}\s/) do |line|
72
+
73
+ e=line.chomp
74
+
75
+ # parse params
76
+ if e=~ READ_REG_EXP
77
+
78
+ #get line
79
+
80
+ length=$3.to_i #4152
81
+ offset=$2.to_i #3289232
82
+ #puts line
83
+ res=File.read(@ace_file_name,length,offset)
84
+
85
+ end
86
+
87
+ end
88
+
89
+ return res
90
+ end
91
+
92
+ def create_contig_indexes
93
+ res=[]
94
+
95
+ start_pos=0
96
+ end_pos = 0
97
+ contig=nil
98
+ (ace_file=File.open(@ace_file_name)).grep(/^\s*CO\s/) do |line|
99
+ # puts ace_file.pos, line.length
100
+ end_pos = ace_file.pos - line.length
101
+
102
+ #puts line
103
+ if line=~/^\s*CO\s+([^\s]+\s)/
104
+
105
+ if contig
106
+ #from = last_pos if from == 0
107
+
108
+ res << "#{contig}\t#{start_pos}\t#{end_pos-start_pos}"
109
+
110
+ # puts "#{contig}\t#{start_pos}\t#{offset}"
111
+
112
+
113
+ end
114
+
115
+ start_pos = end_pos
116
+
117
+ contig = $1
118
+
119
+ end
120
+
121
+ #last_pos = ace_file.pos
122
+ #offset=last_pos - from
123
+ end
124
+
125
+ if contig
126
+ end_pos = ace_file.pos
127
+ res << "#{contig}\t#{start_pos}\t#{end_pos-start_pos}"
128
+ # puts "#{contig}\t#{start_pos}\t#{end_pos-start_pos}"
129
+ end
130
+
131
+
132
+
133
+ return res
134
+ end
135
+
136
+ def create_index_file(index_file_name)
137
+
138
+ puts "creating index file #{index_file_name}"
139
+
140
+ @index_file = File.open(index_file_name,'w+')
141
+ @index_file.puts(create_contig_indexes.join("\n"))
142
+ @index_file.close
143
+ end
144
+
145
+
146
+ def close
147
+ #@ace_file.close
148
+ @index_file.close
149
+ end
150
+
151
+
152
+
153
+
154
+ end
@@ -0,0 +1,39 @@
1
+ # Description: This class provided the methods to add Reads data
2
+ # ---- Author: Noe Fernandez Pozo
3
+ # ------ Date: 31-May-2011
4
+
5
+ class Read
6
+
7
+ attr_accessor :name, :orientation, :start_in_consensus, :bs, :fasta
8
+ attr_accessor :padded_bases_num, :item_num, :tag_num
9
+ attr_accessor :qual_clip_start, :qual_clip_end, :align_clip_start, :align_clip_end
10
+
11
+ def initialize(name,orientation,start_in_consensus)
12
+ @name = name
13
+ @orientation = orientation
14
+ @start_in_consensus = start_in_consensus
15
+ @bs = []
16
+ end
17
+
18
+ def add_fasta(fasta)
19
+ @fasta = fasta
20
+ end
21
+
22
+ def add_data(padded_bases_num,item_num,tag_num)
23
+ @padded_bases_num = padded_bases_num
24
+ @item_num = item_num
25
+ @tag_num = tag_num
26
+ end
27
+
28
+ def add_qual_clipping(qual_clip_start, qual_clip_end, align_clip_start, align_clip_end)
29
+ @qual_clip_start = qual_clip_start
30
+ @qual_clip_end = qual_clip_end
31
+ @align_clip_start = align_clip_start
32
+ @align_clip_end = align_clip_end
33
+ end
34
+
35
+ def add_bs(bs)
36
+ @bs.push bs
37
+ end
38
+
39
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/scbi_ace.rb'}"
9
+ puts "Loading scbi_ace gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,3 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/scbi_ace'
@@ -0,0 +1,62 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require 'json'
3
+
4
+ class TestScbiAce < Test::Unit::TestCase
5
+
6
+ def setup
7
+ end
8
+
9
+ def test_open
10
+ ace=IndexedAceFile.new(File.join(File.dirname(__FILE__),'test.ace'))
11
+
12
+ # puts ace.read_contig('7180000000028')[0..100]
13
+ # puts ace.read_contig('7180000000029')
14
+
15
+ ace.close
16
+ assert true
17
+ end
18
+
19
+ def test_aceparser
20
+ ace=AceParser.new(File.join(File.dirname(__FILE__),'test.ace'))
21
+
22
+ ace.each_contig do |contig|
23
+
24
+ puts contig.reads.count
25
+ end
26
+
27
+ # contig=ace.next_contig
28
+
29
+ # puts contig.fasta
30
+ # ace.each_contig do |contig|
31
+ #
32
+ # end
33
+
34
+ ace.close
35
+
36
+ end
37
+
38
+
39
+ def test_next_contig
40
+ ace=AceParser.new(File.join(File.dirname(__FILE__),'test.ace'))
41
+
42
+
43
+
44
+ contig1=ace.next_contig
45
+ assert_equal(1701,contig1.reads.length)
46
+
47
+ # puts JSON::pretty_generate(contig1.reads)
48
+
49
+ contig1=ace.next_contig
50
+ assert_equal(3,contig1.reads.length)
51
+ # puts contig1.reads.first[1].fasta
52
+
53
+
54
+ contig1=ace.next_contig
55
+ assert_equal(4,contig1.reads.length)
56
+
57
+ ace.close
58
+
59
+
60
+ end
61
+
62
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scbi_ace
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.6
6
+ platform: ruby
7
+ authors:
8
+ - Noe Fernandez & Dario Guerrero
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-07-25 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.8.0
24
+ type: :development
25
+ version_requirements: *id001
26
+ description: scbi_ace is a ruby gem to read and parse ACE files containing contigs. It automatically indexes the input ace file to improve random access to contigs.
27
+ email:
28
+ - noefp@uma.es , dariogf@gmail.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files:
34
+ - History.txt
35
+ - Manifest.txt
36
+ - PostInstall.txt
37
+ files:
38
+ - History.txt
39
+ - Manifest.txt
40
+ - PostInstall.txt
41
+ - README.rdoc
42
+ - Rakefile
43
+ - lib/scbi_ace.rb
44
+ - script/console
45
+ - script/destroy
46
+ - script/generate
47
+ - test/test_helper.rb
48
+ - test/test_scbi_ace.rb
49
+ - lib/scbi_ace/indexed_ace_file.rb
50
+ - lib/scbi_ace/ace_parser.rb
51
+ - lib/scbi_ace/contig.rb
52
+ - lib/scbi_ace/read.rb
53
+ homepage: http://www.scbi.uma.es/downloads
54
+ licenses: []
55
+
56
+ post_install_message: PostInstall.txt
57
+ rdoc_options:
58
+ - --main
59
+ - README.rdoc
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ requirements: []
75
+
76
+ rubyforge_project: scbi_ace
77
+ rubygems_version: 1.8.24
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: scbi_ace is a ruby gem to read and parse ACE files containing contigs
81
+ test_files:
82
+ - test/test_helper.rb
83
+ - test/test_scbi_ace.rb