Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/unbalanced_rxns #222

Merged
merged 16 commits into from
Jun 12, 2020
Merged

Fix/unbalanced_rxns #222

merged 16 commits into from
Jun 12, 2020

Conversation

eiden309
Copy link
Contributor

@eiden309 eiden309 commented May 27, 2020

Main improvements in this PR:

1. Added checkSmatrixMNX.m (script intended for automatic curation of reaction balance) into repository for documentation purposes

2. After manual curation of selected unbalanced reactions in the model (details found in modMetsandSmatrix.tsv), used script modMetsandSmatrix.m to balance reactions by:

  • Modifying model.metFormula/model.metCharges for 280 metabolites (and all related metabolites with same metNames)
  • Modifying model.S of 556 metabolites

*Addresses all reactions which can currently be balanced (based on information from existing databases) in issue #194
**Script display_rxnMetInfo.m utilized to facilitate manual curation

3. After reactions are elemental- and charge-balanced, identified that requirement of coenzyme A (CoA) in biomass equation for the anaerobic model is not necessary and removed the CoA requirement

4. After changes are made, checkRxnBalance.m committed in this PR is used to check the model before and after the changes. Exchange reactions, transport reactions, SLIMER reactions and reactions with missing information are excluded from the final output.

List of reactions balanced:

r_0001
r_0002
r_0004
r_0014
r_0015
r_0034
r_0035
r_0038
r_0041
r_0043
r_0045
r_0063
r_0066
r_0067
r_0073
r_0074
r_0080
r_0082
r_0083
r_0088
r_0089
r_0092
r_0093
r_0094
r_0100
r_0105
r_0106
r_0107
r_0123
r_0124
r_0146
r_0150
r_0153
r_0157
r_0189
r_0195
r_0209
r_0210
r_0212
r_0213
r_0215
r_0219
r_0223
r_0224
r_0228
r_0234
r_0240
r_0263
r_0264
r_0265
r_0266
r_0271
r_0274
r_0282
r_0312
r_0313
r_0315
r_0319
r_0322
r_0335
r_0340
r_0341
r_0342
r_0343
r_0344
r_0345
r_0357
r_0358
r_0360
r_0361
r_0362
r_0363
r_0364
r_0437
r_0441
r_0442
r_0446
r_0447
r_0449
r_0450
r_0454
r_0455
r_0457
r_0461
r_0463
r_0464
r_0465
r_0466
r_0467
r_0477
r_0478
r_0490
r_0499
r_0501
r_0502
r_0503
r_0504
r_0506
r_0507
r_0508
r_0509
r_0511
r_0512
r_0518
r_0524
r_0525
r_0530
r_0531
r_0534
r_0535
r_0539
r_0540
r_0545
r_0550
r_0551
r_0552
r_0555
r_0558
r_0559
r_0560
r_0571
r_0572
r_0573
r_0574
r_0575
r_0616
r_0617
r_0618
r_0619
r_0620
r_0621
r_0622
r_0623
r_0624
r_0625
r_0646
r_0647
r_0648
r_0649
r_0650
r_0651
r_0652
r_0653
r_0654
r_0655
r_0665
r_0666
r_0672
r_0673
r_0681
r_0682
r_0683
r_0687
r_0690
r_0695
r_0701
r_0702
r_0703
r_0704
r_0705
r_0706
r_0711
r_0712
r_0722
r_0723
r_0727
r_0728
r_0729
r_0730
r_0737
r_0747
r_0748
r_0749
r_0750
r_0751
r_0752
r_0753
r_0754
r_0755
r_0756
r_0758
r_0760
r_0763
r_0768
r_0769
r_0785
r_0797
r_0798
r_0799
r_0800
r_0802
r_0803
r_0804
r_0813
r_0831
r_0832
r_0842
r_0852
r_0853
r_0855
r_0882
r_0883
r_0886
r_0888
r_0890
r_0905
r_0907
r_0911
r_0912
r_0916
r_0919
r_0920
r_0921
r_0922
r_0941
r_0967
r_0968
r_0969
r_0970
r_0971
r_0972
r_0973
r_0974
r_0975
r_0976
r_0977
r_0978
r_0979
r_0982
r_0993
r_0995
r_0998
r_0999
r_1000
r_1004
r_1006
r_1027
r_1029
r_1031
r_1032
r_1033
r_1034
r_1035
r_1036
r_1037
r_1038
r_1039
r_1042
r_1043
r_1045
r_1049
r_1057
r_1058
r_1066
r_1067
r_1069
r_1076
r_1078
r_1089
r_1090
r_1095
r_1617
r_1690
r_1725
r_1797
r_1975
r_2064
r_2074
r_2112
r_2113
r_2116
r_2126
r_2147
r_2148
r_2150
r_2151
r_2154
r_2156
r_2157
r_2162
r_2168
r_2172
r_2176
r_2177
r_2179
r_2209
r_2210
r_2211
r_2212
r_2213
r_2214
r_2215
r_2216
r_2217
r_2218
r_2232
r_2233
r_2238
r_2240
r_2242
r_2244
r_2245
r_2248
r_2249
r_2250
r_2258
r_2260
r_2268
r_2271
r_2275
r_2277
r_2280
r_2281
r_2282
r_2286
r_2289
r_2290
r_2292
r_2293
r_2294
r_2295
r_2296
r_2297
r_2298
r_2300
r_2302
r_2304
r_2308
r_2309
r_2310
r_2311
r_2312
r_2313
r_2315
r_2316
r_2317
r_2318
r_2319
r_2320
r_2321
r_2323
r_2325
r_2326
r_2327
r_2329
r_2330
r_2331
r_2332
r_2344
r_2345
r_2346
r_2347
r_2348
r_2349
r_2350
r_2351
r_2352
r_2353
r_2354
r_2355
r_2356
r_2357
r_2358
r_2359
r_2360
r_2361
r_2362
r_2363
r_2364
r_2365
r_2366
r_2367
r_2368
r_2376
r_2384
r_2392
r_2400
r_2408
r_2416
r_2424
r_2432
r_2438
r_2440
r_2446
r_2447
r_2448
r_2449
r_2450
r_2451
r_2452
r_2453
r_2454
r_2455
r_2456
r_2457
r_2458
r_2459
r_2460
r_2461
r_2462
r_2463
r_2464
r_2465
r_2466
r_2467
r_2468
r_2469
r_2470
r_2471
r_2472
r_2473
r_2474
r_2475
r_2476
r_2477
r_2478
r_2479
r_2480
r_2481
r_2482
r_2483
r_2484
r_2485
r_2486
r_2487
r_2506
r_2507
r_2510
r_2511
r_2512
r_2513
r_2514
r_2515
r_2516
r_2517
r_2518
r_2519
r_2520
r_2528
r_2529
r_2530
r_2531
r_2532
r_2533
r_2534
r_2535
r_2536
r_2537
r_2538
r_2539
r_2540
r_2541
r_2542
r_2543
r_2544
r_2545
r_2546
r_2547
r_2548
r_2549
r_2550
r_2551
r_2552
r_2553
r_2554
r_2555
r_2556
r_2557
r_2558
r_2559
r_2560
r_2561
r_2562
r_2563
r_2564
r_2565
r_2566
r_2567
r_2568
r_2569
r_2570
r_2571
r_2572
r_2573
r_2574
r_2575
r_2576
r_2577
r_2578
r_2579
r_2580
r_2581
r_2582
r_2583
r_2584
r_2586
r_2588
r_2590
r_2592
r_2594
r_2596
r_2598
r_2600
r_2602
r_2603
r_2604
r_2605
r_2606
r_2607
r_2608
r_2609
r_2610
r_2611
r_2612
r_2613
r_2614
r_2615
r_2616
r_2617
r_2618
r_2619
r_2620
r_2621
r_2622
r_2623
r_2624
r_2625
r_2626
r_2627
r_2628
r_2629
r_2630
r_2631
r_2632
r_2633
r_2634
r_2635
r_2636
r_2637
r_2638
r_2639
r_2640
r_2641
r_2642
r_2643
r_2644
r_2645
r_2646
r_2647
r_2648
r_2649
r_2650
r_2651
r_2652
r_2653
r_2654
r_2655
r_2656
r_2657
r_2658
r_2659
r_2660
r_2661
r_2662
r_2663
r_2664
r_2665
r_2666
r_2667
r_2668
r_2669
r_2670
r_2671
r_2672
r_2673
r_2674
r_2675
r_2676
r_2677
r_2678
r_2679
r_2680
r_2681
r_2682
r_2683
r_2684
r_2685
r_2686
r_2687
r_2688
r_2689
r_2690
r_2691
r_2692
r_2693
r_2694
r_2695
r_2696
r_2697
r_2698
r_2699
r_2700
r_2701
r_2702
r_2703
r_2704
r_2705
r_2706
r_2707
r_2708
r_2709
r_2710
r_2711
r_2712
r_2713
r_2714
r_2715
r_2716
r_2717
r_2718
r_2719
r_2720
r_2721
r_2722
r_2723
r_2724
r_2725
r_2726
r_2727
r_2728
r_2729
r_2730
r_2731
r_2732
r_2733
r_2734
r_2735
r_2736
r_2737
r_2738
r_2739
r_2740
r_2741
r_2742
r_2743
r_2744
r_2745
r_2746
r_2747
r_2748
r_2749
r_2750
r_2751
r_2752
r_2753
r_2754
r_2755
r_2756
r_2757
r_2758
r_2759
r_2760
r_2761
r_2762
r_2763
r_2764
r_2765
r_2766
r_2767
r_2768
r_2769
r_2770
r_2771
r_2772
r_2773
r_2774
r_2775
r_2776
r_2777
r_2778
r_2779
r_2780
r_2781
r_2782
r_2783
r_2784
r_2785
r_2786
r_2787
r_2788
r_2789
r_2790
r_2791
r_2792
r_2793
r_2794
r_2795
r_2796
r_2797
r_2798
r_2799
r_2800
r_2801
r_2802
r_2803
r_2804
r_2805
r_2806
r_2807
r_2808
r_2809
r_2810
r_2811
r_2812
r_2813
r_2814
r_2815
r_2816
r_2817
r_2818
r_2819
r_2820
r_2821
r_2822
r_2823
r_2824
r_2825
r_2826
r_2827
r_2828
r_2829
r_2830
r_2831
r_2832
r_2833
r_2834
r_2835
r_2836
r_2837
r_2838
r_2839
r_2840
r_2841
r_2842
r_2843
r_2844
r_2845
r_2846
r_2847
r_2848
r_2849
r_2850
r_2851
r_2852
r_2853
r_2854
r_2855
r_2856
r_2857
r_2858
r_2859
r_2860
r_2861
r_2862
r_2863
r_2864
r_2865
r_2866
r_2867
r_2868
r_2869
r_2870
r_2871
r_2872
r_2873
r_2874
r_2875
r_2876
r_2877
r_2878
r_2879
r_2880
r_2881
r_2882
r_2883
r_2884
r_2885
r_2886
r_2887
r_2888
r_2889
r_2890
r_2891
r_2948
r_2949
r_2950
r_2951
r_2952
r_2953
r_2954
r_2955
r_2956
r_2957
r_2958
r_2959
r_2960
r_2961
r_2962
r_2963
r_2964
r_2965
r_2966
r_2967
r_2968
r_2969
r_2970
r_2971
r_2972
r_2973
r_2974
r_2975
r_2976
r_2977
r_2978
r_2979
r_2980
r_2981
r_2982
r_2983
r_2984
r_2985
r_2986
r_2987
r_2988
r_2989
r_2990
r_2991
r_2992
r_2993
r_2994
r_2995
r_2996
r_2997
r_2998
r_2999
r_3000
r_3001
r_3002
r_3003
r_3004
r_3005
r_3006
r_3007
r_3008
r_3009
r_3010
r_3011
r_3022
r_3023
r_3024
r_3025
r_3026
r_3027
r_3028
r_3029
r_3030
r_3031
r_3032
r_3033
r_3034
r_3035
r_3036
r_3037
r_3038
r_3039
r_3040
r_3041
r_3042
r_3043
r_3044
r_3045
r_3058
r_3059
r_3060
r_3061
r_3062
r_3063
r_3064
r_3065
r_3066
r_3067
r_3068
r_3069
r_3078
r_3079
r_3080
r_3081
r_3082
r_3083
r_3084
r_3085
r_3086
r_3087
r_3088
r_3089
r_3090
r_3091
r_3092
r_3093
r_3094
r_3095
r_3096
r_3097
r_3098
r_3099
r_3100
r_3101
r_3102
r_3103
r_3105
r_3106
r_3107
r_3108
r_3109
r_3110
r_3111
r_3112
r_3113
r_3114
r_3115
r_3116
r_3117
r_3118
r_3119
r_3120
r_3121
r_3122
r_3123
r_3124
r_3125
r_3126
r_3127
r_3128
r_3129
r_3130
r_3131
r_3132
r_3133
r_3134
r_3135
r_3136
r_3137
r_3138
r_3139
r_3140
r_3141
r_3142
r_3143
r_3144
r_3145
r_3146
r_3147
r_3148
r_3149
r_3150
r_3151
r_3152
r_3153
r_3154
r_3155
r_3156
r_3157
r_3158
r_3159
r_3160
r_3161
r_3162
r_3163
r_3164
r_3165
r_3166
r_3167
r_3168
r_3169
r_3170
r_3171
r_3172
r_3173
r_3174
r_3175
r_3176
r_3177
r_3178
r_3179
r_3180
r_3181
r_3182
r_3183
r_3184
r_3185
r_3186
r_3187
r_3188
r_3189
r_3190
r_3191
r_3192
r_3193
r_3194
r_3195
r_3196
r_3197
r_3198
r_3199
r_3200
r_3201
r_3202
r_3203
r_3204
r_3205
r_3206
r_3207
r_3208
r_3209
r_3210
r_3211
r_3212
r_3213
r_3214
r_3215
r_3216
r_3217
r_3218
r_3219
r_3220
r_3221
r_3222
r_3223
r_3224
r_3225
r_3226
r_3227
r_3228
r_3229
r_3230
r_3231
r_3232
r_3233
r_3234
r_3235
r_3236
r_3237
r_3238
r_3239
r_3240
r_3241
r_3242
r_3243
r_3244
r_3245
r_3246
r_3247
r_3248
r_3249
r_3250
r_3251
r_3264
r_3265
r_3266
r_3267
r_3296
r_3316
r_3317
r_3318
r_3319
r_3320
r_3321
r_3322
r_3323
r_3332
r_3333
r_3334
r_3335
r_3336
r_3337
r_3338
r_3339
r_3340
r_3341
r_3342
r_3343
r_3344
r_3345
r_3346
r_3347
r_3348
r_3356
r_3364
r_3372
r_3380
r_3388
r_3396
r_3404
r_3412
r_3420
r_3428
r_3436
r_3444
r_3452
r_3460
r_3468
r_3476
r_3484
r_3492
r_3500
r_4042
r_4186
r_4202
r_4219
r_4235
r_4239
r_4245
r_4267
r_4268
r_4279
r_4286
r_4303
r_4304
r_4313
r_4382
r_4495
r_4567
r_4571
r_4577
r_4578

Remaining unbalanced reactions:
model.rxns Imbalance issue(s) to check Charge difference Elemental difference
r_0013 checkMetCharge 4 []
r_0229 checkMetCharge 2 []
r_0365 checkMetCharge -1 []
r_0438 checkMetChargeAndFormula -0.633 H0.633
r_0439 checkMetChargeAndFormula 1.266 H-1.266
r_0532 checkMetCharge -2 []
r_1603 checkMetFormula [] H-2
r_2070 checkMetCharge -2 []
r_2071 checkMetCharge -2 []
r_4170 checkMetFormula [] R-1
r_4250 checkMetFormula [] R1
r_4253 checkMetFormula [] R1
r_4271 checkMetFormula [] R1
r_4320 checkMetChargeAndFormula 2 R1
r_4321 checkMetChargeAndFormula -2 R1
r_4328 checkMetFormula [] R-1
r_4568 checkMetFormula [] O-1

I hereby confirm that I have:

  • Tested my code with all requirements for running the model
  • Selected devel as a target branch (top left drop-down menu)
  • If needed, asked first in the Gitter chat room about this PR

@eiden309 eiden309 added the bug something is wrong in the model label May 27, 2020
@eiden309 eiden309 requested review from edkerk and feiranl May 27, 2020 02:09
Copy link
Collaborator

@feiranl feiranl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, overall it is great.

@feiranl
Copy link
Collaborator

feiranl commented May 28, 2020

@BenjaSanchez When I rerun this commit, all bigg IDs for mets and rxns cannot be saved. So I try only loadYeastModel and saveYeastModel function in devel branch, it is same, all bigg IDs are removed. And even though that I want to rerun the addBiGGidentifiers.m, there is a problem here for my matlab using xlsread. Could you help to check that? I think it is beacuse that when loadYeastModel, biggID field was loaded in a different field. After using the below code, it can be saved again. I noticed that in ravenCobraWrapper: as for metBiGGID, I noticed that that metBiGGID and metBiGGID are present in the function.

model.metBiGGID = model.metisbigg__46__metaboliteID
model.rxnBIGGID = model.rxnisbigg__46__reactionID

Dependencies: matlab 2019b cobra 3.1 raven 2.3.1

@BenjaSanchez
Copy link
Contributor

@feiranl as I wrote in PR #188:

NOTE that after this branch is merged and until new versions for (RAVEN & COBRA) toolboxes are released, any further development in yeast-GEM should be conducted with the corresponding (development) toolbox branches (otherwise the BiGG fields will be removed) @feiranl.

So please revert your changes and switch to devel in RAVEN & COBRA

@edkerk
Copy link
Member

edkerk commented May 28, 2020

By running the code below:

code

bs       = getElementalBalance(model);
idx      = find(bs.balanceStatus==0);
[~,exch] = getExchangeRxns(model);
slime    = find(contains(model.rxnNames,'SLIME'));
idx(ismember(idx,[exch;slime]))=[];
out = model.rxns(idx);
for i=1:length(idx)
    dif = bs.leftComp(idx(i),:) - bs.rightComp(idx(i),:);
    mets = find(~dif==0);
    difference = '';
    for j=1:length(mets)
        difference = strcat(difference,bs.elements.abbrevs(mets(j)));
        difference = strcat(difference,num2str(dif(mets(j))));
    end
    out(i,2) = difference;
end
out

There are still ~90 unbalanced reactions (filtered out are SLIME and exchange reactions). Some of these seem easy to fix, e.g.:

  • r_0340, r_0342, r_0343, r_0919 should be treated the same as r_0341.
  • r_2285 should be treated same as r_2284, r_2286 etc., remove 4 H+.
  • s_2778 should have formula C4H5OSR, matching other acyl-ACP mets. (I know we said we should't touch Rs in formulas, but this is just about consistency across similar metabolites).
  • r_2126, r_4042, r_4567 add H2O as substrate, these are hydrolases.
  • r_0041 can do with only 1 H+ as substrate, not 2.
  • r_0747 add H+ in line with r_0748, r_0749 etc.

Not all of them seem so trivial, but there might be a few more from this list that could be fixed 'easily'.

@eiden309
Copy link
Contributor Author

@edkerk noted on the reactions. I will look through those and see if there was any reason for not correcting them previously

@BenjaSanchez BenjaSanchez added the wip work in progress label May 29, 2020
@feiranl
Copy link
Collaborator

feiranl commented Jun 5, 2020

@eiden309, Could you document the newly balanced reactions of this pull request and also the remaining unbalanced reactions list here? Thanks!

@eiden309
Copy link
Contributor Author

eiden309 commented Jun 7, 2020

@feiranl I have edited the PR comment to include the requested lists of reactions!

@BenjaSanchez BenjaSanchez removed the wip work in progress label Jun 10, 2020
@BenjaSanchez BenjaSanchez merged commit 39ada1b into devel Jun 12, 2020
@BenjaSanchez BenjaSanchez deleted the fix/unbalanced_rxns branch June 12, 2020 10:20
This was referenced Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is wrong in the model
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants