Class: Bio::CdHitReport
- Inherits:
-
Object
- Object
- Bio::CdHitReport
- Includes:
- Enumerable
- Defined in:
- lib/bio-cd-hit-report/cd-hit-report.rb
Instance Method Summary collapse
- #clusters ⇒ Object
- #each_cluster(&block) ⇒ Object
- #get_members(cluster_id) ⇒ Object (also: #get_cluster)
-
#initialize(file) ⇒ CdHitReport
constructor
A new instance of CdHitReport.
- #total_clusters ⇒ Object
Constructor Details
#initialize(file) ⇒ CdHitReport
Returns a new instance of CdHitReport.
8 9 10 11 |
# File 'lib/bio-cd-hit-report/cd-hit-report.rb', line 8 def initialize(file) @report = CdHitParser.new @report.report_file = file end |
Instance Method Details
#clusters ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/bio-cd-hit-report/cd-hit-report.rb', line 13 def clusters cls = [] @report.each do |c| cls << c end cls end |
#each_cluster(&block) ⇒ Object
21 22 23 |
# File 'lib/bio-cd-hit-report/cd-hit-report.rb', line 21 def each_cluster(&block) clusters.each(&block) end |
#get_members(cluster_id) ⇒ Object Also known as: get_cluster
29 30 31 |
# File 'lib/bio-cd-hit-report/cd-hit-report.rb', line 29 def get_members(cluster_id) clusters.select {|cluster| cluster.cluster_id == cluster_id.to_s}.map{|c|c.members} end |
#total_clusters ⇒ Object
25 26 27 |
# File 'lib/bio-cd-hit-report/cd-hit-report.rb', line 25 def total_clusters clusters.size end |