Class: TriNuc
- Inherits:
-
Object
- Object
- TriNuc
- Defined in:
- lib/genetic_code.rb
Instance Attribute Summary collapse
-
#codon ⇒ Object
readonly
Returns the value of attribute codon.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
-
#seq ⇒ Object
readonly
Returns the value of attribute seq.
-
#strand ⇒ Object
readonly
Returns the value of attribute strand.
Instance Method Summary collapse
-
#initialize(seq, pos, strand, ind = nil) ⇒ TriNuc
constructor
A new instance of TriNuc.
Constructor Details
#initialize(seq, pos, strand, ind = nil) ⇒ TriNuc
Returns a new instance of TriNuc.
132 133 134 135 136 137 138 139 140 |
# File 'lib/genetic_code.rb', line 132 def initialize seq, pos, strand, ind=nil raise ArgumentError, "Sequence is malformed" unless seq && seq =~ /^[ATGC]{3}$/ raise ArgumentError, "Three genomic coordinates are required" unless pos.is_a?(Array) && pos.length == 3 @seq = seq.to_sym @pos = pos @strand = strand @index = ind @codon = Codon[@seq] end |
Instance Attribute Details
#codon ⇒ Object (readonly)
Returns the value of attribute codon.
131 132 133 |
# File 'lib/genetic_code.rb', line 131 def codon @codon end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
131 132 133 |
# File 'lib/genetic_code.rb', line 131 def index @index end |
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
131 132 133 |
# File 'lib/genetic_code.rb', line 131 def pos @pos end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
131 132 133 |
# File 'lib/genetic_code.rb', line 131 def seq @seq end |
#strand ⇒ Object (readonly)
Returns the value of attribute strand.
131 132 133 |
# File 'lib/genetic_code.rb', line 131 def strand @strand end |