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 ...
随机推荐
- WebView 的使用----android 网络连接处理分析
在Android中,可以有多种方式来实现网络编程: 创建URL,并使用URLConnection/HttpURLConnection 使用HttpClient 使用WebView 创建URL,并使用U ...
- 安卓自动化测试:Android studio 自带的 Record Espresso Test || [ Appium & (Android studio || Python|| Eclipse ) ]
1.Android studio 自带的 Record Espresso Test https://developer.android.com/studio/test/espresso-test-r ...
- android studio使用中遇到的问题
旧版和新版切换会报错(点击更正, 不影响程序使用) 2.debug正常, 打包签名程序时候报错 String index out of range: -82 java.lang.StringIndex ...
- 用PHP抓取淘宝商品的用户晒单评论+图片实例
为什么想起来做这个功能?是因为前段时间在做一个淘客网站的时候,想到是否能抓取到淘宝商品的买家秀呢?经过一番折腾发现,淘宝商品用户评价信息是通过Ajax来调取的,通过嗅探网址发现,评论数据的请求接口是: ...
- Java泛型学习笔记 - (一)泛型的介绍
一.什么是泛型:泛型的作用是用来规定一个类, 接口或方法所能接受的数据的类型. 就像在声明方法时指定参数一样, 我们在声明一个类, 接口或方法时, 也可以指定其"类型参数", 也就 ...
- WIN7-64位安装PLSQL-Developer步骤
可参与网址http://tech.ddvip.com/2012-07/1343104017178927.html 以下操作是从网上搜索在64位WIN7测试通过,64位无法使用PL/SQL Develo ...
- 方法的重载overload
/*方法的重载overload * 重载:在同一个类里可以定义一个或者一个以上的方法 * 参数类型不一致 * 参数数量不一致 * */ public class Chongza ...
- nginx+tomcat+dubbo单机部署多台dubbo应用
前面的博客已经介绍如何使用nginx+tomcat,今天做的是如何在单台服务器上如何部署多台dubbo 应用的集群. 由于在项目中遇到了这个问题,今天就把它记录下来. 1.
- how a 程序猿 doubled his salary?
One thing i can say, no matter what position i was in or what was my salary, i never stopped studyin ...
- Hadoop安装——如何修改端口冲突
在一个集群中,尽管是多用户,但是端口是公用的,存在冲突的可能.如果另一个用户已经采用默认配置安装了hadoop,那么当前用户再安装hadoop时,必然会产生端口的冲突.在配置自己的hadoop时,可以 ...