Question: ANSWER WITH MATLAB CODE Write a function getcodonusage(s) that takes a DNA strand s as input, calls the findorf(s) function to find the ORF, and

ANSWER WITH MATLAB CODE

Write a function getcodonusage(s) that takes a DNA strand s as input, calls the findorf(s) function to find the ORF, and returns the codon usage of the sequence as both a vector (each element corresponding to the count of a codon, where codons are in alphabetical order) and as a struct with each codon as a field, and its count as the number of occurence of that codon. The returned structure should contain all possible codons, with codons not occurring in the sequence having a count of 0. Do not use functions available in the Bioinformatics toolbox. Hint: You may find getallcodons.m function useful. If your solution calls other files (such as findorf and getallcodons), you can add these functions to the end of your getcodonusage.m file, so your getcodonusage file is self-contained.

Here is an outline (pseudocode) for this function that you can follow. This is of course, not exactly the Matlab code.

Let v be the codon count vector. Let r be the codon count struct. allcodons=getallcodons(); Initialize v to be a vector of zeros (you will have as many elements as allcodons). Foreach allcodons as cod: Initialize r.(cod) to zero. orf=findorf(s); Foreach orf as cod: Find the index of cod in allcodons using strcmp(). Increment the corresponding entry in v by one. Increment r.(cod) by one. 

The following are codes for findorf.m and getallcodons.m, please use them in your answer!:

function cods = getallcodons

for i='ACGT'

for j='ACGT'

for k = 'ACGT'

cods(end+1) = [i j k];

end

end

end

function o = findorf(s)

s='ATTAATGCATTTTTAGGAATA';

starts = strfind(s,'ATG');

stops = [strfind(s,'TAA') strfind(s,'TAG') strfind(s,'TGA')];

if isempty(starts); starts=1;

orfs = zeros(0,2);

for mystart=starts

I = (stops > mystart) & (mod(stops - mystart, 3)==0);

mystops = stops(I);

if isempty(mystops); mystops= numel(s); end

mystop = mystops(1);

orfs(end+1,:) = [mystart mystop];

end

lengths = orfs(:,2) - orfs(:,1);

[maxlen, I] = max(lengths);

startstop = orfs(I,:);

o = ();

for i =startstop(1) : 3 : startstop(2)

o[end+1] = s(i:i+2);

end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!