spectrum_hash 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -12
- data/lib/spectrum_hash/splash.rb +7 -3
- data/lib/spectrum_hash/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e722e675d098633fbd9c722ae9228f05cdec21d
|
4
|
+
data.tar.gz: bb25509f784e1009bb0b997e5cb1ae74aa0431f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aa5ef383767f2525672da797e641fbc9cf3c9a5a3cd77c14983b0c67548aa2b35fed4bc9c91852bccbda4412035a88da6a166f17093ba8366bee17a68b6d446
|
7
|
+
data.tar.gz: e8afb17a438faa364a8f8333a97b6e5793d6fc1df46c58b35cbbfab8ccb8fa25435221cba86cd11ca8bd3cb37339af02ee70139937cfc74a3a635060e1834d59
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ spectrum = [
|
|
38
38
|
]
|
39
39
|
|
40
40
|
SpectrumHash.from_peaks(spectrum).splash
|
41
|
-
# => "splash10-
|
41
|
+
# => "splash10-0006-9100000000-b0cf38693934211e4e35"
|
42
42
|
```
|
43
43
|
|
44
44
|
Create a splash from a tab delimited list of peaks and strings.
|
@@ -54,30 +54,34 @@ spectrum = <<-TXT
|
|
54
54
|
TXT
|
55
55
|
|
56
56
|
SpectrumHash.from_string(spectrum).splash
|
57
|
-
# => "splash10-
|
57
|
+
# => "splash10-0006-9100000000-b0cf38693934211e4e35"
|
58
58
|
```
|
59
59
|
|
60
|
-
There are a
|
61
|
-
splash
|
60
|
+
There are a few convenience methods to get the different components of
|
61
|
+
the splash
|
62
62
|
```ruby
|
63
63
|
|
64
|
-
splash = SpectrumHash.from_splash_string "splash10-
|
64
|
+
splash = SpectrumHash.from_splash_string "splash10-0006-9100000000-b0cf38693934211e4e35"
|
65
65
|
|
66
66
|
# print the version number for the splash
|
67
67
|
splash.version
|
68
68
|
# => "1"
|
69
69
|
|
70
|
-
#
|
70
|
+
# get the full version block
|
71
71
|
splash.version_block
|
72
72
|
# => "splash10"
|
73
73
|
|
74
|
-
#
|
74
|
+
# get the top ten block
|
75
|
+
splash.top_ten_block
|
76
|
+
# => "0006"
|
77
|
+
|
78
|
+
# get the histogram block
|
75
79
|
splash.histogram_block
|
76
|
-
# => "
|
80
|
+
# => "9100000000"
|
77
81
|
|
78
|
-
#
|
82
|
+
# get the hash block
|
79
83
|
splash.hash_block
|
80
|
-
# => "
|
84
|
+
# => "b0cf38693934211e4e35"
|
81
85
|
|
82
86
|
# get the histogram as a list of integers (handy for comparisons)
|
83
87
|
splash.histogram_list
|
@@ -87,8 +91,6 @@ splash.histogram_list
|
|
87
91
|
|
88
92
|
Get the manhattan distance between the histogram blocks of two splashes
|
89
93
|
```ruby
|
90
|
-
splash1 = SpectrumHash.from_splash_string "splash10-z400010000-d64778f5782df78f3910"
|
91
|
-
splash2 = SpectrumHash.from_splash_string "splash10-z40h010000-d349672ea211ef542549"
|
92
94
|
splash1.distance_to splash2
|
93
95
|
# => 17
|
94
96
|
```
|
data/lib/spectrum_hash/splash.rb
CHANGED
@@ -59,16 +59,20 @@ module SpectrumHash
|
|
59
59
|
split_splash[0]
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def top_ten_block
|
63
63
|
split_splash[1]
|
64
64
|
end
|
65
65
|
|
66
|
-
def
|
66
|
+
def histogram_block
|
67
67
|
split_splash[2]
|
68
68
|
end
|
69
69
|
|
70
|
+
def hash_block
|
71
|
+
split_splash[3]
|
72
|
+
end
|
73
|
+
|
70
74
|
def histogram_list
|
71
|
-
@histogram_list ||= histogram_block.chars.map{|v| v.to_i
|
75
|
+
@histogram_list ||= histogram_block.chars.map{|v| v.to_i }
|
72
76
|
end
|
73
77
|
|
74
78
|
def to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectrum_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|