Problem

Figure 2. The Hamming distance between these two strings is 7. Mismatched symbols are colored red.

Given two strings ss and tt of equal length, the Hamming distance between ss and tt, denoted dH(s,t)dH(s,t), is the number of corresponding symbols that differ in ss and tt. See Figure 2.

Given: Two DNA strings ss and tt of equal length (not exceeding 1 kbp).

Return: The Hamming distance dH(s,t)dH(s,t).

Sample Dataset

GAGCCTACTAACGGGAT
CATCGTAATGACGGCCT

Sample Output

7

代码:
###Counting Point Mutations ###
def CPM(s, t):
l = min(len(s), len(t))
result = 0
for i in range(0, l):
if s[i] <> t[i]:
result += 1
print result if __name__ == "__main__":
fh = open ("C:\\Users\\hyl\\Desktop\\rosalind_hamm.txt")
s = fh.readline()
for line in fh:
t = line
CPM(s, t)

6.Counting Point Mutations的更多相关文章

  1. 06 Counting Point Mutations

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

  2. 萌新笔记——Cardinality Estimation算法学习(二)(Linear Counting算法、最大似然估计(MLE))

    在上篇,我了解了基数的基本概念,现在进入Linear Counting算法的学习. 理解颇浅,还请大神指点! http://blog.codinglabs.org/articles/algorithm ...

  3. POJ_2386 Lake Counting (dfs 错了一个负号找了一上午)

    来之不易的2017第一发ac http://poj.org/problem?id=2386 Lake Counting Time Limit: 1000MS   Memory Limit: 65536 ...

  4. ZOJ3944 People Counting ZOJ3939 The Lucky Week (模拟)

    ZOJ3944 People Counting ZOJ3939 The Lucky Week 1.PeopleConting 题意:照片上有很多个人,用矩阵里的字符表示.一个人如下: .O. /|\ ...

  5. find out the neighbouring max D_value by counting sort in stack

    #include <stdio.h> #include <malloc.h> #define MAX_STACK 10 ; // define the node of stac ...

  6. 1004. Counting Leaves (30)

    1004. Counting Leaves (30)   A family hierarchy is usually presented by a pedigree tree. Your job is ...

  7. 1.Counting DNA Nucleotides

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

  8. vuex2.0.0爬坑记录 -- mutations的第一个参数state不能解构

    今天在学习vuex的过程中,遇到了一个很困扰人的问题,最终利用vuex的状态快照工具logger解决了问题. 问题是这样的,我在子组件中使用了mapState()函数来将状态映射至子组件中,使子组件能 ...

  9. uva 11401 Triangle Counting

    // uva 11401 Triangle Counting // // 题目大意: // // 求n范围内,任意选三个不同的数,能组成三角形的个数 // // 解题方法: // // 我们设三角巷的 ...

随机推荐

  1. asp.net自己创建的app_code文件夹中的类不能访问的解决办法

    在Web应用程序中不能通过右键项目-〉”添加“-〉”添加ASP.NET文件夹“方式添加 .因为Web应用程序中App_Code就不存在 .不过可以通过手动的方式创建,添加一个文件夹命名为App_Cod ...

  2. spring @ModelAttribute 注解

    @ModelAttribute // 表示请求该类的每个Action前都会首先执行它,也可以将一些准备数据的操作放置在该方法里面. public void setReqAndRes(HttpServl ...

  3. Result Maps collection does not contain value for java.lang.Integer异常处理

    使用Mybatis的时候出现这个问题是因为配置文件的问题造成的,mybatis需要写大量的配置文件, 尽管有mybatis-generator,但是里面的内容有很多还是要自己去写的,在这过程中难免会出 ...

  4. RBAC类使用

    1.实现首先我们先简单理解一下RBAC,顾名思义,RBAC是基于角色的权限设计.既然根据角色去分权限,那么我们就得有角色表,权限表,角色对应权限表,这是最基本的.角色是什么,就是你的身份,你的职位,也 ...

  5. hihoCoder#1051

    刚开始学习C语言,准备在做hiho的题目的过程中来学习,在此进行记录,如果代码中有错误或者不当的地方还请指正. 时间限制:2000ms 单点时限:1000ms 内存限制:256MB 描述 小Ho给自己 ...

  6. HTML中的select只读

    因为Select下拉框只支持disabled属性,不支持readOnly属性,而在提交时,disabled的控件,又是不提交值的.现提供以下几种解决方案: 1.在html中使用以下代码,在select ...

  7. 看的oracle数据库视频 记的一点笔记

    3个默认的用户    sys          //网络管理员  权限由上到下降低 [最后加上 as sysdba]    system  //本地管理员    scott     //普通用户  默 ...

  8. Ubuntu下freeradius的EAP-MD5,PEAPv0/EAP-MSCHAPv2,EAP-TTLS/MD5,EAP-TTLS/MSCHAPv2方式认证(基于mysql)

    基于freeradius+mysql,今天验证下freeradius的EAP认证:1.EAP-MD5:2.EAP-PEAP 一.EAP-MD5方式认证 1.修改配置文件 (1)/usr/local/e ...

  9. iOS学习之判断是否有网络的方法

    在实际开发中, 会有这样一个需求: 用户在有网的状态下会直接从网络请求数据, 在没网的情况下直接从本地读取数据. 下边的方法可以判断是否有网络. - (BOOL)connectedToNetwork ...

  10. goldengate for big data 12.2.0.1.1新增功能

    新格式支持:包括Avro OCF和HDFS顺序文件,OGG现在支持将数据写入Avro对象容器(Object container format)和HDFS顺序文件 支持Hadoop平台元数据或DDL更新 ...