1.Counting DNA Nucleotides
Problem
A string is simply an ordered collection of symbols selected from some alphabet and formed into a word; the length of a string is the number of symbols that it contains.
An example of a length 21 DNA string (whose alphabet contains the symbols 'A', 'C', 'G', and 'T') is "ATGCTTCAGAAAGGTCTTACG."
Given: A DNA string ss of length at most 1000 nt.
Return: Four integers (separated by spaces) counting the respective number of times that the symbols 'A', 'C', 'G', and 'T' occur in ss.
Sample Dataset
AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC
Sample Output
20 12 17 21
# -*- coding: utf-8 -*-
@author: hyl
"""
### 2. Transcribing DNA into RNA ###
d = {'A':0,'T':0,'G':0,'C':0}
with open('C:\\Users\\hyl\\Desktop\\rosalind_dna.txt') as f:
for line in f:
for i in line :
if i == "A":
d['A'] +=1
if i == "T":
d['T'] +=1
if i == "G":
d['G'] +=1
if i == "C":
d['C'] +=1
print str( d['A']) + " "+str(d['C']) + " " + str(d['G']) + " " + str(d['T'])
1.Counting DNA Nucleotides的更多相关文章
- 01 A Counting DNA Nucleotides
Problem A string is simply an ordered collection of symbols selected from some alphabet and formed i ...
- JELLYFISH - Fast, Parallel k-mer Counting for DNA
kmer分析其实是非常耗费计算资源的,如果我们自己写脚本来分析kmer的话,首先要将所有的序列打断成一定长度的kmer,然后将所有的kmer存储起来,最后统计每个kmer出现的频率,或者统计出现指定次 ...
- [LeetCode] Repeated DNA Sequences 求重复的DNA序列
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
- [Leetcode] Repeated DNA Sequences
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
- 6.Counting Point Mutations
Problem Figure 2. The Hamming distance between these two strings is 7. Mismatched symbols are colore ...
- leetcode 187. Repeated DNA Sequences 求重复的DNA串 ---------- java
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
- 【leetcode】Repeated DNA Sequences(middle)★
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
- LeetCode() Repeated DNA Sequences 看的非常的过瘾!
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
- Repeated DNA Sequences
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
随机推荐
- PHP是什么
php 是一种服务器端的,嵌入html的脚本语言.php区别其他像客户端java的地方是它的代码在服务器端执行.php能做什么? 最低水平,php可以做任何其他cgi程序所能做的事,例如收集表格数据, ...
- Virtual Box 下Ubuntu桥接网络设置
转自:http://os.51cto.com/art/200908/144564.htm 一般而言,安装完VirtualBox设定网路时选择默认的NAT模式,Guest就可顺利联网了,但是这种方式比较 ...
- Raspberry Pi Resources-Using the UART
参考:RPi Serial Connection 本文来自:http://www.raspberry-projects.com/pi/programming-in-c/uart-serial-port ...
- C++ 类模板的使用
从事C++挺久了,在前段时看书时,发现高手,都是在写模板无,泛型编程,顿感差距.自己连模板都没有写,于是就小小的研究了下模板的用法. 模板简而言之就是对某此对象的相同方法,或处理方式,进行归纳,总结, ...
- js②
操作符 ECMA-262描述了一组用于操作数据值的操作符,包括算术操作符(如加号和减号).位操作符.关系操作符和相等操作符. 一元操作符 递增和递减操作符(++ --) 一元加和减操作符 对非数值应用 ...
- Hibernate入门与简谈
Hibernate jdbc Java Databases Connectivity, 他是提供了一组Java API来访问关系数据库的Java程序.这些Java API 可以使Java应用程序执行S ...
- HTML DOM
1.DOM方法 常用 getElementById() 返回带有指定 ID 的元素 getElementsByTagName() 返回包含带有指定标签名称的所有元素的节点列表(集合/节点数组) ge ...
- 探索javascript----滚轮事件的兼容
具体使用时,我们还要判断浏览器,记得传入的是兼容事件:var e=window.event||ev; 选择事件:
- html页面3秒后自动跳转的方法有哪些
在进行web前端开发实战练习时,我们常常遇到一种问题就是,web前端开发应该如何实现页面N秒之后自动跳转呢?通过查找相关html教程,总结了3个方法: 方法1: 最简单的一种:直接在前面<hea ...
- elasticsearch,python包pyes进行的处理
elasticsearch:高性能搜索引擎,官网:https://www.elastic.co/products/elasticsearch/ 对于它相信大家都不陌生,es的使用已经广泛存在 各大网站 ...