rbbt-util 5.6.16 → 5.6.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/util/misc.rb +75 -72
- metadata +47 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cd5bcdf21e90d1e62413b0c5f05c2fe92cd43cc
|
4
|
+
data.tar.gz: 0e5f75492b51edf63e76b32624d4a4dc39092a6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2b471f1a98ae3ddfe81fd90675cc05a8d1cbbd24da1ce2d08955f476038681f87bebfd979d9798241c0cee531e28c1c18e4faa868a9d7f7c24dfc2831742bdf
|
7
|
+
data.tar.gz: 4db6e2a91bc5c1cf7370feba6494ffef580f80b4b0d67d7c27be5b8f83a2a9f429e73244001541a40252ca9c7a218eaae8c75a46e76352b20e0deb5f565d145f
|
data/lib/rbbt/util/misc.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'lockfile'
|
2
2
|
require 'net/smtp'
|
3
3
|
require 'digest/md5'
|
4
|
-
require 'narray'
|
5
4
|
require 'cgi'
|
6
5
|
require 'zlib'
|
7
6
|
require 'rubygems/package'
|
@@ -506,80 +505,82 @@ end
|
|
506
505
|
"val" => "V"
|
507
506
|
}
|
508
507
|
|
509
|
-
def self.fast_align(reference, sequence)
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
end
|
535
|
-
|
536
|
-
|
537
|
-
start_pos = a[-1,0..rows-1].to_a.index start
|
538
|
-
|
539
|
-
ref = ''
|
540
|
-
seq = ''
|
541
|
-
rpos = start_pos
|
542
|
-
spos = cols - 1
|
543
|
-
|
544
|
-
while spos > 0 and rpos > 0
|
545
|
-
score = a[spos,rpos]
|
546
|
-
score_match = a[spos-1,rpos-1]
|
547
|
-
score_skip_reference = a[spos,rpos-1]
|
548
|
-
score_skip_sequence = a[spos-1,rpos]
|
508
|
+
#def self.fast_align(reference, sequence)
|
509
|
+
#
|
510
|
+
#require 'narray'
|
511
|
+
# init_gap = -1
|
512
|
+
# gap = -2
|
513
|
+
# diff = -2
|
514
|
+
# same = 2
|
515
|
+
|
516
|
+
# cols = sequence.length + 1
|
517
|
+
# rows = reference.length + 1
|
518
|
+
|
519
|
+
# a = NArray.int(cols, rows)
|
520
|
+
|
521
|
+
# for spos in 0..cols-1 do a[spos, 0] = spos * init_gap end
|
522
|
+
# for rpos in 0..rows-1 do a[0, rpos] = rpos * init_gap end
|
523
|
+
|
524
|
+
# spos = 1
|
525
|
+
# while spos < cols do
|
526
|
+
# rpos = 1
|
527
|
+
# while rpos < rows do
|
528
|
+
# match = a[spos-1,rpos-1] + (sequence[spos-1] != reference[rpos-1] ? diff : same)
|
529
|
+
# skip_sequence = a[spos-1,rpos] + gap
|
530
|
+
# skip_reference = a[spos,rpos-1] + gap
|
531
|
+
# a[spos,rpos] = [match, skip_sequence, skip_reference].max
|
532
|
+
# rpos += 1
|
533
|
+
# end
|
534
|
+
# spos += 1
|
535
|
+
# end
|
549
536
|
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
537
|
+
# start = Misc.max(a[-1,0..rows-1])
|
538
|
+
# start_pos = a[-1,0..rows-1].to_a.index start
|
539
|
+
|
540
|
+
# ref = ''
|
541
|
+
# seq = ''
|
542
|
+
# rpos = start_pos
|
543
|
+
# spos = cols - 1
|
544
|
+
|
545
|
+
# while spos > 0 and rpos > 0
|
546
|
+
# score = a[spos,rpos]
|
547
|
+
# score_match = a[spos-1,rpos-1]
|
548
|
+
# score_skip_reference = a[spos,rpos-1]
|
549
|
+
# score_skip_sequence = a[spos-1,rpos]
|
550
|
+
|
551
|
+
# case
|
552
|
+
# when score == score_match + (sequence[spos-1] != reference[rpos-1] ? diff : same)
|
553
|
+
# ref << reference[rpos-1]
|
554
|
+
# seq << sequence[spos-1]
|
555
|
+
# spos -= 1
|
556
|
+
# rpos -= 1
|
557
|
+
# when score == score_skip_reference + gap
|
558
|
+
# ref << reference[rpos-1]
|
559
|
+
# seq << '-'
|
560
|
+
# rpos -= 1
|
561
|
+
# when score == score_skip_sequence + gap
|
562
|
+
# seq << sequence[spos-1]
|
563
|
+
# ref << '-'
|
564
|
+
# spos -= 1
|
565
|
+
# else
|
566
|
+
# raise "stop"
|
567
|
+
# end
|
568
|
+
# end
|
568
569
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
570
|
+
# while (rpos > 0)
|
571
|
+
# ref << reference[rpos-1]
|
572
|
+
# seq = seq << '-'
|
573
|
+
# rpos -= 1
|
574
|
+
# end
|
574
575
|
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
end
|
576
|
+
# while (spos > 0)
|
577
|
+
# seq << sequence[spos-1]
|
578
|
+
# ref = ref + '-'
|
579
|
+
# spos -= 1
|
580
|
+
# end
|
581
|
+
#
|
582
|
+
# [ref.reverse + reference[start_pos..-1], seq.reverse + '-' * (rows - start_pos - 1)]
|
583
|
+
#end
|
583
584
|
|
584
585
|
def self.IUPAC_to_base(iupac)
|
585
586
|
IUPAC2BASE[iupac]
|
@@ -972,6 +973,8 @@ end
|
|
972
973
|
rescue
|
973
974
|
Log.warn("Error checking lockfile #{lockfile}: #{$!.message}. Removing. Content: #{begin Open.read(lockfile) rescue "Could not open file" end}")
|
974
975
|
FileUtils.rm lockfile if File.exists?(lockfile)
|
976
|
+
lockfile = Lockfile.new(lock_path)
|
977
|
+
retry
|
975
978
|
end
|
976
979
|
|
977
980
|
begin
|
metadata
CHANGED
@@ -1,113 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.6.
|
4
|
+
version: 5.6.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
15
|
version_requirements: !ruby/object:Gem::Requirement
|
23
16
|
requirements:
|
24
|
-
- -
|
17
|
+
- - '>='
|
25
18
|
- !ruby/object:Gem::Version
|
26
19
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: progress-monitor
|
29
20
|
requirement: !ruby/object:Gem::Requirement
|
30
21
|
requirements:
|
31
|
-
- -
|
22
|
+
- - '>='
|
32
23
|
- !ruby/object:Gem::Version
|
33
24
|
version: '0'
|
34
|
-
type: :runtime
|
35
25
|
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: progress-monitor
|
36
29
|
version_requirements: !ruby/object:Gem::Requirement
|
37
30
|
requirements:
|
38
|
-
- -
|
31
|
+
- - '>='
|
39
32
|
- !ruby/object:Gem::Version
|
40
33
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: lockfile
|
43
34
|
requirement: !ruby/object:Gem::Requirement
|
44
35
|
requirements:
|
45
|
-
- -
|
36
|
+
- - '>='
|
46
37
|
- !ruby/object:Gem::Version
|
47
38
|
version: '0'
|
48
|
-
type: :runtime
|
49
39
|
prerelease: false
|
40
|
+
type: :runtime
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: lockfile
|
50
43
|
version_requirements: !ruby/object:Gem::Requirement
|
51
44
|
requirements:
|
52
|
-
- -
|
45
|
+
- - '>='
|
53
46
|
- !ruby/object:Gem::Version
|
54
47
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: spreadsheet
|
57
48
|
requirement: !ruby/object:Gem::Requirement
|
58
49
|
requirements:
|
59
|
-
- -
|
50
|
+
- - '>='
|
60
51
|
- !ruby/object:Gem::Version
|
61
52
|
version: '0'
|
62
|
-
type: :runtime
|
63
53
|
prerelease: false
|
54
|
+
type: :runtime
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: spreadsheet
|
64
57
|
version_requirements: !ruby/object:Gem::Requirement
|
65
58
|
requirements:
|
66
|
-
- -
|
59
|
+
- - '>='
|
67
60
|
- !ruby/object:Gem::Version
|
68
61
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: highline
|
71
62
|
requirement: !ruby/object:Gem::Requirement
|
72
63
|
requirements:
|
73
|
-
- -
|
64
|
+
- - '>='
|
74
65
|
- !ruby/object:Gem::Version
|
75
66
|
version: '0'
|
76
|
-
type: :runtime
|
77
67
|
prerelease: false
|
68
|
+
type: :runtime
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: highline
|
78
71
|
version_requirements: !ruby/object:Gem::Requirement
|
79
72
|
requirements:
|
80
|
-
- -
|
73
|
+
- - '>='
|
81
74
|
- !ruby/object:Gem::Version
|
82
75
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: narray
|
85
76
|
requirement: !ruby/object:Gem::Requirement
|
86
77
|
requirements:
|
87
|
-
- -
|
78
|
+
- - '>='
|
88
79
|
- !ruby/object:Gem::Version
|
89
80
|
version: '0'
|
90
|
-
type: :runtime
|
91
81
|
prerelease: false
|
82
|
+
type: :runtime
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: term-ansicolor
|
92
85
|
version_requirements: !ruby/object:Gem::Requirement
|
93
86
|
requirements:
|
94
|
-
- -
|
87
|
+
- - '>='
|
95
88
|
- !ruby/object:Gem::Version
|
96
89
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: term-ansicolor
|
99
90
|
requirement: !ruby/object:Gem::Requirement
|
100
91
|
requirements:
|
101
|
-
- -
|
92
|
+
- - '>='
|
102
93
|
- !ruby/object:Gem::Version
|
103
94
|
version: '0'
|
104
|
-
type: :runtime
|
105
95
|
prerelease: false
|
106
|
-
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
96
|
+
type: :runtime
|
111
97
|
description: Utilities for handling tsv files, caches, etc
|
112
98
|
email: miguel.vazquez@cnio.es
|
113
99
|
executables:
|
@@ -288,33 +274,39 @@ homepage: http://github.com/mikisvaz/rbbt-util
|
|
288
274
|
licenses:
|
289
275
|
- MIT
|
290
276
|
metadata: {}
|
291
|
-
post_install_message:
|
277
|
+
post_install_message:
|
292
278
|
rdoc_options: []
|
293
279
|
require_paths:
|
294
280
|
- lib
|
295
281
|
required_ruby_version: !ruby/object:Gem::Requirement
|
296
282
|
requirements:
|
297
|
-
- -
|
283
|
+
- - '>='
|
298
284
|
- !ruby/object:Gem::Version
|
299
285
|
version: '0'
|
300
286
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
301
287
|
requirements:
|
302
|
-
- -
|
288
|
+
- - '>='
|
303
289
|
- !ruby/object:Gem::Version
|
304
290
|
version: '0'
|
305
291
|
requirements: []
|
306
|
-
rubyforge_project:
|
292
|
+
rubyforge_project:
|
307
293
|
rubygems_version: 2.2.2
|
308
|
-
signing_key:
|
294
|
+
signing_key:
|
309
295
|
specification_version: 4
|
310
296
|
summary: Utilities for the Ruby Bioinformatics Toolkit (rbbt)
|
311
297
|
test_files:
|
298
|
+
- test/test_helper.rb
|
312
299
|
- test/rbbt/test_workflow.rb
|
300
|
+
- test/rbbt/test_association.rb
|
301
|
+
- test/rbbt/test_resource.rb
|
302
|
+
- test/rbbt/test_entity.rb
|
303
|
+
- test/rbbt/test_knowledge_base.rb
|
304
|
+
- test/rbbt/test_tsv.rb
|
305
|
+
- test/rbbt/test_persist.rb
|
306
|
+
- test/rbbt/test_annotations.rb
|
307
|
+
- test/rbbt/test_fix_width_table.rb
|
313
308
|
- test/rbbt/resource/test_path.rb
|
314
309
|
- test/rbbt/util/test_cmd.rb
|
315
|
-
- test/rbbt/util/simpleopt/test_setup.rb
|
316
|
-
- test/rbbt/util/simpleopt/test_get.rb
|
317
|
-
- test/rbbt/util/simpleopt/test_parse.rb
|
318
310
|
- test/rbbt/util/test_chain_methods.rb
|
319
311
|
- test/rbbt/util/test_simpleDSL.rb
|
320
312
|
- test/rbbt/util/test_log.rb
|
@@ -327,17 +319,13 @@ test_files:
|
|
327
319
|
- test/rbbt/util/test_semaphore.rb
|
328
320
|
- test/rbbt/util/test_misc.rb
|
329
321
|
- test/rbbt/util/test_tmpfile.rb
|
330
|
-
- test/rbbt/
|
331
|
-
- test/rbbt/
|
332
|
-
- test/rbbt/
|
333
|
-
- test/rbbt/test_knowledge_base.rb
|
322
|
+
- test/rbbt/util/simpleopt/test_setup.rb
|
323
|
+
- test/rbbt/util/simpleopt/test_get.rb
|
324
|
+
- test/rbbt/util/simpleopt/test_parse.rb
|
334
325
|
- test/rbbt/association/test_index.rb
|
335
326
|
- test/rbbt/association/test_item.rb
|
336
|
-
- test/rbbt/test_tsv.rb
|
337
327
|
- test/rbbt/workflow/test_task.rb
|
338
328
|
- test/rbbt/workflow/test_step.rb
|
339
|
-
- test/rbbt/test_persist.rb
|
340
|
-
- test/rbbt/test_annotations.rb
|
341
329
|
- test/rbbt/persist/test_tsv.rb
|
342
330
|
- test/rbbt/persist/tsv/test_lmdb.rb
|
343
331
|
- test/rbbt/persist/tsv/test_kyotocabinet.rb
|
@@ -352,5 +340,3 @@ test_files:
|
|
352
340
|
- test/rbbt/tsv/test_filter.rb
|
353
341
|
- test/rbbt/tsv/test_attach.rb
|
354
342
|
- test/rbbt/tsv/test_manipulate.rb
|
355
|
-
- test/rbbt/test_fix_width_table.rb
|
356
|
-
- test/test_helper.rb
|