Human Gene Functions
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 451 Accepted Submission(s): 277
Problem Description
It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been interested in identifying human genes and determining their functions, because these can be used to diagnose human diseases and to design new drugs for them.
A human gene can be identified through a series of time-consuming biological experiments, often with the help of computer programs. Once a sequence of a gene is obtained, the next job is to determine its function. One of the methods for biologists to use in determining the function of a new gene sequence that they have just identified is to search a database with the new gene as a query. The database to be searched stores many gene sequences and their functions – many researchers have been submitting their genes and functions to the database and the database is freely accessible through the Internet.
A database search will return a list of gene sequences from the database that are similar to the query gene. Biologists assume that sequence similarity often implies functional similarity. So, the function of the new gene might be one of the functions that the genes from the list have. To exactly determine which one is the right one another series of biological experiments will be needed.
Your job is to make a program that compares two genes and determines their similarity as explained below. Your program may be used as a part of the database search if you can provide an efficient one.
Given two genes AGTGATG and GTTAG, how similar are they? One of the methods to measure the similarity of two genes is called alignment. In an alignment, spaces are inserted, if necessary, in appropriate positions of the genes to make them equally long and score the resulting genes according to a scoring matrix.
For example, one space is inserted into AGTGATG to result in AGTGAT-G, and three spaces are inserted into GTTAG to result in –GT--TAG. A space is denoted by a minus sign (-). The two genes are now of equal length. These two strings are aligned:
AGTGAT-G
-GT--TAG
In this alignment, there are four matches, namely, G in the second position, T in the third, T in the sixth, and G in the eighth. Each pair of aligned characters is assigned a score according to the following scoring matrix.
* denotes that a space-space match is not allowed. The score of the alignment above is (-3)+5+5+(-2)+(-3)+5+(-3)+5=9.
Of course, many other alignments are possible. One is shown below (a different number of spaces are inserted into different positions):
AGTGATG
-GTTA-G
This alignment gives a score of (-3)+5+5+(-2)+5+(-1) +5=14. So, this one is better than the previous one. As a matter of fact, this one is optimal since no other alignment can have a higher score. So, it is said that the similarity of the two genes is 14.
A human gene can be identified through a series of time-consuming biological experiments, often with the help of computer programs. Once a sequence of a gene is obtained, the next job is to determine its function. One of the methods for biologists to use in determining the function of a new gene sequence that they have just identified is to search a database with the new gene as a query. The database to be searched stores many gene sequences and their functions – many researchers have been submitting their genes and functions to the database and the database is freely accessible through the Internet.
A database search will return a list of gene sequences from the database that are similar to the query gene. Biologists assume that sequence similarity often implies functional similarity. So, the function of the new gene might be one of the functions that the genes from the list have. To exactly determine which one is the right one another series of biological experiments will be needed.
Your job is to make a program that compares two genes and determines their similarity as explained below. Your program may be used as a part of the database search if you can provide an efficient one.
Given two genes AGTGATG and GTTAG, how similar are they? One of the methods to measure the similarity of two genes is called alignment. In an alignment, spaces are inserted, if necessary, in appropriate positions of the genes to make them equally long and score the resulting genes according to a scoring matrix.
For example, one space is inserted into AGTGATG to result in AGTGAT-G, and three spaces are inserted into GTTAG to result in –GT--TAG. A space is denoted by a minus sign (-). The two genes are now of equal length. These two strings are aligned:
AGTGAT-G
-GT--TAG
In this alignment, there are four matches, namely, G in the second position, T in the third, T in the sixth, and G in the eighth. Each pair of aligned characters is assigned a score according to the following scoring matrix.
* denotes that a space-space match is not allowed. The score of the alignment above is (-3)+5+5+(-2)+(-3)+5+(-3)+5=9.
Of course, many other alignments are possible. One is shown below (a different number of spaces are inserted into different positions):
AGTGATG
-GTTA-G
This alignment gives a score of (-3)+5+5+(-2)+5+(-1) +5=14. So, this one is better than the previous one. As a matter of fact, this one is optimal since no other alignment can have a higher score. So, it is said that the similarity of the two genes is 14.
Input
The input consists of T test cases. The number of test cases ) (T is given in the first line of the input. Each test case consists of two lines: each line contains an integer, the length of a gene, followed by a gene sequence. The length of each gene sequence is at least one and does not exceed 100.
Output
The output should print the similarity of each test case, one per line.
Sample Input
2 7 AGTGATG 5 GTTAG 7 AGCTATT 9 AGCTTTAAA
Sample Output
14 21
#include<stdio.h> int p[110][110]; int mat[102][102]; int max(int a,int b,int c) { return(a>b?(a>c?a:c):(b>c?b:c)); } int main() { mat['A']['A'] = mat['C']['C'] = mat['G']['G'] = mat['T']['T'] = 5; mat['A']['C'] = mat['C']['A'] = mat['A']['T'] = mat['T']['A'] = mat['-']['T'] = -1; mat['A']['G'] = mat['G']['A'] = mat['C']['T'] = mat['T']['C'] = mat['G']['T'] = mat['T']['G'] = mat['-']['G'] = -2; mat['-']['A'] = mat['C']['G'] = mat['G']['C'] = -3; mat['-']['C'] = -4; //freopen("in.txt","r",stdin); int T,n1,n2,i,j; char str1[110],str2[110]; scanf("%d",&T); while(T--) { scanf("%d%s%d%s",&n1,str1,&n2,str2); for(j=1;j<=n2;j++) p[0][j]=p[0][j-1]+mat['-'][str2[j-1]]; for(i=1;i<=n1;i++) p[i][0]=p[i-1][0]+mat['-'][str1[i-1]]; for(i=1;i<=n1;i++) for(j=1;j<=n2;j++) p[i][j]=max(p[i-1][j-1]+mat[str1[i-1]][str2[j-1]],p[i-1][j]+mat['-'][str1[i-1]],p[i][j-1]+mat['-'][str2[j-1]]); printf("%d\n",p[n1][n2]); } return(0); }
相关推荐
pku acm 第1080题Human Gene Functions c完整的代码,有详细的注释
北大POJ1080-Human Gene Functions POJ1080-Human Gene Functions
北大POJ1080-Human Gene Functions
这是关于这三个问题的详解文档 包括了完整代码 和 详细解释
DP:1011 NTA 简单题1013 Great Equipment 简单题1024 Calendar Game 简单题1027 Human Gene Functions 简单题1037 Gridland 简单题1052 Algernon's Noxious Emissions 简单题1409 Communication System 简单题,但是...
Human
3d人体姿态骨骼相关的实验,需要使用human3.6m数据集
1995 Animating human athletics 1995 Animating human athletics 1995 Animating human athletics
Human-in-the-Loop Machine Learning lays out methods for humans and machines to work together effectively. Summary Most machine learning systems that are deployed in the world today learn from human ...
Gene mapping is used in experimental genetics to improve the hardiness or productivity of animals or plants of agricultural value, to explore basic mechanisms of inheritance, or to study animal models...
深度学习训练数据和测试数据,horse_or_human.zip
HR050 Human Resource
makehuman -1.1.1导入blender使用骨骼调整动画,以及MAX中模型在blender中如何蒙皮.
Diffle-Human 密钥交换 Diffle-Human 密钥交换
grasshopper的插件 human 非常人性化
中国HIV VPR基因多态性分析,郑煜煌,周华英,Little sequence information is available for human immunodeficiency virus type 1(HIV-1) vpr genes of Chinese origin. In our study, we analyzed HIV-1 vpr ...
gazebo模型文件 blue_bin_cuboid human_female_1 mailbox_red recycle_bin_green Box_15x30 human_female_1_1 office_env recycle_bin_red Box_24x15M human_female_2 office_env_w tissue_box_1 Box_24x15W human_...
本书译自 Apple 官方推出的设计指南《iOS Human Interface Guidelines》,完整(注意!是完整!满满都是泪啊!)翻译了该指南所有内容,在文字和排版上也尽可能保证忠实还原,但并未取得官方翻译授权。
导入K1-5基因的间充质干细胞抑制血管生成研究,刘海霞,初银珠,间充质干细胞作为细胞工具可用于局部释放抗癌分子。然而,间充质干细胞自身释放前血管因子促进血管生成。本实验中,我们设计将胎
Human 3.6M 3D human pose dataset fetcher