scbi_fqbin 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.gitignore +14 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/{README.rdoc → README.md} +0 -0
  7. data/Rakefile +8 -28
  8. data/lib/scbi_fqbin.rb +3 -5
  9. data/lib/scbi_fqbin/fastabin.rb +411 -0
  10. data/lib/scbi_fqbin/fastq_file_c.rb +373 -0
  11. data/lib/scbi_fqbin/fbin_file.rb +1 -1
  12. data/lib/scbi_fqbin/t.rb +9 -0
  13. data/lib/scbi_fqbin/t2.rb +12 -0
  14. data/lib/scbi_fqbin/version.rb +3 -0
  15. data/lib_fqbin_src.zip +0 -0
  16. data/lib_fqbin_src/Makefile +66 -0
  17. data/lib_fqbin_src/fq +0 -0
  18. data/lib_fqbin_src/fq.c +165 -0
  19. data/lib_fqbin_src/hash_fqbin +0 -0
  20. data/lib_fqbin_src/hash_fqbin.c +212 -0
  21. data/lib_fqbin_src/idx_fqbin +21 -0
  22. data/lib_fqbin_src/iterate_fqbin +0 -0
  23. data/lib_fqbin_src/iterate_fqbin.c +136 -0
  24. data/lib_fqbin_src/lib_fqbin.c +1748 -0
  25. data/lib_fqbin_src/lib_fqbin.h +194 -0
  26. data/lib_fqbin_src/mk_fqbin +0 -0
  27. data/lib_fqbin_src/mk_fqbin.c +138 -0
  28. data/lib_fqbin_src/other/bwxform.c +915 -0
  29. data/lib_fqbin_src/other/bwxform.h +74 -0
  30. data/lib_fqbin_src/other/find_in_index.c +130 -0
  31. data/lib_fqbin_src/other/hash_fbin_nogzchunks.c +164 -0
  32. data/lib_fqbin_src/other/idx_fqbin +0 -0
  33. data/lib_fqbin_src/other/idx_fqbin.c +67 -0
  34. data/lib_fqbin_src/other/make_hsh.sh +14 -0
  35. data/lib_fqbin_src/other/rd_extras_fbin.c +45 -0
  36. data/lib_fqbin_src/read_fq +0 -0
  37. data/lib_fqbin_src/read_fq.c +143 -0
  38. data/lib_fqbin_src/read_fqbin +0 -0
  39. data/lib_fqbin_src/read_fqbin.c +101 -0
  40. data/lib_fqbin_src/sort_index +9 -0
  41. data/lib_fqbin_src/test.rb +13 -0
  42. data/scbi_fqbin.gemspec +25 -0
  43. data/test/build.rake +15 -0
  44. data/test/fbinfile +0 -0
  45. data/test/fbinfile.index +0 -0
  46. data/test/no_test_fill_file.rb +66 -0
  47. data/test/old/app.rb +43 -0
  48. data/test/old/bin/iterate_fastabin.rb +54 -0
  49. data/test/old/bin/mk_fastabin.rb +22 -0
  50. data/test/old/bin/rd_fastabin.rb +36 -0
  51. data/test/old/bin/rd_fq.rb +20 -0
  52. data/test/old/bioruby.rb +27 -0
  53. data/test/old/c/Makefile +34 -0
  54. data/test/old/c/fbin_lib.zip +0 -0
  55. data/test/old/c/iterate_fbin.c +54 -0
  56. data/test/old/c/libreria_gz.c +707 -0
  57. data/test/old/c/libreria_gz.h +127 -0
  58. data/test/old/c/main.c +86 -0
  59. data/test/old/c/mk_fbin.c +24 -0
  60. data/test/old/c/rd_seq_fbin.c +44 -0
  61. data/test/old/c/test_ffi/a.out +0 -0
  62. data/test/old/c/test_ffi/app.c +26 -0
  63. data/test/old/c/test_ffi/app.rb +19 -0
  64. data/test/old/c/test_ffi/liblibreria_gz.dylib +0 -0
  65. data/test/old/c/test_ffi/libmylibrary.dylib +0 -0
  66. data/test/old/c/test_ffi/my_library.rb +23 -0
  67. data/test/old/c/test_ffi/mylibrary.c +22 -0
  68. data/test/old/c/test_ffi/mylibrary.h +6 -0
  69. data/test/old/c/usage_instructions.txt +62 -0
  70. data/test/old/ext/Makefile +187 -0
  71. data/test/old/ext/Makefile.dario +34 -0
  72. data/test/old/ext/extconf.rb +8 -0
  73. data/test/old/ext/mk_fbin.c +24 -0
  74. data/test/old/ext/sample/extras.txt +4 -0
  75. data/{.gemtest → test/old/ext/sample/extras2.txt} +0 -0
  76. data/test/old/ext/sample/f1.fasta +10 -0
  77. data/test/old/ext/sample/f1.fasta.qual +10 -0
  78. data/test/old/ext/sample/f1.fbin +0 -0
  79. data/test/old/ext/sample/f1.fbin.index +0 -0
  80. data/test/old/ext/sample/main.c +86 -0
  81. data/test/old/ext/usage_instructions.txt +62 -0
  82. data/test/old/t_scbi_fastabin.rb +140 -0
  83. data/test/read_tests/10-original_sizes.sh +16 -0
  84. data/test/read_tests/20-fq_time.sh +23 -0
  85. data/test/read_tests/30-fbin_read_time.sh +23 -0
  86. data/test/read_tests/40-bsc_read_time.sh +21 -0
  87. data/test/read_tests/50-fq_time_x4.sh +25 -0
  88. data/test/read_tests/60-fbin_read_time_x4.sh +24 -0
  89. data/test/read_tests/70-bsc_read_time_x4.sh +32 -0
  90. data/test/results_bio_scbi_fasta.txt +11 -0
  91. data/test/{test_scbi_fbin_file.rb → scbi_fbin_file_test.rb} +0 -0
  92. data/test/speed.txt +81 -0
  93. data/test/t_scbi_fasta.rb +12 -0
  94. data/test/write_tests/10-original_sizes.sh +16 -0
  95. data/test/write_tests/20-zip_time.sh +17 -0
  96. data/test/write_tests/30-mk_fbin_time.sh +23 -0
  97. data/test/write_tests/31-mk_fbin_time_f30.sh +21 -0
  98. data/test/write_tests/40-gzip_time.sh +16 -0
  99. data/test/write_tests/41-bsc_time.sh +16 -0
  100. data/test/write_tests/50-zip_sizes.sh +16 -0
  101. data/test/write_tests/60-fbin_sizes.sh +17 -0
  102. data/test/write_tests/61-fbin_sizes_f30.sh +16 -0
  103. data/test/write_tests/70-gzip_sizes.sh +17 -0
  104. data/test/write_tests/80-bsc_sizes.sh +17 -0
  105. data/website/index.html +87 -0
  106. data/website/index.txt +81 -0
  107. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  108. data/website/stylesheets/screen.css +159 -0
  109. data/website/template.html.erb +50 -0
  110. metadata +208 -95
  111. data/History.txt +0 -19
  112. data/Manifest.txt +0 -12
  113. data/PostInstall.txt +0 -7
  114. data/script/console +0 -10
  115. data/script/destroy +0 -14
  116. data/script/generate +0 -14
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dcb4c18dbccdd6482584cb3802ed537b58c3786e
4
+ data.tar.gz: 7b545c529fd75b6411d4d611d48f2ceb8b81f845
5
+ SHA512:
6
+ metadata.gz: 5948652a1740474b8f03589bbfe3a6761d6fab7a048ceef0d29ba29203793f21e233b53f78c79e867d7cb6f672ca835dd44468b5d6bab2968dfe9fc297fa7015
7
+ data.tar.gz: e0dd01ce455d5789caa5bc7a888b77d295871e759f5509ce4f1b002fffab5f7e68f3ae01ff5a2d8bcb2f55f6fcbc33c5b3ccd63922a0a597aff3de19393f4e63
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ..gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 dariogf
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
File without changes
data/Rakefile CHANGED
@@ -1,28 +1,8 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- # require './lib/scbi_fqbin'
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_fqbin' do
14
- self.developer 'Dario Guerrero', '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 = [['scbi_fasta','>= 0.0.1'],['ffi','>= 0.0.1']]
18
-
19
- end
20
-
21
- require 'newgem/tasks'
22
- Dir['tasks/**/*.rake'].each { |t| load t; puts t}
23
-
24
- # TODO - want other tests/tasks run by default? Add them to the list
25
-
26
- # remove_task :default
27
- task :default => [:build, :install,:spec, :features]
28
-
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << 'test'
7
+ t.pattern = "test/*_test.rb"
8
+ end
data/lib/scbi_fqbin.rb CHANGED
@@ -1,8 +1,6 @@
1
- $: << File.join(File.dirname(__FILE__),File.basename(__FILE__,File.extname(__FILE__)))
2
-
3
- # require 'fastabin'
4
- require 'fbin_file'
1
+ require "scbi_fqbin/version"
2
+ require 'scbi_fqbin/fbin_file'
5
3
 
6
4
  module ScbiFqbin
7
- VERSION = '0.2.2'
5
+ # Your code goes here...
8
6
  end
@@ -0,0 +1,411 @@
1
+ ########################################################
2
+ # Author: Dario Guerrero & Rafael Larrosa
3
+ #
4
+ # Encapsulates FastaBIN format routines
5
+ #
6
+ #
7
+ #
8
+ ########################################################
9
+
10
+ require 'zlib'
11
+ require 'scbi_fasta'
12
+
13
+ class Fastabin
14
+
15
+ #--------------------------------------
16
+ # CONSTANT DEFINITIONS
17
+ #--------------------------------------
18
+
19
+ #Compression type. Valid values are Zlib::NO_COMPRESSION, Zlib::BEST_SPEED, Zlib::BEST_COMPRESSION, Zlib::DEFAULT_COMPRESSION, and an integer from 0 to 9.
20
+ COMPRESSION=Zlib::BEST_COMPRESSION
21
+ SEQUENCES_PER_BLOCK=10
22
+ READ_BIN_REG_EXP= /^([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/
23
+
24
+ READ_REG_EXP= /^([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/
25
+
26
+ #--------------------------------------
27
+ # Constructor
28
+ #--------------------------------------
29
+ def initialize(filename, mode = 'r', index_filename=nil)
30
+
31
+ @filename=filename
32
+ @index_filename = index_filename ||= filename+'.index';
33
+ @bin_file = nil
34
+ @need_to_regenerate_index=false
35
+
36
+ @added_sequence_count=0
37
+
38
+ # check open mode read or write
39
+ if mode.upcase.index('W')
40
+ bin_mode='wb'
41
+ if File.exists?(@index_filename)
42
+ File.delete(@index_filename)
43
+ end
44
+ else
45
+
46
+ # if read mode, check if file exits
47
+ if !File.exists?(filename)
48
+ raise "File #{filename} doesn't exists'"
49
+ end
50
+
51
+ # if index doesn't exits, recreate it
52
+ if !File.exists?(@index_filename)
53
+ regenerate_index
54
+ end
55
+
56
+ # check open mode
57
+ bin_mode = 'rb'
58
+
59
+ end
60
+
61
+ #open files
62
+ @bin_io = File.open(filename,bin_mode)
63
+ @bin_file = Zlib::GzipWriter.new(@bin_io)
64
+
65
+ end
66
+
67
+
68
+ #--------------------------------------
69
+ # Add a pair of fasta and qual files to the Fastabin file
70
+ #--------------------------------------
71
+ def add_fasta_qual(fasta_file_name,qual_file_name)
72
+
73
+ # use FastaQualFile to read fasta
74
+ qf = FastaQualFile.new(fasta_file_name,qual_file_name)
75
+
76
+
77
+ # iterate over sequences
78
+ qf.each do |name,fasta,qual|
79
+
80
+ if (qf.num_seqs % 10000) == 0
81
+ puts Time.now.to_s + ',' + qf.num_seqs.to_s + ':' + name
82
+ end
83
+ #
84
+ #add them to fastabin
85
+ add_seq(name,fasta,qual,nil)
86
+
87
+ end
88
+
89
+ qf.close
90
+
91
+ end
92
+
93
+ #--------------------------------------
94
+ # Add one seq to the fastabin file
95
+ #--------------------------------------
96
+ def add_seq(seq_name, seq_fasta, seq_qual, seq_extras=nil)
97
+
98
+ if (@added_sequence_count % SEQUENCES_PER_BLOCK==0)
99
+ #@bin_file.flush
100
+ @bin_file.close
101
+ #@bin_io.close
102
+
103
+ @bin_io = File.open(@filename,'ab')
104
+ @bin_file = Zlib::GzipWriter.new(@bin_io)
105
+ puts "NEW BLOCK"
106
+
107
+ end
108
+ @added_sequence_count += 1
109
+
110
+ @need_to_regenerate_index = true
111
+
112
+ zipped_fasta = ''
113
+ zipped_qual = ''
114
+ zipped_extras = ''
115
+
116
+ ini = @bin_file.pos
117
+
118
+ # get current pos and write deflated data to fastabin format
119
+ #zipped_fasta = deflate_fasta(seq_fasta.strip)
120
+ zipped_fasta = seq_fasta.strip
121
+
122
+ if !seq_qual.empty?
123
+ q = seq_qual.strip.split(' ')
124
+ q.map!{|e| (e.to_i+33).chr}
125
+ #zipped_qual = deflate_qual(q.join)
126
+ zipped_qual = q.join
127
+
128
+ #puts q.join
129
+ #raise
130
+ #zipped_qual = deflate_qual(seq_qual.strip)
131
+
132
+ end
133
+
134
+ if !seq_extras.nil?
135
+ #zipped_extras = deflate_extras(seq_extras)
136
+ zipped_extras = seq_extras
137
+ end
138
+
139
+ # write data to index file and bin (to retrieve it later if index file gets lost)
140
+ head = "#{seq_name} #{zipped_fasta.size} #{zipped_qual.size} #{zipped_extras.size}"
141
+ bin_index_line ="#{head.size.to_s.rjust(4)}#{head}"
142
+
143
+ #index_line ="#{seq_name} #{ini+bin_index_line.size} #{zipped_fasta.size} #{zipped_qual.size} #{zipped_extras.size}"
144
+ #puts index_line
145
+ #index_file.puts index_line
146
+
147
+ @bin_file.write bin_index_line
148
+
149
+ # puts zipped_fasta
150
+ # puts zipped_qual
151
+ # puts zipped_extras
152
+
153
+ # puts "1F:#{zipped_fasta}@#{zipped_fasta.size.to_s}@#{zipped_fasta.length.to_s}"
154
+ # puts "1Q:#{zipped_qual}@#{zipped_qual.size.to_s}@#{zipped_qual.length.to_s}"
155
+ # puts "1E:#{zipped_extras}@#{zipped_extras.size.to_s}@#{zipped_extras.length.to_s}"
156
+ #
157
+
158
+ @bin_file.puts zipped_fasta
159
+ @bin_file.puts zipped_qual
160
+ @bin_file.puts zipped_extras
161
+
162
+
163
+
164
+ end
165
+
166
+ #--------------------------------------
167
+ # Iterate over all sequences of a fastabin file
168
+ #--------------------------------------
169
+ def each(get_fasta=true,get_qual=true,get_extras=true)
170
+
171
+ #bin = ''
172
+ @bin_file.pos=0
173
+
174
+
175
+ while !@bin_file.eof?
176
+
177
+ head_size = @bin_file.read(4).to_i
178
+ line = @bin_file.read(head_size)
179
+
180
+ if line =~ READ_BIN_REG_EXP
181
+
182
+ name = $1
183
+ i = @bin_file.pos
184
+ fz = $2.to_i
185
+ qz=$3.to_i
186
+ ez=$4.to_i
187
+
188
+ @bin_file.pos = i+fz+qz+ez
189
+
190
+ name,fasta,qual,extras = extract_seq(name,i,fz,qz,ez)
191
+
192
+ yield(name,fasta,qual,extras)
193
+
194
+ else
195
+ raise "Invalid index line found at each"
196
+ end
197
+
198
+ end
199
+
200
+ end
201
+
202
+ #--------------------------------------
203
+ # Iterate over all sequences of a fastabin file
204
+ #--------------------------------------
205
+ def each_by_index(get_fasta=true,get_qual=true)
206
+ index_file = Zlib::GzipReader.open(@index_filename)
207
+
208
+ # iterate over each line of index_file
209
+ index_file.each_line do |e|
210
+
211
+ # parse params
212
+ if e=~ READ_REG_EXP
213
+
214
+ name = $1
215
+ i = $2.to_i
216
+ fz = $3.to_i
217
+ qz=$4.to_i
218
+ ez=$5.to_i
219
+
220
+ name,fasta,qual,extras = extract_seq(name,i,fz,qz,ez)
221
+
222
+ yield(name,fasta,qual,extras)
223
+ end
224
+
225
+ end
226
+ index_file.close
227
+
228
+ end
229
+
230
+ #--------------------------------------
231
+ # Read one seq from the fastabin file by name
232
+ #--------------------------------------
233
+ def read_seq(seq_name)
234
+
235
+ index_file = Zlib::GzipReader.open(@index_filename)
236
+
237
+ res = nil
238
+ e=nil
239
+
240
+ index_file.grep(/^#{seq_name}\s/) do |line|
241
+
242
+ e=line.chomp
243
+
244
+ # parse params
245
+ if e=~ READ_REG_EXP
246
+ name = $1
247
+ i = $2.to_i
248
+ fz = $3.to_i
249
+ qz=$4.to_i
250
+ ez=$5.to_i
251
+
252
+ res = extract_seq(name,i,fz,qz,ez)
253
+ end
254
+ break
255
+ end
256
+
257
+ index_file.close
258
+
259
+ return res
260
+ end
261
+
262
+
263
+ #--------------------------------------
264
+ # Count lines in index file. This is sequence count
265
+ #--------------------------------------
266
+ def count
267
+ index_file = Zlib::GzipReader.open(@index_filename)
268
+
269
+ res=index_file.readlines.count
270
+
271
+ index_file.close
272
+
273
+ return res
274
+ end
275
+
276
+ #--------------------------------------
277
+ # Close files
278
+ #--------------------------------------
279
+ def close
280
+
281
+ @bin_file.close if !@bin_file.closed?
282
+ #@bin_io.close if !@bin_io.closed?
283
+
284
+ regenerate_index if @need_to_regenerate_index
285
+ end
286
+
287
+
288
+ private
289
+
290
+ #--------------------------------------
291
+ # Extract/regenerate index from bin file
292
+ #--------------------------------------
293
+
294
+ def regenerate_index
295
+ #puts Time.now.to_s + " - extracting index"
296
+
297
+ bin_io = File.open(@filename,'rb')
298
+ bin_file = Zlib::GzipReader.new(bin_io).to_io
299
+
300
+ index_file = Zlib::GzipWriter.open(@index_filename)
301
+ #@bin_file.pos=0
302
+ i=0
303
+ while !bin_file.eof?
304
+
305
+ head_size = bin_file.read(4).to_i
306
+ line = bin_file.read(head_size)
307
+
308
+ if line =~ READ_BIN_REG_EXP
309
+
310
+ name = $1
311
+ i = bin_file.pos
312
+ fz = $2.to_i
313
+ qz=$3.to_i
314
+ ez=$4.to_i
315
+
316
+ index_line ="#{name} #{i} #{fz} #{qz} #{ez}"
317
+ #puts index_line
318
+ i += 1
319
+
320
+ puts i
321
+ index_file.puts index_line
322
+
323
+ bin_file.pos = i+fz+qz+ez
324
+
325
+ else
326
+ raise "Invalid index line found at each"
327
+ end
328
+
329
+ end
330
+
331
+ #puts Time.now.to_s + ' - done'
332
+
333
+ index_file.close
334
+ bin_file.close
335
+ #bin_io.close
336
+
337
+
338
+ end
339
+
340
+ def extract_seq(name,i,fz,qz,ez)
341
+
342
+ #annotate current pos in files to revert changes later
343
+ current_bin_pos = @bin_file.pos
344
+
345
+ res = nil
346
+
347
+ # read bin data and inflate it
348
+ @bin_file.pos = i
349
+
350
+ fasta_d = @bin_file.read(fz)
351
+ # puts "2F:#{fasta_d}@#{fasta_d.size}"
352
+ fasta = inflate(fasta_d)
353
+ fasta_d=nil
354
+
355
+ qual_d = @bin_file.read(qz)
356
+ qual = inflate(qual_d)
357
+ # puts "2Q:#{qual_d}@#{qual_d.size}"
358
+ qual_d=nil
359
+
360
+ extras_d = @bin_file.read(ez)
361
+ extras = inflate(extras_d)
362
+ # puts "2E:#{extras_d}@#{extras_d.size}"
363
+ extras_d=nil
364
+
365
+ res =[name, fasta, qual, extras]
366
+
367
+ @bin_file.pos = current_bin_pos
368
+
369
+ return res
370
+ end
371
+
372
+ def deflate_fasta(input)
373
+
374
+ zipper = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,15,9,Zlib::FILTERED)
375
+ res= zipper.deflate(input, Zlib::FINISH)
376
+ zipper.close
377
+
378
+ return res
379
+ end
380
+
381
+ def deflate_qual(input)
382
+
383
+ # zipper = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,15,9,Zlib::FILTERED)
384
+ zipper = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,15,9)
385
+ res= zipper.deflate(input, Zlib::FINISH)
386
+ zipper.close
387
+
388
+ return res
389
+ end
390
+
391
+ def deflate_extras(input)
392
+
393
+ zipper = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,15,9,Zlib::HUFFMAN_ONLY)
394
+ res= zipper.deflate(input, Zlib::FINISH)
395
+ zipper.close
396
+
397
+ return res
398
+ end
399
+
400
+ def inflate(input)
401
+
402
+ unzipper = Zlib::Inflate.new(15)
403
+ res= unzipper.inflate(input)
404
+ #unzipper.finish
405
+ unzipper.close
406
+
407
+ return res
408
+ end
409
+
410
+ end
411
+