Class: Bio::MAF::AllSpeciesFilter
Constant Summary
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
Instance Attribute Summary collapse
-
#bs ⇒ Object
readonly
Returns the value of attribute bs.
Instance Method Summary collapse
-
#initialize(species, idx) ⇒ AllSpeciesFilter
constructor
A new instance of AllSpeciesFilter.
- #match(entry) ⇒ Object
Methods inherited from Filter
Methods included from KVHelpers
bin_start_prefix, extract_index_offset, extract_n_sequences, extract_species_vec, extract_text_size, unpack_key
Constructor Details
#initialize(species, idx) ⇒ AllSpeciesFilter
Returns a new instance of AllSpeciesFilter.
885 886 887 888 |
# File 'lib/bio/maf/index.rb', line 885 def initialize(species, idx) ids = species.collect {|s| 1 << idx.species.fetch(s) } @mask = ids.reduce(0, :|) end |
Instance Attribute Details
#bs ⇒ Object (readonly)
Returns the value of attribute bs.
884 885 886 |
# File 'lib/bio/maf/index.rb', line 884 def bs @bs end |
Instance Method Details
#match(entry) ⇒ Object
890 891 892 893 |
# File 'lib/bio/maf/index.rb', line 890 def match(entry) vec = extract_species_vec(entry) (@mask & vec) == @mask end |