Class: Bio::DB::Fasta::Region
- Inherits:
-
Object
- Object
- Bio::DB::Fasta::Region
- Defined in:
- lib/bio-faidx/faidx.rb,
lib/bio-faidx/faidx.rb
Instance Method Summary collapse
- #joinRegion(other) ⇒ Object
- #overlap_in_set(set) ⇒ Object
- #overlaps(other) ⇒ Object
- #subset(other) ⇒ Object
Instance Method Details
#joinRegion(other) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/bio-faidx/faidx.rb', line 77 def joinRegion (other) return nil unless self.overlaps(other) out = self.clone out.start = other.start if other.start < out.start out.end = other.end if other.end > out.end return out end |
#overlap_in_set(set) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/bio-faidx/faidx.rb', line 85 def overlap_in_set(set) overlap_set = Set.new set.each do |e| overlap_set << e if self.overlaps(e) end overlap_set end |
#overlaps(other) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/bio-faidx/faidx.rb', line 65 def overlaps (other) return false if other.entry != @entry return true if other.start >= @start and other.start <= @end return true if other.end >= @start and other.end <= @end return false end |
#subset(other) ⇒ Object
72 73 74 75 |
# File 'lib/bio-faidx/faidx.rb', line 72 def subset (other) return false if other.entry != @entry return true if other.start >= @start and other.end <= @end end |