Databases (Python)#
geckopy objects in geckopy.databases.
Functions#
Function |
Summary |
|---|---|
Group rows by (kind, ec, substrate, organism) and write three TSVs. |
|
Loaded BRENDA tables. |
|
Raised when the BRENDA bulk JSON cannot be located or validated. |
|
Compute the molecular weight of a protein from its sequence. |
|
One ComplexPortal complex. |
|
Lists of metabolites to skip when writing DLKcat input. |
|
Download per-gene KEGG data for |
|
Download the KEGG phylogenetic distance file distributed with RAVEN. |
|
Download UniProt protein data for an organism and write a TSV. |
|
Return the path to the unpacked BRENDA JSON, extracting if needed. |
|
Extract the single JSON member from a BRENDA tarball. |
|
Download (once) the BRENDA files and return the folder that holds them. |
|
Populate |
|
Per-condition flux measurements with per-reaction exchange data. |
|
Download complex stoichiometries from EBI Complex Portal. |
|
Parsed kegg.tsv. Arrays are aligned: row i in every field |
|
Load BRENDA kcat, SA, and MW dumps from a folder. |
|
The BRENDA measurement table of a BRENDA folder. |
|
Parse a ComplexPortal JSON file into a list of entries. |
|
Load the two DLKcat ignore-list TSV files. |
|
Parse a GECKO |
|
Parse a kegg.tsv into a KeggDB. |
|
Parse a paxDB.tsv file and return a |
|
Load a KEGG phylogenetic distance struct from a MATLAB .mat file. |
|
Load (and optionally filter) absolute proteomics data. |
|
Parse a uniprot.tsv file into a UniprotDB. |
|
The metabolite's SMILES, whatever shape its annotation is in. |
|
Yield one |
|
KEGG phylogenetic distance structure. |
|
Pre-loaded proteomics data for f-factor and concentration filling. |
|
One measurement yielded by |
|
Return the hex sha256 digest of a file's contents. |
|
Parsed uniprot.tsv. Arrays are aligned: row i in every field |
Reference#
aggregate_and_write#
aggregate_and_write(rows: Iterable[Row], out_dir: str | Path, *, release: str, date: str | None=None)
Group rows by (kind, ec, substrate, organism) and write three TSVs.
For kcat and SA the snapshot keeps one wide row per triple with both max and median columns; for MW only the per-triple max is written.
Parameters
rowsIterable of
Rowfromparse_brenda_json.out_dirOutput directory for
kcat.tsv,sa.tsv,mw.tsv. Created if missing.releaseBRENDA release string, e.g.
"2026.1". Written into the header line of each TSV.dateISO date string for the header. Defaults to today.
Returns
dictMapping of
Kindto written path.
BrendaData#
Loaded BRENDA tables.
Each kcat / SA table is exposed as separate _max and _median
DataFrames built once at load time. Both views share the same row
set (one per (ec, substrate, organism) triple); they differ only in
which aggregation of the raw measurements fills the kcat
column. Choose between views via kcat_for / sa_for.
Attributes
kcat_max, kcat_medianDataFrames with columns
ec_code(str),substrate(str),organism(str),kcat(float, 1/s),n(Int64).sa_max, sa_medianSame shape, joined with MW to give an SA-derived kcat. Columns
ec_code,organism,kcat(float, 1/s),mw(float, g/mmol),n(Int64).
BrendaDownloadError#
Raised when the BRENDA bulk JSON cannot be located or validated.
calculate_mw#
calculate_mw(sequence: str)
Compute the molecular weight of a protein from its sequence.
Ported from GECKO MATLAB: src/geckomat/get_enzyme_data/calculateMW.m.
Each residue contributes its average mass; one water mass is added once (representing the H + OH at the peptide termini, equivalent to one un-eliminated water relative to N residues + N water masses).
Recognized amino acid codes (the sequence is uppercased first, so matching is case-insensitive):
ACDEFGHIKLMNPQRSTVWY - the 20 standard residues
BJOZUX - non-standard / ambiguous codes
Whitespace and digits are skipped silently. Any other unrecognized character is also skipped, but triggers one warning per call listing every distinct offending character.
Parameters
sequenceProtein sequence as a string. May contain whitespace, digits, and other non-letter characters; those are ignored.
Returns
floatMolecular weight in g/mol (Da). Returns
nanfor an empty/all-skipped sequence (no residues), so a missing sequence is not mistaken for an 18 Da "protein".
ComplexPortalEntry#
One ComplexPortal complex.
The JSON field name stochiometry (a typo in the original
ComplexPortal API) is renamed to stoichiometry here. The
field geneName is renamed to gene_names for Python
conventions. Both renames happen only on this in-memory object;
the JSON file itself is untouched.
DLKcatIgnoreLists#
Lists of metabolites to skip when writing DLKcat input.
Attributes
ignore_namesNormalized (lowercase, alphanumeric-only) metabolite names to skip entirely.
ignore_smilesSMILES strings to skip; matched as-is against
metabolite.annotation['smiles'].currency_pairsPairs of normalized metabolite names. When both halves of a pair appear in the same reaction, both are stripped from that reaction's substrates (unless removal would leave no substrates).
download_kegg#
download_kegg(kegg_id: str, out_path: str | Path, *, gene_id_field: str='kegg', session: requests.Session | None=None)
Download per-gene KEGG data for kegg_id and write to out_path.
Parameters
kegg_idKEGG organism code, e.g.
"sce".out_pathDestination CSV path (overwritten if it exists).
gene_id_fieldKEGG entry field to use as the gene matching key in col 2.
"kegg"(default) copies the bare KEGG gene ID fromENTRY. Other values name an alternative annotation line (e.g."OrderedLocus"), which is matched on the prefix.sessionOptional requests.Session for connection reuse and test injection. A new transient session is created if absent.
Returns
PathThe written
out_path.
Raises
RuntimeErrorIf the organism list cannot be retrieved or a KEGG request is rejected (e.g. an invalid organism code). Batches that come back with fewer entries than requested are not an error; the missing gene IDs are skipped with a debug log.
ValueErrorIf
gene_id_fieldis not present in any returned entry.
download_phyl_dist#
download_phyl_dist(out_path: str | Path, *, url: str=KEGG_PHYL_DIST_URL, session: requests.Session | None=None)
Download the KEGG phylogenetic distance file distributed with RAVEN.
fuzzy_kcat_matching uses it to pick the evolutionarily closest
organism when BRENDA has no entry for the model's own organism.
The file covers all KEGG organisms (~5 MB). It is written to a
temporary file next to out_path and only moved into place once
load_phyl_dist can read it, so a failed download never leaves
a partial file at out_path.
Parameters
out_pathDestination
.matpath (overwritten if it exists), typicallyadapter.get_phyl_dist_path().urlSource URL. Defaults to
keggPhylDist.matof RAVEN 3.0.0b1.sessionOptional requests.Session for connection reuse and test injection. A new transient session is created if absent.
Returns
PathThe written
out_path.
Raises
requests.HTTPErrorIf the download fails.
KeyErrorIf the downloaded file is not a
phylDistStruct.mat file.
download_uniprot#
download_uniprot(uniprot_id: str | int, out_path: str | Path, *, id_type: str='taxonomy_id', gene_id_field: str='gene_oln', reviewed: bool=True, session: requests.Session | None=None)
Download UniProt protein data for an organism and write a TSV.
Parameters
uniprot_idUniProt-side identifier whose meaning depends on
id_type. Forid_type='taxonomy_id'this is an NCBI taxonomy ID (e.g.559292for Saccharomyces cerevisiae S288C).out_pathDestination TSV path (overwritten if it exists).
id_typeUniProt query field for
uniprot_id. Default"taxonomy_id". MATLAB's adapter accepts the alias"taxonomy"; pass either.gene_id_fieldUniProt field that becomes the second column (the gene matching key). Default
"gene_oln"(Ordered Locus Names) works for most prokaryotes and budding yeast.reviewedIf True (default), restrict the query to reviewed (Swiss-Prot) entries.
sessionOptional
requests.Sessionfor connection reuse and test injection. A new transient session is used otherwise.
Returns
PathThe written
out_path.
Raises
RuntimeErrorIf the UniProt request fails after retries.
ensure_brenda_json#
ensure_brenda_json(cache_dir: str | Path, *, expected_sha256: str | None=None)
Return the path to the unpacked BRENDA JSON, extracting if needed.
Look-up order in cache_dir:
1. *.json already unpacked: return as-is.
2. *.json.tar.gz tarball: validate expected_sha256
(if given), extract the single JSON member, return its path.
3. Neither present: raise BrendaDownloadError with
instructions for manual download.
Parameters
cache_dirDirectory in which the user drops the BRENDA download. Created if missing.
expected_sha256If given, the tarball must hash to this value or the function raises
BrendaDownloadError. Ignored when only an unpacked.jsonis present.
Returns
PathAbsolute path to the unpacked BRENDA JSON.
extract_brenda_json#
extract_brenda_json(tarball_path: str | Path, dest_dir: str | Path)
Extract the single JSON member from a BRENDA tarball.
Parameters
tarball_pathPath to
brenda_<release>.json.tar.gz.dest_dirDirectory to extract the JSON into. The file is written under its name as stored inside the tarball.
Returns
PathPath to the extracted JSON file.
fetch_brenda_asset#
fetch_brenda_asset(files: Iterable[str]=TABLES)
Download (once) the BRENDA files and return the folder that holds them.
Parameters
filesFile names without
.gz(default:kcat.tsv,sa.tsv,mw.tsvandmeasurements.tsv); further files of the release aresequences.fasta,substrates.tsvandkcatCombineParams.tsv.
Returns
pathlib.PathThe cache folder with the files, decompressed.
find_met_smiles#
find_met_smiles(model: 'cobra.Model', *, cache_path: Optional[Path]=None)
Populate metabolite.annotation['smiles'] from PubChem.
Ported from GECKO MATLAB: src/geckomat/change_model/findMetSmiles.m.
For every metabolite in the model:
Skip if the name starts with
prot_(enzyme pseudometabolite).Skip if
annotation['smiles']is already set.Look up the metabolite name in the local TSV cache.
If still not found, query PubChem; cache the result.
The same metabolite name may appear on many cobra.Metabolite
instances (different compartments). Lookup is done once per unique
name and the SMILES is applied to every metabolite sharing that name.
Parameters
modelA cobra.Model. Mutated in place: each metabolite gains
annotation['smiles']when a SMILES is found.cache_pathPath to the SMILES cache TSV. If None, defaults to
model.adapter.params.path / "data" / "smilesDB.tsv"if the model is an EcModel with adapter; otherwise raises ValueError. The file is created if missing and appended to as new SMILES are downloaded.
FluxData#
Per-condition flux measurements with per-reaction exchange data.
Attributes
condsNames of the experimental conditions / samples.
p_totTotal protein content per condition, g/gDCW. Shape
(n_conds,).gr_rateMeasured growth rate per condition, 1/h. Shape
(n_conds,).exch_fluxesExchange flux per (condition, reaction), mmol/gDCW/h. Shape
(n_conds, n_rxns). NaN means "no measurement";+/-1000means unconstrained (used byapply_flux_data_constraints).exch_metsMetabolite names matching the columns of
exch_fluxes.exch_rxn_idsExchange reaction IDs in the model, matching the columns of
exch_fluxesandexch_mets.evotune_rmse_weightOptional per-condition weights for the evotune-kcat-tuning RMSE term.
Noneif the source file did not have theevotuneRMSEweightcolumn.sourceOptional per-condition free-text describing where the data came from.
Noneif the source file did not have asourcecolumn.
get_complex_data#
get_complex_data(taxonomic_id: Optional[int], *, write_to: Optional[Path]=None)
Download complex stoichiometries from EBI Complex Portal.
Ported from GECKO MATLAB: src/geckomat/change_model/getComplexData.m.
Taxonomic ID semantics:
A positive integer queries that organism only.
0queries all organisms (no species filter).Noneraises ValueError.
The response is post-processed to expand "complexes of complexes": when a Complex Portal entry references other complexes as subunits, those are flattened into one combined protein list with multiplied stoichiometries.
Parameters
taxonomic_idNCBI taxonomy ID for the organism, or 0 for all organisms.
write_toOptional path. If given, the data is also written as JSON (matching the MATLAB
ComplexPortal.jsonformat) to this path so subsequent runs can useload_complex_portal_json.
Returns
list of ComplexPortalEntryParsed and post-processed complexes.
Raises
ValueErrorIf
taxonomic_idis None.requests.HTTPErrorIf the API returns an unrecoverable error.
KeggDB#
Parsed kegg.tsv. Arrays are aligned: row i in every field
describes the same KEGG entry.
mw is in Da, matching the file column verbatim.
load_brenda_data#
load_brenda_data(folder: str | Path, *, filter_outlier_kcats: bool=True)
Load BRENDA kcat, SA, and MW dumps from a folder.
Ported from GECKO MATLAB: src/geckomat/get_enzyme_data/loadBRENDAdata.m.
Reads kcat.tsv, sa.tsv, mw.tsv from folder, splits
the kcat and SA wide tables into per-aggregation views, applies the
GECKO unit conversions, and joins SA + MW on EC + organism
(case-insensitive) to produce derived kcat tables.
Unit conventions:
KCAT: file values are in 1/s already; no scaling.
SA: file values in
[umol/min/mg]are multiplied by1/60to give[mmol/s/g].MW: file value in
[g/mol]is multiplied by1/1000to give[g/mmol].Derived kcat in the SA table is
SA * MW = [1/s].
Both kcat and SA are loaded as separate max and median views over
the raw measurements aggregated per (ec, substrate, organism)
triple, so a project can opt into median aggregation via
adapter.params.kcat_aggregate_brenda without regenerating the
snapshot. See docs/kcat_aggregation.md for the rationale.
Malformed lines (wrong number of fields, non-numeric value column)
are skipped with a logger.warning; the rest of the file is
parsed normally.
Parameters
folderDirectory containing all three BRENDA dump files.
filter_outlier_kcatsIf True (default), drop a row whose kcat is more than 4 orders of magnitude below the typical kcat of its EC before it can be matched to any reaction -- see
_filter_outlier_rowsfor the rationale and mechanism. Set False to reproduce the unfiltered 1.0-era behaviour.
Returns
BrendaDataBoth kcat views may be empty if the source files were empty or contained only malformed lines; both SA views may be empty if no SA row matched any MW row.
Raises
FileNotFoundErrorIf any of the three expected files is missing.
load_brenda_measurements#
load_brenda_measurements(folder: str | Path)
The BRENDA measurement table of a BRENDA folder.
Returns
pandas.DataFrameColumns as in the file (
ec,substrate,substrate_inchikey,organism,taxid,uniprot,seq_id,kcat,temperature,ph,pmid) pluslog10_kcat. The release line of the file (e.g.BRENDA release 2026.1) is inattrs["release"].
load_complex_portal_json#
load_complex_portal_json(path: str | Path)
Parse a ComplexPortal JSON file into a list of entries.
Parameters
pathPath to a ComplexPortal.json file. The file is expected to be a JSON array of complex objects with these fields:
complexID,name,specie,geneName,protID,stochiometry.
Returns
list of ComplexPortalEntry
:
Raises
FileNotFoundErrorIf the file does not exist.
ValueErrorIf the file is not valid JSON or any entry is malformed.
load_dlkcat_ignore_lists#
load_dlkcat_ignore_lists(project_data_folder: Path | str | None=None)
Load the two DLKcat ignore-list TSV files.
Looks for DLKcatIgnoreMets.tsv and DLKcatCurrencyMets.tsv
in project_data_folder first; falls back to the defaults
shipped inside geckopy.data for any file missing from the
project folder.
The two files are independent: the project folder may override just one of them.
Ported from GECKO MATLAB: the inline file-loading parts of src/geckomat/gather_kcats/writeDLKcatInput.m.
Parameters
project_data_folderProject's
data/folder, typicallyadapter.params.path / "data". IfNone(or the file is absent there), the geckopy-shipped default is used.
Returns
DLKcatIgnoreListsNormalized ignore lists ready to feed to
write_dlkcat_input.
load_flux_data#
load_flux_data(path: str | Path)
Parse a GECKO fluxData.tsv into a FluxData.
File format (tab-delimited, one header row):
condition Ptot grRate <met1> (<rxn1>) <met2> (<rxn2>) ...
c1 0.5 0.4 -10.0 5.0 ...
c2 0.6 0.5 -8.5 4.2 ...
Optional extra columns (in any position):
evotuneRMSEweight(float): weights for evotune kcat tuning.source(str): free-text describing the data origin.
Both columns are dropped from the matrix and surfaced on the
returned FluxData as evotune_rmse_weight and source.
Ported from GECKO MATLAB: src/geckomat/utilities/loadFluxData.m.
Parameters
pathPath to the TSV file.
Returns
FluxData
:
Raises
FileNotFoundErrorIf
pathdoes not exist.ValueErrorIf the file has no header row or no exchange columns.
load_kegg_tsv#
load_kegg_tsv(path: str | Path, *, kegg_id: str | None=None, gene_id_field: str='kegg', auto_download: bool=True)
Parse a kegg.tsv into a KeggDB.
If path does not exist and kegg_id is given and
auto_download is True, fetches the data via download_kegg
first, then parses.
Parameters
pathPath to kegg.tsv. May not exist if
kegg_idtriggers an auto-download.kegg_idKEGG organism code (e.g.
"sce"). Required for auto-download; otherwise unused.gene_id_fieldKEGG entry field to use as the gene matching key. Default
"kegg"uses column 2, the bare KEGG gene ID.auto_downloadIf True (default) and
pathis missing, triggerdownload_kegg(kegg_id, path, gene_id_field=...)before parsing. Set to False to keep the loader pure (e.g. tests).
Returns
KeggDB
:
Raises
FileNotFoundErrorIf
pathdoes not exist and eitherauto_downloadis False orkegg_idis None.ValueErrorIf the file has malformed rows.
load_pax_db#
load_pax_db(path: str | Path, uniprot_db: 'UniprotDB')
Parse a paxDB.tsv file and return a ProtData.
The file is tab-delimited with one or more #-prefixed header
lines and three data columns: internal_id, gene_id,
level. Gene IDs are stripped of any leading
<digits>. modifier (paxDB's internal species/version prefix)
before matching against uniprot_db.genes. Rows whose gene
name is not in the UniProt DB are dropped silently.
Abundance for each surviving row is computed as
level * uniprot_db.mw[matched_index]. The returned
abundances array is 1-D since paxDB files contain a single
column of levels; callers can stack multiple ProtData objects
column-wise to form a 2-D array if they want multi-sample
averaging.
Ported from GECKO MATLAB: the inline paxDB-parsing block of src/geckomat/limit_proteins/calculateFfactor.m.
Parameters
pathPath to
paxDB.tsv.uniprot_dbLoaded UniProt database, used to resolve gene names to UniProt IDs and look up molecular weights.
Returns
ProtData
:
Raises
FileNotFoundErrorIf
pathdoes not exist.
load_phyl_dist#
load_phyl_dist(path: str | Path)
Load a KEGG phylogenetic distance struct from a MATLAB .mat file.
The .mat file is expected to contain a single variable
phylDistStruct with fields names (cell of strings) and
distMat (N x N numeric matrix). The MATLAB ids field
is ignored: fuzzy_kcat_matching never uses it.
Names are stripped of any trailing parenthetical comment, matching
MATLAB's regexprep(names, '\s*\(.*', ''). The resulting
cleaned names populate two pre-computed lookup maps for fast
organism resolution at match time:
name_to_index: lowercased full name -> first matching index.genus_to_indices: lowercased genus (first whitespace token) -> all matching indices.
Ported from GECKO MATLAB (inline KEGG_struct helper in
src/geckomat/gather_kcats/fuzzyKcatMatching.m).
Parameters
pathPath to
PhylDist.mat.
Returns
PhylDistPopulated dataclass.
Raises
FileNotFoundErrorIf
pathdoes not exist.KeyErrorIf the .mat file does not contain a
phylDistStructvariable with bothnamesanddistMatfields.
load_prot_data#
load_prot_data(source: Union[str, Path, ProtData], repl_per_cond: list[int], *, filter_data: bool=True, min_val: float=0.0, max_rsd: float=1.0, max_missing: Union[float, list[float]]=2.0 / 3.0, cut_lowest: float=5.0, add_stdevs: float=1.0)
Load (and optionally filter) absolute proteomics data.
The input file is tab-delimited with one header row and columns
uniprot, repl1, repl2, ..., replN where the replicate columns
are concatenated across conditions in the order given by
repl_per_cond (e.g. [3, 2] -> first three columns are
condition 0's triplicate, next two are condition 1's duplicate).
Levels are in mg/gDCW.
For each condition, the per-replicate measurements are reduced to a single value per protein:
filter_data=Trueapplies the following pipeline (matching MATLAB):maxMissing: rows with fewer than
max_missing * n_replicatesstrictly-positive measurements have all replicates set to NaN.RSD: rows whose
std/mean > max_rsdare set to NaN.Collapse: per-row
mean + add_stdevs * std.minVal: collapsed values below
min_val-> NaN.Bottom cut: among non-NaN values, the lowest
cut_lowestpercent are set to NaN.
filter_data=Falsejust takes the per-row mean (NaN-safe).
Rows that end up NaN in every condition are dropped, along with their UniProt IDs.
Ported from GECKO MATLAB: src/geckomat/utilities/loadProtData.m.
Parameters
sourcePath to the TSV file, OR a pre-loaded
ProtDatato re-filter (matching MATLAB).repl_per_condNumber of replicates per condition. The total of these must equal the number of replicate columns in the file.
filter_dataWhether to apply the filtering pipeline. When False, every other parameter is unused.
min_valMinimum collapsed value to keep.
max_rsdMaximum relative standard deviation per row.
max_missingMinimum fraction of strictly-positive replicates required. May be a single float (applied to all conditions) or a list of length
len(repl_per_cond).cut_lowestPercentage of lowest collapsed values to discard per condition.
add_stdevsNumber of standard deviations to add to the per-row mean when collapsing.
Returns
ProtDataabundancesshape(n_proteins_kept, n_conditions).
Raises
FileNotFoundErrorIf a path is given that does not exist.
ValueErrorIf
repl_per_condis empty, the file has no replicate columns, or the column count does not match.
load_uniprot_tsv#
load_uniprot_tsv(path: str | Path, *, split_gene_cells: bool=False, uniprot_id: str | int | None=None, id_type: str='taxonomy_id', gene_id_field: str='gene_oln', reviewed: bool=True, auto_download: bool=True)
Parse a uniprot.tsv file into a UniprotDB.
If path does not exist and uniprot_id is given and
auto_download is True, download_uniprot is invoked first.
Parameters
pathPath to uniprot.tsv. May not exist if
uniprot_idtriggers an auto-download.split_gene_cellsIf True, rows whose Gene Names cell contains whitespace-separated multiple names are expanded into one row per gene name. All other fields (Entry, EC, MW, sequence) are duplicated across the expanded rows. This matters for organisms where the UniProt
gene_olnfield returns multiple space-separated ORF names per entry: with the default of False, the cell is stored verbatim (including any embedded whitespace), so an exact-match lookup against a single ORF name silently misses those genes.uniprot_idUniProt-side identifier (e.g. NCBI taxonomy ID). Required for auto-download; otherwise unused.
id_typeUniProt query field type for
uniprot_id. Default"taxonomy_id".gene_id_fieldUniProt field that becomes the Gene Names column. Default
"gene_oln".reviewedIf True (default), restrict the auto-download query to reviewed (Swiss-Prot) entries.
auto_downloadIf True (default) and
pathis missing, triggerdownload_uniprotbefore parsing. Set to False to keep the loader pure (e.g. tests).
Returns
UniprotDBParsed database. MW is in Da.
Raises
FileNotFoundErrorIf
pathdoes not exist and eitherauto_downloadis False oruniprot_idis None.ValueErrorIf the file has duplicate Entry values, or if the header does not have at least 5 tab-delimited fields.
Notes
Empty cells (common for EC number and Sequence) become empty
strings, matching MATLAB textscan with %q behavior.
Duplicate entries raise, matching MATLAB's dispEM failure mode.
met_smiles#
met_smiles(metabolite)
The metabolite's SMILES, whatever shape its annotation is in.
cobra stores an annotation value as the object it was assigned, and
returns a list for a model read back from a file: a metabolite
annotated in memory by find_met_smiles carries "CCO",
and the same metabolite after a save/load round trip carries
["CCO"]. Readers that assume a string get a list that compares
equal to nothing and is not hashable.
Returns the first non-empty entry, or "" when there is none.
parse_brenda_json#
parse_brenda_json(path: str | Path)
Yield one Row per (kind, EC, substrate, organism) measurement.
Range values like "0.1-2.5 {NADH}" collapse to their upper
bound. Mutant-flagged rows, the -999 missing-value marker, kcat values
above the physical ceiling, and the spontaneous pseudo-EC are
skipped. Measurements fan out across proteins[] so one input
row may produce several output rows (one per organism).
Parameters
pathPath to the unpacked BRENDA bulk JSON file (Release 2026.1 or later, schema version 2.0.0).
Yields
Row
:
PhylDist#
KEGG phylogenetic distance structure.
Attributes
namesKEGG organism names, with any trailing parenthetical comment stripped. Stored in original case.
dist_matrixN x Npairwise evolutionary distance matrix.dist_matrix[i, j]is the distance betweennames[i]andnames[j].name_to_indexLowercased name -> index in
names. First occurrence wins for duplicate names (matching MATLABfind(..., 1)).genus_to_indicesLowercased genus (first whitespace-delimited word of the name) -> list of indices in
nameswhose genus matches.
ProtData#
Pre-loaded proteomics data for f-factor and concentration filling.
Attributes
uniprot_idsUniProt IDs (one per protein measurement).
abundancesNumeric abundances. Shape
(n_proteins,)for a single sample, or(n_proteins, n_samples)if multiple datasets were merged. Units are arbitrary (only ratios are used).
Row#
One measurement yielded by parse_brenda_json.
sha256_of#
sha256_of(path: str | Path, *, chunk_size: int=65536)
Return the hex sha256 digest of a file's contents.
UniprotDB#
Parsed uniprot.tsv. Arrays are aligned: row i in every field
describes the same database entry (or gene-name row when split).
mw is in Da, matching the Mass column of the TSV verbatim.