Sha256: 47b5609cbbfb2a45df45233b930268f5695005c5c12aa82ff356451a9137ad63

Contents?: true

Size: 608 Bytes

Versions: 28

Compression:

Stored size: 608 Bytes

Contents

#!/usr/bin/env ruby

require 'json'

if ARGV.count != 2
  puts "#{$0} cluster.fasta.clstr COUNT"
  exit
end

path=ARGV.shift
list_max=ARGV.shift.to_i

# puts path

h={}

last_line = ''

f=File.open(path)

f.each do |line|
  if line =~ />Cluster/
      if !last_line.empty?
        if last_line =~ /^([\d]+)\s[^>]*>([^\s]*)\.\.\.\s/
          # puts $1
          h[$2]=$1.to_i+1
        end
      end
  end
  
  last_line=line
  
end

f.close


# puts "30 most repeated sequences:"
list_max.times do
  ma=h.max_by{|k,v| v}
  if ma
    puts ma.join(' => ')
    h.delete(ma[0])
  end
end


# puts h.sort.to_json

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
seqtrimnext-2.0.68 bin/resume_clusters.rb
seqtrimnext-2.0.66 bin/resume_clusters.rb
seqtrimnext-2.0.62 bin/resume_clusters.rb
seqtrimnext-2.0.61 bin/resume_clusters.rb
seqtrimnext-2.0.60 bin/resume_clusters.rb
seqtrimnext-2.0.59 bin/resume_clusters.rb
seqtrimnext-2.0.57 bin/resume_clusters.rb
seqtrimnext-2.0.56 bin/resume_clusters.rb
seqtrimnext-2.0.55 bin/resume_clusters.rb
seqtrimnext-2.0.54 bin/resume_clusters.rb
seqtrimnext-2.0.52 bin/resume_clusters.rb
seqtrimnext-2.0.51 bin/resume_clusters.rb
seqtrimnext-2.0.50 bin/resume_clusters.rb
seqtrimnext-2.0.49 bin/resume_clusters.rb
seqtrimnext-2.0.48 bin/resume_clusters.rb
seqtrimnext-2.0.46 bin/resume_clusters.rb
seqtrimnext-2.0.45 bin/resume_clusters.rb
seqtrimnext-2.0.42 bin/resume_clusters.rb
seqtrimnext-2.0.41 bin/resume_clusters.rb
seqtrimnext-2.0.39 bin/resume_clusters.rb