readSimPhenyCMPD

PURPOSE ^

readSimPhenyCMPD Read SimPheny compound file obtained from admin console

SYNOPSIS ^

function [metInfo,mets] = readSimPhenyCMPD(fileName)

DESCRIPTION ^

readSimPhenyCMPD Read SimPheny compound file obtained from admin console

 [metInfo,mets] = readSimPhenyCMPD(fileName)

INPUT
 fileName      SimPheny compound file name

OUTPUTS
 metInfo       Structure contaning data on metabolites
 mets          List of metabolites

 Markus Herrgard 6/4/07

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [metInfo,mets] = readSimPhenyCMPD(fileName)
0002 %readSimPhenyCMPD Read SimPheny compound file obtained from admin console
0003 %
0004 % [metInfo,mets] = readSimPhenyCMPD(fileName)
0005 %
0006 %INPUT
0007 % fileName      SimPheny compound file name
0008 %
0009 %OUTPUTS
0010 % metInfo       Structure contaning data on metabolites
0011 % mets          List of metabolites
0012 %
0013 % Markus Herrgard 6/4/07
0014 
0015 fid = fopen(fileName,'r');
0016 
0017 cnt = 0;
0018 while 1
0019     line = fgetl(fid);
0020     if ~ischar(line),   break,   end
0021     fields = splitString(line,'","');
0022     for j = 1:length(fields)
0023         fields{j} = strrep(fields{j},',"','');
0024         fields{j} = strrep(fields{j},'",','');
0025         fields{j} = strrep(fields{j},'"','');
0026     end
0027     if (length(fields) == 9)
0028         cnt = cnt+1;
0029         mets{cnt} = fields{1};
0030         metInfo(cnt).ID = fields{1};
0031         metInfo(cnt).name = fields{2};
0032         metInfo(cnt).formula = fields{3};
0033         metInfo(cnt).charge = str2double(fields{5});
0034         metInfo(cnt).casNumber = fields{6};
0035         metInfo(cnt).neutralFormula = fields{7};
0036         metInfo(cnt).altNames = splitString(fields{8},'/');
0037         for j = 1:length(metInfo(cnt).altNames)
0038            metInfo(cnt).altNames{j} = deblank(metInfo(cnt).altNames{j});
0039         end
0040         metInfo(cnt).KEGGID = fields{9};
0041     end
0042 end
0043 
0044 mets = columnVector(mets);
0045 fclose(fid);

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003