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
-
#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.
838 839 840 |
# File 'lib/bio/maf/index.rb', line 838 def initialize(l) @l = l end |
Class Method Details
.build(spec, idx) ⇒ Object
827 828 829 830 831 832 833 834 835 836 |
# File 'lib/bio/maf/index.rb', line 827 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
#match(entry) ⇒ Object
842 843 844 |
# File 'lib/bio/maf/index.rb', line 842 def match(entry) return ! @l.find { |f| ! f.call(entry) } end |