Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chado Buddy Documentation #89

Open
dsenalik opened this issue Jul 23, 2024 · 0 comments · May be fixed by #90
Open

Chado Buddy Documentation #89

dsenalik opened this issue Jul 23, 2024 · 0 comments · May be fixed by #90

Comments

@dsenalik
Copy link
Contributor

dsenalik commented Jul 23, 2024

This is a place for notes and about Chado Buddies for use in developing documentation from PR tripal/tripal#1844

Branch: 89-chado-buddy

One of the simplest cases is working with the chado db table. The db and dbxref tables are handled by the ChadoDbxrefBuddy class

To use it, you will first get a connection to the Buddy service

$buddy_service = \Drupal::service('tripal_chado.chado_buddy');

Then you create an instance of whatever buddy you want to use, for example:

$buddy_instance = $buddy_service->createInstance('chado_dbxref_buddy', []);

Each buddy instance will have various functions to get, set, or update values.
This table summarizes the functions available

chado table: db dbxref cv cvterm # arrays
lookup getDb() getDbxref() getCv() getCvterm() 1
insert insertDb() insertDbxref() insertCv() insertCvterm() 1
update updateDb() updateDbxref() updateCv() updateCvterm() 2
upsert upsertDb() upsertDbxref() upsertCv() upsertCvterm() 1
associate - associateDbxref() - associateCvterm() na

For update functions, there are two arrays, the first contains the new values, the second contains the query values (conditions)

The array values for the db functions can contain the following keys. These directly correspond to columns in the chado.db table.
db_name must be used as an alias for name to prevent ambiguity for cv functions.

table table column required for insert
db db_id no
db name (db_name)* yes
db description (db_description)* no
db urlprefix no
db url no

The array values for the dbxref functions can contain the following keys. These directly correspond to columns in either the chado.dbxref or chado.db tables. Asterisk notes when key differs from column name to prevent ambiguity.
db_name must be used as an alias for name to prevent ambiguity for cv functions.

table table column required for insert
dbxref dbxref_id only used for query
dbxref accession yes
dbxref version no
dbxref description (dbxref_description)* no
db db_id yes, but either db_id or name or db_name required
db name (db_name)* see above
db description (db_description)* no
db urlprefix no
db url no

The array values for the cv functions can contain the following keys. These directly correspond to columns in the chado.cv table. Asterisk notes when key differs from column name to prevent ambiguity.
cv_name must be used as an alias for name to prevent ambiguity for db functions.

table table column required for insert
cv cv_id no
cv name (cv_name)* yes
cv urlprefix no
cv url no

The array values for the cvterm functions can contain the following keys. These directly correspond to columns in either the chado.cvterm, chado.cv, chado.dbxref, or chado.db tables. Asterisk notes when key differs from column name to prevent ambiguity.
db_name must be used as an alias for name to prevent ambiguity for db functions.

table table column required for insert
cvterm cvterm_id only used for query
cvterm cv_id yes but can instead use cv_name
cvterm dbxref_id yes but can instead use accession + (db_id or db_name)
cvterm name (cvterm_name)* yes
cvterm definition (cvterm_definition)* no
cvterm is_obsolete no
cvterm is_relationshiptype no
cv cv_id no
cv name (cv_name)* yes
cv definition (cv_definition)* no
dbxref dbxref_id only if using an existing dbxref
dbxref accession yes but can instead use existing dbxref_id
dbxref version no
dbxref description (dbxref_description)* no
db db_id yes, but either db_id or name or db_name required, and only if adding a new dbxref
db name (db_name)* see above
db description (db_description)* no
db urlprefix no
db url no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant