Class: Bio::Assembly::Read

Inherits:
Object
  • Object
show all
Defined in:
lib/bio-assembly/read.rb

Direct Known Subclasses

Ace::Read, Caf::Read

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str = "") ⇒ Read

Returns a new instance of Read.



9
10
11
# File 'lib/bio-assembly/read.rb', line 9

def initialize(str="")
 @seq = Bio::Sequence::NA.new(str)
end

Instance Attribute Details

#clear_range_fromObject

Returns the value of attribute clear_range_from.



8
9
10
# File 'lib/bio-assembly/read.rb', line 8

def clear_range_from
  @clear_range_from
end

#clear_range_toObject

Returns the value of attribute clear_range_to.



8
9
10
# File 'lib/bio-assembly/read.rb', line 8

def clear_range_to
  @clear_range_to
end

#fromObject

Returns the value of attribute from.



8
9
10
# File 'lib/bio-assembly/read.rb', line 8

def from
  @from
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/bio-assembly/read.rb', line 8

def name
  @name
end

#orientationObject

Returns the value of attribute orientation.



8
9
10
# File 'lib/bio-assembly/read.rb', line 8

def orientation
  @orientation
end

#seqObject

Returns the value of attribute seq.



8
9
10
# File 'lib/bio-assembly/read.rb', line 8

def seq
  @seq
end

#toObject

Returns the value of attribute to.



8
9
10
# File 'lib/bio-assembly/read.rb', line 8

def to
  @to
end

Instance Method Details

#<=>(other) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bio-assembly/read.rb', line 41

def <=>(other)
  unless other.kind_of?(Bio::Assembly::Read)
    raise "[Error] markers are not comparable"
  end
  if self.from == other.from
    # sort by to if froms are identical
    return self.to.<=>(other.to)
  else
    return self.from.<=>(other.from)
  end
end

#==(other_read) ⇒ Object



13
14
15
# File 'lib/bio-assembly/read.rb', line 13

def ==(other_read)
   name == other_read.name
end

#num_basesObject



17
18
19
# File 'lib/bio-assembly/read.rb', line 17

def num_bases
  seq.length
end