Problem

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的更多相关文章

  1. 01 A Counting DNA Nucleotides

    Problem A string is simply an ordered collection of symbols selected from some alphabet and formed i ...

  2. JELLYFISH - Fast, Parallel k-mer Counting for DNA

    kmer分析其实是非常耗费计算资源的,如果我们自己写脚本来分析kmer的话,首先要将所有的序列打断成一定长度的kmer,然后将所有的kmer存储起来,最后统计每个kmer出现的频率,或者统计出现指定次 ...

  3. [LeetCode] Repeated DNA Sequences 求重复的DNA序列

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  4. [Leetcode] Repeated DNA Sequences

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  5. 6.Counting Point Mutations

    Problem Figure 2. The Hamming distance between these two strings is 7. Mismatched symbols are colore ...

  6. 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 ...

  7. 【leetcode】Repeated DNA Sequences(middle)★

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  8. LeetCode() Repeated DNA Sequences 看的非常的过瘾!

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  9. Repeated DNA Sequences

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

随机推荐

  1. LeetCode 5 Longest Palindromic Substring manacher算法,最长回文子序列,string.substr(start,len) 难度:2

    https://leetcode.com/problems/longest-palindromic-substring/ manacher算法相关:http://blog.csdn.net/ywhor ...

  2. 面试复习(C++)之希尔排序

    #include<iostream> using namespace std; void Shellsort(int *a,int len) { int gap; ;gap>;gap ...

  3. 面试复习(C++)之冒泡排序

    第一次写技术博客,先只贴代码吧. #include <iostream> using namespace std; void Bubble(int *arr,int len) { int ...

  4. jquery 层根据矩形路径移动和闪耀(原创)

    <!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>De ...

  5. Centos配置SS5代理

    wget http://heanet.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz tar xvf ss5-3.8.9-8 ...

  6. Text Justification

    在一段时间没刷题之后,我发现脑子严重地滞涩了.这题AC花了好大力气,出现了Memory Limit Exceed,Core Dump,以及各种普通的编译.运行错误.MLE 和 CD错误是比较难检查的, ...

  7. Basic linux command

    1. useradd  解释:添加新用户,在/etc/password文件中添加一行记录. 参数: -g    用于添加账户时指定该账户的私有组,如果不指定-g参数,useradd命令会自动创建与该用 ...

  8. centos 7 下安装numpy、scipy等python包

    本文适用于刚入门的小白,欢迎大牛们批评指正. 因为要开始数据分析,而python又不像R和matlab那么简洁.需要安装的包很多~ 网上找了好多牛人博客,想在centos7下安装numpy,scipy ...

  9. jquery.get()

    1.获取当前jquery对象匹配到的dom元素 2.语法: jqueryObject.get([index]) //jQueryObject[index]等价于jQueryObject.get(ind ...

  10. HTMlhleper

    @{ ViewBag.Title = "Index";} <h2>Index</h2> <div> @{ int id=12121; var I ...