Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are to write a program that searches through an array that contains a sequence of characters. These characters are restricted to be the letters

You are to write a program that searches through an array that contains a sequence of characters. These

characters are restricted to be the letters A, G, T, and C The last character in the sequence is set to

be the code 0, which is thus easy to detect. That array should be declared and initialized exactly as

follows in your program (a vector of only one row and many columns; search in the web how to use in

Matlab the function strfind

DNA = [A, G, C, G, G, G, A, C, C, G, T, C, ...

C, C, G, A, C, A, T, T, G, A, T, G, ...

A, A, G, G, G, T, C, A, T, A, G, A, ...

C, C, C, A, A, T, A, C, G, C, C, A, ...

C, C, A, C, C, C, C, A, A, G, T, T, ...

T, T, C, C, T, G, T, G, T, C, T, T, ...

C, C, A, T, T, G, A, G, T, A, G, A, ...

T, T, G, A, C, A, C, T, C, C, C, A, ...

G, A, T, G, 0

Your program should repeatedly ask the user for two things:

1. the length of a search sequence, and

2. the search sequence itself.

The program should then search through the entire array DNA to find the starting element subscript

(index) of all matching sequences. The elements of the search sequence may take on one of

five

characters: A, G, T, C and *. The meaning of the * character is that of wild card - that is, it

matches all four nucleotides: A, G, T,and C.

The program should terminate when the length of the input sequence is zero or less. If the input search

sequence contains a character other than A, G, T,C or *, the program should report that as an

error and terminate, as shown in the examples below. You should only report the first character that has

an error (and exit), there no need to check if there are more characters that are wrong.

MATLAB Code

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

13. You always should try to make a good first impression.

Answered: 1 week ago