Sha256: 2af3c56260b3f75c9641b2f86e0666103c2c1270a63d8a40734b2579821a21f8
Contents?: true
Size: 1.07 KB
Versions: 6
Compression:
Stored size: 1.07 KB
Contents
#!/usr/bin/env ruby require 'cri' Signal.trap("PIPE", "EXIT") Signal.trap("INT", "EXIT") root_cmd = Cri::Command.new_basic_root.modify do name 'peptfilter' flag :i, :unique, "only output unique peptides" required :l, :minlen, "minimum length (default: 5)" required :u, :maxlen, "minimum length (default: 50)" required :a, :lacks, "a string whose letters represent amino acids that may not occur in the peptide" required :c, :contains, "a string whose letters represent amino acids that must all occur in the peptide" run do |opts, args, cmd| minlen = opts.fetch(:minlen, "5").to_i maxlen = opts.fetch(:maxlen, "50").to_i lacks = opts.fetch(:lacks, "").chars.to_a contains = opts.fetch(:contains, "").chars.to_a $stdin.each_line do |pept| pept = pept.chomp length_ok = pept.length >= minlen && pept.length <= maxlen lacks_ok = (pept.chars.to_a & lacks).size == 0 contains_ok = (pept.chars.to_a & contains).size == contains.size if length_ok && lacks_ok && contains_ok puts pept end end end end root_cmd.run(ARGV)
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
unipept-0.4.2 | bin/peptfilter |
unipept-0.4.1 | bin/peptfilter |
unipept-0.4.0 | bin/peptfilter |
unipept-0.3.5 | bin/peptfilter |
unipept-0.3.4 | bin/peptfilter |
unipept-0.3.3 | bin/peptfilter |