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 ...
随机推荐
- Spring Security (一)
一.pom.xml <!-- spring security --> <dependency> <groupId>org.springframework.secur ...
- 阅读摘录《javascript 高级程序设计》01
前言: 因为工作需要,所以开始主攻前台JS方面的技术.在以前的工作中,使用过这门脚本语言.但是都是比较凌乱的,用到什么学什么,只是为了实现业务,而去使用. 不会考虑到代码优化,封装对象等.今次特意借了 ...
- mysql sql 分页
mysql SELECT * FROM TT LIMIT 1,20 少量 数据 大量数据(百万级) select * from news where id>=(select id from ne ...
- 《Pro Express.js》学习笔记——Express服务启动常规七步
Express服务启动常规七步 1. 引用模块 var express=require('express'), compression=require('compression'), bo ...
- (1)WCF少废话系列之 _Hello WCF!
本节旨在通过实例的方式让初学者对WCF有一个感性的认识,坚持由特殊到普遍再由普遍到特殊的认知规律. WCF(Windows Communication Fundation),微软分布式通信架构的集合, ...
- 使用BCrypt算法加密存储登录密码用法及好处
//导入import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; /** *使用BCrypt算法加密存储登录密码 ...
- 进程间通信--fork函数
#include <unistd.h> pid_t fork(void); fork() creates a new process by duplicating the calling ...
- Python学习基本
刚开始学习是看了这个网站: 廖雪峰的官方网站 http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac92707 ...
- 作业七:团队项目——Alpha版本冲刺阶段006
今日进展:完成主体代码. 今日安排:对程序主体进行编写.
- 使用CSS3动画模拟实现小球自由落体效果
使用纯CSS代码模拟实现小球自由落体效果: html代码如下: <div id="ballDiv"> <div id="ball">&l ...