Sha256: ec56cee73c2bb782ab210588887862b9c5b3b8180d52c71da30eaee546c8e54a
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require "parse_fasta" module PasvLib module Io def read_refs fname refs = {} ParseFasta::SeqFile.open(fname).each_record do |rec| if has_gaps? rec.seq raise PasvLib::ParseError, "Record '#{rec.header}' had gaps! Did you accidentally " \ "provide aligned sequences?" end if refs.count.zero? head = "first_pasv_ref" else head = "pasv_ref___#{rec.id}" end refs[head] = rec.seq end refs end def read_queries fname queries = {} ParseFasta::SeqFile.open(fname).each_record do |rec| if has_gaps? rec.seq raise PasvLib::ParseError, "Record '#{rec.header}' had gaps! Did you accidentally " \ "provide aligned sequences?" end header = "pasv_query___#{rec.header}" queries[header] = rec.seq end queries end private def has_gaps? seq seq.include?("-") || seq.include?(".") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pasv_lib-0.5.0 | lib/pasv_lib/io.rb |