Tripal: Tripal Chado Deprecate API functions

Created on 9 Apr 2018  路  11Comments  路  Source: tripal/tripal

As we write the API docs it's become apparent that the naming conventions in the Tripal Chado api docs are not consistent, there is a mix of tripal, tripal_chado, and chado.

The suggestion is to change all the names to chado_function_name and deprecate the old names.

For example:
function tripal_get_publication would become function chado_get_publication and tripal_get_publication would end up in a tripal_chado.DEPRECATED.api.inc pointing to the new chado_get_publication, something like this:
function tripal_get_publication($identifiers, $options = array()) { chado_get_publication($identifiers, $options); }

Thoughts are welcome!

discussion tripal-7.x-3.x

Most helpful comment

tripal_chado.cv.inc

  • [x] tripal_chado_publish_records --> chado_publish_records
  • [x] tripal_get_chado_tokens --> chado_get_chado_tokens
  • [x] tripal_replace_chado_tokens --> chado_replace_chado_tokens

tripal_chado.migrate.api.inc

  • [x] tripal_chado_migrate_tripal_content_type -- > chado_migrate_tripal_content_type

tripal_chado.mviews.api.inc

  • [x] tripal_add_mview --> chado_add_mview
  • [x] tripal_edit_mview --> chado_edit_mview
  • [x] tripal_get_mview_id --> chado_get_mview_id
  • [x] tripal_refresh_mview --> chado_refresh_mview
  • [x] tripal_get_mviews --> chado_get_mviews
  • [x] tripal_delete_mview --> chado_delete_mview
  • [x] tripal_populate_mview --> chado_populate_mview

tripal_chado.query.api.inc

  • [x] tripal_get_schema_name --> chado_get_schema_name
  • [x] hook_tripal_get_schema_name_alter --> hook_chado_get_schema_name_alter

tripal_chado.semweb.api.inc

  • [x] tripal_add_chado_semweb_table --> chado_add_chado_semweb_table
  • [x] tripal_associate_chado_semweb_term --> chado_associate_chado_semweb_term
  • [x] tripal_get_chado_semweb_term --> chado_get_chado_semweb_term
  • [x] tripal_format_chado_semweb_term --> chado_format_chado_semweb_term
  • [x] tripal_get_chado_semweb_column --> chado_get_chado_semweb_column

All 11 comments

I like changing all API functions in the tripal_chado module to have just a 'chado_' prefix as opposed to 'tripal_chado' as the prefix as it's shorter and I think a namespace that probably won't ever have a conflict...

Is this specific to the API functions carried over from Tripal2 or does it include new API functions in Tripal Chado?

When we last went through making API functions consistent, we went with

  • tripal_[verb]_* for general Tripal API functions
  • chado_[verb]_* for general Chado API functions
  • tripal_chado_[verb]_* for API functions in specific modules (e.g. publication, organism, etc.)

So while it looks inconsistent now, that's because it has all been lumped together. There is a reason to it ;-)

That said, now that they are all lumped together in the single Tripal Chado module, I think I'm content condensing the tripal_chado_[verb]_* to chado_[verb]_*.

What are the tripal_[verb]_* functions in tripal chado? We should be careful of these...

I'm a bit confused now. Most of the methods in the tripal_chado/api/module folder all start with tripal_[verb]_* instead of tripal_chado_[verb]_*.

Excluding those files the tripal_[verb]_* are:

tripal_chado.cv.inc

tripal_replace_chado_tokens

tripal_chado.mviews.api.inc

tripal_edit_mview
tripal_get_mview_id
tripal_refresh_mview
tripal_get_mviews
tripal_delete_mview
tripal_populate_mview

tripal_chado.query.api.inc

hook_tripal_get_schema_name_alter

tripal_chado.semweb.api.inc

tripal_associate_chado_semweb_term
tripal_get_chado_semweb_term
tripal_format_chado_semweb_term
tripal_get_chado_semweb_column

I suspect that the tripal_chado_[verb]_* may be in the legacy folders and are now deprecated.

Here is a suggestion for API documentation naming

| Module Type | Naming Scheme | Notes |
| ------------- |-------------| -----|
| Tripal Core Modules | tripal_[verb]_* | This includes tripal, tripal_ds, tripal_bulk_loader, tripal_ws, etc. modules. |
| Tripal Chado | chado_[verb]_* | For backwards compatibility we will keep Chado API calls without a 'tripal' prefix for all API functions in the tripal_chado module. This will be used for all API functions in the tripal_chado module. |
| Tripal Storage Modules | tripal_[service]_[verb]_* | For all future Storage API (other than Chado) those will have a 'tripal' prefix. The [service] tag would be the name of the storage service (e.g. 'neo4j', 'mongodb', etc.)|
| Tripal Extension Modules | [module_name]_[verb]_* | Extension modules authors are encouraged to name their modules with a 'tripal' prefix, thus API function calls should also begin with tripal in that case. | |

I like your suggested naming @spficklin.

At first I was hesitant to change the current tripal_[verb]_ functions in tripal chado... But after looking at @shawnawsu list above, I agree that all those functions should be chado_[verb]_ to reduce conflict with similar support for alternate storage backends.

tripal_chado.cv.inc

  • [x] tripal_chado_publish_records --> chado_publish_records
  • [x] tripal_get_chado_tokens --> chado_get_chado_tokens
  • [x] tripal_replace_chado_tokens --> chado_replace_chado_tokens

tripal_chado.migrate.api.inc

  • [x] tripal_chado_migrate_tripal_content_type -- > chado_migrate_tripal_content_type

tripal_chado.mviews.api.inc

  • [x] tripal_add_mview --> chado_add_mview
  • [x] tripal_edit_mview --> chado_edit_mview
  • [x] tripal_get_mview_id --> chado_get_mview_id
  • [x] tripal_refresh_mview --> chado_refresh_mview
  • [x] tripal_get_mviews --> chado_get_mviews
  • [x] tripal_delete_mview --> chado_delete_mview
  • [x] tripal_populate_mview --> chado_populate_mview

tripal_chado.query.api.inc

  • [x] tripal_get_schema_name --> chado_get_schema_name
  • [x] hook_tripal_get_schema_name_alter --> hook_chado_get_schema_name_alter

tripal_chado.semweb.api.inc

  • [x] tripal_add_chado_semweb_table --> chado_add_chado_semweb_table
  • [x] tripal_associate_chado_semweb_term --> chado_associate_chado_semweb_term
  • [x] tripal_get_chado_semweb_term --> chado_get_chado_semweb_term
  • [x] tripal_format_chado_semweb_term --> chado_format_chado_semweb_term
  • [x] tripal_get_chado_semweb_column --> chado_get_chado_semweb_column

Looks good! My only comment is: do you think we need the double chado in some of the names (e.g. chado_get_chado_tokens)? I think the fact that they are specific to chado is implied by the first chado making the second one redundant.

I would suggest,

- tripal_get_chado_tokens --> chado_get_chado_tokens --> chado_get_tokens
- tripal_replace_chado_tokens --> chado_replace_chado_tokens --> chado_replace_tokens
- tripal_add_chado_semweb_table --> chado_add_chado_semweb_table --> chado_add_semweb_table
- tripal_associate_chado_semweb_term --> chado_associate_chado_semweb_term --> chado_associate_semweb_term
- tripal_get_chado_semweb_term --> chado_get_chado_semweb_term --> chado_get_semweb_term
- tripal_format_chado_semweb_term --> chado_format_chado_semweb_term --> chado_format_semweb_term
- tripal_get_chado_semweb_column --> chado_get_chado_semweb_column --> chado_get_semweb_column

Thoughts? @spficklin do you think that looses too much info in favor of being succinct?

Yes, I agree, let's take out the double chado.

Ok, I've made these changes:

  • [x] chado_get_chado_tokens --> chado_get_tokens
  • [x] chado_replace_chado_tokens --> chado_replace_tokens
  • [x] chado_add_chado_semweb_table --> chado_add_semweb_table
  • [x] chado_associate_chado_semweb_term --> chado_associate_semweb_term
  • [x] chado_get_chado_semweb_term --> chado_get_semweb_term
  • [x] chado_format_chado_semweb_term --> chado_format_semweb_term
  • [x] chado_get_chado_semweb_column --> chado_get_semweb_column

Changes in the tripal_chado.module.DEPRECATED.api.inc:

tripal_chado.analysis.api.inc

  • [x] tripal_get_analysis --> chado_get_analysis
  • [x] tripal_get_analysis_select_options --> chado_get_analysis_select_options

tripal_chado.contact.api.inc

  • [x] tripal_insert_contact --> chado_insert_contact
  • [x] tripal_autocomplete_contact --> chado_autocomplete_contact

tripal_chado.cv.api.inc

  • [x] tripal_get_cv --> chado_get_cv
  • [x] tripal_get_cv_select_options --> chado_get_cv_select_options
  • [x] tripal_get_cvterm --> chado_get_cvterm
  • [x] tripal_get_cvterm_select_options --> chado_get_cvterm_select_options
  • [x] tripal_update_cvtermpath --> chado_update_cvtermpath
  • [x] tripal_update_cvtermpath_root_loop --> chado_update_cvtermpath_root_loop
  • [x] tripal_update_cvtermpath_loop --> chado_update_cvtermpath_loop
  • [x] tripal_update_cvtermpath_loop_increment --> chado_update_cvtermpath_loop_increment
  • [x] tripal_insert_cv --> chado_insert_cv
  • [x] tripal_insert_cvterm --> chado_insert_cvterm
  • [x] tripal_submit_obo_job --> chado_submit_obo_job
  • [x] tripal_insert_obo --> chado_insert_obo
  • [x] tripal_get_obo --> chado_get_obo
  • [x] tripal_autocomplete_cv --> chado_autocomplete_cv
  • [x] tripal_autocomplete_cvterm --> chado_autocomplete_cvterm
  • [x] tripal_associate_cvterm --> chado_associate_cvterm

tripal_chado.db.api.inc

  • [x] tripal_get_db --> chado_get_db
  • [x] tripal_get_db_select_options --> chado_get_db_select_options
  • [x] tripal_get_dbxref --> chado_get_dbxref
  • [x] tripal_get_dbxref_url --> chado_get_dbxref_url
  • [x] tripal_insert_db --> chado_insert_db
  • [x] tripal_insert_dbxref --> chado_insert_dbxref
  • [x] tripal_associate_dbxref --> chado_associate_dbxref
  • [x] tripal_autocomplete_dbxref --> chado_autocomplete_dbxref

tripal_chado.feature.api.inc

  • [x] tripal_autocomplete_feature --> chado_autocomplete_feature
  • [x] tripal_reverse_compliment_sequence --> chado_reverse_compliment_sequence
  • [x] tripal_get_feature_sequences --> chado_get_feature_sequences
  • [x] tripal_get_bulk_feature_sequences --> chado_get_bulk_feature_sequences
  • [x] tripal_get_fasta_defline --> chado_get_fasta_defline
  • [x] tripal_get_location_string --> chado_get_location_string
  • [x] tripal_get_feature_relationships --> chado_get_feature_relationships
  • [x] _tripal_feature_load_relationships --> _chado_feature_load_relationships
  • [x] _tripal_feature_get_aggregate_relationships --> _chado_feature_get_aggregate_relationships

tripal_chado.organism.api.inc

  • [x] tripal_get_organism --> chado_get_organism
  • [x] tripal_get_organism_scientific_name --> chado_get_organism_scientific_name
  • [x] tripal_get_organism_select_options --> chado_get_organism_select_options
  • [x] tripal_get_organism_image_url --> chado_get_organism_image_url
  • [x] tripal_autocomplete_organism --> chado_autocomplete_organism
  • [x] tripal_abbreviate_infraspecific_rank --> chado_abbreviate_infraspecific_rank

tripal_chado.phylotree.api.inc

  • [x] tripal_validate_phylotree --> chado_validate_phylotree
  • [x] tripal_insert_phylotree --> chado_insert_phylotree
  • [x] tripal_update_phylotree --> chado_update_phylotree
  • [x] tripal_delete_phylotree --> chado_delete_phylotree
  • [x] tripal_assign_phylogeny_tree_indices --> chado_assign_phylogeny_tree_indices
  • [x] tripal_phylogeny_import_tree --> chado_phylogeny_import_tree
  • [x] tripal_phylogeny_get_node_types_vocab --> chado_phylogeny_get_node_types_vocab
  • [x] tripal_phylogeny_import_tree_file --> chado_phylogeny_import_tree_file

tripal_chado.pub.api.inc

  • [x] tripal_get_publication --> chado_get_publication
  • [x] tripal_publication_exists --> chado_publication_exists
  • [x] tripal_autocomplete_pub --> chado_autocomplete_pub
  • [x] tripal_import_pub_by_dbxref --> chado_import_pub_by_dbxref
  • [x] tripal_execute_active_pub_importers --> chado_execute_active_pub_importers
  • [x] tripal_reimport_publications --> chado_reimport_publications
  • [x] tripal_pub_create_citations --> chado_pub_create_citations
  • [x] tripal_pub_create_citation --> chado_pub_create_citation
  • [x] tripal_get_minimal_pub_info --> chado_get_minimal_pub_info

tripal_chado.stock.api.inc

  • [x] tripal_get_stock --> chado_get_stock
  • [x] tripal_get_multiple_stocks --> chado_get_multiple_stocks
Was this page helpful?
0 / 5 - 0 ratings

Related issues

taytayp picture taytayp  路  6Comments

spficklin picture spficklin  路  7Comments

Ferrisx4 picture Ferrisx4  路  6Comments

kyrenya picture kyrenya  路  6Comments

bradfordcondon picture bradfordcondon  路  11Comments