Skip to content

Commit

Permalink
merge sbg with github
Browse files Browse the repository at this point in the history
  • Loading branch information
rmtfleming committed Jun 9, 2015
2 parents f90e74d + 328f164 commit 20eb7bf
Show file tree
Hide file tree
Showing 8,503 changed files with 5,493 additions and 2,556,977 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 4 additions & 1 deletion changeGeneAssociation.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@
for i = 1:length(genes)
if (translateNamesFlag)
% Translate gene names to systematic names
[isInList,translID] = ismember(genes{i},geneNameList);
genes{i}
geneNameList
systNameList
[isInList,translID] = ismember(genes{i},geneNameList)
if isInList
newGene = systNameList{translID};
grRule = regexprep(grRule,[genes{i} '$'],newGene);
Expand Down
6 changes: 3 additions & 3 deletions checkCobraModelUnique.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
fprintf('%s\n',thisMetName);
if (renameFlag)
fprintf('Renaming non-unique metabolites\n');
rxnIDs = findRxnIDs(model,thisMetName);
for j = 1:length(rxnIDs)
model.rxns{rxnIDs(j)} = [thisMetName '_' num2str(j)];
metIDs = findMetIDs(model,thisMetName);
for j = 1:length(metIDs)
model.mets{metIDs(j)} = [thisMetName '_' num2str(j)];
fprintf('%s\n',model.mets{rxnIDs(j)});
end
end
Expand Down
66 changes: 40 additions & 26 deletions checkDuplicateRxn.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [model,removed] = checkDuplicateRxn(model,method)
function [model,removed, rxnRelationship] = checkDuplicateRxn(model,method)
%checkDuplicateRxn Checks model for duplicate reactions and removes them
%
% [model,removed] = checkDuplicateRxn(model,method)
Expand All @@ -13,10 +13,12 @@
% removed reaction numbers that were removed
%
% Aarash Bordbar 02/11/08
% Uri David Akavia 20-Feb-2014

model = removeMetabolites(model, model.mets(all(model.S == 0,2)));
[nMets,nRxns] = size(model.S);
removed = '';
cnt = 1;
removed = cell(0);
cnt = 0;
switch method
case 1
h = waitbar(0, 'Checking by Abbreviation ...');
Expand All @@ -38,27 +40,39 @@
end
close(h);
case 2
h = waitbar(0, 'Checking by reaction ...');
for i = 1:nMets
possibleMatches = find(model.S(i,:));
for j = 1:length(possibleMatches)
for k = 1:length(possibleMatches)
if model.S(:,possibleMatches(j)) == model.S(:,possibleMatches(k)) & strcmp(model.rxns(possibleMatches(j)),model.rxns(possibleMatches(k))) == 0
model = removeRxns(model,model.rxns(possibleMatches(k)));
removed{cnt,1} = model.rxns(possibleMatches(k));
cnt = cnt+1;
elseif model.S(:,possibleMatches(j)) == model.S(:,possibleMatches(k)) & strcmp(model.rxns(possibleMatches(j)),model.rxns(possibleMatches(k))) == 1
model2 = model;
model2.rxns{possibleMatches(j)} = '';
model2 = removeRxns(model2,model.rxns(possibleMatches(j)));
model2.rxns{possibleMatches(j)} = model.rxns{possibleMatches(j)};
model = model2;
removed{cnt,1} = model.rxns{possibleMatches(j)};
cnt = cnt+1;
end
end
end
waitbar(i/nMets,h);
end
close(h);
h = waitbar(0, 'Checking by reaction ...');
[~, ia, ic] = unique(model.S', 'rows');
reactionsToRemove = cell(0);
rxnsKept = cell(0);
duplicateReactions = cell(0);
if (length(ia) ~= length(ic))
for rxnInd=1:max(ic)
% If the current reaction appears more than once
if (sum(rxnInd == ic) > 1)
identicalRxns = find(ic == rxnInd);
rxnWithDuplicates = model.rxns(identicalRxns(1));
rxnsToRemove = model.rxns(identicalRxns(2:end))';
% Same abbreviation
if (strcmp(rxnWithDuplicates, rxnsToRemove))
model2 = model;
model2.rxns(identicalRxns(1)) = '';
model2 = removeRxns(model2, rxnsToRemove);
model2.rxns(identicalRxns(1)) = rxnWithDuplicates;
removed = [removed; rxnsToRemove'];
cnt = cnt+1;
else
reactionsToRemove = [reactionsToRemove, rxnsToRemove];
end
rxnsKept = [rxnsKept; rxnWithDuplicates];
duplicateReactions = [duplicateReactions; {rxnsToRemove}];
end
waitbar(rxnInd/max(ic), h);
end
removed = [removed; reactionsToRemove'];
model = removeRxns(model, reactionsToRemove);
cnt = cnt + length(reactionsToRemove);
rxnRelationship.keptRxns = rxnsKept;
rxnRelationship.duplicates = duplicateReactions;
end
close(h);
end
Binary file added external/download
Binary file not shown.
Binary file added external/libSBML-5.11.0-core-src.tar.gz
Binary file not shown.
Binary file added external/libSBML-5.11.0-core-src.tar.gz.1
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added external/libSBML-5.11.4-matlab/OutputSBML.mexa64
Binary file not shown.
Binary file added external/libSBML-5.11.4-matlab/OutputSBML.mexglx
Binary file not shown.
Binary file not shown.
Binary file added external/libSBML-5.11.4-matlab/OutputSBML.mexw32
Binary file not shown.
Binary file added external/libSBML-5.11.4-matlab/OutputSBML.mexw64
Binary file not shown.
34 changes: 34 additions & 0 deletions external/libSBML-5.11.4-matlab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## **libSBML-5.11.4 MATLAB interface**

**LibSBML** is a free, open-source programming library to help you read, write, manipulate, translate, and validate [SBML](http://sbml.org) files and data streams.

This archive contains standalone binaries for the libSBML MATLAB interface. It the interface files are ready to run; they require no compilation or additional steps beyond informing MATLAB about the path to the folder where you unpacked the archive. Instructions for doing this are given below.


### Installation instructions

1. Extract the archive somewhere on your local computer.

2. Start your copy of MATLAB and add the folder to your MATLAB path using [addPath](http://www.mathworks.com/help/matlab/ref/addpath.html).

3. Verify that everything works. You can do this easily by changing into that folder within your running MATLAB environment, then issuing the command `TranslateSBML('test.xml')` in MATLAB. If everything went as planned, the output of that command will be a MATLAB structure representing the toy test model.

4. Save the changes to your MATLAB path for future use. To do this, you can use the [savepath](http://www.mathworks.com/help/matlab/ref/savepath.html) command in MATLAB.


### Help and support

For more information about the libSBML MATLAB interface, please see the [libSBML MATLAB API Documentation][1].

Please report any problems you encounter using libSBML either to the
developers directly (using the email address <libsbml-team@caltech.edu>) or using the [issue tracker][2].

Thank you for your interest in libSBML!

The LibSBML Team.


[![SBML Logo](http://sbml.org/images/8/82/Official-sbml-supported-70.jpg)](http://sbml.org)

[1]: http://sbml.org/Software/libSBML/docs/matlab-api/libsbml-matlab-reading-files.html
[2]: https://sourceforge.net/tracker/?group_id=71971&atid=942737
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function buildSBML(varargin)
% same time this new build scheme was introduced.

our_name = sprintf('%s.m', mfilename);
other_name = 'OutputSBML.c';
other_name = 'OutputSBML.cpp';
if ~exist(fullfile(pwd, our_name), 'file') ...
|| ~exist(fullfile(pwd, other_name), 'file')
error_incorrect_dir('matlab');
Expand Down Expand Up @@ -692,43 +692,43 @@ function compile_mex(include_dir, library_dir, matlab_octave)
if isWindows()
fhandle = @mex;
disp(' - Building TranslateSBML ...');
feval(fhandle, 'TranslateSBML.c', inc_arg, inc_arg2, library_dir, '-DWIN32');
feval(fhandle, 'TranslateSBML.cpp', inc_arg, inc_arg2, library_dir, '-DWIN32');
disp(' - Building OutputSBML ...');
feval(fhandle, 'OutputSBML.c', inc_arg, inc_arg2, library_dir, '-DWIN32');
feval(fhandle, 'OutputSBML.cpp', inc_arg, inc_arg2, library_dir, '-DWIN32');
else
fhandle = @mex;
disp(' - Building TranslateSBML ...');
if ~isempty(altoptions)
feval(fhandle, 'TranslateSBML.c', '-f', altoptions, inc_arg, inc_arg2, lib_arg, added_args);
feval(fhandle, 'TranslateSBML.cpp', '-f', altoptions, inc_arg, inc_arg2, lib_arg, added_args);
else
feval(fhandle, 'TranslateSBML.c', inc_arg, inc_arg2, lib_arg, added_args);
feval(fhandle, 'TranslateSBML.cpp', inc_arg, inc_arg2, lib_arg, added_args);
end;
disp(' - Building OutputSBML ...');
if ~isempty(altoptions)
feval(fhandle, 'OutputSBML.c', '-f', altoptions, inc_arg, inc_arg2, lib_arg, added_args);
feval(fhandle, 'OutputSBML.cpp', '-f', altoptions, inc_arg, inc_arg2, lib_arg, added_args);
else
feval(fhandle, 'OutputSBML.c', inc_arg, inc_arg2, lib_arg, added_args);
feval(fhandle, 'OutputSBML.cpp', inc_arg, inc_arg2, lib_arg, added_args);
end;
end;
else
if isWindows()
fhandle = @mkoctfile;
disp(' - Building TranslateSBML ...');
feval(fhandle, '--mex', 'TranslateSBML.c', '-DUSE_OCTAVE', inc_arg, inc_arg2, ...
feval(fhandle, '--mex', 'TranslateSBML.cpp', '-DUSE_OCTAVE', inc_arg, inc_arg2, ...
'-lbz2', '-lz', library_dir);
disp(' - Building OutputSBML ...');
feval(fhandle, '--mex', 'OutputSBML.c', '-DUSE_OCTAVE', inc_arg, inc_arg2, ...
feval(fhandle, '--mex', 'OutputSBML.cpp', '-DUSE_OCTAVE', inc_arg, inc_arg2, ...
'-lbz2', '-lz', library_dir);
else
fhandle = @mkoctfile;
disp(' - Building TranslateSBML ...');
feval(fhandle, '--mex', 'TranslateSBML.c', '-DUSE_OCTAVE', inc_arg, inc_arg2, ...
feval(fhandle, '--mex', 'TranslateSBML.cpp', '-DUSE_OCTAVE', inc_arg, inc_arg2, ...
'-lbz2', '-lz', lib_arg, added_args);
disp(' - Building OutputSBML ...');
feval(fhandle, '--mex', 'OutputSBML.c', '-DUSE_OCTAVE', inc_arg, inc_arg2, ...
feval(fhandle, '--mex', 'OutputSBML.cpp', '-DUSE_OCTAVE', inc_arg, inc_arg2, ...
'-lbz2', '-lz', lib_arg, added_args);
end;
% mkoctfile --mex TranslateSBML.c -DUSE_OCTAVE inc_arg inc_arg2 -lbz2 -lz lib_arg;
% mkoctfile --mex TranslateSBML.cpp -DUSE_OCTAVE inc_arg inc_arg2 -lbz2 -lz lib_arg;
end;

transFile = strcat('TranslateSBML.', mexext());
Expand Down Expand Up @@ -774,12 +774,12 @@ function copy_matlab_dir(orig_dir, working_dir)

% Copy files from src/bindings/matlab.

[success, msg, msgid] = copyfile('TranslateSBML.c', working_dir);
[success, msg, msgid] = copyfile('TranslateSBML.cpp', working_dir);
if ~success
error(sprintf('\n%s\n%s\n', msg, 'Build failed.'));
end;

[success, msg, msgid] = copyfile('OutputSBML.c', working_dir);
[success, msg, msgid] = copyfile('OutputSBML.cpp', working_dir);
if ~success
error(sprintf('\n%s\n%s\n', msg, 'Build failed.'));
end;
Expand Down Expand Up @@ -884,8 +884,8 @@ function error_incorrect_dir(expected)

%copy files to libsbml
cd(orig_dir);
copyfile('TranslateSBML.c', new_dir);
copyfile('OutputSBML.c', new_dir);
copyfile('TranslateSBML.cpp', new_dir);
copyfile('OutputSBML.cpp', new_dir);
copyfile('*.m', new_dir);
copyfile('*.xml', new_dir);
cd(new_dir);
Expand Down
76 changes: 76 additions & 0 deletions external/libSBML-5.11.4-matlab/isFbcEnabled.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
function fbcEnabled = isFbcEnabled()
% Checks whether the version of libSBML has been built with
% the FBC package extension enabled

% Filename : isFbcEnabled.m
% Description : check fbc status
% Author(s) : SBML Team <sbml-team@caltech.edu>
% Organization: EMBL-EBI, Caltech
% Created : 2011-02-08
%
% This file is part of libSBML. Please visit http://sbml.org for more
% information about SBML, and the latest version of libSBML.
%
% Copyright (C) 2013-2014 jointly by the following organizations:
% 1. California Institute of Technology, Pasadena, CA, USA
% 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
% 3. University of Heidelberg, Heidelberg, Germany
%
% Copyright (C) 2009-2011 jointly by the following organizations:
% 1. California Institute of Technology, Pasadena, CA, USA
% 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
%
% Copyright (C) 2006-2008 by the California Institute of Technology,
% Pasadena, CA, USA
%
% Copyright (C) 2002-2005 jointly by the following organizations:
% 1. California Institute of Technology, Pasadena, CA, USA
% 2. Japan Science and Technology Agency, Japan
%
% This library is free software; you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation. A copy of the license
% agreement is provided in the file named "LICENSE.txt" included with
% this software distribution and also available online as
% http://sbml.org/software/libsbml/license.html

% assume not enabled
fbcEnabled = 0;

if (isoctave() == '0')
filename = fullfile(tempdir, 'fbc.xml');
else
filename = fullfile(pwd, 'fbc.xml');
end;
writeTempFile(filename);

try
[m, e] = TranslateSBML(filename, 1, 0);

if (length(e) == 0 && isfield(m, 'fbc_version') == 1 )
fbcEnabled = 1;
end;

delete(filename);

catch

delete(filename);

return
end;




function writeTempFile(filename)

fout = fopen(filename, 'w');

fprintf(fout, '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n');
fprintf(fout, '<sbml xmlns=\"http://www.sbml.org/sbml/level3/version1/core\" ');
fprintf(fout, 'xmlns:fbc=\"http://www.sbml.org/sbml/level3/version1/fbc/version1\" ');
fprintf(fout, 'level=\"3\" version=\"1\" fbc:required=\"false\">\n');
fprintf(fout, ' <model/>\n</sbml>\n');

fclose(fout);
Loading

0 comments on commit 20eb7bf

Please sign in to comment.