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 and the second list might be , 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", , )

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

anyone plz help me out here

Comments
Your post was not answered for a reason. Don't bump

hi
after reading the specification like 5 times here's what I came up with :)

first part:

def binding_locations( strA, strB ):
    indexes = []
    i = 0
    while i < len( strA ):
       # compare the strA cut from the index i to whatever size strB is
       # and if the strings are equal add the index to the list and increment the value of i depending on the length of strB
        if strA[ i : i + len( strB ) ] == strB:
            indexes += [ i ]
            i += len( strB ) - 1
        i += 1           #go to next index
    return indexes

second part:

def match_enzymes( strand, enzymes, recognitionSequence ):
    l = []
    # basically using the first function :)
    for i in range( len( enzymes ) ):
        indexes = binding_locations( strand, recognitionSequence[ i ] )
        l += [ ( enzymes[ i ], indexes ) ]
    return l

I couldn't understand the specification for the third part if you could provide an example I'll try to help :)

P.S I tested this using your examples and here are my results:

>>> binding_locations( "AAAAAAAAGGTTCCGTCGAAAA", "AAAA" )
[0, 4, 18]
>>> binding_locations( "AAAAAAAAGGTTCCGTCGAAAA", "GT" )
[9, 14]
>>> match_enzymes( "TCGAGGATCC", ['BamHI', 'TaqI'], ['GGATCC', 'TCGA'] )
[('BamHI', [4]), ('TaqI', [0])]
>>>

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.

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.

Dear MasterofPuppets,

"I couldn't understand the specification for the third part if you could provide an example I'll try to help :)"

Heres an example for the one_cutters function:

one_cutters('TCGAGAATTCTCGA',['EcoRI','TaqI'],['GAATTC','TCGA'])
[('EcoRI', [4]), ('TaqI', [])]

This question has already been answered. Start a new discussion instead.