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. 一眼看懂KMP匹配算法

    KMP算法——快速从字符串M(母串)中找出与字符串Z(子串)匹配的子串 例1: 0 1 2 3 4 5 M:a b c a b d Z:  a b d BF算法(最一般的算法,也叫“蛮力算法”): 将 ...

  2. 主流 SQLServer 迁移到 MySQL 工具对比

    首次需要数据转换是测试环节,当时为了快速验证新研发云产品性能与结果准确性(算法类),所以需大量的原始数据,最快的办法就是使用老产品的真实数据.因为在前期数据转换时主用于内部验证,并没有花很多心思去处理 ...

  3. Codeforces Round #211 (Div. 2) D题(二分,贪心)解题报告

    ---恢复内容开始--- 题目地址 简要题意: n个小伙子一起去买自行车,他们有每个人都带了一些钱,并且有公有的一笔梦想启动资金,可以分配给任何小伙子任何数值,当然分配权在我们的手中.现在给出m辆自行 ...

  4. Mybatis使用generator自动生成映射配置文件信息

     使用mybatis配置映射文件比较的麻烦,但是有自动生成jar工具,方便加速开发速度,下面主要是该工具的使用以及相关的配置. 1.下载相关的资源 我们需要下载mybatis-generator-co ...

  5. c++作业:Circle

    Circle Github链接

  6. 在PHP中如何实现在做了么个操作后返回到指定页面

    我们经常会碰到类似用户在没有登录的情况下进行提问.评论,需要用户登录后返回刚才浏览的网页,这种功能用cookie保存当前url地址来实现.我用的是jquery,读者需要懂点jquery中的ajax请求 ...

  7. js图片拖放原理(很简单,不是框架,入门基础)

    <html> <meta> <script src='jquery-1.8.3.min.js'></script> <script> /* ...

  8. iOS autoresizing布局

    在对UIView以及其子类空间的布局方案有多种,今天温习了一下autoresizing布局 一.了解一下相关知识: 1.UIView其中一个属性为 @property(nonatomic) UIVie ...

  9. Android深度探索(卷1)HAL与驱动开发

    第一章 介绍Android驱动开发和移植技术 主要对android和linux做了总体的介绍,让我们有了个感性的认识. 一.Android的四层系统架构: a) Linux内核:Android是基于L ...

  10. java基础之 超类Object

    一.概述:       Object类是所有Java类的祖先.每个类都使用 Object 作为超类.所有对象(包括数组)都实现这个类的方法.在不明确给出超类的情况下,Java会自动把Object作为要 ...