% Loads matrix Data.m with sequences in binary MATLAB format. % Writes out the data in fastA and interleaved Phylip format. clear load Data K=size(Data,1) N=size(Data,2) D=size(Data,3) d= input('Which data set do you want to retrieve?'); fid =fopen('dna.fastA','w'); for k=1:K strain=strcat('>strain',num2str(k)); fprintf(fid,'%8s\n',strain); for n=1:N if Data(k,n,d)==1 fprintf(fid,'%1s','A'); elseif Data(k,n,d)==2 fprintf(fid,'%1s','C'); elseif Data(k,n,d)==3 fprintf(fid,'%1s','G'); elseif Data(k,n,d)==4 fprintf(fid,'%1s','T'); else error('Unknown nucleotide'); end if mod(n,50)==0 | n==N fprintf(fid,'\n'); end end end fclose(fid); % Get FastA format into sequential Phylip format !readseq -f=Phylip3.2 dna.fastA -out=dna.phyB -a !sed 's/ YF//g' dna.phyB > stercus !/bin/mv stercus dna.phyB