492
|
1 # RAS to Bounds
|
|
2
|
|
3 Apply Reaction Activity Scores (RAS) as constraints to metabolic model bounds.
|
|
4
|
|
5 ## Overview
|
|
6
|
|
7 The RAS to Bounds tool integrates RAS values into metabolic model flux bounds, creating sample-specific constrained models for flux sampling. This enables personalized metabolic modeling based on gene expression patterns.
|
|
8
|
|
9 ## Usage
|
|
10
|
|
11 ### Command Line
|
|
12
|
|
13 ```bash
|
|
14 ras_to_bounds -td /path/to/COBRAxy \
|
|
15 -ms ENGRO2 \
|
|
16 -ir ras_scores.tsv \
|
|
17 -rs true \
|
|
18 -mes allOpen \
|
|
19 -idop constrained_bounds/
|
|
20 ```
|
|
21
|
|
22 ### Galaxy Interface
|
|
23
|
|
24 Select "RAS to Bounds" from the COBRAxy tool suite and configure model and constraint parameters.
|
|
25
|
|
26 ## Parameters
|
|
27
|
|
28 ### Required Parameters
|
|
29
|
|
30 | Parameter | Flag | Description |
|
|
31 |-----------|------|-------------|
|
|
32 | Tool Directory | `-td, --tool_dir` | Path to COBRAxy installation directory |
|
|
33 | Model Selector | `-ms, --model_selector` | Built-in model (ENGRO2, Custom) |
|
|
34 | RAS Selector | `-rs, --ras_selector` | Enable RAS constraint application |
|
|
35
|
|
36 ### Model Parameters
|
|
37
|
|
38 | Parameter | Flag | Description | Default |
|
|
39 |-----------|------|-------------|---------|
|
|
40 | Model Selector | `-ms, --model_selector` | Built-in model choice | ENGRO2 |
|
|
41 | Custom Model | `-mo, --model` | Path to custom SBML model | - |
|
|
42 | Model Name | `-mn, --model_name` | Custom model filename | - |
|
|
43
|
|
44 ### Medium Parameters
|
|
45
|
|
46 | Parameter | Flag | Description | Default |
|
|
47 |-----------|------|-------------|---------|
|
|
48 | Medium Selector | `-mes, --medium_selector` | Medium configuration | allOpen |
|
|
49 | Custom Medium | `-meo, --medium` | Path to custom medium file | - |
|
|
50
|
|
51 ### Constraint Parameters
|
|
52
|
|
53 | Parameter | Flag | Description | Default |
|
|
54 |-----------|------|-------------|---------|
|
|
55 | RAS Input | `-ir, --input_ras` | RAS scores TSV file | - |
|
|
56 | RAS Names | `-rn, --name` | Sample names for RAS data | - |
|
|
57 | Cell Class | `-cc, --cell_class` | Output cell class information | - |
|
|
58
|
|
59 ### Output Parameters
|
|
60
|
|
61 | Parameter | Flag | Description | Default |
|
|
62 |-----------|------|-------------|---------|
|
|
63 | Output Path | `-idop, --output_path` | Directory for constrained bounds | ras_to_bounds/ |
|
|
64 | Output Log | `-ol, --out_log` | Log file path | - |
|
|
65
|
|
66 ## Input Formats
|
|
67
|
|
68 ### RAS Scores File
|
|
69
|
|
70 Tab-separated format with reactions as rows and samples as columns:
|
|
71
|
|
72 ```
|
|
73 Reaction Sample1 Sample2 Sample3 Control1 Control2
|
|
74 R00001 1.25 0.85 1.42 1.05 0.98
|
|
75 R00002 0.65 1.35 0.72 1.15 1.08
|
|
76 R00003 2.15 2.05 0.45 0.95 1.12
|
|
77 ```
|
|
78
|
|
79 ### Custom Model File (Optional)
|
|
80
|
|
81 SBML format metabolic model:
|
|
82 - XML format (.xml, .sbml)
|
|
83 - Compressed formats supported (.xml.gz, .xml.zip, .xml.bz2)
|
|
84 - Must contain valid reaction, metabolite, and gene definitions
|
|
85
|
|
86 ### Custom Medium File (Optional)
|
|
87
|
|
88 Exchange reactions defining growth medium:
|
|
89
|
|
90 ```
|
|
91 reaction
|
|
92 EX_glc__D_e
|
|
93 EX_o2_e
|
|
94 EX_pi_e
|
|
95 EX_nh4_e
|
|
96 ```
|
|
97
|
|
98 ## Algorithm
|
|
99
|
|
100 ### Constraint Application
|
|
101
|
|
102 1. **Base Model Loading**: Load specified metabolic model and medium
|
|
103 2. **Bounds Extraction**: Extract original flux bounds for each reaction
|
|
104 3. **RAS Integration**: For each sample and reaction:
|
|
105 ```
|
|
106 if RAS > 1.0:
|
|
107 new_upper_bound = original_upper_bound * RAS
|
|
108 if RAS < 1.0:
|
|
109 new_lower_bound = original_lower_bound * RAS
|
|
110 ```
|
|
111 4. **Bounds Output**: Generate sample-specific bounds files
|
|
112
|
|
113 ### Scaling Rules
|
|
114
|
|
115 - **RAS > 1**: Upregulated reactions → increased flux capacity
|
|
116 - **RAS < 1**: Downregulated reactions → decreased flux capacity
|
|
117 - **RAS = 1**: No change from original bounds
|
|
118 - **Missing RAS**: Original bounds retained
|
|
119
|
|
120 ## Output Format
|
|
121
|
|
122 ### Bounds Files
|
|
123
|
|
124 One TSV file per sample with constrained bounds:
|
|
125
|
|
126 ```
|
|
127 # bounds_Sample1.tsv
|
|
128 Reaction lower_bound upper_bound
|
|
129 R00001 -1000 1250.5
|
|
130 R00002 -650.2 1000
|
|
131 R00003 -1000 2150.8
|
|
132 ```
|
|
133
|
|
134 ### Directory Structure
|
|
135
|
|
136 ```
|
|
137 ras_to_bounds/
|
|
138 ├── bounds_Sample1.tsv
|
|
139 ├── bounds_Sample2.tsv
|
|
140 ├── bounds_Sample3.tsv
|
|
141 ├── bounds_Control1.tsv
|
|
142 ├── bounds_Control2.tsv
|
|
143 └── constraints_log.txt
|
|
144 ```
|
|
145
|
|
146 ## Examples
|
|
147
|
|
148 ### Basic Usage with Built-in Model
|
|
149
|
|
150 ```bash
|
|
151 # Apply RAS constraints to ENGRO2 model
|
|
152 ras_to_bounds -td /opt/COBRAxy \
|
|
153 -ms ENGRO2 \
|
|
154 -ir ras_data.tsv \
|
|
155 -rs true \
|
|
156 -idop results/bounds/
|
|
157 ```
|
|
158
|
|
159 ### Custom Model and Medium
|
|
160
|
|
161 ```bash
|
|
162 # Use custom model with specific medium
|
|
163 ras_to_bounds -td /opt/COBRAxy \
|
|
164 -ms Custom \
|
|
165 -mo models/custom_model.xml \
|
|
166 -mn custom_model.xml \
|
|
167 -mes custom \
|
|
168 -meo media/minimal_medium.tsv \
|
|
169 -ir patient_ras.tsv \
|
|
170 -rs true \
|
|
171 -idop personalized_models/ \
|
|
172 -ol constraints.log
|
|
173 ```
|
|
174
|
|
175 ### Multiple Sample Processing
|
|
176
|
|
177 ```bash
|
|
178 # Process cohort data with sample classes
|
|
179 ras_to_bounds -td /opt/COBRAxy \
|
|
180 -ms ENGRO2 \
|
|
181 -ir cohort_ras_scores.tsv \
|
|
182 -rn "Patient1,Patient2,Patient3,Healthy1,Healthy2" \
|
|
183 -rs true \
|
|
184 -cc sample_classes.tsv \
|
|
185 -idop cohort_bounds/
|
|
186 ```
|
|
187
|
|
188 ## Built-in Models
|
|
189
|
|
190 ### ENGRO2
|
|
191 - **Species**: Homo sapiens
|
|
192 - **Scope**: Genome-scale reconstruction
|
|
193 - **Reactions**: ~2,000 reactions
|
|
194 - **Metabolites**: ~1,500 metabolites
|
|
195 - **Use Case**: General human metabolism
|
|
196
|
|
197 ### Custom Model Requirements
|
|
198 - Valid SBML format
|
|
199 - Consistent reaction/metabolite naming
|
|
200 - Proper compartment definitions
|
|
201 - Gene-protein-reaction associations
|
|
202
|
|
203 ## Medium Configurations
|
|
204
|
|
205 ### allOpen (Default)
|
|
206 - All exchange reactions unconstrained
|
|
207 - Maximum metabolic flexibility
|
|
208 - Suitable for exploratory analysis
|
|
209
|
|
210 ### Custom Medium
|
|
211 - User-defined nutrient availability
|
|
212 - Tissue-specific conditions
|
|
213 - Disease-specific constraints
|
|
214
|
|
215 ## Quality Control
|
|
216
|
|
217 ### Pre-processing Checks
|
|
218 - Verify RAS data completeness (recommend >80% reaction coverage)
|
|
219 - Check for extreme RAS values (>10 or <0.1 may indicate issues)
|
|
220 - Validate model consistency and solvability
|
|
221
|
|
222 ### Post-processing Validation
|
|
223 - Confirm bounds files generated for all samples
|
|
224 - Check constraint log for warnings
|
|
225 - Test model feasibility with sample bounds
|
|
226
|
|
227 ## Tips and Best Practices
|
|
228
|
|
229 ### RAS Data Preparation
|
|
230 - **Normalization**: Ensure RAS values are properly normalized (median ~1.0)
|
|
231 - **Filtering**: Remove reactions with consistently missing data
|
|
232 - **Validation**: Check RAS distributions across samples
|
|
233
|
|
234 ### Model Selection
|
|
235 - Use ENGRO2 for general human tissue analysis
|
|
236 - Consider custom models for specific organisms or tissues
|
|
237 - Validate model scope matches your biological question
|
|
238
|
|
239 ### Medium Configuration
|
|
240 - Match medium to experimental conditions
|
|
241 - Use minimal medium for growth requirement analysis
|
|
242 - Consider tissue-specific nutrient availability
|
|
243
|
|
244 ## Integration Workflow
|
|
245
|
|
246 ### Upstream Tools
|
|
247 - [RAS Generator](ras-generator.md) - Generate RAS scores from expression data
|
|
248
|
|
249 ### Downstream Tools
|
|
250 - [Flux Simulation](flux-simulation.md) - Sample fluxes using constrained bounds
|
|
251 - [MAREA](marea.md) - Statistical analysis of constraint effects
|
|
252
|
|
253 ### Typical Pipeline
|
|
254
|
|
255 ```bash
|
|
256 # 1. Generate RAS from expression data
|
|
257 ras_generator -td /opt/COBRAxy -in expression.tsv -ra ras.tsv
|
|
258
|
|
259 # 2. Apply RAS constraints to model bounds
|
|
260 ras_to_bounds -td /opt/COBRAxy -ms ENGRO2 -ir ras.tsv -rs true -idop bounds/
|
|
261
|
|
262 # 3. Sample fluxes with constraints
|
|
263 flux_simulation -td /opt/COBRAxy -ms ENGRO2 -in bounds/*.tsv -a CBS -idop fluxes/
|
|
264
|
|
265 # 4. Analyze and visualize results
|
|
266 marea -td /opt/COBRAxy -input_data fluxes/mean.tsv -choice_map ENGRO2 -idop maps/
|
|
267 ```
|
|
268
|
|
269 ## Troubleshooting
|
|
270
|
|
271 ### Common Issues
|
|
272
|
|
273 **No bounds files generated**
|
|
274 - Check RAS file format and sample names
|
|
275 - Verify model loading (check model path/format)
|
|
276 - Ensure sufficient disk space for output
|
|
277
|
|
278 **Model infeasibility after constraints**
|
|
279 - RAS values may be too restrictive
|
|
280 - Consider scaling factor adjustment
|
|
281 - Check medium compatibility with constraints
|
|
282
|
|
283 **Missing reactions in bounds**
|
|
284 - RAS data may not cover all model reactions
|
|
285 - Original bounds retained for missing reactions
|
|
286 - Consider reaction mapping validation
|
|
287
|
|
288 ### Error Messages
|
|
289
|
|
290 | Error | Cause | Solution |
|
|
291 |-------|-------|----------|
|
|
292 | "Model not found" | Invalid model path | Check model file location |
|
|
293 | "RAS file invalid" | Malformed TSV format | Verify file structure and encoding |
|
|
294 | "Infeasible solution" | Over-constrained model | Relax RAS scaling or medium constraints |
|
|
295
|
|
296 ### Performance Issues
|
|
297
|
|
298 **Slow processing**
|
|
299 - Large models may require significant memory
|
|
300 - Consider batch processing for many samples
|
|
301 - Monitor system resource usage
|
|
302
|
|
303 **Memory errors**
|
|
304 - Reduce model size or split processing
|
|
305 - Increase available system memory
|
|
306 - Use more efficient file formats
|
|
307
|
|
308 ## Advanced Usage
|
|
309
|
|
310 ### Batch Processing Script
|
|
311
|
|
312 ```bash
|
|
313 #!/bin/bash
|
|
314 # Process multiple RAS files
|
|
315 for ras_file in ras_data/*.tsv; do
|
|
316 sample_name=$(basename "$ras_file" .tsv)
|
|
317 ras_to_bounds -td /opt/COBRAxy \
|
|
318 -ms ENGRO2 \
|
|
319 -ir "$ras_file" \
|
|
320 -rs true \
|
|
321 -idop "bounds_$sample_name/"
|
|
322 done
|
|
323 ```
|
|
324
|
|
325 ### Custom Scaling Functions
|
|
326
|
|
327 For advanced users, RAS scaling can be customized by modifying the constraint application logic in the source code.
|
|
328
|
|
329 ## See Also
|
|
330
|
|
331 - [RAS Generator](ras-generator.md) - Generate input RAS data
|
|
332 - [Flux Simulation](flux-simulation.md) - Use constrained bounds for sampling
|
|
333 - [Model Setting](metabolic-model-setting.md) - Extract model components |