Permalink
Browse files

Comments

  • Loading branch information...
1 parent 9f8f5e1 commit 7eb94a1deb67c5d39ea1209af92a724df894a3e5 @pjotrp committed May 3, 2013
Showing with 5 additions and 3 deletions.
  1. +5 −3 bin/fasta_filter.rb
View
8 bin/fasta_filter.rb
@@ -10,7 +10,6 @@
require 'ostruct'
class OptParser
-
#
# Return a structure describing the options.
#
@@ -70,20 +69,23 @@ def self.parse(args)
opt_parser.parse!(args)
options
end # parse()
-
end # class OptParser
options = OptParser.parse(ARGV)
num = -1
FastaReader::emit_fastarecord(-> { ARGF.gets }) { | rec |
num += 1
+ # --- Filtering
next if options.filter and not eval(options.filter)
- if options.codonize
+ if options.codonize
+ # --- Round sequence to nearest 3 nucleotides
size = rec.seq.size
rec.seq = rec.seq[0..size - (size % 3) - 1]
end
+ # --- Only use sequences from MIN size
next if options.min and rec.seq.size < options.min
+ # --- Truncate description to ID
rec.descr = rec.id if options.id
print rec.to_fasta

0 comments on commit 7eb94a1

Please sign in to comment.