I want to find DFT of a input sequence. I have run the following code but not getting desired output. Is there any mistake? please help.

조회 수: 9 (최근 30일)
if true
% code
end
clear all;
close all;
clc
sample_dna = fastaread('sequence_AF099922.Fasta');
sample_dna = struct2cell(sample_dna);
sample_dna = cell2mat(sample_dna(2));
sample_dna = sample_dna(7021:15020);
cds = [928 1038 2527 2856 4113 4376 5464 5643 7254 7604];
for ctr = 1:2:length(cds)
actual_exons(cds(ctr):cds(ctr+1))=1;
end
actual_exons(cds(length(cds))+1:length(sample_dna)) =0;
[x] = dna_binary(sample_dna);
ln = length(x);
xk = zeros (1,ln);
% code block to find the DFT of the sequence
i = sqrt(-1);
for k = 0: ln-1
for n=0: ln-1
xk(k+1) = xk(k+1) + (x(n+1)*exp((-i)*2*pi*k*n/ln));
end
end
Y = abs(xk),^2;
P = Y/max(Y);
plot(actual_exons,'k:');
hold on
plot(P);
axis([0 8000 0 1.05])
xlabel('Nucleotide position');
ylabel('Output');
title('Detection of period three behaviour using DFT');
  댓글 수: 4

댓글을 달려면 로그인하십시오.

채택된 답변

Kodavati Mahendra
Kodavati Mahendra 2018년 6월 4일
편집: Kodavati Mahendra 2018년 6월 4일
line 26,
Y = abs(xk).^2;
you can use the "fft" function in MATLAB, Lines 18-25 can be replaced with
xk = fft(x,ln);
or even more simpler, Lines 17-25 can be replaced with
xk = fft(x);
Both are equivalent, rest seems fine. Also I do not have bioinformatics toolbox, so do not know about dna_binary function. Please add it to your code dna_binary
Regards,
Mahendra
  댓글 수: 1
SUBHAJIT KAR
SUBHAJIT KAR 2018년 6월 4일
dna_binary is a function which accepts DNA sequence comprising A,C,T,G and convert it to specific binary indicator sequence. Here is the coding.
if true
% code
end
function[x] = dna_binary(sample_dna)
for i= 1:length(sample_dna)
if sample_dna(i)=='A' || sample_dna(i) =='a'
x(i) = 0.1260;
elseif sample_dna(i)=='T'||sample_dna(i) == 't'
x(i) = 0.1335;
elseif sample_dna(i) == 'C' || sample_dna(i) == 'c'
x(i) = 0.1340;
elseif sample_dna(i) = 'G' || sample_dna(i) == 'g'
x(i) = 0.0806;
end
end
end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bartlett에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by