gene-matcher 0.1.5 → 0.1.6
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 +12 -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: 16d36396bec9b08dc0cd41f911274feef3b444c7c5408e406b528d627f74e92b
|
4
|
+
data.tar.gz: 71f75988056e3de2a0e022ed7b501e88209866f373e753e471298462ff7f428e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47f79bf0bf8be63ada87103503d2ec0ef7717cf2d008ff836dbf9d5582c035f082e6049bb3add93c6130c15024a015bb7f52aa8f04300963cafed1119a0f1d4c
|
7
|
+
data.tar.gz: 38e05772aacdd96a57d43ff0cb16f19c00adf300c083d85b6fbb93cbb0449ab51212981d94ef1cbe5a38c542fa707d9bd9cb39dc0b58b3a3782ed9f5ab5eeda5
|
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,17 @@ class Alignment
|
|
87
83
|
def number_of_blank
|
88
84
|
end
|
89
85
|
|
86
|
+
def score_a
|
87
|
+
return alignment_count / @alignmentI.length.to_f
|
88
|
+
end
|
89
|
+
|
90
|
+
def score(thresh=20)
|
91
|
+
# 長さがthresh以下なら0を返す
|
92
|
+
return 0 if @alignmentI.length < thresh
|
93
|
+
return alignment_count * score_a
|
94
|
+
end
|
95
|
+
|
90
96
|
def to_s
|
91
|
-
"score=#{
|
97
|
+
"score=#{score} I=" + @alignmentI + " J=" + @alignmentJ;
|
92
98
|
end
|
93
99
|
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.6
|
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
|