-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChEBIIDAnnotations.m
17 lines (17 loc) · 1.06 KB
/
ChEBIIDAnnotations.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function [AmodelAddedKEGG]=ChEBIIDAnnotations(Amodel,TabDelimFile,Row,Hits,MetPos)
%If you want to customize the type of annotation in this function, you have to
%change the Regular Expression in the next line to a pattern of your desire.
StrSearchCell=regexp(TabDelimFile(Row(Hits),:),'CHEBI "([0-9]+)"');
StrSearchArray = ~cellfun(@isempty,StrSearchCell);
TargetCellInRow= find(StrSearchArray);
if ~isempty(TargetCellInRow)
%Don't forget to alter or comment out the next line if
%you have customized the type of annotation you are
%looking for above.
FoundStr=regexprep(TabDelimFile{Row(Hits),TargetCellInRow},'.*CHEBI "([0-9]+)".*','$1');
%Remember to change the target cell array to match the
%customized annotation (Amodel.MetCustomAnnotation)
Amodel.metChEBIID(MetPos,1)=cellstr(FoundStr);
end
AmodelAddedKEGG=Amodel;
end