Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing a code in Python 3. This program needs to take a desired string sequence (ex. ATGCCGTGCAAT), with a maximum length of

I need help writing a code in Python 3. This program needs to take a desired string sequence (ex. ATGCCGTGCAAT), with a maximum length of 12, and a minimum of 4. This string needs to be seperated into all possible substrings, by decreasing length (so stops at a count of 4). All the possible substrings need to account for their reversed counterparts (ex. the 12mer above comes reversed to account for the other strand). Once all of these are found, they need to be put on a list together from longest to shortest. Then the program needs to loop through the list of substrings and stop when the first sequence is found in a bigger sequence (it would be the biggest possible string). It would finally need to return the sequence. Any help would be much appreciated!
Im going to attempt at refining this post, to provide some more clarity into what I am asking.
An example of what I am trying to get my code to do is:
string =ATTGCAGTCGCTTAAGTCC
sub = GCAGTCC (the condition is: min = 3, max=6, but if the length of sub is somewhere in this range, thats fine)
Break down sub into all possible variants from max len of sequence to min len, and place on list:
6 --> GCAGTCC, CGTCAGG (max)
5--> GCAGTC, CGTCAG
4 --> GCAGT, CGTCA
3--> GCAG, CGTC (min)
Then all these values are complied onto a list from the highest length to the lowest. Ideally it would look like: [GCAGTCC, CGTCAGG, GCAGTC, CGTCAG, ...]. Then I would need to make a loop to find which sequence (the longest one) exists in the original string. Then it would need to return the matching sequence back to the user. In the case of the example, it would be GCAGTC (also seen as 5 above). Let me know if this needs more clarification!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

6 What is the balanced scorecard method?

Answered: 1 week ago