Class: Bio::MAF::Filters
- Inherits:
-
Object
- Object
- Bio::MAF::Filters
- Includes:
- KVHelpers
- Defined in:
- lib/bio/maf/index.rb
Constant Summary collapse
- FILTER_CLASSES =
{ :with_all_species => MAF::AllSpeciesFilter, :at_least_n_sequences => MAF::AtLeastNSequencesFilter, :min_size => MAF::MinSizeFilter, :max_size => MAF::MaxSizeFilter }
Constants included from KVHelpers
KVHelpers::CHROM_BIN_PREFIX_FMT, KVHelpers::KEY_FMT, KVHelpers::KEY_SCAN_FMT, KVHelpers::VAL_FMT, KVHelpers::VAL_IDX_OFFSET_FMT, KVHelpers::VAL_N_SEQ_FMT, KVHelpers::VAL_SPECIES_FMT, KVHelpers::VAL_TEXT_SIZE_FMT
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(l) ⇒ Filters
constructor
A new instance of Filters.
- #match(entry) ⇒ Object
Methods included from KVHelpers
bin_start_prefix, extract_index_offset, extract_n_sequences, extract_species_vec, extract_text_size, unpack_key
Constructor Details
#initialize(l) ⇒ Filters
Returns a new instance of Filters.
946 947 948 |
# File 'lib/bio/maf/index.rb', line 946 def initialize(l) @l = l end |
Class Method Details
.build(spec, idx) ⇒ Object
935 936 937 938 939 940 941 942 943 944 |
# File 'lib/bio/maf/index.rb', line 935 def self.build(spec, idx) l = spec.collect do |key, val| if FILTER_CLASSES.has_key? key FILTER_CLASSES[key].new(val, idx) else raise "Unsupported filter key #{key}!" end end return Filters.new(l) end |
Instance Method Details
#empty? ⇒ Boolean
950 951 952 |
# File 'lib/bio/maf/index.rb', line 950 def empty? @l.empty? end |
#match(entry) ⇒ Object
954 955 956 |
# File 'lib/bio/maf/index.rb', line 954 def match(entry) return ! @l.find { |f| ! f.call(entry) } end |