class Bio::Bam::QueryBuilder

Attributes

subexpressions[RW]

Public Class Methods

new() click to toggle source
# File lib/bio-sambamba/filtering.rb, line 56
def initialize
  @subexpressions = []
  class << @subexpressions
    def pjoin str
      self.map{|expr| '(' + expr + ')'}.join str
    end
  end
end

Public Instance Methods

expression() click to toggle source
# File lib/bio-sambamba/filtering.rb, line 129
def expression
  subexpressions.pjoin ' and '
end
flag() click to toggle source
# File lib/bio-sambamba/filtering.rb, line 65
def flag
  FlagQueryBuilder.new(self)
end
intersection(&block) click to toggle source
# File lib/bio-sambamba/filtering.rb, line 123
def intersection &block
  qb = QueryBuilder.new
  qb.instance_eval &block
  @subexpressions << (qb.subexpressions.pjoin ' and ')
end
negate(&block) click to toggle source
# File lib/bio-sambamba/filtering.rb, line 110
def negate &block
  qb = QueryBuilder.new
  qb.instance_eval &block
  @subexpressions << ('not (' + qb.expression + ')')
end
tag(tagname) click to toggle source
# File lib/bio-sambamba/filtering.rb, line 69
def tag tagname
  TagQueryBuilder.new(self, tagname)
end
union(&block) click to toggle source
# File lib/bio-sambamba/filtering.rb, line 116
def union &block
  qb = QueryBuilder.new
  qb.instance_eval &block
  @subexpressions << (qb.subexpressions.pjoin ' or ')
  nil
end