Help: How to use FASTAREAD and store it in structure array
이전 댓글 표시
I've been trying to reads a seq file using the fastaread in order to get the kmer (parts of the sequence) from the stored sequence. The kmer length is used from the user input. This supposes to store the kmers with respect to its sequence name. The one I developed is done almost everything except that the kmers are stored in one length instead of different cells.
>> struKm(1)
ans =
seqNam: 'YBR018C'
kmer: [1x723 char]
-------
struKm(1).kmer(:)
ans =
'T'
'G'
'C'
'C'
'A'
'G'
'C'
'T'
--------- My code is as follows: ----------
data=fastaread('GAL4.seq');
[a,numinput] = size(data); %determine the number of input dna sequences
k=input('Please enter the size of Kmer:');
struKm = struct('seqNam','kmer');
for i=1:numinput
[b,len] = size(data(i).Sequence); %determine the length of the current input dna sequence
elen = len-k+1;
for j=1:elen
struKm(i).seqNam = sprintf('%s', data(i).Header,i);
for s=j:(j+k-1)
%disp(data(i).Sequence(s))
[struKm(i).kmer(j) ,errmsg] = sprintf('%c', data(i).Sequence(s) );
disp(errmsg)
end
end
end
----- I need to store the kmers as the following: ----
YBR018C TTG TGC GCC CCA CAG AGC GCT ... ... YBR019C TAT ATA TAG AGT GTT TTT ... ...
------ GAL4.seq ------ >YBR018C TTTGCCAGCTTACTATCCTTCTTGAA ... etc >YBR019C TATAGTTTTT ... etc
Can you please help me to correct my code so the kmer is stored in the specified length?
Thank you,
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Sequence Alignment에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!