dna reverse

简介: dna reverse
Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms.
If you want to know more http://en.wikipedia.org/wiki/DNA
In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". You have function with one side of the DNA (string, except for Haskell); you need to get the other complementary side. DNA strand is never empty or there is no DNA at all (again, except for Haskell).
DNAStrand ("ATTGC") # return "TAACG"
DNAStrand ("GTAT") # return "CATA"

代码

function DNAStrand(dna){
    function switch(x){
        switch (x){
            case "A":
                return "T";break;
            case "T":
                return "A";break;
            case "G":
                return "C";break;
            case "C":
                return "G";break;
        }
    }
    for(var i= 0,r='',l=dna.length;i<l;i++){
        r+=switch(dna[i])
    }
    return r
}
目录
相关文章
|
5月前
|
机器学习/深度学习 算法 计算机视觉
SORT新方法AM-SORT | 超越DeepSORT/CO-SORT/CenterTrack等方法,成为跟踪榜首
SORT新方法AM-SORT | 超越DeepSORT/CO-SORT/CenterTrack等方法,成为跟踪榜首
254 0
|
5月前
【每日一题Day369】LC187重复的DNA序列 | 字符串哈希
【每日一题Day369】LC187重复的DNA序列 | 字符串哈希
43 1
|
12月前
|
机器学习/深度学习 自然语言处理 语音技术
从 Seq2Seq 到 Attention:彻底改变序列建模
从 Seq2Seq 到 Attention:彻底改变序列建模
57 0
|
4月前
|
人工智能
技术心得:区间检测(range)
技术心得:区间检测(range)
30 0
|
5月前
|
存储
力扣187 重复DNA序列
力扣187 重复DNA序列
|
5月前
leetcode-187:重复的DNA序列
leetcode-187:重复的DNA序列
49 0
华为机试HJ63:DNA序列
华为机试HJ63:DNA序列
|
机器学习/深度学习 自然语言处理 运维
Word2Vec:一种基于预测的方法
Word2Vec:一种基于预测的方法
285 0
A. Way Too Long Words(无思维纯模拟)
A. Way Too Long Words(无思维纯模拟)
47 0
word中列表序列隔空不同的简单解决方案
word中列表序列隔空不同的简单解决方案
120 0
word中列表序列隔空不同的简单解决方案