Module: ViennaRna::RnaExtensions::ClassMethods

Defined in:
lib/vienna_rna/modules/rna_extensions.rb

Instance Method Summary collapse

Instance Method Details

#generate_sequence(sequence_length) ⇒ Object



21
22
23
24
# File 'lib/vienna_rna/modules/rna_extensions.rb', line 21

def generate_sequence(sequence_length)
  # 0th order Markov chain w/ uniform probability distribution
  Rna.init_from_string(sequence_length.times.inject("") { |string, _| string + %w[A U C G][rand(4)] })
end

#shuffle(sequence, token_length = 2) ⇒ Object



26
27
28
# File 'lib/vienna_rna/modules/rna_extensions.rb', line 26

def shuffle(sequence, token_length = 2)
  Shuffle.new(sequence).shuffle(token_length)
end