-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChemSpiderAnnotations.m
17 lines (17 loc) · 1.07 KB
/
ChemSpiderAnnotations.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function [AmodelAddedKEGG]=ChemSpiderAnnotations(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),:),'CHEMSPIDER "[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},'.*CHEMSPIDER "([0-9]*)".*','$1');
%Remember to change the target cell array to match the
%customized annotation (Amodel.MetCustomAnnotation)
Amodel.metChemSpiderID(MetPos,1)=cellstr(FoundStr);
end
AmodelAddedKEGG=Amodel;
end