Class: ListDb
- Inherits:
-
Object
- Object
- ListDb
- Defined in:
- lib/seqtrimnext/classes/list_db.rb
Overview
List all entries in a DB, by name
list all DB names if db is ALL
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, db) ⇒ ListDb
constructor
A new instance of ListDb.
Constructor Details
#initialize(path, db) ⇒ ListDb
Returns a new instance of ListDb.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/seqtrimnext/classes/list_db.rb', line 8 def initialize(path,db) filename=File.join(path,'formatted',db) if File.exists?(filename) f = File.open(filename) f.grep(/^>(.*)$/) do |line| puts $1 end f.close else puts "File #{filename} doesn't exists" puts '' puts "Available databases:" puts '-'*20 d=Dir.glob(File.join(path,'formatted','*.fasta')) d.entries.map{|e| puts File.basename(e)} # cmd= "grep '^>' #{File.join(path,'formatted',db+'.fasta')}" # system(cmd) end end |