Skip to content

Commit

Permalink
Merge pull request #1254 from dsenalik/1252-tv3-get_organism_select
Browse files Browse the repository at this point in the history
1252 tv3 get organism select
  • Loading branch information
spficklin committed Feb 25, 2022
2 parents c789988 + 0882cd6 commit 0090f46
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tripal_chado/api/modules/tripal_chado.organism.api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ function chado_get_organism_scientific_name($organism) {
$rank = $organism->type_id->name;
}
}
// For db query where we explicitly supply infraspecific_type
elseif (property_exists($organism, 'infraspecific_type')) {
$rank = $organism->infraspecific_type;
}
else {
$rank_term = chado_get_cvterm(['cvterm_id' => $organism->type_id]);
if ($rank_term) {
Expand Down Expand Up @@ -220,9 +224,10 @@ function chado_get_organism_select_options($syncd_only = TRUE) {
$csql = "SELECT * FROM {organism} ORDER BY genus, species";
// if present in this site's version of chado, include infraspecific nomenclature in sorting
if (chado_column_exists('organism', 'infraspecific_name')) {
$csql .= ", REPLACE ((SELECT name FROM {cvterm} CVT WHERE CVT.cvterm_id = type_id" .
" AND CVT.cv_id = (SELECT cv_id FROM {cv} WHERE name='taxonomic_rank')), 'no_rank', '')," .
" infraspecific_name";
$csql = "SELECT organism_id, genus, species, type_id,"
. " (REPLACE ((SELECT name FROM {cvterm} CVT WHERE CVT.cvterm_id = type_id AND CVT.cv_id ="
. " (SELECT cv_id FROM {cv} WHERE name='taxonomic_rank')), 'no_rank', '')) AS infraspecific_type,"
. " infraspecific_name FROM {organism} ORDER BY genus, species, infraspecific_type, infraspecific_name";
}
$orgs = chado_query($csql);

Expand Down

0 comments on commit 0090f46

Please sign in to comment.