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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc04a509020bcd5a59796b90449bee2beb75b5ad
4
- data.tar.gz: 321206974a47953f3d7da2f2157d9c4316c81fa8
3
+ metadata.gz: 7e722e675d098633fbd9c722ae9228f05cdec21d
4
+ data.tar.gz: bb25509f784e1009bb0b997e5cb1ae74aa0431f0
5
5
  SHA512:
6
- metadata.gz: 604e3388185a4ab91674988e8a8908df8421bcec90d1edf0ba77a868b4d893f025808da81270ed98f7fb7a15c4f4987a98212c434cc3a449c4bcecb035219556
7
- data.tar.gz: 2e161c8b001ed0072598356e639be8ebd1592760c9bef1f0fc175527d877424fc3cfb555b21bf04199a1e274ee8bb78bdec15bcf704ca8c2329bd9418eb48d94
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-z400010000-d64778f5782df78f3910"
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-z400010000-d64778f5782df78f3910"
57
+ # => "splash10-0006-9100000000-b0cf38693934211e4e35"
58
58
  ```
59
59
 
60
- There are a couple methods to get the different components of the
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-z40h010000-d349672ea211ef542549"
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
- # print the full version block
70
+ # get the full version block
71
71
  splash.version_block
72
72
  # => "splash10"
73
73
 
74
- # print the histogram block
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
- # => "z40h010000"
80
+ # => "9100000000"
77
81
 
78
- # print the hash block
82
+ # get the hash block
79
83
  splash.hash_block
80
- # => "d349672ea211ef542549"
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
  ```
@@ -59,16 +59,20 @@ module SpectrumHash
59
59
  split_splash[0]
60
60
  end
61
61
 
62
- def histogram_block
62
+ def top_ten_block
63
63
  split_splash[1]
64
64
  end
65
65
 
66
- def hash_block
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(36) }
75
+ @histogram_list ||= histogram_block.chars.map{|v| v.to_i }
72
76
  end
73
77
 
74
78
  def to_s
@@ -1,3 +1,3 @@
1
1
  module SpectrumHash
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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: 2015-10-23 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty