944,072 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 774
  • Python RSS
Oct 27th, 2009
-2

DNA Questions

Expand Post »
def binding_locations(strA, strB):

The first parameter represents a strand of DNA. The second parameter is one strand from a recognition sequence. Return a list of all the indices where the recognition sequence appears in the DNA strand. (These are the restriction sites.) For example, if the DNA palindrome appears at the beginning of the DNA strand, then 0 would be one of the items in the returned list. Only look from left to right; don't reverse the first parameter and look backwards. str.find will probably be helpful.

Example:
the first string is 'AAAAAAAAGGTTCCGTCGAAAA' for example and the second string is 'AAAA'

---------------------------------------------

def match_enzymes(str, list, list):

The first parameter is a DNA strand; the second is a list of strings that are restriction enzyme names; and the third is a list of recognition sequences that are matched by the corresponding restriction enzymes. The first list might be ['BamHI', 'TaqI'] and the second list might be ['GGATCC', 'TCGA'], for example. Return a list of tuples where the first item of each tuple is the name of a restriction enzyme and the second item is the list of indices (in the DNA strand) of the restriction sites that the enzyme cuts.

Example:
match_enzymes("TCGAGGATCC", ['BamHI', 'TaqI'], ['GGATCC', 'TCGA'])

return [('BamHI', [4]), ('TaqI', [0])]

---------------------------------------------------------

def one_cutters(str, list, list):

The first parameter is a DNA strand; the second is a list of strings that are restriction enzyme names; and the third is a list of recognition sequences that are matched by the corresponding restriction enzymes. Return a list of tuples representing the 1-cutters for that strand. The first item of each tuple is the name of a restriction enzyme and the second item is the index (in the DNA strand) of the one restriction site that the enzyme cuts.

This function is the same as the previous match_enzymes function but instead, it will return the index of where the first cut of the DNA strand occurs.



Please help me out.

Thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mms6 is offline Offline
13 posts
since Oct 2009
Oct 28th, 2009
-2
Re: DNA Questions
anyone plz help me out here
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mms6 is offline Offline
13 posts
since Oct 2009
Oct 28th, 2009
0
Re: DNA Questions
hi
after reading the specification like 5 times here's what I came up with

first part:
Python Syntax (Toggle Plain Text)
  1. def binding_locations( strA, strB ):
  2. indexes = []
  3. i = 0
  4. while i < len( strA ):
  5. # compare the strA cut from the index i to whatever size strB is
  6. # and if the strings are equal add the index to the list and increment the value of i depending on the length of strB
  7. if strA[ i : i + len( strB ) ] == strB:
  8. indexes += [ i ]
  9. i += len( strB ) - 1
  10. i += 1 #go to next index
  11. return indexes

second part:
Python Syntax (Toggle Plain Text)
  1. def match_enzymes( strand, enzymes, recognitionSequence ):
  2. l = []
  3. # basically using the first function :)
  4. for i in range( len( enzymes ) ):
  5. indexes = binding_locations( strand, recognitionSequence[ i ] )
  6. l += [ ( enzymes[ i ], indexes ) ]
  7. return l

I couldn't understand the specification for the third part if you could provide an example I'll try to help
Reputation Points: 20
Solved Threads: 74
Posting Whiz in Training
masterofpuppets is offline Offline
272 posts
since Jul 2009
Oct 28th, 2009
0
Re: DNA Questions
P.S I tested this using your examples and here are my results:

Python Syntax (Toggle Plain Text)
  1. >>> binding_locations( "AAAAAAAAGGTTCCGTCGAAAA", "AAAA" )
  2. [0, 4, 18]
  3. >>> binding_locations( "AAAAAAAAGGTTCCGTCGAAAA", "GT" )
  4. [9, 14]
  5. >>> match_enzymes( "TCGAGGATCC", ['BamHI', 'TaqI'], ['GGATCC', 'TCGA'] )
  6. [('BamHI', [4]), ('TaqI', [0])]
  7. >>>
Reputation Points: 20
Solved Threads: 74
Posting Whiz in Training
masterofpuppets is offline Offline
272 posts
since Jul 2009
Oct 28th, 2009
0
Re: DNA Questions
Click to Expand / Collapse  Quote originally posted by mms6 ...
anyone plz help me out here
We're not here to do your homework for you. But good job on copy-pasting your assignment.
hi
after reading the specification like 5 times here's what I came up with
Dear MasterofPuppets,
You shouldn't be spoon feeding people looking for us to do their homework for them. Even though you provided good code, it doesn't help the OP at all because he's obviously going to just copy-paste your solutions and turn them in exactly in the same manner as he copy-pasted his assignment and posted it here.
Reputation Points: 355
Solved Threads: 292
Veteran Poster
jlm699 is offline Offline
1,102 posts
since Jul 2008
Oct 31st, 2009
0
Re: DNA Questions
If the OP has not even given an example of what has been tried, I would prod them to at least give an idea of how they would approach the solution. Then you can give hints how to proceed.

Another way to help is to give a related example that would be a part of the solution. At least this way the OP gets involved in the quest to solve the problem.

If you had fun with the challenge to solve the problem, be a little patient and don't post your solution right away.
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Line number in Tkinter Text field
Next Thread in Python Forum Timeline: Schooling scripts





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC