The DNA of a living organism consists of a string of 4 different bases represented with letters A, T, G, C. The DNA has a double helix structure which means these bases are paired in the string. An A base is always paired with a T base molecule and a C base is always paired with G molecule. Write a function matchingPair that accepts a single strand of the DNA structure as a string parameter and produces the pairing strand as a result and returns it. Strings can be considered as list of characters. Therefore the subscript notation that we use for lists is acceptable for strings as well. For example to reach to the 4th character of a string variable mystring, you may use the notation mystring[3]. Write another function search that accepts a long and a short DNA strand as parameters. The function should return the index positions of the occurrences of the short strand in the long strand as a list. Test your functions by accepting a long strand of DNA to find the matching pair strand and multiple short strands of DNA to search in the first strand. Upload your program.py file. Example output: Enter a DNA strand: AAGTTCGGTACACTCGTTTAACGC The matching pair is TTCAAGCCATGTGAGCAAATTGCG Enter a DNA strand to search in the long strand( empty string to stop): TTA Index position of TTA is: [17] Enter a DNA strand to search in the long strand(empty string to stop): AC Index positions of AC is: [9, 11, 20] Enter a DNA strand to search in the long strand(empty string to stop):
In Phython Language:
The DNA of a living organism consists of a string of 4 different bases represented with letters A, T, G, C. The DNA has a double helix structure which means these bases are paired in the string. An A base is always paired with a T base molecule and a C base is always paired with G molecule. Write a function matchingPair that accepts a single strand of the DNA structure as a string parameter and produces the pairing strand as a result and returns it. Strings can be considered as list of characters. Therefore the subscript notation that we use for lists is acceptable for strings as well. For example to reach to the 4th character of a string variable mystring, you may use the notation mystring[3].
Write another function search that accepts a long and a short DNA strand as parameters. The function should return the index positions of the occurrences of the short strand in the long strand as a list. Test your functions by accepting a long strand of DNA to find the matching pair strand and multiple short strands of DNA to search in the first strand. Upload your program.py file.
Example output:
Enter a DNA strand: AAGTTCGGTACACTCGTTTAACGC
The matching pair is TTCAAGCCATGTGAGCAAATTGCG
Enter a DNA strand to search in the long strand( empty string to stop): TTA
Index position of TTA is: [17]
Enter a DNA strand to search in the long strand(empty string to stop): AC
Index positions of AC is: [9, 11, 20]
Enter a DNA strand to search in the long strand(empty string to stop):
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images