3.Complementing a Strand of DNA
Problem
In DNA strings, symbols '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的更多相关文章
- 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 ...
- 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 ...
- TOJ 2641 Gene
描述 How can millions of different and complex structures be built using only a few simple building bl ...
- Longest common subsequence(LCS)
问题 说明该问题在生物学中的实际意义 Biological applications often need to compare the DNA of two (or more) different ...
- 2. Transcribing DNA into RNA
Problem An RNA string is a string formed from the alphabet containing 'A', 'C', 'G', and 'U'. Given ...
- uva1368 DNA Consensus String
<tex2html_verbatim_mark> Figure 1. DNA (Deoxyribonucleic Acid) is the molecule which contains ...
- DNA Consensus String
题目(中英对照): DNA (Deoxyribonucleic Acid) is the molecule which contains the genetic instructions. It co ...
- 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 ...
- DNA sequence open reading frames (ORFs) | DNA序列的开放阅读框ORF预测
常见的ORF预测工具 Open Reading Frame Finder- NCBI ORF Finder - SMS OrfPredictor - YSU 基本概念 开放阅读框(英语:Open r ...
随机推荐
- share登录Samba可读可写(适合虚拟机下学习使用)
直接配置 smb.conf ( path = /etc/samba/smb.conf ). 首先,进入到 samba 文件夹: cd /etc/samba/ 备份 smb.conf: mv smb.c ...
- Request和response的用法总结
Request 个我总结:只要记住 只要是有关于客户端请求的信息,都可以藉由它来取得,例如请求标头.请求方法.请求参数.使用者IP等等信息. 3.什么情况下为响应?什么情况下为请求? 简单一句话,请求 ...
- 跨域请求ajax jsonp的使用解惑
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- C++中常见错误整理(不定期更新)
1.cannot have cv-qualifier 在C++中CV指const和volatile,非成员函数和静态成员函数不能有CV限定.
- Linux快捷键和别名
一.设置别名 1使用命令行 alias 别名='命令'(只对本次登陆生效) 2.使用配置文件设置别名(永久生效) vi /root/.bashrc 打开系统别名配置文件,一般是用 ...
- ubuntu的一些操作
1.修改ubuntu的grub启动选择菜单 需要修改到文件为 /boot/grub/grub.cfg 命令: sudo gedit /boot/grub/grub.cfg 修改默认启动项:set de ...
- c++虚函数和内联构造函数
创建一个含有虚函数的对象时, 编译器会实现 "初始化其VPTR以指向相应的VTABLE" 这个操作 ,而实现这个操作是通过 "插入隐藏代码至构造函数中" 故此时 ...
- NASAL脚本实现的高精度定时器
#timer thread #-------以下:用户禁止访问------- #定时器属性 var TimerHash = { #定时间隔 time : , #触发函数 trigFunc : nil, ...
- 19:A*B问题
总时间限制: 1000ms 内存限制: 65536kB 描述 输入两个正整数A和B,求A*B. 输入 一行,包含两个正整数A和B,中间用单个空格隔开.1 <= A,B <= 50000 ...
- JS常用方法记录
//对Object的num字段进行排序 var compare = function (propertyName) { return function (object1, object2) { var ...