Class: Bio::MAF::Filters

Inherits:
Object
  • Object
show all
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

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.



860
861
862
# File 'lib/bio/maf/index.rb', line 860

def initialize(l)
  @l = l
end

Class Method Details

.build(spec, idx) ⇒ Object



849
850
851
852
853
854
855
856
857
858
# File 'lib/bio/maf/index.rb', line 849

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



864
865
866
# File 'lib/bio/maf/index.rb', line 864

def match(entry)
  return ! @l.find { |f| ! f.call(entry) }
end