Sha256: a40a5f5b419616ddbdd71a4e07f4071875e8dcec37824d6f51e36bc28199cb1e

Contents?: true

Size: 937 Bytes

Versions: 28

Compression:

Stored size: 937 Bytes

Contents

#!/usr/bin/env ruby

require 'scbi_fasta'

# GOOD_QUAL=50
# BAD_QUAL=10
# DOWN_CASE=('a'..'z')


class Array
 def count
	self.length
 end

end

if ARGV.count < 4
  puts "#{$0} FASTA QUAL OUTPUT_NAME SEQ_NAMES_FILE"
  exit
else
  
  fasta = ARGV.shift
  qual = ARGV.shift
  output_name = ARGV.shift
  seqs_file=ARGV.shift

  seqs=[]

  f=File.open(seqs_file).each_line do |line|
  	seqs.push line.strip.chomp
  end
  # puts seqs.join(';')
  
	fqr=FastaQualFile.new(fasta,qual)
	
	output_fasta=File.new(output_name+'.fasta','a')
	output_qual=File.new(output_name+'.fasta.qual','a')

	fqr.each do |seq_name,seq_fasta,seq_qual|
  	if seqs.index(seq_name)
  	    output_fasta.puts ">#{seq_name}"
  			output_fasta.puts seq_fasta
  	    output_qual.puts ">#{seq_name}"
  			output_qual.puts seq_qual
  			seqs.delete(seq_name)
  			if seqs.empty?
  			  break
			  end
  	end
  end
  
  output_qual.close
  output_fasta.close
  fqr.close

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
seqtrimnext-2.0.68 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.66 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.62 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.61 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.60 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.59 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.57 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.56 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.55 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.54 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.52 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.51 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.50 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.49 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.48 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.46 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.45 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.42 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.41 bin/extract_seqs_from_fasta.rb
seqtrimnext-2.0.39 bin/extract_seqs_from_fasta.rb