Class: Cluster
- Inherits:
-
Object
- Object
- Cluster
- Defined in:
- lib/bio-cd-hit-report/cluster.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #cluster_id ⇒ Object
- #entries ⇒ Object
-
#initialize(arg = {}) ⇒ Cluster
constructor
A new instance of Cluster.
- #members ⇒ Object
- #representative ⇒ Object (also: #rep_seq)
- #size ⇒ Object (also: #length)
Constructor Details
#initialize(arg = {}) ⇒ Cluster
Returns a new instance of Cluster.
4 5 6 7 |
# File 'lib/bio-cd-hit-report/cluster.rb', line 4 def initialize(arg={}) self.name = arg[:name] self.data = arg[:data] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
2 3 4 |
# File 'lib/bio-cd-hit-report/cluster.rb', line 2 def data @data end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/bio-cd-hit-report/cluster.rb', line 2 def name @name end |
Instance Method Details
#cluster_id ⇒ Object
9 10 11 |
# File 'lib/bio-cd-hit-report/cluster.rb', line 9 def cluster_id name.scan(/Cluster\s(.*)/).join end |
#entries ⇒ Object
27 28 29 |
# File 'lib/bio-cd-hit-report/cluster.rb', line 27 def entries data.split("\n").map{|line|line.scan(/>(.+)\.{3}/)} end |
#members ⇒ Object
13 14 15 |
# File 'lib/bio-cd-hit-report/cluster.rb', line 13 def members entries.join(',') end |
#representative ⇒ Object Also known as: rep_seq
17 18 19 |
# File 'lib/bio-cd-hit-report/cluster.rb', line 17 def representative data.split("\n").map{|line|line.scan(/>(.+)\.{3}\s\*/)}.join end |
#size ⇒ Object Also known as: length
22 23 24 |
# File 'lib/bio-cd-hit-report/cluster.rb', line 22 def size entries.size end |