Size: 8136
Comment:
|
← Revision 42 as of 2016-06-30 09:58:48 ⇥
Size: 7922
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Practical 8 = | ## page was renamed from Meetings/Nepal2016/Ara_GSM = Practical 4 = |
Line 5: | Line 6: |
1. Download the file AraGSM.tgz into the area in which you have been using for your other practicals. | 1. Download the file [[http://mudsharkstatic.brookes.ac.uk/Nepal2016/P4/AraGSM.tgz|AraGSM.tgz]] into the area in which you have been using for your other practicals. |
Line 7: | Line 8: |
2. This is a compressed archive file and you will need to extract the files before they can be used: | 1. This is a compressed archive file and you will need to extract the files before they can be used: |
Line 13: | Line 14: |
3. This will generate a directory, A.thaliana, containing two sub-directories: Model and Analysis. Model contains the model definition files and an additional python module (in Model/Tools). Analysis contains the python modules you will need for this practical. | 1. This will generate a directory, AraGSM, containing two sub-directories: Model and Analysis. Model contains the model definition files and an additional python module (in Model/Tools). Analysis contains the python modules you will need for this practical. |
Line 15: | Line 16: |
4. For the sake of the practical we have made a few simplifications and the model and results will not be identical to those in the lecture. the aim of the practical is to illustrate the techniques used. | 1. For the sake of the practical we have made a few simplifications and the model and results will not be identical to those in the lecture. the aim of the practical is to illustrate the techniques used. |
Line 18: | Line 19: |
== Investigating the effect of knocking our the Calvin cycle enzymes from GSM of A. thaliana == | == Investigating the effect of knocking out the Calvin cycle enzymes from GSM of A. thaliana == |
Line 21: | Line 22: |
2. Start [[http://mudshark.brookes.ac.uk/ScrumPy|ScrumPy]] and the load the model as before. | 1. Start [[http://mudshark.brookes.ac.uk/ScrumPy|ScrumPy]] and the load the model as before. |
Line 24: | Line 26: |
3. Import the {{{KnockOut}}} module. | 1. Import the {{{KnockOut}}} module. |
Line 27: | Line 30: |
4. This defines a single function also called {{{KnockOut}}}{{{Effects}}} that returns a dictionary recording the impact of removing each reaction from the model (relative change in objective value) | 1. This defines a single function also called {{{KnockOut}}}{{{Effects}}} that returns a dictionary recording the impact of removing each reaction from the model (relative change in objective value) |
Line 29: | Line 33: |
{{{#!python | {{{#!python >>> import BuildLP |
Line 34: | Line 40: |
Observe the fluxes of the Calvin Cycle enzymes | |
Line 35: | Line 42: |
Observe the fluxes of the Calvin Cycle enzymes | 1. Provide the model, reaction to be knocked out and {{{lp}} as argument to the function {{{KnockOutEffects}}} |
Line 39: | Line 47: |
Load the {{{KnockOutEffects}}} from the {{{KnockOut}}} module and provide the reaction to be knocked out in the argument {{{#!python >>> mutant_solution = KnockOutEffects.KnockOut(m, 'SEDOHEPTULOSE-BISPHOSPHATASE-RXN_Plas', lp) }}} |
Store the solution as {{{mutant_solution}}} |
Line 46: | Line 50: |
{{{#!python >>> mutant_solution = KnockOut.KnockOutEffects(m, 'SEDOHEPTULOSE-BISPHOSPHATASE-RXN_Plas', lp) }}} |
|
Line 47: | Line 54: |
2. Similarly , find the reactions that were inactive as a effect of knock out 3. Identify the reactions that have different flux values as compared to wild type and interpret the results. |
1. Similarly , find the reactions that were inactive as a effect of knock out 1. Identify the reactions that have different flux values as compared to wild type and interpret the results. |
Line 56: | Line 63: |
>>> print rxn, mutant_solution[rxn] - wild_type_solution[rxn] | >>> print rxn, mutant_solution[rxn], wild_type_solution[rxn] |
Line 58: | Line 65: |
Line 62: | Line 66: |
Repeat Step 5-9 for the FBPase, phosphoribulokinase, G3Pdh and SBPase, FBPase dual knock out mutant. | Repeat Step 5-8 for the {{{FBPase}}}, {{{PRK}}}, {{{G3Pdh}}} and {{{SBPas, FBPase}}} dual knock out mutants. |
Line 65: | Line 69: |
== Part B : Analysing the response to varying input of photon flux == | == Part B : Analysing the response of GSM of A. thaliana to varying input of photon flux == |
Line 72: | Line 76: |
2. Start ScrumPy and load the model: | 1. Start ScrumPy and load the model: |
Line 76: | Line 82: |
>>> m = ScrumPy.Model("../../Model/AraTopLevel.spy") | >>> m = ScrumPy.Model("../../Model/AraTopLevel.spy") |
Line 79: | Line 84: |
Line 82: | Line 86: |
1. Examine the files that are now presented - how much can you recognise from previous work in this course. | |
Line 83: | Line 88: |
3. Examine the files that are now presented - how much can you recognise from previous work in this course. | 1. Create an LP object with the GSM of A.thaliana as argument (see previous LP exercise for details on how to do this). |
Line 85: | Line 90: |
4. Create an LP object with the rice GSM as argument (see previous LP exercise for details on how to do this). 5. Set the objective to minimisation of all fluxes. Since minimisation is the default direction, all you need to do is to use the {{{lp.SetObjective()}}} method with all reactions in the LP object as argument, which can be obtained as {{{lp.cnames.values()}}} |
1. Set the objective to minimisation of all fluxes. Since minimisation is the default direction, all you need to do is to use the {{{lp.SetObjective()}}} method with all reactions in the LP object as argument, which can be obtained as {{{lp.cnames.values()}}} |
Line 90: | Line 94: |
6. Use the dictionary of biomass fluxes as fixed constraints ({{{lp.SetFixedFlux(...)}}}).(like in exercise from Part A) | 1. Use the dictionary of biomass fluxes as fixed constraints. {{{#!python >>> import BuildLP >>> lp = BuildLP.BuildLP(m) >>> fd = BuildLP.biomass_dictionary >>> lp.SetFixedFlux(fd) }}} 1. Try to solve the LP and make sure the number of reactions in the solution is non-zero 1. You will scan the photon uptake reaction by fixing its flux to a set of value in a linear range, specifically 50 points evenly distributed from 0 to 1. To do this, first generate a list of these values and store it as {{{collection}}} (Use the knowledge from exercise of the [[http://mudshark.brookes.ac.uk/AccliPhot/WorkshopOne/prac1|python practical]]). |
Line 93: | Line 108: |
7. Try to solve the LP and make sure the number of reactions in the solution is non-zero | 1. Import the module {{{DataSets}}} from {{{Data}}}. Create an instance of the {{{DataSet}}} class. The {{{DataSet}}} class is a subclass of the {{{ScrumPy}}} {{{matrix}}} class, as are the stoichiometry matrices that you have looked at before, so much of the structure and properties of data sets will be similar. |
Line 95: | Line 110: |
8. You will scan the photon uptake reaction by fixing its flux to a set of value in a linear range, specifically 50 points evenly distributed from 0 to 1. To do this, first generate a list of these values (Use the knowledge from exercise of the [[http://mudshark.brookes.ac.uk/AccliPhot/WorkshopOne/prac1|python practical]]). | {{{#!python >>> ds = DataSets.DataSet() }}} . 1.Write a {{{for}}} loop over the list of values generated above. Inside the loop, set the constrain on the photon uptake reaction ({{{Photon_tx}}}) equal to the loop variable, solve the LP, collect the solution in a dictionary and update in a dataset. There is a {{{DataSet}}} method, called {{{UpdateFromDic(...)}}}, that updates the data set with a dictionary |
Line 98: | Line 117: |
9.Define a dictionary (this will be referred to as {{{sol}}} henceforth) where you will collect the LP solutions. | {{{#!python >>> for number in collection: >>> lp.SetFixedFlux({"Photon_tx" :number }) >>> lp.Solve() >>> if lp.GetStatusMsg() == "Optimal": >>> sol_dic = lp.GetPrimSol() >>> ds.UpdateFromDic(sol_dic) }}} 1. You will now analyse the data. But before that, study the properties of dataset you have just updated. Please do not print the whole dataset. |
Line 100: | Line 127: |
10.Write a {{{for}}} loop over the list of values generated above. Inside the loop, set the constrain on the photon uptake reaction ({{{Photon_tx}}}) equal to the loop variable, solve the LP, and collect the solution in {{{sol}}} created above (you can use the loop variable as key) 11. You will now analyse the LP data. In order to collect the names of all reactions that appear in any of the solutions, create an empty dictionary and run a {{{for}}} loop to update it with the reaction names from the solutions generated previously, e.g. {{{#!python >>> reacs = {} >>> for sol in collection: reacs.update(sol_collection[sol]) }}} 12. Import the module {{{DataSets}}} from {{{Data}}}. Create an instance of the {{{DataSet}}} class, give the keys of the reaction name dictionary just created to the argument with keyword {{{ItemNames}}}, as such: {{{#!python >>> ds = DataSets.DataSet(ItemNames=reacs.keys()) }}} 13. The names provided will be column names in data set created. The {{{DataSet}}} class is a subclass of the {{{ScrumPy}}} {{{matrix}}} class, as are the stoichiometry matrices that you have looked at before, so much of the structure and properties of data sets will be similar. 14. Update the data set with the LP solutions so that each row corresponds to a fixed photon flux. Conveniently, there is a {{{DataSet}}} method, called {{{UpdateFromDic(...)}}}, that updates the data set with a dictionary if the keys can be found in the column names of the data set and the values are numbers. Write a {{{for}}} loop over the {{{collection}}} dictionary and update the data set with each solution. 15. Since we are interested in reactions that change flux as a response to changes in photon flux, we need to identify these reaction in the data set. We will do this by looking at the aboslute difference between the smallest and largest flux through each reaction in the set. Use a {{{for}}} loop over the column names of the data set (if the data set is named as{{{ ds}}} this is {{{ds.cnames}}}). For each column name get the associated list of values (use the method {{{ds.GetCol(c)}}} with {{{c}}} being the name of column, i.e. if you are in a loop, the loop variable); calculate absolute of the difference between the maximum and minimum flux value in the list (we can use the built-in functions {{{abs()}}}, {{{max()}}}, and {{{min()}}} for this), if this difference is above a fixed threshold the reaction (i.e. the loop variable) will be stored. Here is the code: |
1. Since we are interested in reactions that change flux as a response to changes in photon flux, we need to identify these reaction in the data set. We will do this by looking at the aboslute difference between the smallest and largest flux through each reaction in the set. Use a {{{for}}} loop over the column names of the data set (if the data set is named as{{{ ds}}} this is {{{ds.cnames}}}). For each column name get the associated list of values (use the method {{{ds.GetCol(c)}}} with {{{c}}} being the name of column, i.e. if you are in a loop, the loop variable); calculate absolute of the difference between the maximum and minimum flux value in the list (we can use the built-in functions {{{abs()}}}, {{{max()}}}, and {{{min()}}} for this), if this difference is above a fixed threshold the reaction (i.e. the loop variable) will be stored. Here is the code: |
Line 135: | Line 133: |
col = ds.GetCol(c) if abs(max(col) - min(col)) > lim: changing.append(c) }}} |
>>> col = ds.GetCol(c) >>> if abs(max(col) - min(col)) > lim: >>> changing.append(c) }}} 1. Use the plotting methods of {{{DataSet}}} to look at the flux responses of the changing reactions. Set the x-axis as the photon flux with the method {{{ds.SetPlotX(...)}}}, where the argument is a column name in the data set {{{ds}}}, here the photon transporter ({{{Photon_tx}}}) (note that {{{ds}}}{{{.SetPlotX(...)}}} only initialises the plot internally, you will not see the plot until data is added). Add columns to the plot using the method {{{ds}}}{{{.AddToPlot(...)}}}, where the argument is either a string (name of a column), or a list (of column names). Similarly, you can remove column from the plot using the methods {{{ds.RemoveFromPlot(...)}}} and {{{ds.RemoveAllFromPlot()}}}. You can check all the functions of the dataset {{{dir(ds)}}}. |
Line 143: | Line 141: |
16. Use the plotting methods of {{{DataSet}}} to look at the flux responses of the changing reactions. Set the x-axis as the photon flux with the method {{{ds.SetPlotX(...)}}}, where the argument is a column name in the data set {{{ds}}}, here the photon transporter ({{{Photon_tx}}}) (note that {{{ds}}}{{{.SetPlotX(...)}}} only initialises the plot internally, you will not see the plot until data is added). Add columns to the plot using the method {{{ds}}}{{{.AddToPlot(...)}}}, where the argument is either a string (name of a column), or a list (of column names). Similarly, you can remove column from the plot using the methods {{{ds.RemoveFromPlot(...)}}} and {{{ds.RemoveAllFromPlot()}}}. You can check all the functions of the dataset {{{dir(ds)}}}. | 1. You can repeat the exercise using the {{{LightScan}}} module given in the {{{Analysis}}} directory. |
Practical 4
Analysing a genome scale metabolic model of A. thaliana
In this practical we (you !) will be replicating some the analysis that was discussed in the previous lecture. In order to do this you will need to download the files associated with the model:
Download the file AraGSM.tgz into the area in which you have been using for your other practicals.
- This is a compressed archive file and you will need to extract the files before they can be used:
$ tar -zxf AraGSM.tgz
- This will generate a directory, AraGSM, containing two sub-directories: Model and Analysis. Model contains the model definition files and an additional python module (in Model/Tools). Analysis contains the python modules you will need for this practical.
- For the sake of the practical we have made a few simplifications and the model and results will not be identical to those in the lecture. the aim of the practical is to illustrate the techniques used.
Part A:
Investigating the effect of knocking out the Calvin cycle enzymes from GSM of A. thaliana
- cd into Analysis/Knockouts
Start ScrumPy and the load the model as before.
Import the KnockOut module.
This defines a single function also called KnockOutEffects that returns a dictionary recording the impact of removing each reaction from the model (relative change in objective value)
Observe the fluxes of the Calvin Cycle enzymes
Provide the model, reaction to be knocked out and lp}} as argument to the function {{{KnockOutEffects
Store the solution as mutant_solution
1 >>> mutant_solution = KnockOut.KnockOutEffects(m, 'SEDOHEPTULOSE-BISPHOSPHATASE-RXN_Plas', lp)
- Investigate the differences in wild_type_solution and mutant_solution and interpret the results.
- Similarly , find the reactions that were inactive as a effect of knock out
- Identify the reactions that have different flux values as compared to wild type and interpret the results.
1 >>> from Util import Set
2 >>> new_active_reactions = Set.Complement(mutant_solution, wild_type_solution)
3 >>> inactive_reactions = Set.Complement(wild_type_solution, mutant_solution)
4 >>> for rxn in Set.Intersect(mutant_solution, wild_type_solution):
5 >>> if abs(mutant_solution[rxn] - wild_type_solution[rxn]) > 1e-5:
6 >>> print rxn, mutant_solution[rxn], wild_type_solution[rxn]
Repeat Step 5-8 for the FBPase, PRK, G3Pdh and SBPas, FBPase dual knock out mutants.
Part B : Analysing the response of GSM of A. thaliana to varying input of photon flux
- Change directory to the relevant area:
$ cd A.thaliana/Analysis/LightScan
Start ScrumPy and load the model:
1 >>> m = ScrumPy.Model("../../Model/AraTopLevel.spy")
(If you wish to avoid a bit of typing, leave the model name blank and use the file selector to find the model file instead.)
- Examine the files that are now presented - how much can you recognise from previous work in this course.
- Create an LP object with the GSM of A.thaliana as argument (see previous LP exercise for details on how to do this).
Set the objective to minimisation of all fluxes. Since minimisation is the default direction, all you need to do is to use the lp.SetObjective() method with all reactions in the LP object as argument, which can be obtained as lp.cnames.values()
- Use the dictionary of biomass fluxes as fixed constraints.
- Try to solve the LP and make sure the number of reactions in the solution is non-zero
You will scan the photon uptake reaction by fixing its flux to a set of value in a linear range, specifically 50 points evenly distributed from 0 to 1. To do this, first generate a list of these values and store it as collection (Use the knowledge from exercise of the python practical).
1. Import the module DataSets from Data. Create an instance of the DataSet class. The DataSet class is a subclass of the ScrumPy matrix class, as are the stoichiometry matrices that you have looked at before, so much of the structure and properties of data sets will be similar.
1 >>> ds = DataSets.DataSet()
1.Write a for loop over the list of values generated above. Inside the loop, set the constrain on the photon uptake reaction (Photon_tx) equal to the loop variable, solve the LP, collect the solution in a dictionary and update in a dataset. There is a DataSet method, called UpdateFromDic(...), that updates the data set with a dictionary
- You will now analyse the data. But before that, study the properties of dataset you have just updated. Please do not print the whole dataset.
1. Since we are interested in reactions that change flux as a response to changes in photon flux, we need to identify these reaction in the data set. We will do this by looking at the aboslute difference between the smallest and largest flux through each reaction in the set. Use a for loop over the column names of the data set (if the data set is named as ds this is ds.cnames). For each column name get the associated list of values (use the method ds.GetCol(c) with c being the name of column, i.e. if you are in a loop, the loop variable); calculate absolute of the difference between the maximum and minimum flux value in the list (we can use the built-in functions abs(), max(), and min() for this), if this difference is above a fixed threshold the reaction (i.e. the loop variable) will be stored. Here is the code:
Use the plotting methods of DataSet to look at the flux responses of the changing reactions. Set the x-axis as the photon flux with the method ds.SetPlotX(...), where the argument is a column name in the data set ds, here the photon transporter (Photon_tx) (note that ds.SetPlotX(...) only initialises the plot internally, you will not see the plot until data is added). Add columns to the plot using the method ds.AddToPlot(...), where the argument is either a string (name of a column), or a list (of column names). Similarly, you can remove column from the plot using the methods ds.RemoveFromPlot(...) and ds.RemoveAllFromPlot(). You can check all the functions of the dataset dir(ds).
1. You can repeat the exercise using the LightScan module given in the Analysis directory.