Dear MATLAB community,
I would like to create a fasta file from a cell array of character vectors. I have used the fastawrite function in Bioinformatics toolbox but I encounter the following error:
a=top50.dat.aa{2,1}; % 'a' is 50 X 1 cell array of character vectors
fastawrite('test.fasta',a)
Error using fastawrite (line 123)
Data is not a valid sequence or structure.
I have also tried to convert 'a' to a string but the error is still the same:
fastawrite('test.fasta',string(a))
Error using fastawrite (line 123)
Data is not a valid sequence or structure.
I have solved this issue by using a loop (since fasta write appends an existing file instead of overwriting it) but I would like to know if a more direct solution exists.
for i=1:50 fastawrite('test.fasta', string(a(i,1)))end
Considering that since MATLAB 2018 all functions which take character array as an input work with string arrays, I would like to know if there is an issue with my code or with fastawrite.
Thank you,
Akshay
IIT D
Best Answer