Sha256: 5d8d516829da02995c0a68f39f7c1abf772d5a208b6711ef9d91ac35effe59d2

Contents?: true

Size: 600 Bytes

Versions: 8

Compression:

Stored size: 600 Bytes

Contents

#!/usr/bin/env ruby

require 'scbi_fasta'


if ARGV.count < 3
  puts "#{$0} FASTA_FILE OUTPUT_NAME SEQS_PER_FILE_COUNT"
  exit
end



fastq = ARGV.shift
output_name = ARGV.shift
split_by = ARGV.shift.to_i


file_index=1
out=File.new("#{output_name}#{file_index}.fasta",'w')
fqr=FastaQualFile.new(fastq)

count = 0

fqr.each do |seq_name,seq_fasta,comments|

  if (count >= split_by)
    count=0

    file_index +=1
    out.close
    out=File.new("#{output_name}#{file_index}.fasta",'w')
  end

  out.puts(">#{seq_name} #{comments}")
  out.puts(seq_fasta)

  count +=1

end

out.close if out
fqr.close

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
seqtrimnext-2.0.68 bin/split_fasta.rb
seqtrimnext-2.0.66 bin/split_fasta.rb
seqtrimnext-2.0.62 bin/split_fasta.rb
seqtrimnext-2.0.61 bin/split_fasta.rb
seqtrimnext-2.0.60 bin/split_fasta.rb
seqtrimnext-2.0.59 bin/split_fasta.rb
seqtrimnext-2.0.57 bin/split_fasta.rb
seqtrimnext-2.0.56 bin/split_fasta.rb