Skip to content

Commit

Permalink
Merge branch 'develop' into feat-duplicateRxnCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
haowang-bioinfo committed Oct 19, 2023
2 parents 38c0b8b + baa778e commit bf822e6
Show file tree
Hide file tree
Showing 29 changed files with 22,208 additions and 4,393 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,15 @@
"contributions": [
"bug"
]
},
{
"login": "jreimertz",
"name": "Justin Reimertz",
"avatar_url": "https://avatars.githubusercontent.com/u/119626411?v=4",
"profile": "https://github.com/jreimertz",
"contributions": [
"bug"
]
}
],
"repoType": "github",
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/check-metabolictasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ jobs:
matrix:
task-type: [essential, verification]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout
uses: actions/checkout@v3

- name: Check ${{ matrix.task-type }} metabolic tasks
run: |
/usr/local/bin/matlab -nodisplay -nosplash -nodesktop -r "addpath(genpath('.')); testMetabolicTasks('${{ matrix.task-type }}'); exit;"
- name: Check ${{ matrix.task-type }} metabolic tasks
run: |
/usr/local/bin/matlab -nodisplay -nosplash -nodesktop -r "addpath(genpath('.')); testMetabolicTasks('${{ matrix.task-type }}');"
11 changes: 5 additions & 6 deletions .github/workflows/yaml-conversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ jobs:
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout
uses: actions/checkout@v3

- name: Run conversion script
run: |
/usr/local/bin/matlab -nodisplay -nosplash -nodesktop -r "addpath(genpath('.')); run('code/test/testYamlConversion.m'); exit;"
- name: Run conversion script
run: |
/usr/local/bin/matlab -nodisplay -nosplash -nodesktop -r "addpath(genpath('.')); testYamlConversion"
5 changes: 4 additions & 1 deletion .github/workflows/yaml-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ jobs:
## Return non-zero exit code on warnings as well as errors
# strict: # optional, default is false

- name: Basic MEMOTE tests
run: python code/test/memoteTest.py

- name: Test import with cobrapy and consistency with annotation files
run: python code/test/sanityCheck.py
run: python code/test/sanityCheck.py
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Join the chat at https://gitter.im/SysBioChalmers/Human-GEM](https://badges.gitter.im/SysBioChalmers/Human-GEM.svg)](https://gitter.im/SysBioChalmers/Human-GEM?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![GitHub version](https://badge.fury.io/gh/sysbiochalmers%2FHuman-GEM.svg)](https://badge.fury.io/gh/sysbiochalmers%2FHuman-GEM)
[![DOI](https://zenodo.org/badge/105752644.svg)](https://zenodo.org/badge/latestdoi/105752644)<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-28-success.svg)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-29-success.svg)](#contributors)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

### Brief Model Description
Expand Down Expand Up @@ -137,23 +137,24 @@ A collection of manually curated 2D metabolic maps associated with Human-GEM are
<td align="center" valign="top" width="12.5%"><img src="https://avatars.githubusercontent.com/u/10344158?v=4?s=80" width="80px;" alt="Jorge Ferreira"/><br /><sub><b>Jorge Ferreira</b></sub><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Ajorgemlferreira" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/CadavidJoseL"><img src="https://avatars.githubusercontent.com/u/62765618?v=4?s=80" width="80px;" alt="Jose L. Cadavid"/><br /><sub><b>Jose L. Cadavid</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3ACadavidJoseL" title="Bug reports">🐛</a> <a href="#research-CadavidJoseL" title="Research">🔬</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/juliette-cooke"><img src="https://avatars.githubusercontent.com/u/90753730?v=4?s=80" width="80px;" alt="Juliette"/><br /><sub><b>Juliette</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Ajuliette-cooke" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/jreimertz"><img src="https://avatars.githubusercontent.com/u/119626411?v=4?s=80" width="80px;" alt="Justin Reimertz"/><br /><sub><b>Justin Reimertz</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Ajreimertz" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/mpagni12"><img src="https://avatars.githubusercontent.com/u/45748199?v=4?s=80" width="80px;" alt="Marco Pagni"/><br /><sub><b>Marco Pagni</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Ampagni12" title="Bug reports">🐛</a> <a href="#research-mpagni12" title="Research">🔬</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://orcid.org/0000-0002-7753-9042"><img src="https://avatars.githubusercontent.com/u/23480589?v=4?s=80" width="80px;" alt="Mihail Anton"/><br /><sub><b>Mihail Anton</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Amihai-sysbio" title="Bug reports">🐛</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=mihai-sysbio" title="Code">💻</a> <a href="#ideas-mihai-sysbio" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-mihai-sysbio" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/SysBioChalmers/Human-GEM/pulls?q=is%3Apr+reviewed-by%3Amihai-sysbio" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=mihai-sysbio" title="Tests">⚠️</a> <a href="#talk-mihai-sysbio" title="Talks">📢</a></td>
<td align="center" valign="top" width="12.5%"><img src="https://avatars.githubusercontent.com/u/26245751?v=4?s=80" width="80px;" alt="Pierre-Etienne Cholley"/><br /><sub><b>Pierre-Etienne Cholley</b></sub><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Apecholleyc" title="Bug reports">🐛</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=pecholleyc" title="Code">💻</a> <a href="#content-pecholleyc" title="Content">🖋</a> <a href="#research-pecholleyc" title="Research">🔬</a> <a href="https://github.com/SysBioChalmers/Human-GEM/pulls?q=is%3Apr+reviewed-by%3Apecholleyc" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="12.5%"><img src="https://avatars.githubusercontent.com/u/2399043?v=4?s=80" width="80px;" alt="Pierre-Etienne Cholley"/><br /><sub><b>Pierre-Etienne Cholley</b></sub><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Apecholley" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="12.5%"><img src="https://avatars.githubusercontent.com/u/8766764?v=4?s=80" width="80px;" alt="PkiwiBird"/><br /><sub><b>PkiwiBird</b></sub><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3APkiwiBird" title="Bug reports">🐛</a> <a href="#research-PkiwiBird" title="Research">🔬</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=PkiwiBird" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><img src="https://avatars.githubusercontent.com/u/8766764?v=4?s=80" width="80px;" alt="PkiwiBird"/><br /><sub><b>PkiwiBird</b></sub><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3APkiwiBird" title="Bug reports">🐛</a> <a href="#research-PkiwiBird" title="Research">🔬</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=PkiwiBird" title="Code">💻</a></td>
<td align="center" valign="top" width="12.5%"><img src="https://avatars.githubusercontent.com/u/38076281?v=4?s=80" width="80px;" alt="Pranas Grigaitis"/><br /><sub><b>Pranas Grigaitis</b></sub><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Apranasag" title="Bug reports">🐛</a> <a href="#content-pranasag" title="Content">🖋</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=pranasag" title="Code">💻</a> <a href="#research-pranasag" title="Research">🔬</a></td>
<td align="center" valign="top" width="12.5%"><img src="https://avatars.githubusercontent.com/u/32029599?v=4?s=80" width="80px;" alt="Pınar Kocabaş"/><br /><sub><b>Pınar Kocabaş</b></sub><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Apinarkocabas" title="Bug reports">🐛</a> <a href="#research-pinarkocabas" title="Research">🔬</a> <a href="https://github.com/SysBioChalmers/Human-GEM/pulls?q=is%3Apr+reviewed-by%3Apinarkocabas" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/Rasools"><img src="https://avatars.githubusercontent.com/u/22166601?v=4?s=80" width="80px;" alt="Rasool Saghaleyni"/><br /><sub><b>Rasool Saghaleyni</b></sub></a><br /><a href="#ideas-Rasools" title="Ideas, Planning, & Feedback">🤔</a> <a href="#research-Rasools" title="Research">🔬</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/cherkaos"><img src="https://avatars.githubusercontent.com/u/4625396?v=4?s=80" width="80px;" alt="Sarah Cherkaoui"/><br /><sub><b>Sarah Cherkaoui</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Acherkaos" title="Bug reports">🐛</a> <a href="#content-cherkaos" title="Content">🖋</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=cherkaos" title="Code">💻</a> <a href="#research-cherkaos" title="Research">🔬</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/simas232"><img src="https://avatars.githubusercontent.com/u/11994076?v=4?s=80" width="80px;" alt="Simonas Marcišauskas"/><br /><sub><b>Simonas Marcišauskas</b></sub></a><br /><a href="#question-simas232" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/TunahanCakir"><img src="https://avatars.githubusercontent.com/u/71440332?v=4?s=80" width="80px;" alt="TunahanCakir"/><br /><sub><b>TunahanCakir</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3ATunahanCakir" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/XuhangLi"><img src="https://avatars.githubusercontent.com/u/41695293?v=4?s=80" width="80px;" alt="Xuhang Li"/><br /><sub><b>Xuhang Li</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3AXuhangLi" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/feiranl"><img src="https://avatars.githubusercontent.com/u/32157802?v=4?s=80" width="80px;" alt="feiranl"/><br /><sub><b>feiranl</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Afeiranl" title="Bug reports">🐛</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=feiranl" title="Code">💻</a> <a href="#data-feiranl" title="Data">🔣</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=feiranl" title="Documentation">📖</a> <a href="#ideas-feiranl" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-feiranl" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-feiranl" title="Maintenance">🚧</a> <a href="#platform-feiranl" title="Packaging/porting to new platform">📦</a> <a href="#projectManagement-feiranl" title="Project Management">📆</a> <a href="#research-feiranl" title="Research">🔬</a> <a href="https://github.com/SysBioChalmers/Human-GEM/pulls?q=is%3Apr+reviewed-by%3Afeiranl" title="Reviewed Pull Requests">👀</a></td>
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/feiranl"><img src="https://avatars.githubusercontent.com/u/32157802?v=4?s=80" width="80px;" alt="feiranl"/><br /><sub><b>feiranl</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Afeiranl" title="Bug reports">🐛</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=feiranl" title="Code">💻</a> <a href="#data-feiranl" title="Data">🔣</a> <a href="https://github.com/SysBioChalmers/Human-GEM/commits?author=feiranl" title="Documentation">📖</a> <a href="#ideas-feiranl" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-feiranl" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-feiranl" title="Maintenance">🚧</a> <a href="#platform-feiranl" title="Packaging/porting to new platform">📦</a> <a href="#projectManagement-feiranl" title="Project Management">📆</a> <a href="#research-feiranl" title="Research">🔬</a> <a href="https://github.com/SysBioChalmers/Human-GEM/pulls?q=is%3Apr+reviewed-by%3Afeiranl" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/johan-gson"><img src="https://avatars.githubusercontent.com/u/32481323?v=4?s=80" width="80px;" alt="johan-gson"/><br /><sub><b>johan-gson</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Ajohan-gson" title="Bug reports">🐛</a> <a href="#content-johan-gson" title="Content">🖋</a> <a href="#research-johan-gson" title="Research">🔬</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/manas-kohli"><img src="https://avatars.githubusercontent.com/u/5028979?v=4?s=80" width="80px;" alt="manas-kohli"/><br /><sub><b>manas-kohli</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Amanas-kohli" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://orcid.org/0000-0003-3947-488X"><img src="https://avatars.githubusercontent.com/u/3072880?v=4?s=80" width="80px;" alt="smoretti"/><br /><sub><b>smoretti</b></sub></a><br /><a href="https://github.com/SysBioChalmers/Human-GEM/issues?q=author%3Asmoretti" title="Bug reports">🐛</a> <a href="#research-smoretti" title="Research">🔬</a></td>
Expand Down
8 changes: 5 additions & 3 deletions code/GPRs/simplifyGrRules.m
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
eqn = str2sym(eqn_str);

% separate equation into terms/pieces ("children")
eqn_pieces = arrayfun(@char,children(eqn),'UniformOutput',false);
eqn_pieces = cellfun(@char,children(eqn),'UniformOutput',false);

% find pieces that are further separable, and recursively separate until
% all pieces are single genes
Expand All @@ -202,12 +202,14 @@
%% Functions to test whether an equation is a collection of ORs or ANDs
function res = is_or(eqn)
% check if outermost operations contain ORs
res = length(regexp(char(eqn),'\|')) > length(regexp(char(children(eqn)),'\|'));
res = length(regexp(char(eqn),'\|')) > ...
sum(cell2mat(cellfun(@(x) length(regexp(char(x), '\|')), children(eqn), 'UniformOutput', false)));
end

function res = is_and(eqn)
% check if outermost operations contain ANDs
res = length(regexp(char(eqn),'&')) > length(regexp(char(children(eqn)),'&'));
res = length(regexp(char(eqn),'&')) > ...
sum(cell2mat(cellfun(@(x) length(regexp(char(x), '\&')), children(eqn), 'UniformOutput', false)));
end


Expand Down
5 changes: 4 additions & 1 deletion code/addMetabolicNetwork.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,11 @@
newGenes = setdiff(newGenes, newModel.genes);
end

% append new genes to list of model genes
% append new genes and their names to model
newModel.genes = [newModel.genes; newGenes];
emptyGeneNames = newGenes;
emptyGeneNames(:) = {''};
newModel.geneShortNames = [newModel.geneShortNames; emptyGeneNames];

% add new columns to rxnGeneMat will be updated after the new reactions are added below.
newModel.rxnGeneMat(:, end+1:end+numel(newGenes)) = 0;
Expand Down
107 changes: 107 additions & 0 deletions code/estimateEssentialGenes.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
function [eGenes, INIT_output] = estimateEssentialGenes(model, dataFile, taskStruct, useGeneSymbol)
% generate tINIT models and estimate essential genes
%
% Input:
%
% model reference human or animal model
%
% dataFile (opt, default Hart2015_RNAseq.txt)
%
% taskStruct metabolic task structure (opt, default is Essential tasks)
%
% useGeneSymbol use gene symbols as ids and in grRules (opt, default TRUE)
%
% Output:
%
% eGenes results structure with the following fields:
% taskList list of metabolic tasks that were tested
% tissues list of tissues (model IDs) corresponding to each model
% geneList cell array of the list of genes from each model
% essentialGenes cell array with one entry per model, where each
% entry is a logical matrix with rows corresponding
% to genes (in geneList) and columns to tasks (in
% taskList). Entries in the matrix are true when a
% gene is essential for a task, and false otherwise.
%
% INIT_output structure containing tINIT models (or information
% necessary to regenerate tINIT models) for which gene
% essentiality will be evaluated.
%
% Note: This function may take long computation time.
%


if nargin < 2
% load Hart et al. RNA-Seq cell line data
dataFile = 'Hart2015_RNAseq.txt';
end

if nargin < 3
taskStruct = parseTaskList('metabolicTasks_Essential.txt');
end

if nargin < 4
useGeneSymbol = true;
end

% replace gene IDs with gene symbols
if useGeneSymbol
idMapping = [model.genes, model.geneShortNames];
[grRules,genes,rxnGeneMat] = replaceGrRules(model.grRules,idMapping);
model.grRules = grRules;
model.genes = genes;
model.rxnGeneMat = rxnGeneMat;
end

% pre-process RNA-Seq data
disp('Step 1: preprocess and preliminary step')
tmp = readtable(dataFile);
arrayData.genes = tmp.gene;
arrayData.tissues = tmp.Properties.VariableNames(2:end)';
arrayData.levels = table2array(tmp(:,2:end));


% Run some preliminary steps
[~,deletedDeadEndRxns] = simplifyModel(model,true,false,true,true,true);
cModel = removeReactions(model,deletedDeadEndRxns,false,true);
[taskReport, essentialRxnMat] = checkTasks(cModel,[],true,false,true,taskStruct);


% add pre-processing results to arrayData structure
arrayData.deletedDeadEndRxns = deletedDeadEndRxns;
arrayData.taskReport = taskReport;
arrayData.essentialRxnMat = essentialRxnMat;
arrayData.threshold = 1;


% run tINIT
disp('Step 2: get tissue models')
model = addBoundaryMets(model);
params = {};
INIT_output = {};

for i = 1:length(arrayData.tissues)
disp(['Tissue ', num2str(i), ' out of ', num2str(length(arrayData.tissues)),': ', arrayData.tissues{i}])

% First try to run tINIT with shorter time limit. If it fails, then
% try again with a longer time limit.
try
params.TimeLimit = 1000;
init_model = getINITModel2(model,arrayData.tissues{i},[],[],arrayData,[],true,[],true,true,taskStruct,params);
catch
params.TimeLimit = 5000;
init_model = getINITModel2(model,arrayData.tissues{i},[],[],arrayData,[],true,[],true,true,taskStruct,params);
end

init_model.id = arrayData.tissues{i};
INIT_output.id{i,1} = init_model.id;
INIT_output.model{i,1} = init_model;

end

disp('Step 3: get essential genes')
% get essential genes for each model and task
eGenes = getTaskEssentialGenes(INIT_output, model, taskStruct);
eGenes.refModel = model;

end
Loading

0 comments on commit bf822e6

Please sign in to comment.