Entering edit mode
4.0 years ago
2001linana
▴
40
Hi. I hope this is a appropriate place to ask this question, because it feels like a matlab question. So, I have the following piece of code,
clear;
load('metadata.mat');
seqF = fastaread('nCoV_align_trim_0310.fas');
% seqF is a struct with two fields, i.e., Header and Sequence
seqMetadata = [];
for i = 1:length(seqF)
seqF(i).Header = erase(seqF(i).Header,'_');
seqF(i).Header = erase(seqF(i).Header,' ');
found = false;
for j = 1:length(allMetadata)
md = allMetadata(j);
mdName = md.id;
if strcmp(mdName(1:9),' BetaCoV/')
mdName = mdName(10:end);
end
if strcmp(seqF(i).Header,mdName)
found = true;
break;
end
end
if found
seqMetadata = [seqMetadata md];
end
end
I was confused about the second for loop. I mean, what exactly is this allMetadata variable ? It looks like it is not defined anywhere else, right? Any comments are greatly appreciated.
Abandon MATLAB for bioinformatics sooner rather than later, and you will spare yourself many weeks of agony.
If you have a license for MatLab then you can contact their tech support. While you may get an answer here, chances of that happening with programs that require a license are smaller than free/open-source programs.
Looks like this is a follow-up on the fasta parsing question you had asked earlier. This code appears to be some sort of fasta parser.