Problem

In DNA stringssymbols 'A' and 'T' are complements of each other, as are 'C' and 'G'.

The reverse complement of a DNA string ss is the string scsc formed by reversing the symbols of ss, then taking the complement of each symbol (e.g., the reverse complement of "GTCA" is "TGAC").

Given: A DNA string ss of length at most 1000 bp.

Return: The reverse complement scsc of ss.

Sample Dataset

AAAACCCGGT

Sample Output

ACCGGGTTTT
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 08 20:33:16 2016 @author: hyl
“””
alt_map = {'ins':'0'}
complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'} def reverse_complement(seq):
for k,v in alt_map.iteritems():
seq = seq.replace(k,v)
bases = list(seq)
bases = reversed([complement.get(base,base) for base in bases])
bases = ''.join(bases)
for k,v in alt_map.iteritems():
bases = bases.replace(v,k)
print bases
if __name__ == "__main__":
fh= open ("C:\\Users\\hyl\\Desktop\\rosalind_revc.txt")
seq =''
for line in fh.readlines():
seq += line
reverse_complement(seq)

3.Complementing a Strand of DNA的更多相关文章

  1. 03 Complementing a Strand of DNA

    Problem In DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' and 'G'. The r ...

  2. CHAPTER 38 Reading ‘the Book of Life’ The Human Genome Project 第38章 阅读生命之书 人体基因组计划

    CHAPTER 38 Reading ‘the Book of Life’ The Human Genome Project 第38章 阅读生命之书 人体基因组计划 Humans have about ...

  3. TOJ 2641 Gene

    描述 How can millions of different and complex structures be built using only a few simple building bl ...

  4. Longest common subsequence(LCS)

    问题 说明该问题在生物学中的实际意义 Biological applications often need to compare the DNA of two (or more) different ...

  5. 2. Transcribing DNA into RNA

    Problem An RNA string is a string formed from the alphabet containing 'A', 'C', 'G', and 'U'. Given ...

  6. uva1368 DNA Consensus String

    <tex2html_verbatim_mark> Figure 1. DNA (Deoxyribonucleic Acid) is the molecule which contains ...

  7. DNA Consensus String

    题目(中英对照): DNA (Deoxyribonucleic Acid) is the molecule which contains the genetic instructions. It co ...

  8. Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) E. DNA Evolution 树状数组

    E. DNA Evolution 题目连接: http://codeforces.com/contest/828/problem/E Description Everyone knows that D ...

  9. DNA sequence open reading frames (ORFs) | DNA序列的开放阅读框ORF预测

    常见的ORF预测工具 Open Reading Frame Finder- NCBI ORF Finder - SMS OrfPredictor  - YSU 基本概念 开放阅读框(英语:Open r ...

随机推荐

  1. GDB配置与.gdbinit的编写

    GDB配置与.gdbinit的编写 当 GDB(即 GNU Project Debugger)启动时,它在当前用户的主目录中寻找一个名为 .gdbinit 的文件:如果该文件存在,则 GDB 就执行该 ...

  2. NOIP2016之反面教材提供

    NOIP 2016信息竞赛总结 竞赛历程总结: 算下来一共学了11个月的信息竞赛,从最初进来的时候大概会一点最最基础的语法,上课什么也听不懂,然后一直追进度,我想在这个阶段中我的问题主要是自己知道自己 ...

  3. curl get

    //Get方式实现 //初始化 $ch = curl_init(); //设置选项,包括URL curl_setopt($ch, CURLOPT_URL, "http://www.jb51. ...

  4. failed to open the runspace pool. the server manager winrm plug-in might be corrupted or missing

    添加对127.0.0.1的监听 netsh http add iplisten 127.0.0.01 添加完后的效果

  5. JS详解

    事件源对象:event.srcElement.tagName  event.srcElement.type 捕获/释放:event.srcElement.setCapture();  event.sr ...

  6. Linux系统重要快捷键& Shell 常用通配符

    [Tab]:使用Tab键来进行命令补全: [Ctrl+c]:强行终止当前程序: [Ctrl+d]:键盘输入结束或退出终端: [Ctrl+s]:暂定当前程序,暂停后按下任意键恢复运行: [Ctrl+z] ...

  7. rpc使用JUnit模块测试设计的方法及常见问题

    RPC:Remote Procedure Call 远程过程调用 Wikipedia:http://en.wikipedia.org/wiki/Remote_Procedure_Call 百度百科:h ...

  8. ANDROID : java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String in android

    Andriod系统包中现在已经自带加密函数,如果用apache的codec包则会报以上错误,用android.util.Base64以下方法代替org.apache.commons.codec.bin ...

  9. HeadFirst 设计模式

    一.设计原则 封装变化 多用组合,少用继承 针对接口编程,不针对实现编程 为交互对象之间的松紧耦合设计而努力 对扩展开放,都修稿关闭 依赖抽象,不要依赖具体类 最少知识原则:之和朋友交谈 好莱坞原则: ...

  10. MySQL数据库6 -查询基础,简单查询,条件查询,对查询结果排序

    一.SELECT语句 SELECT COL1,COL2,....COLn FROM TABLE1,TABLE2,....TABLEn [WHERE CONDITIONS] -- 查询条件 [GROUP ...