scbi_fasta

DESCRIPTION:

scbi_fasta is a ruby gem to read FASTA+QUAL files (DNA/RNA sequences).

FEATURES/PROBLEMS:

  • Read FASTA files with associated QUAL files

  • Quality values can be automatically splitted

  • Iteration over large files without extra memory usage

SYNOPSIS:

Reading a FASTA+QUAL with iterator:

require 'scbi_fasta'

# open file in sanger mode
fqr=FastaQualFile.new('file1.fasta','file1.fasta.qual')

fqr.each do |name,seq_fasta,qual,comments|

  puts name
  puts seq_fasta
  puts qual
  puts comments
end

fqr.close

Reading a FASTA one sequence at a time:

require 'scbi_fasta'

# open file 
fqr=FastaQualFile.new('file1.fasta','file1.fasta.qual')

begin

# read one sequence
name,seq_fasta,qual,comments=fqr.next_seq

# name will be nil if there are not more sequences available

if !name.nil?

  puts name
  puts seq_fasta
  puts qual
  puts comments
end

end until name.nil?

fqr.close

REQUIREMENTS:

  • This is a standalone gem.

INSTALL:

  • gem install scbi_fasta

LICENSE:

(The MIT License)

Copyright © 2010 Almudena Bocinos, Dario Guerrero

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.