Mercurial > repos > bimib > cobraxy
comparison COBRAxy/utils/general_utils.py @ 341:fe87d6fd7884 draft
Uploaded
| author | luca_milaz |
|---|---|
| date | Thu, 04 Sep 2025 13:03:21 +0000 |
| parents | da4f5f4a9046 |
| children | 03a7ba63813f |
comparison
equal
deleted
inserted
replaced
| 340:da4f5f4a9046 | 341:fe87d6fd7884 |
|---|---|
| 604 return cobra.io.read_sbml_model(FilePath(f"{self.name}", FileFormat.XML, prefix = f"{toolDir}/local/models/").show()) | 604 return cobra.io.read_sbml_model(FilePath(f"{self.name}", FileFormat.XML, prefix = f"{toolDir}/local/models/").show()) |
| 605 | 605 |
| 606 def load_custom_model(self, file_path :FilePath, ext :Optional[FileFormat] = None) -> cobra.Model: | 606 def load_custom_model(self, file_path :FilePath, ext :Optional[FileFormat] = None) -> cobra.Model: |
| 607 ext = ext if ext else file_path.ext | 607 ext = ext if ext else file_path.ext |
| 608 try: | 608 try: |
| 609 if ext in FileFormat.XML: | 609 if str(ext) in FileFormat.XML.value: |
| 610 return cobra.io.read_sbml_model(file_path.show()) | 610 return cobra.io.read_sbml_model(file_path.show()) |
| 611 | 611 |
| 612 if ext in FileFormat.JSON: | 612 if str(ext) in FileFormat.JSON.value: |
| 613 # Compressed files are not automatically handled by cobra | 613 # Compressed files are not automatically handled by cobra |
| 614 if(ext == "json"): | 614 if(ext == "json"): |
| 615 return cobra.io.load_json_model(file_path.show()) | 615 return cobra.io.load_json_model(file_path.show()) |
| 616 else: | 616 else: |
| 617 return self.extract_json_model(file_path, ext) | 617 return self.extract_json_model(file_path, ext) |
