Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

ModelSEED CoreApi

Scott Devoid edited this page May 4, 2012 · 1 revision

getBiochemistry Definition: {} = coreApi->getBiochemistry(string:biochemistry uuid); Description: Return the biochemistry data structure with the reactions (including reagents), compounds, and media. Currently uses Rose::DB, but is pretty slow. Might use DBI and raw SQL to speed up eventually Returns:

Utility method used to join rows in a many-to-many relationship.

Expects $row->[0] to be the id to join on.

Ex.

Turns:
$cols = ['Name', 'Compound', 'Direction']

$rows = [
  ['rxn00001', 'reagent 1', 'cpd00001', '=>'],
  ['rxn00001', 'reagent 2', 'cpd00002', '<='],
  ['rxn00002', 'reagent 3', 'cpd00003', '=>']
]

$type = 'Reagent'

Into:
{
  'rxn00001' => [
                  {
                    'type       => 'Reagent',
                    'attributes => {
                      'Name'      => 'reagent 1',
                      'Compound'  => 'cpd00001',
                      'Direction' => '=>'
                    }
                  },
                  {
                    'type'       => 'Reagent',
                    'attributes' => {
                      'Name'      => 'reagent 2',
                      'Compound'  => 'cpd00002',
                      'Direction' => '<='
                    }
                  }
                ],
  'rxn00002' => [
                  {
                    'type'       => 'Reagent',
                    'attributes' => {
                      'Name'      => 'reagent 3',
                      'Compound'  => 'cpd00003',
                      'Direction' => '=>'
                    }
                  }
                ]
}

Query looks like: [ ['name', 'like', '%atp%'], ['locked', '0'] ]

You can specify the comparison operator (=, >, <=, like, etc...),
  or it will use '=' by default.

Returns string of SQL like:
  "name like '%atp% AND locked = '0'"

Note: does NOT add the WHERE clause