|
@@ -131,7 +131,7 @@ function tripal_feature_permissions() {
|
|
* @param $node
|
|
* @param $node
|
|
* The node on which the operation is to be performed, or, if it does not yet exist, the
|
|
* The node on which the operation is to be performed, or, if it does not yet exist, the
|
|
* type of node to be created
|
|
* type of node to be created
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @param $op
|
|
* @param $op
|
|
* The operation to be performed
|
|
* The operation to be performed
|
|
*
|
|
*
|
|
@@ -141,9 +141,9 @@ function tripal_feature_permissions() {
|
|
* @return
|
|
* @return
|
|
* If the permission for the specified operation is not set then return FALSE. If the
|
|
* If the permission for the specified operation is not set then return FALSE. If the
|
|
* permission is set then return NULL as this allows other modules to disable
|
|
* permission is set then return NULL as this allows other modules to disable
|
|
- * access. The only exception is when the $op == 'create'. We will always
|
|
|
|
|
|
+ * access. The only exception is when the $op == 'create'. We will always
|
|
* return TRUE if the permission is set.
|
|
* return TRUE if the permission is set.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @ingroup tripal_feature
|
|
* @ingroup tripal_feature
|
|
*/
|
|
*/
|
|
function chado_feature_node_access($node, $op, $account) {
|
|
function chado_feature_node_access($node, $op, $account) {
|
|
@@ -189,14 +189,14 @@ function tripal_feature_menu() {
|
|
'access arguments' => array('access chado_feature content'),
|
|
'access arguments' => array('access chado_feature content'),
|
|
'type' => MENU_CALLBACK,
|
|
'type' => MENU_CALLBACK,
|
|
);
|
|
);
|
|
-
|
|
|
|
|
|
+
|
|
$items['find/sequences/ajax'] = array(
|
|
$items['find/sequences/ajax'] = array(
|
|
'title' => 'Sequence Retrieval',
|
|
'title' => 'Sequence Retrieval',
|
|
'page callback' => 'tripal_feature_seq_extract_form_ahah_update',
|
|
'page callback' => 'tripal_feature_seq_extract_form_ahah_update',
|
|
'access arguments' => array('access chado_feature content'),
|
|
'access arguments' => array('access chado_feature content'),
|
|
'type' => MENU_CALLBACK,
|
|
'type' => MENU_CALLBACK,
|
|
);
|
|
);
|
|
-
|
|
|
|
|
|
+
|
|
// the administative settings menu
|
|
// the administative settings menu
|
|
$items['admin/tripal/tripal_feature'] = array(
|
|
$items['admin/tripal/tripal_feature'] = array(
|
|
'title' => 'Features',
|
|
'title' => 'Features',
|
|
@@ -339,7 +339,7 @@ function tripal_feature_theme() {
|
|
'arguments' => array(NULL),
|
|
'arguments' => array(NULL),
|
|
'path' => drupal_get_path('module', 'tripal_feature') . '/theme'
|
|
'path' => drupal_get_path('module', 'tripal_feature') . '/theme'
|
|
),
|
|
),
|
|
-
|
|
|
|
|
|
+
|
|
// themed forms
|
|
// themed forms
|
|
'tripal_feature_seq_extract_form' => array(
|
|
'tripal_feature_seq_extract_form' => array(
|
|
'arguments' => array('form'),
|
|
'arguments' => array('form'),
|
|
@@ -354,37 +354,37 @@ function tripal_feature_theme() {
|
|
function tripal_feature_block_info() {
|
|
function tripal_feature_block_info() {
|
|
|
|
|
|
$blocks['references']['info'] = t('Tripal Feature References');
|
|
$blocks['references']['info'] = t('Tripal Feature References');
|
|
- $blocks['references']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['references']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
$blocks['base']['info'] = t('Tripal Feature Details');
|
|
$blocks['base']['info'] = t('Tripal Feature Details');
|
|
- $blocks['base']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['base']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
$blocks['sequence']['info'] = t('Tripal Feature Sequence');
|
|
$blocks['sequence']['info'] = t('Tripal Feature Sequence');
|
|
- $blocks['sequence']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['sequence']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
$blocks['featureloc_sequences']['info'] = t('Tripal Feature Annotated Sequence');
|
|
$blocks['featureloc_sequences']['info'] = t('Tripal Feature Annotated Sequence');
|
|
- $blocks['featureloc_sequences']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['featureloc_sequences']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
$blocks['synonyms']['info'] = t('Tripal Feature Synonyms');
|
|
$blocks['synonyms']['info'] = t('Tripal Feature Synonyms');
|
|
- $blocks['synonyms']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['synonyms']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
$blocks['properties']['info'] = t('Tripal Feature Properties');
|
|
$blocks['properties']['info'] = t('Tripal Feature Properties');
|
|
- $blocks['properties']['cache'] = BLOCK_NO_CACHE;;
|
|
|
|
|
|
+ $blocks['properties']['cache'] = DRUPAL_NO_CACHE;;
|
|
|
|
|
|
$blocks['terms']['info'] = t('Tripal Annotated Terms');
|
|
$blocks['terms']['info'] = t('Tripal Annotated Terms');
|
|
- $blocks['terms']['cache'] = BLOCK_NO_CACHE;;
|
|
|
|
|
|
+ $blocks['terms']['cache'] = DRUPAL_NO_CACHE;;
|
|
|
|
|
|
$blocks['alignments']['info'] = t('Tripal Feature Alignments');
|
|
$blocks['alignments']['info'] = t('Tripal Feature Alignments');
|
|
- $blocks['alignments']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['alignments']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
$blocks['relationships']['info'] = t('Tripal Feature Relationships');
|
|
$blocks['relationships']['info'] = t('Tripal Feature Relationships');
|
|
- $blocks['relationships']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['relationships']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
$blocks['org_feature_counts']['info'] = t('Tripal Organism Feature Counts');
|
|
$blocks['org_feature_counts']['info'] = t('Tripal Organism Feature Counts');
|
|
- $blocks['org_feature_counts']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['org_feature_counts']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
$blocks['org_feature_browser']['info'] = t('Tripal Organism Feature Browser');
|
|
$blocks['org_feature_browser']['info'] = t('Tripal Organism Feature Browser');
|
|
- $blocks['org_feature_browser']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
+ $blocks['org_feature_browser']['cache'] = DRUPAL_NO_CACHE;
|
|
|
|
|
|
return $blocks;
|
|
return $blocks;
|
|
}
|
|
}
|
|
@@ -394,11 +394,11 @@ function tripal_feature_block_info() {
|
|
* @ingroup tripal_feature
|
|
* @ingroup tripal_feature
|
|
*/
|
|
*/
|
|
function tripal_feature_block_view($delta = '') {
|
|
function tripal_feature_block_view($delta = '') {
|
|
-
|
|
|
|
|
|
+
|
|
if (user_access('access chado_feature content') and arg(0) == 'node' and is_numeric(arg(1))) {
|
|
if (user_access('access chado_feature content') and arg(0) == 'node' and is_numeric(arg(1))) {
|
|
$nid = arg(1);
|
|
$nid = arg(1);
|
|
$node = node_load($nid);
|
|
$node = node_load($nid);
|
|
-
|
|
|
|
|
|
+
|
|
$block = array();
|
|
$block = array();
|
|
switch ($delta) {
|
|
switch ($delta) {
|
|
case 'references':
|
|
case 'references':
|
|
@@ -511,24 +511,24 @@ function chado_feature_insert($node) {
|
|
'type_id' => $type[0]->cvterm_id,
|
|
'type_id' => $type[0]->cvterm_id,
|
|
);
|
|
);
|
|
$feature = tripal_core_chado_select('feature', array('feature_id'), $values);
|
|
$feature = tripal_core_chado_select('feature', array('feature_id'), $values);
|
|
-
|
|
|
|
|
|
+
|
|
// add the genbank accession and synonyms
|
|
// add the genbank accession and synonyms
|
|
chado_feature_add_synonyms($node->synonyms, $feature[0]->feature_id);
|
|
chado_feature_add_synonyms($node->synonyms, $feature[0]->feature_id);
|
|
|
|
|
|
// make sure the entry for this feature doesn't already exist in the chado_feature table
|
|
// make sure the entry for this feature doesn't already exist in the chado_feature table
|
|
// if it doesn't exist then we want to add it.
|
|
// if it doesn't exist then we want to add it.
|
|
$node_check_sql = "
|
|
$node_check_sql = "
|
|
- SELECT * FROM {chado_feature}
|
|
|
|
|
|
+ SELECT * FROM {chado_feature}
|
|
WHERE feature_id = :feature_id
|
|
WHERE feature_id = :feature_id
|
|
";
|
|
";
|
|
$node_check = db_query($node_check_sql, array(':feature_id' => $feature[0]->feature_id))->fetchObject();
|
|
$node_check = db_query($node_check_sql, array(':feature_id' => $feature[0]->feature_id))->fetchObject();
|
|
if (!$node_check) {
|
|
if (!$node_check) {
|
|
// next add the item to the drupal table
|
|
// next add the item to the drupal table
|
|
$sql = "
|
|
$sql = "
|
|
- INSERT INTO {chado_feature} (nid, vid, feature_id, sync_date)
|
|
|
|
|
|
+ INSERT INTO {chado_feature} (nid, vid, feature_id, sync_date)
|
|
VALUES (:nid, :vid, :feature_id, :time)
|
|
VALUES (:nid, :vid, :feature_id, :time)
|
|
";
|
|
";
|
|
- db_query($sql, array(':nid' => $node->nid, ':vid' => $node->vid,
|
|
|
|
|
|
+ db_query($sql, array(':nid' => $node->nid, ':vid' => $node->vid,
|
|
':feature_id' => $feature[0]->feature_id, ':time' => REQUEST_TIME));
|
|
':feature_id' => $feature[0]->feature_id, ':time' => REQUEST_TIME));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -577,7 +577,7 @@ function chado_feature_update($node) {
|
|
);
|
|
);
|
|
$options = array('return_record' => TRUE);
|
|
$options = array('return_record' => TRUE);
|
|
$status = tripal_core_chado_update('feature', $match, $values, $options);
|
|
$status = tripal_core_chado_update('feature', $match, $values, $options);
|
|
-
|
|
|
|
|
|
+
|
|
// add the genbank synonyms
|
|
// add the genbank synonyms
|
|
chado_feature_add_synonyms($node->synonyms, $feature_id);
|
|
chado_feature_add_synonyms($node->synonyms, $feature_id);
|
|
}
|
|
}
|
|
@@ -589,7 +589,7 @@ function chado_feature_update($node) {
|
|
WATCHDOG_WARNING
|
|
WATCHDOG_WARNING
|
|
);
|
|
);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -662,11 +662,11 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
|
|
$synonym = chado_query($synonym_sql, array(':name' => $syn))->fetchObject();
|
|
$synonym = chado_query($synonym_sql, array(':name' => $syn))->fetchObject();
|
|
if (!$synonym) {
|
|
if (!$synonym) {
|
|
$synonym_isql = "
|
|
$synonym_isql = "
|
|
- INSERT INTO {synonym} (name, synonym_sgml, type_id)
|
|
|
|
- VALUES (:name, :synonym_sgml,
|
|
|
|
- (SELECT cvterm_id
|
|
|
|
- FROM {CVTerm} CVT
|
|
|
|
- INNER JOIN CV ON CVT.cv_id = CV.cv_id
|
|
|
|
|
|
+ INSERT INTO {synonym} (name, synonym_sgml, type_id)
|
|
|
|
+ VALUES (:name, :synonym_sgml,
|
|
|
|
+ (SELECT cvterm_id
|
|
|
|
+ FROM {CVTerm} CVT
|
|
|
|
+ INNER JOIN CV ON CVT.cv_id = CV.cv_id
|
|
WHERE CV.name = 'feature_property' and CVT.name = 'synonym')
|
|
WHERE CV.name = 'feature_property' and CVT.name = 'synonym')
|
|
)
|
|
)
|
|
";
|
|
";
|
|
@@ -680,7 +680,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
|
|
|
|
|
|
// now add in our new sysnonym
|
|
// now add in our new sysnonym
|
|
$feature_syn_isql = "
|
|
$feature_syn_isql = "
|
|
- INSERT INTO {feature_synonym} (synonym_id,feature_id,pub_id)
|
|
|
|
|
|
+ INSERT INTO {feature_synonym} (synonym_id,feature_id,pub_id)
|
|
VALUES (:synonym_id, :feature_id, :pub_id)";
|
|
VALUES (:synonym_id, :feature_id, :pub_id)";
|
|
$args = array(':synonym_id' => $synonym->synonym_id, ':feature_id' => $feature_id, ':pub_id'=> 1);
|
|
$args = array(':synonym_id' => $synonym->synonym_id, ':feature_id' => $feature_id, ':pub_id'=> 1);
|
|
if (!chado_query($feature_syn_isql, $args)) {
|
|
if (!chado_query($feature_syn_isql, $args)) {
|
|
@@ -703,12 +703,12 @@ function chado_feature_add_gbaccession($accession, $feature_id) {
|
|
|
|
|
|
// remove any old accession from genbank dbEST
|
|
// remove any old accession from genbank dbEST
|
|
$fdbxref_dsql = "
|
|
$fdbxref_dsql = "
|
|
- DELETE FROM {feature_dbxref}
|
|
|
|
- WHERE feature_id = :feature_id and dbxref_id IN
|
|
|
|
- (SELECT DBX.dbxref_id
|
|
|
|
- FROM {dbxref} DBX
|
|
|
|
- INNER JOIN DB ON DB.db_id = DBX.db_id
|
|
|
|
- INNER JOIN feature_dbxref FDBX ON DBX.dbxref_id = FDBX.dbxref_id
|
|
|
|
|
|
+ DELETE FROM {feature_dbxref}
|
|
|
|
+ WHERE feature_id = :feature_id and dbxref_id IN
|
|
|
|
+ (SELECT DBX.dbxref_id
|
|
|
|
+ FROM {dbxref} DBX
|
|
|
|
+ INNER JOIN DB ON DB.db_id = DBX.db_id
|
|
|
|
+ INNER JOIN feature_dbxref FDBX ON DBX.dbxref_id = FDBX.dbxref_id
|
|
WHERE DB.name = 'DB:Genbank' and FDBX.feature_id = :feature_id
|
|
WHERE DB.name = 'DB:Genbank' and FDBX.feature_id = :feature_id
|
|
)
|
|
)
|
|
";
|
|
";
|
|
@@ -841,8 +841,8 @@ function chado_feature_form($node, $param) {
|
|
|
|
|
|
// get the sequence ontology CV ID
|
|
// get the sequence ontology CV ID
|
|
$values = array('name' => 'sequence');
|
|
$values = array('name' => 'sequence');
|
|
- $cv = tripal_core_chado_select('cv', array('cv_id'), $values);
|
|
|
|
- $cv_id = $cv[0]->cv_id;
|
|
|
|
|
|
+ $cv = tripal_core_chado_select('cv', array('cv_id'), $values);
|
|
|
|
+ $cv_id = $cv[0]->cv_id;
|
|
|
|
|
|
$form['feature_type'] = array(
|
|
$form['feature_type'] = array(
|
|
'#title' => t('Feature Type'),
|
|
'#title' => t('Feature Type'),
|
|
@@ -917,7 +917,7 @@ function chado_feature_form($node, $param) {
|
|
*/
|
|
*/
|
|
function chado_feature_validate($node) {
|
|
function chado_feature_validate($node) {
|
|
$result = 0;
|
|
$result = 0;
|
|
-
|
|
|
|
|
|
+
|
|
// make sure the feature type is a real sequence ontology term
|
|
// make sure the feature type is a real sequence ontology term
|
|
$type = tripal_cv_get_cvterm_by_name($node->feature_type, NULL, 'sequence');
|
|
$type = tripal_cv_get_cvterm_by_name($node->feature_type, NULL, 'sequence');
|
|
if (!$type) {
|
|
if (!$type) {
|
|
@@ -932,13 +932,13 @@ function chado_feature_validate($node) {
|
|
SELECT *
|
|
SELECT *
|
|
FROM {feature} F
|
|
FROM {feature} F
|
|
INNER JOIN {cvterm} CVT ON F.type_id = CVT.cvterm_id
|
|
INNER JOIN {cvterm} CVT ON F.type_id = CVT.cvterm_id
|
|
- WHERE
|
|
|
|
- F.uniquename = :uname AND
|
|
|
|
- F.organism_id = :orgnism_id AND
|
|
|
|
- CVT.name = :cvtname AND
|
|
|
|
|
|
+ WHERE
|
|
|
|
+ F.uniquename = :uname AND
|
|
|
|
+ F.organism_id = :orgnism_id AND
|
|
|
|
+ CVT.name = :cvtname AND
|
|
NOT f.feature_id = :feature_id
|
|
NOT f.feature_id = :feature_id
|
|
";
|
|
";
|
|
- $args = array(':uname' => $node->uniquename, ':organism_id' => $node->organism_id,
|
|
|
|
|
|
+ $args = array(':uname' => $node->uniquename, ':organism_id' => $node->organism_id,
|
|
':cvtname' => $node->feature_type, ':feature_id' => $node->feature_id);
|
|
':cvtname' => $node->feature_type, ':feature_id' => $node->feature_id);
|
|
$result = chado_query($sql, $args)->fetchObject();
|
|
$result = chado_query($sql, $args)->fetchObject();
|
|
if ($result) {
|
|
if ($result) {
|
|
@@ -953,9 +953,9 @@ function chado_feature_validate($node) {
|
|
SELECT *
|
|
SELECT *
|
|
FROM {feature} F
|
|
FROM {feature} F
|
|
INNER JOIN {cvterm} CVT ON F.type_id = CVT.cvterm_id
|
|
INNER JOIN {cvterm} CVT ON F.type_id = CVT.cvterm_id
|
|
- WHERE
|
|
|
|
- F.uniquename = :name AND
|
|
|
|
- F.organism_id = :organism_id AND
|
|
|
|
|
|
+ WHERE
|
|
|
|
+ F.uniquename = :name AND
|
|
|
|
+ F.organism_id = :organism_id AND
|
|
CVT.name = :cvtname
|
|
CVT.name = :cvtname
|
|
";
|
|
";
|
|
$args = array(':name' => $node->uniquename, ':organism_id' => $node->organism_id, ':cvtname' => $node->feature_type);
|
|
$args = array(':name' => $node->uniquename, ':organism_id' => $node->organism_id, ':cvtname' => $node->feature_type);
|
|
@@ -992,10 +992,10 @@ function chado_feature_load($node) {
|
|
if (strcmp($feature->name, $feature->uniquename)==0) {
|
|
if (strcmp($feature->name, $feature->uniquename)==0) {
|
|
$node->title = $feature->name . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
|
|
$node->title = $feature->name . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
|
|
}
|
|
}
|
|
- // in previous version of Tripal, the feature title was simply the unique name.
|
|
|
|
|
|
+ // in previous version of Tripal, the feature title was simply the unique name.
|
|
// so, we recreate the title just to be sure all of our feature pages are consistent
|
|
// so, we recreate the title just to be sure all of our feature pages are consistent
|
|
else {
|
|
else {
|
|
- $node->title = $feature->name . ", " . $feature->uniquename . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
|
|
|
|
|
|
+ $node->title = $feature->name . ", " . $feature->uniquename . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// set the title to be the feature name or uniquename as configured
|
|
// set the title to be the feature name or uniquename as configured
|
|
@@ -1003,7 +1003,7 @@ function chado_feature_load($node) {
|
|
$node->title = $feature->name;
|
|
$node->title = $feature->name;
|
|
}
|
|
}
|
|
if ($title_type == 'feature_unique_name') {
|
|
if ($title_type == 'feature_unique_name') {
|
|
- $node->title = $feature->uniquename;
|
|
|
|
|
|
+ $node->title = $feature->uniquename;
|
|
}
|
|
}
|
|
|
|
|
|
$additions = new stdClass();
|
|
$additions = new stdClass();
|
|
@@ -1029,11 +1029,11 @@ function tripal_feature_load_organism($organism_id) {
|
|
function tripal_feature_load_synonyms($feature_id) {
|
|
function tripal_feature_load_synonyms($feature_id) {
|
|
|
|
|
|
$sql = "
|
|
$sql = "
|
|
- SELECT S.name
|
|
|
|
- FROM {feature_synonym} FS
|
|
|
|
- INNER JOIN {synonym} S ON FS.synonym_id = S.Synonym_id
|
|
|
|
|
|
+ SELECT S.name
|
|
|
|
+ FROM {feature_synonym} FS
|
|
|
|
+ INNER JOIN {synonym} S ON FS.synonym_id = S.Synonym_id
|
|
WHERE FS.feature_id = :feature_id
|
|
WHERE FS.feature_id = :feature_id
|
|
- ORDER BY S.name
|
|
|
|
|
|
+ ORDER BY S.name
|
|
";
|
|
";
|
|
$results = chado_query($sql, array(':feature_id' => $feature_id));
|
|
$results = chado_query($sql, array(':feature_id' => $feature_id));
|
|
$synonyms = array();
|
|
$synonyms = array();
|
|
@@ -1051,16 +1051,16 @@ function tripal_feature_load_synonyms($feature_id) {
|
|
function tripal_feature_load_properties($feature_id) {
|
|
function tripal_feature_load_properties($feature_id) {
|
|
|
|
|
|
$sql = "
|
|
$sql = "
|
|
- SELECT
|
|
|
|
- CVT.name as cvname, CVT.definition, CVT.is_obsolete,
|
|
|
|
- FS.type_id, FS.value, FS.rank,
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ CVT.name as cvname, CVT.definition, CVT.is_obsolete,
|
|
|
|
+ FS.type_id, FS.value, FS.rank,
|
|
DBX.dbxref_id,DBX.accession,DB.name as dbname,
|
|
DBX.dbxref_id,DBX.accession,DB.name as dbname,
|
|
DB.urlprefix, DB.description as db_description, DB.url
|
|
DB.urlprefix, DB.description as db_description, DB.url
|
|
FROM {featureprop} FS
|
|
FROM {featureprop} FS
|
|
INNER JOIN {cvterm} CVT ON FS.type_id = CVT.cvterm_id
|
|
INNER JOIN {cvterm} CVT ON FS.type_id = CVT.cvterm_id
|
|
INNER JOIN {dbxref} DBX ON CVT.dbxref_id = DBX.dbxref_id
|
|
INNER JOIN {dbxref} DBX ON CVT.dbxref_id = DBX.dbxref_id
|
|
INNER JOIN {db} DB ON DB.db_id = DBX.db_id
|
|
INNER JOIN {db} DB ON DB.db_id = DBX.db_id
|
|
- WHERE
|
|
|
|
|
|
+ WHERE
|
|
FS.feature_id = :feature_id
|
|
FS.feature_id = :feature_id
|
|
ORDER BY FS.rank ASC
|
|
ORDER BY FS.rank ASC
|
|
";
|
|
";
|
|
@@ -1080,17 +1080,17 @@ function tripal_feature_load_properties($feature_id) {
|
|
function tripal_feature_load_references($feature_id) {
|
|
function tripal_feature_load_references($feature_id) {
|
|
|
|
|
|
$sql = "
|
|
$sql = "
|
|
- SELECT
|
|
|
|
|
|
+ SELECT
|
|
F.uniquename, F.Feature_id,
|
|
F.uniquename, F.Feature_id,
|
|
DB.description as dbdesc, DB.db_id, DB.name as db_name, DB.urlprefix,
|
|
DB.description as dbdesc, DB.db_id, DB.name as db_name, DB.urlprefix,
|
|
- DBX.accession, DBX.dbxref_id
|
|
|
|
- FROM {feature} F
|
|
|
|
- INNER JOIN {feature_dbxref} FDBX ON F.feature_id = FDBX.feature_id
|
|
|
|
- INNER JOIN {dbxref} DBX ON DBX.dbxref_id = FDBX.dbxref_id
|
|
|
|
- INNER JOIN {db} ON DB.db_id = DBX.db_id
|
|
|
|
- WHERE
|
|
|
|
|
|
+ DBX.accession, DBX.dbxref_id
|
|
|
|
+ FROM {feature} F
|
|
|
|
+ INNER JOIN {feature_dbxref} FDBX ON F.feature_id = FDBX.feature_id
|
|
|
|
+ INNER JOIN {dbxref} DBX ON DBX.dbxref_id = FDBX.dbxref_id
|
|
|
|
+ INNER JOIN {db} ON DB.db_id = DBX.db_id
|
|
|
|
+ WHERE
|
|
F.feature_id = :feature_id
|
|
F.feature_id = :feature_id
|
|
- ORDER BY DB.name
|
|
|
|
|
|
+ ORDER BY DB.name
|
|
";
|
|
";
|
|
$results = chado_query($sql, array(':feature_id' => $feature_id));
|
|
$results = chado_query($sql, array(':feature_id' => $feature_id));
|
|
$references = array();
|
|
$references = array();
|
|
@@ -1126,7 +1126,7 @@ function tripal_feature_load_featurelocs($feature_id, $side = 'as_parent', $aggr
|
|
if (strcmp($side, 'as_child')==0) {
|
|
if (strcmp($side, 'as_child')==0) {
|
|
$sql .= "WHERE FL.feature_id = :feature_id ";
|
|
$sql .= "WHERE FL.feature_id = :feature_id ";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$flresults = chado_query($sql, array(':feature_id' => $feature_id));
|
|
$flresults = chado_query($sql, array(':feature_id' => $feature_id));
|
|
|
|
|
|
// copy the results into an array
|
|
// copy the results into an array
|
|
@@ -1185,7 +1185,7 @@ function tripal_feature_load_relationships($feature_id, $side = 'as_subject') {
|
|
FR.subject_id, FR.type_id as relationship_type_id, FR.object_id, FR.rank,
|
|
FR.subject_id, FR.type_id as relationship_type_id, FR.object_id, FR.rank,
|
|
CVT.name as rel_type,
|
|
CVT.name as rel_type,
|
|
FO.name as object_name, FO.uniquename as object_uniquename,
|
|
FO.name as object_name, FO.uniquename as object_uniquename,
|
|
- CVTO.name as object_type, CVTO.cvterm_id as object_type_id
|
|
|
|
|
|
+ CVTO.name as object_type, CVTO.cvterm_id as object_type_id
|
|
FROM {feature_relationship} FR
|
|
FROM {feature_relationship} FR
|
|
INNER JOIN {cvterm} CVT ON FR.type_id = CVT.cvterm_id
|
|
INNER JOIN {cvterm} CVT ON FR.type_id = CVT.cvterm_id
|
|
INNER JOIN {feature} FS ON FS.feature_id = FR.subject_id
|
|
INNER JOIN {feature} FS ON FS.feature_id = FR.subject_id
|
|
@@ -1298,8 +1298,8 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
|
|
// location and then annotate it with the parts found from the relationships
|
|
// location and then annotate it with the parts found from the relationships
|
|
// locations determiend above.
|
|
// locations determiend above.
|
|
$sql = "
|
|
$sql = "
|
|
- SELECT substring(residues from :start for :size) as residues
|
|
|
|
- FROM {feature}
|
|
|
|
|
|
+ SELECT substring(residues from :start for :size) as residues
|
|
|
|
+ FROM {feature}
|
|
WHERE feature_id = :feature_id
|
|
WHERE feature_id = :feature_id
|
|
";
|
|
";
|
|
$floc_sequences = array();
|
|
$floc_sequences = array();
|
|
@@ -1395,37 +1395,37 @@ function tripal_feature_get_matched_alignments($feature) {
|
|
// match, or %_match
|
|
// match, or %_match
|
|
//
|
|
//
|
|
$sql = "
|
|
$sql = "
|
|
- SELECT
|
|
|
|
- FL1.featureloc_id as left_featureloc_id,
|
|
|
|
- FL1.srcfeature_id as left_srcfeature_id,
|
|
|
|
- FL1.feature_id as left_feature_id,
|
|
|
|
- FL1.fmin as left_fmin,
|
|
|
|
- FL1.is_fmin_partial as left_is_fmin_partial,
|
|
|
|
- FL1.fmax as left_fmax,
|
|
|
|
- FL1.is_fmax_partial as left_is_fmax_partial,
|
|
|
|
- FL1.strand as left_strand,
|
|
|
|
- FL1.phase as left_phase,
|
|
|
|
- FL1.locgroup as left_locgroup,
|
|
|
|
- FL1.rank as left_rank,
|
|
|
|
- FL2.featureloc_id as right_featureloc_id,
|
|
|
|
- FL2.srcfeature_id as right_srcfeature_id,
|
|
|
|
- FL2.feature_id as right_feature_id,
|
|
|
|
- FL2.fmin as right_fmin,
|
|
|
|
- FL2.is_fmin_partial as right_is_fmin_partial,
|
|
|
|
- FL2.fmax as right_fmax,
|
|
|
|
- FL2.is_fmax_partial as right_is_fmax_partial,
|
|
|
|
- FL2.strand as right_strand,
|
|
|
|
- FL2.phase as right_phase,
|
|
|
|
- FL2.locgroup as right_locgroup,
|
|
|
|
- FL2.rank as right_rank
|
|
|
|
- FROM {feature} F1
|
|
|
|
- INNER JOIN {featureloc} FL1 on FL1.srcfeature_id = F1.feature_id
|
|
|
|
- INNER JOIN {feature} F2 on FL1.feature_id = F2.feature_id
|
|
|
|
- INNER JOIN {featureloc} FL2 on FL2.feature_id = F2.feature_id
|
|
|
|
- INNER JOIN {cvterm} CVT2 on F2.type_id = CVT2.cvterm_id
|
|
|
|
- WHERE
|
|
|
|
- F1.feature_id = :feature_id AND
|
|
|
|
- (CVT2.name = 'match' or CVT2.name like '%_match')
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ FL1.featureloc_id as left_featureloc_id,
|
|
|
|
+ FL1.srcfeature_id as left_srcfeature_id,
|
|
|
|
+ FL1.feature_id as left_feature_id,
|
|
|
|
+ FL1.fmin as left_fmin,
|
|
|
|
+ FL1.is_fmin_partial as left_is_fmin_partial,
|
|
|
|
+ FL1.fmax as left_fmax,
|
|
|
|
+ FL1.is_fmax_partial as left_is_fmax_partial,
|
|
|
|
+ FL1.strand as left_strand,
|
|
|
|
+ FL1.phase as left_phase,
|
|
|
|
+ FL1.locgroup as left_locgroup,
|
|
|
|
+ FL1.rank as left_rank,
|
|
|
|
+ FL2.featureloc_id as right_featureloc_id,
|
|
|
|
+ FL2.srcfeature_id as right_srcfeature_id,
|
|
|
|
+ FL2.feature_id as right_feature_id,
|
|
|
|
+ FL2.fmin as right_fmin,
|
|
|
|
+ FL2.is_fmin_partial as right_is_fmin_partial,
|
|
|
|
+ FL2.fmax as right_fmax,
|
|
|
|
+ FL2.is_fmax_partial as right_is_fmax_partial,
|
|
|
|
+ FL2.strand as right_strand,
|
|
|
|
+ FL2.phase as right_phase,
|
|
|
|
+ FL2.locgroup as right_locgroup,
|
|
|
|
+ FL2.rank as right_rank
|
|
|
|
+ FROM {feature} F1
|
|
|
|
+ INNER JOIN {featureloc} FL1 on FL1.srcfeature_id = F1.feature_id
|
|
|
|
+ INNER JOIN {feature} F2 on FL1.feature_id = F2.feature_id
|
|
|
|
+ INNER JOIN {featureloc} FL2 on FL2.feature_id = F2.feature_id
|
|
|
|
+ INNER JOIN {cvterm} CVT2 on F2.type_id = CVT2.cvterm_id
|
|
|
|
+ WHERE
|
|
|
|
+ F1.feature_id = :feature_id AND
|
|
|
|
+ (CVT2.name = 'match' or CVT2.name like '%_match')
|
|
ORDER BY FL1.fmin
|
|
ORDER BY FL1.fmin
|
|
";
|
|
";
|
|
|
|
|
|
@@ -1608,24 +1608,24 @@ function tripal_feature_load_library_feature_browser($library) {
|
|
|
|
|
|
// get the features for this library
|
|
// get the features for this library
|
|
$sql = "
|
|
$sql = "
|
|
- SELECT F.name, F.feature_id, F.uniquename, CVT.name as cvname
|
|
|
|
- FROM {feature} F
|
|
|
|
- INNER JOIN {cvterm} CVT ON F.type_id = CVT.cvterm_id
|
|
|
|
- INNER JOIN {library_feature} LF ON F.feature_id = LF.feature_id
|
|
|
|
- INNER JOIN {library} L ON LF.library_id = L.library_id
|
|
|
|
- WHERE LF.library_id = :library_id and ($where_cvt)
|
|
|
|
|
|
+ SELECT F.name, F.feature_id, F.uniquename, CVT.name as cvname
|
|
|
|
+ FROM {feature} F
|
|
|
|
+ INNER JOIN {cvterm} CVT ON F.type_id = CVT.cvterm_id
|
|
|
|
+ INNER JOIN {library_feature} LF ON F.feature_id = LF.feature_id
|
|
|
|
+ INNER JOIN {library} L ON LF.library_id = L.library_id
|
|
|
|
+ WHERE LF.library_id = :library_id and ($where_cvt)
|
|
ORDER BY feature_id ASC
|
|
ORDER BY feature_id ASC
|
|
";
|
|
";
|
|
$args[':library_id'] = $library->libary_id;
|
|
$args[':library_id'] = $library->libary_id;
|
|
-
|
|
|
|
|
|
+
|
|
// the counting SQL
|
|
// the counting SQL
|
|
$csql = "
|
|
$csql = "
|
|
- SELECT count(*)
|
|
|
|
|
|
+ SELECT count(*)
|
|
FROM {feature} F
|
|
FROM {feature} F
|
|
- INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
|
|
|
|
- INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id
|
|
|
|
- INNER JOIN {library} L on LF.library_id = L.library_id
|
|
|
|
- WHERE LF.library_id = :library_id and ($where_cvt)
|
|
|
|
|
|
+ INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
|
|
|
|
+ INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id
|
|
|
|
+ INNER JOIN {library} L on LF.library_id = L.library_id
|
|
|
|
+ WHERE LF.library_id = :library_id and ($where_cvt)
|
|
GROUP BY L.library_id ";
|
|
GROUP BY L.library_id ";
|
|
|
|
|
|
$org_features = chado_pager_query($sql, 10, 0, $csql, $args);
|
|
$org_features = chado_pager_query($sql, 10, 0, $csql, $args);
|
|
@@ -1675,25 +1675,25 @@ function tripal_feature_load_analysis_feature_browser($analysis) {
|
|
|
|
|
|
// get the features for this library
|
|
// get the features for this library
|
|
$sql = "
|
|
$sql = "
|
|
- SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname
|
|
|
|
- FROM {feature} F
|
|
|
|
- INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
|
|
|
|
- INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id
|
|
|
|
- INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id
|
|
|
|
- WHERE A.analysis_id = :analysis_id and ($where_cvt)
|
|
|
|
|
|
+ SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname
|
|
|
|
+ FROM {feature} F
|
|
|
|
+ INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
|
|
|
|
+ INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id
|
|
|
|
+ INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id
|
|
|
|
+ WHERE A.analysis_id = :analysis_id and ($where_cvt)
|
|
ORDER BY feature_id ASC
|
|
ORDER BY feature_id ASC
|
|
";
|
|
";
|
|
$args[':analysis_id'] = $analysis->analysis_id;
|
|
$args[':analysis_id'] = $analysis->analysis_id;
|
|
|
|
|
|
// the counting SQL
|
|
// the counting SQL
|
|
$csql = "
|
|
$csql = "
|
|
- SELECT count(*)
|
|
|
|
|
|
+ SELECT count(*)
|
|
FROM {feature} F
|
|
FROM {feature} F
|
|
- INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
|
|
|
|
- INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id
|
|
|
|
- INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id
|
|
|
|
- WHERE A.analysis_id = %d and ($where_cvt)
|
|
|
|
- GROUP BY A.analysis_id
|
|
|
|
|
|
+ INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
|
|
|
|
+ INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id
|
|
|
|
+ INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id
|
|
|
|
+ WHERE A.analysis_id = %d and ($where_cvt)
|
|
|
|
+ GROUP BY A.analysis_id
|
|
";
|
|
";
|
|
|
|
|
|
$org_features = chado_pager_query($sql, 10, 0, $csql, $args);
|
|
$org_features = chado_pager_query($sql, 10, 0, $csql, $args);
|
|
@@ -1843,11 +1843,11 @@ function tripal_feature_color_sequence($sequence, $parts, $defline) {
|
|
* @ingroup tripal_feature
|
|
* @ingroup tripal_feature
|
|
*/
|
|
*/
|
|
function tripal_feature_node_presave($node) {
|
|
function tripal_feature_node_presave($node) {
|
|
-
|
|
|
|
|
|
+
|
|
// set the title to ensure it is always unique
|
|
// set the title to ensure it is always unique
|
|
switch ($node->type) {
|
|
switch ($node->type) {
|
|
case 'chado_feature':
|
|
case 'chado_feature':
|
|
-
|
|
|
|
|
|
+
|
|
$values = array('organism_id' => $node->organism_id);
|
|
$values = array('organism_id' => $node->organism_id);
|
|
$organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
|
|
$organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
|
|
$node->title = $node->fname . ', ' . $node->uniquename . ' (' . $node->feature_type . ') ' . $organism[0]->genus . ' ' . $organism[0]->species;
|
|
$node->title = $node->fname . ', ' . $node->uniquename . ' (' . $node->feature_type . ') ' . $organism[0]->genus . ' ' . $organism[0]->species;
|
|
@@ -1860,9 +1860,9 @@ function tripal_feature_node_presave($node) {
|
|
* @ingroup tripal_feature
|
|
* @ingroup tripal_feature
|
|
*/
|
|
*/
|
|
function tripal_feature_node_insert($node) {
|
|
function tripal_feature_node_insert($node) {
|
|
-
|
|
|
|
- // set the URL path after inserting. We do it here because we do not
|
|
|
|
- // know the feature_id in the presave
|
|
|
|
|
|
+
|
|
|
|
+ // set the URL path after inserting. We do it here because we do not
|
|
|
|
+ // know the feature_id in the presave
|
|
switch ($node->type) {
|
|
switch ($node->type) {
|
|
case 'chado_feature':
|
|
case 'chado_feature':
|
|
if (!$node->feature_id) {
|
|
if (!$node->feature_id) {
|
|
@@ -1870,10 +1870,10 @@ function tripal_feature_node_insert($node) {
|
|
$chado_feature = db_query($sql, array(':nid' => $node->nid))->fetchObject();
|
|
$chado_feature = db_query($sql, array(':nid' => $node->nid))->fetchObject();
|
|
$node->feature_id = $chado_feature->feature_id;
|
|
$node->feature_id = $chado_feature->feature_id;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// remove any previous alias
|
|
// remove any previous alias
|
|
db_query("DELETE FROM {url_alias} WHERE src = :src", array(':src' => "node/$node->nid"));
|
|
db_query("DELETE FROM {url_alias} WHERE src = :src", array(':src' => "node/$node->nid"));
|
|
-
|
|
|
|
|
|
+
|
|
// set the URL for this feature page
|
|
// set the URL for this feature page
|
|
$url_alias = tripal_feature_get_feature_url($node);
|
|
$url_alias = tripal_feature_get_feature_url($node);
|
|
path_set_alias("node/$node->nid", $url_alias);
|
|
path_set_alias("node/$node->nid", $url_alias);
|
|
@@ -1910,14 +1910,14 @@ function tripal_feature_node_view($node, $view_mode, $langcode) {
|
|
*
|
|
*
|
|
* @ingroup tripal_feature
|
|
* @ingroup tripal_feature
|
|
*/
|
|
*/
|
|
-function tripal_feature_node_update($node) {
|
|
|
|
-
|
|
|
|
|
|
+function tripal_feature_node_update($node) {
|
|
|
|
+
|
|
// add items to other nodes, build index and search results
|
|
// add items to other nodes, build index and search results
|
|
switch ($node->type) {
|
|
switch ($node->type) {
|
|
case 'chado_feature':
|
|
case 'chado_feature':
|
|
// remove any previous alias
|
|
// remove any previous alias
|
|
db_query("DELETE FROM {url_alias} WHERE src = :src", array(':src' => "node/$node->nid"));
|
|
db_query("DELETE FROM {url_alias} WHERE src = :src", array(':src' => "node/$node->nid"));
|
|
-
|
|
|
|
|
|
+
|
|
// set the URL for this feature page
|
|
// set the URL for this feature page
|
|
$url_alias = tripal_feature_get_feature_url($node);
|
|
$url_alias = tripal_feature_get_feature_url($node);
|
|
path_set_alias("node/$node->nid", $url_alias);
|
|
path_set_alias("node/$node->nid", $url_alias);
|
|
@@ -2315,15 +2315,15 @@ function tripal_feature_coder_ignore() {
|
|
* features is shown.
|
|
* features is shown.
|
|
*/
|
|
*/
|
|
function tripal_feature_match_features_page($id) {
|
|
function tripal_feature_match_features_page($id) {
|
|
-
|
|
|
|
|
|
+
|
|
// if the URL alias configuration is set such that the URL
|
|
// if the URL alias configuration is set such that the URL
|
|
// always begins with 'feature' then we want to use the ID as it is and
|
|
// always begins with 'feature' then we want to use the ID as it is and
|
|
// forward it on. Otherwise, try to find the matching feature.
|
|
// forward it on. Otherwise, try to find the matching feature.
|
|
- $url_alias = variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]');
|
|
|
|
|
|
+ $url_alias = variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]');
|
|
if (!$url_alias) {
|
|
if (!$url_alias) {
|
|
$url_alias = '/feature/[genus]/[species]/[type]/[uniquename]';
|
|
$url_alias = '/feature/[genus]/[species]/[type]/[uniquename]';
|
|
- }
|
|
|
|
- $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash
|
|
|
|
|
|
+ }
|
|
|
|
+ $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash
|
|
if (preg_match('/^feature\//', $url_alias)) {
|
|
if (preg_match('/^feature\//', $url_alias)) {
|
|
drupal_goto($id);
|
|
drupal_goto($id);
|
|
}
|
|
}
|
|
@@ -2388,16 +2388,16 @@ function tripal_feature_match_features_page($id) {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @param unknown_type $form
|
|
* @param unknown_type $form
|
|
* @param unknown_type $form_state
|
|
* @param unknown_type $form_state
|
|
* @param unknown_type $form_id
|
|
* @param unknown_type $form_id
|
|
*/
|
|
*/
|
|
function tripal_feature_form_alter(&$form, &$form_state, $form_id) {
|
|
function tripal_feature_form_alter(&$form, &$form_state, $form_id) {
|
|
- if ($form_id == "tripal_feature_seq_extract_form") {
|
|
|
|
|
|
+ if ($form_id == "tripal_feature_seq_extract_form") {
|
|
// updating the form through the ahah callback sets the action of
|
|
// updating the form through the ahah callback sets the action of
|
|
// the form to the ahah callback URL. We need to set it back
|
|
// the form to the ahah callback URL. We need to set it back
|
|
// to the normal form URL
|
|
// to the normal form URL
|
|
$form['#action'] = url("find/sequences");
|
|
$form['#action'] = url("find/sequences");
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|