Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3b255ca

Browse files
authored
Merge pull request fnplus#635 from shrikantpadhy18/master
Dna pattern matching and finding closest relative
2 parents 1023737 + 591f6cc commit 3b255ca

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from collections import defaultdict
2+
import re as r
3+
dnapattern={
4+
'ATAACCGTACATACGAT':'Shrikant padhy',
5+
'ATCCCGATGCTACATGG':'Shreyash iyyer',
6+
'GTACCGATGGATTTCGA':'Shayantan Santra',
7+
'CTACGATCGATATGCAT':'manthan Raut',
8+
'ATTACCGATCATCGATA':'Alwar Goswami',
9+
'ATGCATTATGATCGAAT':'Kagiso Rabada',
10+
'ATCGATTATGATGGACT':'Mayank Tripathi',
11+
'ATCCGATATCATCTAGC':'Pranay Solse',
12+
'ATGAGCTATCATCTAGC':'Akilesh Salunkhe',
13+
'ATACGGTATCCCGTATA':'Akshay Pawar',
14+
}
15+
dnacount=defaultdict(list)
16+
diseased=input("Enter the most Common pattern found in diseased person")
17+
for j in dnapattern.keys():
18+
ls=[x.start() for x in r.finditer('('+'?'+'='+diseased+')',j)]
19+
dnacount[len(ls)]+=[dnapattern[j]]
20+
find=dnacount.get(max(dnacount.keys()),False)
21+
if(find==False or max(dnacount.keys())==0):
22+
print("Dna Pattern Unmatched")
23+
else:
24+
print("Dna pattern is more similar to the relative named:{}".format(find))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Question:
2+
3+
A forensic lab wants to know whether a deceased person’s DNA matches a set of known relatives. It is known that the closest relatives will have most of the DNA matching, and as the relationship becomes farther, the matching genes will be lesser. For this, the DNA pattern of the deceased is given and the DNA pattern of 10 likely relatives are given. Write a program to identify the family of the deceased.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
def partition(a,l,h):
3+
pivot=a[h]
4+
i=l-1
5+
for j in range(l,h):
6+
if a[j]>pivot:
7+
i+=1
8+
temp=a[i]
9+
a[i]=a[j]
10+
a[j]=temp
11+
12+
temp=a[i+1]
13+
a[i+1]=a[h]
14+
a[h]=temp
15+
16+
return i+1
17+
18+
def quicksort(a,l,h):
19+
if(l<h):
20+
pivot=partition(a,l,h)
21+
quicksort(a,l,pivot-1)
22+
quicksort(a,pivot+1,h)
23+
24+
25+
m=int(input("enter the number of cookie"))
26+
n=int(input("enter the number of child"))
27+
print("m>n")
28+
cookie=[]*(m)
29+
child=[]*(n)
30+
print("enter the cookie size")
31+
for i in range(0,m):
32+
print("enter the size of cookie:{}".format(i+1))
33+
cookie.append(int(input()))
34+
print("enter the greed factor")
35+
for j in range(0,n):
36+
print("enter the greed factor of child:{}".format(j+1))
37+
child.append(int(input()))
38+
39+
quicksort(cookie,0,m-1)
40+
quicksort(child,0,n-1)
41+
count=0
42+
print("The result is:")
43+
for k in range(0,n):
44+
if(child[k]<=cookie[k]):
45+
print("greed={},cookie size={}".format(child[k],cookie[k]))
46+
count+=1
47+
print("Maximum content size={}".format(count))
48+
49+
50+
51+
52+
53+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
QUESTION:
2+
3+
4+
5+
You are baby-sitting n children and have m > n cookies to divide between them. You must give each child exactly one cookie (of course, you cannot give the same cookie to two different children). Each child has a greed factor gi,1 ≤ i ≤ n which is the minimum size of a cookie that the child will be content with; and each cookie has a size sj , 1 ≤ j ≤ m. Your goal is to maximize the number of content children, i.e.., children i assigned a cookie j with gi ≤ s .

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /