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 ...
随机推荐
- erlang服务器启动,有情况会报,enif_send: env==NULL no ono-SMP VMAborted 的错误报告?
问题的原因所在: 1:因为你当前使用的主机是一个单核的主机(不会自动启动): 2:多核上如果不设置-smp enable是不会有什么问题的,因为从OTP R12B开始,如果操作系统报告有多于1个的CP ...
- Git & GitHub
使用 Git 和 GitHub 有一段时间了,总结下经验. 起初接触 Git 是先遇到 GitHub 的,当时傻傻分不清这两者的区别,毕竟名字都那么像,刚开始只想用酷酷的方法 clone 代码(SSH ...
- Primitive JS completion of AJAX
Firstly , let us explain XMLHttpRequest open(), send(), readyState 1. open(method, url, async, user, ...
- (1)WCF少废话系列之 _Hello WCF!
本节旨在通过实例的方式让初学者对WCF有一个感性的认识,坚持由特殊到普遍再由普遍到特殊的认知规律. WCF(Windows Communication Fundation),微软分布式通信架构的集合, ...
- 嵌入式Linux的调试技术
本节我们研究嵌入式Linux的调试技术,对于复杂的Linux驱动及HAL等程序库,需要使用各种方法对其进行调试.刚开始讲了打印内核调试信息:printk,这个函数的用法与printf函数类似,只不过p ...
- 执行时关闭标识位 FD_CLOEXEC 的作用
首先先回顾 apue 中对它的描述: ① 表示描述符在通过一个 exec 时仍保持有效(书P63,3.14节 fcntl 函数,在讲 F_DUPFD 时顺便提到) ② 对打开文件的处理与每个描述符的执 ...
- IE 文档模式
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv= ...
- mac idea中 maven项目添加的时候没有java文件
file --other setting --maven 选中第二项即可 apply下
- web前端教程之javascript创建对象的方法
今天给大家讲讲javascript基础教程中的javascript面向对象的技术,这一次我们深入的学习一下JavaScrip基于t面向对象之创建对象,关于面向对象的一些术语这里就不给大家介绍了,不了解 ...
- Elasticsearch学习之入门2
关于Elasticsearch的几个概念: 1)在Elasticsearch中,文档归属于类型type,而类型归属于索引index,为了方便理解,可以把它们与传统关系型数据库做类比: Relation ...