Sha256: 400c70b8905f27f74fd581c8c9accf5ab24748c9725131890d3e8a560dd4b80b

Contents?: true

Size: 1.11 KB

Versions: 35

Compression:

Stored size: 1.11 KB

Contents

#!/usr/bin/env ruby
#
# fsplit.rb - split FASTA file by each n entries
#
#   Copyright (C) 2001 KATAYAMA Toshiaki <k@bioruby.org>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  $Id: fsplit.rb,v 0.1 2001/06/21 08:22:29 katayama Exp $
#

if ARGV.length != 2

  print <<-USAGE
  fsplit.rb - split FASTA file by each n entries
 
   Usage :
 
     % ./fsplit.rb 2000 seq.f
 
     This will produce seq.f.1, seq.f.2, ... with containing 2000 sequences
     in each file.

  USAGE
  exit 1

end

count = ARGV.shift.to_i

i = -1

while gets
  if /^>/
    i += 1
    if i % count == 0 
      n = i / count
      out = File.new("#{$FILENAME}.#{n+1}", "w+")
    end
  end
  out.print
end

Version data entries

35 entries across 35 versions & 4 rubygems

Version Path
bio-2.0.5 sample/fsplit.rb
bio-2.0.4 sample/fsplit.rb
bio-2.0.3 sample/fsplit.rb
bio-2.0.2 sample/fsplit.rb
bio-2.0.1 sample/fsplit.rb
bio-2.0.0 sample/fsplit.rb
bio-1.6.0.pre.20181210 sample/fsplit.rb
bio-1.5.2 sample/fsplit.rb
bio-1.5.1 sample/fsplit.rb
bio-1.5.0 sample/fsplit.rb
bioruby-bio-1.2.9.9001 sample/fsplit.rb
bioruby-bio-1.2.9.9501 sample/fsplit.rb
bioruby-bio-1.3.0.5000 sample/fsplit.rb
bioruby-bio-1.3.0.9901 sample/fsplit.rb
bioruby-bio-1.3.0 sample/fsplit.rb
bioruby-bio-1.3.1.5000 sample/fsplit.rb
jandot-bio-1.2.1 sample/fsplit.rb
ngoto-bio-1.2.9.9001 sample/fsplit.rb
ngoto-bio-1.2.9.9501 sample/fsplit.rb
ngoto-bio-1.3.0.5000 sample/fsplit.rb