Wobble Hypothesis - Combination or Permutation of Array of strings in ruby
来源:互联网 发布:mac配置java环境 编辑:程序博客网 时间:2024/06/05 09:52
I have a ruby array with 4 strings
nucleotides = ['A', 'G', 'C', 'T']
I need 4^3 combinations of strings.
new_array = ['AGC', 'AGT' .. 'TTT']
This is the wobble hypothesis in genetics. Could someone explain how I could go about achieving this using ruby.
use Array#repeated_permutation
:
nucleotides = %w(A G C T)nucleotides.repeated_permutation(3).map(&:join)#=> ["AAA", "AAG", "AAC", "AAT", "AGA", "AGG", "AGC", "AGT", "ACA", "ACG", "ACC", "ACT", "ATA", "ATG", "ATC", "ATT", "GAA", "GAG", "GAC", "GAT", "GGA", "GGG", "GGC", "GGT", "GCA", "GCG", "GCC", "GCT", "GTA", "GTG", "GTC", "GTT", "CAA", "CAG", "CAC", "CAT", "CGA", "CGG", "CGC", "CGT", "CCA", "CCG", "CCC", "CCT", "CTA", "CTG", "CTC", "CTT", "TAA", "TAG", "TAC", "TAT", "TGA", "TGG", "TGC", "TGT", "TCA", "TCG", "TCC", "TCT", "TTA", "TTG", "TTC", "TTT"]
0 0
- Wobble Hypothesis - Combination or Permutation of Array of strings in ruby
- Get indices for sorted permutation of an array in Ruby?
- Ruby: Sorting an array of strings, in alphabetical order, that includes some arrays of strings
- Finding sum of every combination of two numbers in an array in Ruby
- Sorting an array of hash in Ruby
- Sort array of strings
- Converting a array to an array of ranges in ruby
- OpenCV Unsupported format or combination of formats () in cv::calcHist
- Get nth element of an array in Ruby?
- How to find number of a specific integer in an array of Fixnums ruby
- Matching Portions of A String to Elements of an Array in Ruby
- Condensing an array of hashes within that same array in Ruby
- Ruby converting array of hashes to array of arrays
- How to format strings in an array in ruby?
- Test of Hypothesis(假设检验) Case Study - in the Context of Software Industry
- 初始化一个NULL-terminated array of strings in C (以NULL结尾的字符串数组)
- Ruby Group Parts of An Array
- Extracting Data from array of hashes Ruby
- 软件标准学习:CMMI
- Leetcode 细节实现 Rotate Image
- SAP ABAP编程 几种常用的屏幕输出格式
- Android AIDL实例解析
- Java压缩和解压缩
- Wobble Hypothesis - Combination or Permutation of Array of strings in ruby
- mybatis实战教程(mybatis in action),mybatis入门到精通
- 关于java中压缩与解压缩文件的问题
- Android之高仿雅虎天气(二)---代码结构解析
- Java构造和解析Json数据的两种方法详解一
- rails 4 way笔记--Routing
- druid数据库连接池
- Android开源框架ImageLoader的完美例子
- web前端页面三种弹出对话框的用法实例