Skip to content

Instantly share code, notes, and snippets.

@nakao
Created December 20, 2013 06:52
Show Gist options
  • Save nakao/8051285 to your computer and use it in GitHub Desktop.
Save nakao/8051285 to your computer and use it in GitHub Desktop.
# Split a multi fasta file into single fasta files (1.fasta, 2.fasta, ...)
# > ruby a.rb multi.fasta
require 'rubygems'
gem 'bio'
Bio::FlatFile.auto($<).each_with_index do |entry, i|
File.open("#{i+1}.fasta", "w") do |f|
f.puts entry.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment