gene-matcher 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/alignment.rb +13 -6
- data/lib/gene-matcher.rb +3 -2
- data/lib/smith-waterman.rb +1 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8157bdd5dae107a5180e78d51de4a146b0768b4d8d8b8e638e61ec23ad8d6c6
|
4
|
+
data.tar.gz: 4dc38fa6ecccd8a31f77e96a672ee76d047f55af4957a28bf931c75a8483d45d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5333cfbcc037c18bb67cb140d49018af1e696260ff6268e4c1f5a968e4753fc138425bba5fd96f1928ef9cece8200a957a4f1607ec99ed792f64dff0ea0f77e4
|
7
|
+
data.tar.gz: fc5ff17d69865a118262ec29da7127bf2eae5e7aadad22697bc5c606e668acbccbd848b6caa470be9eafac04dd2dcc5e364a7cb876eab95f659d6d73d2931056
|
data/lib/alignment.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
class Alignment
|
2
|
-
attr_accessor :
|
2
|
+
attr_accessor :alignmentI, :alignmentJ, :startI, :startJ, :endI, :endJ, :reversed, :aside, :source
|
3
3
|
|
4
4
|
BLANK = "-"
|
5
5
|
|
6
6
|
def initialize(h=nil)
|
7
7
|
return init_from_hash(h) if h
|
8
|
-
# スコア
|
9
|
-
@score = 0
|
10
8
|
# 検索対象(データベースに入っていた)配列
|
11
9
|
@alignmentI = ""
|
12
10
|
# 検索した(クエリ=入力された)配列
|
@@ -27,7 +25,6 @@ class Alignment
|
|
27
25
|
|
28
26
|
def init_from_hash(h)
|
29
27
|
# 引数のハッシュから初期化
|
30
|
-
@score = h["score"]
|
31
28
|
@alignmentI = h["alignmentI"]
|
32
29
|
@alignmentJ = h["alignmentJ"]
|
33
30
|
@startI = h["startI"]
|
@@ -42,7 +39,6 @@ class Alignment
|
|
42
39
|
def to_h
|
43
40
|
# ハッシュに変換
|
44
41
|
h = {}
|
45
|
-
h["score"] = @score
|
46
42
|
h["alignmentI"] = @alignmentI
|
47
43
|
h["alignmentJ"] = @alignmentJ
|
48
44
|
h["startI"] = @startI
|
@@ -87,7 +83,18 @@ class Alignment
|
|
87
83
|
def number_of_blank
|
88
84
|
end
|
89
85
|
|
86
|
+
def score_a
|
87
|
+
return 0 if @alignmentI.length == 0
|
88
|
+
return alignment_count / @alignmentI.length.to_f
|
89
|
+
end
|
90
|
+
|
91
|
+
def score(thresh=20)
|
92
|
+
# 長さがthresh以下なら0を返す
|
93
|
+
return 0 if @alignmentI.length < thresh
|
94
|
+
return alignment_count * score_a
|
95
|
+
end
|
96
|
+
|
90
97
|
def to_s
|
91
|
-
"score=#{
|
98
|
+
"score=#{score} I=" + @alignmentI + " J=" + @alignmentJ;
|
92
99
|
end
|
93
100
|
end
|
data/lib/gene-matcher.rb
CHANGED
@@ -14,8 +14,9 @@ class Matcher
|
|
14
14
|
def scan(target_sequence,source = {})
|
15
15
|
sw = SmithWaterman.instance
|
16
16
|
a = sw.alignment(target_sequence, @input_sequence)
|
17
|
-
a.source = source
|
18
|
-
|
17
|
+
a.source = {target_sequence: target_sequence}.merge(source)
|
18
|
+
puts "#{a.score} / #{a.alignment_count} = #{a.score / a.alignment_count}" if ENV["DEBUG"]
|
19
|
+
@alignments += [a] if a.score / a.alignment_count >= @limit
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
data/lib/smith-waterman.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gene-matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ITO Yosei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Algorithm for determining similar regions between nucleic acid sequences.
|
14
14
|
email: y-itou@lumber-mill.co.jp
|