|
@@ -49,7 +49,7 @@ function tripal_analysis_kegg_menu() {
|
|
$items['tripal_analysis_kegg_org_report'] = array(
|
|
$items['tripal_analysis_kegg_org_report'] = array(
|
|
'path' => 'tripal_analysis_kegg_org_report',
|
|
'path' => 'tripal_analysis_kegg_org_report',
|
|
'title' => t('Analysis KEGG report'),
|
|
'title' => t('Analysis KEGG report'),
|
|
- 'page callback' => 'tripal_analysis_kegg_org_report',
|
|
|
|
|
|
+ 'page callback' => 'f',
|
|
'page arguments' => array(1),
|
|
'page arguments' => array(1),
|
|
'access arguments' => array('access chado_analysis_kegg content'),
|
|
'access arguments' => array('access chado_analysis_kegg content'),
|
|
'type' => MENU_CALLBACK
|
|
'type' => MENU_CALLBACK
|
|
@@ -176,95 +176,13 @@ function tripal_analysis_kegg_brite($analysis_id, $type_id, $ajax){
|
|
* Provide a KEGG Analysis form
|
|
* Provide a KEGG Analysis form
|
|
*/
|
|
*/
|
|
function chado_analysis_kegg_form ($node){
|
|
function chado_analysis_kegg_form ($node){
|
|
|
|
+ // add in the default fields
|
|
|
|
+ $form = chado_analysis_form($node);
|
|
|
|
|
|
- $type = node_get_types('type', $node);
|
|
|
|
- $form = array();
|
|
|
|
- $form['title']= array(
|
|
|
|
- '#type' => 'hidden',
|
|
|
|
- '#default_value' => $node->title,
|
|
|
|
- );
|
|
|
|
- $form['analysisname']= array(
|
|
|
|
- '#type' => 'textfield',
|
|
|
|
- '#title' => t('Analysis Name'),
|
|
|
|
- '#required' => FALSE,
|
|
|
|
- '#default_value' => $node->analysisname,
|
|
|
|
- '#weight' => 1
|
|
|
|
- );
|
|
|
|
- $form['program']= array(
|
|
|
|
- '#type' => 'textfield',
|
|
|
|
- '#title' => t('Program'),
|
|
|
|
- '#required' => TRUE,
|
|
|
|
- '#default_value' => $node->program,
|
|
|
|
- '#weight' => 2
|
|
|
|
- );
|
|
|
|
- $form['programversion']= array(
|
|
|
|
- '#type' => 'textfield',
|
|
|
|
- '#title' => t('Program Version'),
|
|
|
|
- '#required' => TRUE,
|
|
|
|
- '#default_value' => $node->programversion,
|
|
|
|
- '#weight' => 3
|
|
|
|
- );
|
|
|
|
- $form['algorithm']= array(
|
|
|
|
- '#type' => 'textfield',
|
|
|
|
- '#title' => t('Algorithm'),
|
|
|
|
- '#required' => FALSE,
|
|
|
|
- '#default_value' => $node->algorithm,
|
|
|
|
- '#weight' => 4
|
|
|
|
- );
|
|
|
|
- $form['sourcename']= array(
|
|
|
|
- '#type' => 'textfield',
|
|
|
|
- '#title' => t('Source Name'),
|
|
|
|
- '#required' => FALSE,
|
|
|
|
- '#default_value' => $node->sourcename,
|
|
|
|
- '#weight' => 5
|
|
|
|
- );
|
|
|
|
- $form['sourceversion']= array(
|
|
|
|
- '#type' => 'textfield',
|
|
|
|
- '#title' => t('Source Version'),
|
|
|
|
- '#required' => FALSE,
|
|
|
|
- '#default_value' => $node->sourceversion,
|
|
|
|
- '#weight' => 6
|
|
|
|
- );
|
|
|
|
- $form['sourceuri']= array(
|
|
|
|
- '#type' => 'textfield',
|
|
|
|
- '#title' => t('Source URI'),
|
|
|
|
- '#required' => FALSE,
|
|
|
|
- '#default_value' => $node->sourceuri,
|
|
|
|
- '#weight' => 7
|
|
|
|
- );
|
|
|
|
- // Get time saved in chado
|
|
|
|
- $default_time = $node->timeexecuted;
|
|
|
|
- $year = preg_replace("/^(\d+)-\d+-\d+ .*/", "$1", $default_time);
|
|
|
|
- $month = preg_replace("/^\d+-0?(\d+)-\d+ .*/", "$1", $default_time);
|
|
|
|
- $day = preg_replace("/^\d+-\d+-0?(\d+) .*/", "$1", $default_time);
|
|
|
|
- // If the time is not set, use current time
|
|
|
|
- if (!$default_time) {
|
|
|
|
- $default_time = time();
|
|
|
|
- $year = format_date($default_time, 'custom', 'Y');
|
|
|
|
- $month = format_date($default_time, 'custom', 'n');
|
|
|
|
- $day = format_date($default_time, 'custom', 'j');
|
|
|
|
- }
|
|
|
|
- $form['timeexecuted']= array(
|
|
|
|
- '#type' => 'date',
|
|
|
|
- '#title' => t('Time Executed'),
|
|
|
|
- '#required' => TRUE,
|
|
|
|
- '#default_value' => array(
|
|
|
|
- 'year' => $year,
|
|
|
|
- 'month' => $month,
|
|
|
|
- 'day' => $day,
|
|
|
|
- ),
|
|
|
|
- '#weight' => 8
|
|
|
|
- );
|
|
|
|
- $form['description']= array(
|
|
|
|
- '#type' => 'textarea',
|
|
|
|
- '#rows' => 15,
|
|
|
|
- '#title' => t('Description and/or Program Settings'),
|
|
|
|
- '#required' => FALSE,
|
|
|
|
- '#default_value' => $node->description,
|
|
|
|
- '#weight' => 9
|
|
|
|
- );
|
|
|
|
|
|
+ // set the defaults
|
|
|
|
+ $kegg = $node->analysis->tripal_analysis_kegg;
|
|
|
|
+ $hierfile = $kegg->hierfile;
|
|
|
|
|
|
- //----KEGG/KAAS Settings (Shown only when Tripal KASS is enabled) ----
|
|
|
|
$moreSettings ['kegg'] = 'KEGG Analysis Settings';
|
|
$moreSettings ['kegg'] = 'KEGG Analysis Settings';
|
|
$form['kegg'] = array(
|
|
$form['kegg'] = array(
|
|
'#title' => t('KEGG Settings'),
|
|
'#title' => t('KEGG Settings'),
|
|
@@ -280,7 +198,7 @@ function chado_analysis_kegg_form ($node){
|
|
'#description' => t('The full path to the hier.tar.gz file generated by KAAS.
|
|
'#description' => t('The full path to the hier.tar.gz file generated by KAAS.
|
|
Alternatively, you can input the full path to the directory
|
|
Alternatively, you can input the full path to the directory
|
|
that contains decompressed kegg files.'),
|
|
that contains decompressed kegg files.'),
|
|
- '#default_value' => $node->hierfile,
|
|
|
|
|
|
+ '#default_value' => $hierfile,
|
|
);
|
|
);
|
|
$form['kegg']['keggjob'] = array(
|
|
$form['kegg']['keggjob'] = array(
|
|
'#type' => 'checkbox',
|
|
'#type' => 'checkbox',
|
|
@@ -289,7 +207,6 @@ function chado_analysis_kegg_form ($node){
|
|
'exist in chado before parsing the file. Otherwise, KEGG '.
|
|
'exist in chado before parsing the file. Otherwise, KEGG '.
|
|
'results that cannot be linked to a feature will be '.
|
|
'results that cannot be linked to a feature will be '.
|
|
'discarded.'),
|
|
'discarded.'),
|
|
- '#default_value' => $node->keggjob,
|
|
|
|
);
|
|
);
|
|
return $form;
|
|
return $form;
|
|
}
|
|
}
|
|
@@ -297,268 +214,77 @@ function chado_analysis_kegg_form ($node){
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
function chado_analysis_kegg_insert($node){
|
|
function chado_analysis_kegg_insert($node){
|
|
- global $user;
|
|
|
|
- // Create a timestamp so we can insert it into the chado database
|
|
|
|
- $time = $node->timeexecuted;
|
|
|
|
- $month = $time['month'];
|
|
|
|
- $day = $time['day'];
|
|
|
|
- $year = $time['year'];
|
|
|
|
- $timestamp = $month.'/'.$day.'/'.$year;
|
|
|
|
|
|
+ // insert the analysis
|
|
|
|
+ chado_analysis_insert($node);
|
|
|
|
|
|
- // If this analysis already exists then don't recreate it in chado
|
|
|
|
- $analysis_id = $node->analysis_id;
|
|
|
|
- if ($analysis_id) {
|
|
|
|
- $sql = "SELECT analysis_id ".
|
|
|
|
- "FROM {Analysis} ".
|
|
|
|
- "WHERE analysis_id = %d ";
|
|
|
|
- $previous_db = tripal_db_set_active('chado');
|
|
|
|
- $analysis = db_fetch_object(db_query($sql, $node->analysis_id));
|
|
|
|
- tripal_db_set_active($previous_db);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // If the analysis doesn't exist then let's create it in chado.
|
|
|
|
- if(!$analysis){
|
|
|
|
- // First add the item to the chado analysis table
|
|
|
|
- $sql = "INSERT INTO {analysis} ".
|
|
|
|
- " (name, description, program, programversion, algorithm, ".
|
|
|
|
- " sourcename, sourceversion, sourceuri, timeexecuted) ".
|
|
|
|
- "VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')";
|
|
|
|
- $previous_db = tripal_db_set_active('chado'); // use chado database
|
|
|
|
- db_query($sql,$node->analysisname, $node->description,
|
|
|
|
- $node->program,$node->programversion,$node->algorithm,
|
|
|
|
- $node->sourcename, $node->sourceversion, $node->sourceuri,
|
|
|
|
- $timestamp);
|
|
|
|
|
|
+ // set the type for this analysis
|
|
|
|
+ tripal_analysis_insert_property($node->analysis->analysis_id,'analysis_type','tripal_analysis_kegg');
|
|
|
|
|
|
- // find the newly entered analysis_id
|
|
|
|
- $sql = "SELECT analysis_id ".
|
|
|
|
- "FROM {Analysis} ".
|
|
|
|
- "WHERE program='%s'".
|
|
|
|
- "AND programversion='%s'".
|
|
|
|
- "AND sourcename='%s'";
|
|
|
|
- $analysis_id = db_result(db_query($sql, $node->program,
|
|
|
|
- $node->programversion, $node->sourcename));
|
|
|
|
-
|
|
|
|
- // Get cvterm_id for 'analysis_kegg_settings'
|
|
|
|
- $sql = "SELECT CVT.cvterm_id FROM {cvterm} CVT ".
|
|
|
|
- "INNER JOIN cv ON cv.cv_id = CVT.cv_id ".
|
|
|
|
- "WHERE CVT.name = 'analysis_kegg_settings' ".
|
|
|
|
- "AND CV.name = 'tripal'";
|
|
|
|
- $type_id = db_result(db_query($sql));
|
|
|
|
-
|
|
|
|
- // Insert the analysis type into the analysisprop table
|
|
|
|
- $sql = "
|
|
|
|
- INSERT INTO {analysisprop} (analysis_id, type_id, value)
|
|
|
|
- VALUES (%d, %d, '%s')
|
|
|
|
- ";
|
|
|
|
- $keggsettings = $node->hierfile;
|
|
|
|
- db_query($sql, $analysis_id, $type_id, $keggsettings);
|
|
|
|
-
|
|
|
|
- tripal_db_set_active($previous_db); // switch back to drupal database
|
|
|
|
- // Add a job if the user wants to parse the html output
|
|
|
|
- if($node->keggjob) {
|
|
|
|
- $job_args[0] = $analysis_id;
|
|
|
|
- $job_args[1] = $node->hierfile;
|
|
|
|
- $job_args[2] = base_path();
|
|
|
|
- if (is_readable($node->hierfile)) {
|
|
|
|
- $fname = preg_replace("/.*\/(.*)/", "$1", $node->hierfile);
|
|
|
|
- tripal_add_job("Parse KAAS output: $fname",'tripal_analysis_kegg',
|
|
|
|
- 'tripal_analysis_kegg_parseHierFile', $job_args, $user->uid);
|
|
|
|
- } else {
|
|
|
|
- drupal_set_message("Can not open KAAS hier.tar.gz output file. Job not scheduled.");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // now add in the remaining settings as a single property but separated by bars
|
|
|
|
+ tripal_analysis_insert_property($node->analysis_id,'analysis_kegg_settings',$node->hierfile);
|
|
|
|
+
|
|
|
|
+ // Add a job if the user wants to parse the html output
|
|
|
|
+ chado_analysis_kegg_submit_job($node);
|
|
|
|
+}
|
|
|
|
+/**
|
|
|
|
+*
|
|
|
|
+*/
|
|
|
|
+function chado_analysis_kegg_submit_job($node){
|
|
|
|
+ global $user;
|
|
|
|
|
|
- // Make sure the entry for this analysis doesn't already exist in the
|
|
|
|
- // chado_analysis table if it doesn't exist then we want to add it.
|
|
|
|
- $node_check_sql = "SELECT * FROM {chado_analysis} ".
|
|
|
|
- "WHERE analysis_id = %d";
|
|
|
|
- $node_check = db_fetch_object(db_query($node_check_sql, $analysis_id));
|
|
|
|
- if(!$node_check){
|
|
|
|
- // next add the item to the drupal table
|
|
|
|
- $sql = "INSERT INTO {chado_analysis} (nid, vid, analysis_id) ".
|
|
|
|
- "VALUES (%d, %d, %d)";
|
|
|
|
- db_query($sql,$node->nid,$node->vid,$analysis_id);
|
|
|
|
- // Create a title for the analysis node using the unique keys so when the
|
|
|
|
- // node is saved, it will have a title
|
|
|
|
- $record = new stdClass();
|
|
|
|
- // If the analysis has a name, use it as the node title. If not, construct
|
|
|
|
- // the title using program, programversion, and sourcename
|
|
|
|
- if ($node->analysisname) {
|
|
|
|
- $record->title = $node->analysisname;
|
|
|
|
|
|
+ if($node->keggjob) {
|
|
|
|
+ $job_args[0] = $analysis_id;
|
|
|
|
+ $job_args[1] = $node->hierfile;
|
|
|
|
+ $job_args[2] = base_path();
|
|
|
|
+ if (is_readable($node->hierfile)) {
|
|
|
|
+ $fname = preg_replace("/.*\/(.*)/", "$1", $node->hierfile);
|
|
|
|
+ tripal_add_job("Parse KAAS output: $fname",'tripal_analysis_kegg',
|
|
|
|
+ 'tripal_analysis_kegg_parseHierFile', $job_args, $user->uid);
|
|
} else {
|
|
} else {
|
|
- //Construct node title as "program (version)
|
|
|
|
- $record->title = "$node->program ($node->programversion)";
|
|
|
|
|
|
+ drupal_set_message("Can not open KAAS hier.tar.gz output file. Job not scheduled.");
|
|
}
|
|
}
|
|
- $record->nid = $node->nid;
|
|
|
|
- drupal_write_record('node',$record,'nid');
|
|
|
|
- drupal_write_record('node_revisions',$record,'nid');
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/*******************************************************************************
|
|
/*******************************************************************************
|
|
* Delete KEGG anlysis
|
|
* Delete KEGG anlysis
|
|
*/
|
|
*/
|
|
function chado_analysis_kegg_delete($node){
|
|
function chado_analysis_kegg_delete($node){
|
|
- // Before removing, get analysis_id so we can remove it from chado database
|
|
|
|
- // later
|
|
|
|
- $sql_drupal = "SELECT analysis_id ".
|
|
|
|
- "FROM {chado_analysis} ".
|
|
|
|
- "WHERE nid = %d ".
|
|
|
|
- "AND vid = %d";
|
|
|
|
- $analysis_id = db_result(db_query($sql_drupal, $node->nid, $node->vid));
|
|
|
|
-
|
|
|
|
- // Remove data from the {chado_analysis}, {node}, and {node_revisions} tables
|
|
|
|
- $sql_del = "DELETE FROM {chado_analysis} ".
|
|
|
|
- "WHERE nid = %d ".
|
|
|
|
- "AND vid = %d";
|
|
|
|
- db_query($sql_del, $node->nid, $node->vid);
|
|
|
|
- $sql_del = "DELETE FROM {node} ".
|
|
|
|
- "WHERE nid = %d ".
|
|
|
|
- "AND vid = %d";
|
|
|
|
- db_query($sql_del, $node->nid, $node->vid);
|
|
|
|
- $sql_del = "DELETE FROM {node_revisions} ".
|
|
|
|
- "WHERE nid = %d ".
|
|
|
|
- "AND vid = %d";
|
|
|
|
- db_query($sql_del, $node->nid, $node->vid);
|
|
|
|
-
|
|
|
|
- //Remove from analysisfeatureprop, analysisfeature, analysis, and analysisprop tables
|
|
|
|
- $previous_db = tripal_db_set_active('chado');
|
|
|
|
- $sql = "SELECT analysisfeature_id FROM {analysisfeature} WHERE analysis_id=%d";
|
|
|
|
- $results = db_query($sql, $analysis_id);
|
|
|
|
- while ($af = db_fetch_object($results)) {
|
|
|
|
- db_query("DELETE FROM {analysisfeatureprop} WHERE analysisfeature_id = %d", $af->analysisfeature_id);
|
|
|
|
- }
|
|
|
|
- db_query("DELETE FROM {analysisfeature} WHERE analysis_id = %d", $analysis_id);
|
|
|
|
- db_query("DELETE FROM {analysisprop} WHERE analysis_id = %d", $analysis_id);
|
|
|
|
- db_query("DELETE FROM {analysis} WHERE analysis_id = %d", $analysis_id);
|
|
|
|
- tripal_db_set_active($previous_db);
|
|
|
|
|
|
+ chado_analysis_delete($node);
|
|
}
|
|
}
|
|
|
|
|
|
/*******************************************************************************
|
|
/*******************************************************************************
|
|
* Update KEGG analysis
|
|
* Update KEGG analysis
|
|
*/
|
|
*/
|
|
function chado_analysis_kegg_update($node){
|
|
function chado_analysis_kegg_update($node){
|
|
- global $user;
|
|
|
|
- if($node->revision){
|
|
|
|
- // TODO -- decide what to do about revisions
|
|
|
|
- } else {
|
|
|
|
- // Create a timestamp so we can insert it into the chado database
|
|
|
|
- $time = $node->timeexecuted;
|
|
|
|
- $month = $time['month'];
|
|
|
|
- $day = $time['day'];
|
|
|
|
- $year = $time['year'];
|
|
|
|
- $timestamp = $month.'/'.$day.'/'.$year;
|
|
|
|
|
|
+ // insert the analysis
|
|
|
|
+ chado_analysis_update($node);
|
|
|
|
|
|
- // get the analysis_id for this node:
|
|
|
|
- $sql = "SELECT analysis_id ".
|
|
|
|
- "FROM {chado_analysis} ".
|
|
|
|
- "WHERE vid = %d";
|
|
|
|
- $analysis_id = db_fetch_object(db_query($sql, $node->vid))->analysis_id;
|
|
|
|
-
|
|
|
|
- $sql = "UPDATE {analysis} ".
|
|
|
|
- "SET name = '%s', ".
|
|
|
|
- " description = '%s', ".
|
|
|
|
- " program = '%s', ".
|
|
|
|
- " programversion = '%s', ".
|
|
|
|
- " algorithm = '%s', ".
|
|
|
|
- " sourcename = '%s', ".
|
|
|
|
- " sourceversion = '%s', ".
|
|
|
|
- " sourceuri = '%s', ".
|
|
|
|
- " timeexecuted = '%s' ".
|
|
|
|
- "WHERE analysis_id = %d ";
|
|
|
|
-
|
|
|
|
- $previous_db = tripal_db_set_active('chado'); // use chado database
|
|
|
|
- db_query($sql, $node->analysisname, $node->description, $node->program,
|
|
|
|
- $node->programversion,$node->algorithm,$node->sourcename,
|
|
|
|
- $node->sourceversion, $node->sourceuri, $timestamp, $analysis_id);
|
|
|
|
-
|
|
|
|
- // Get cvterm_id for 'analysis_kegg_settings'
|
|
|
|
- $sql = "SELECT CVT.cvterm_id FROM {cvterm} CVT ".
|
|
|
|
- "INNER JOIN cv CV ON CV.cv_id = CVT.cv_id ".
|
|
|
|
- "WHERE CVT.name = 'analysis_kegg_settings' ".
|
|
|
|
- "AND CV.name = 'tripal'";
|
|
|
|
- $type_id = db_result(db_query($sql));
|
|
|
|
-
|
|
|
|
- $sql = "UPDATE {analysisprop} ".
|
|
|
|
- "SET value = '%s' ".
|
|
|
|
- "WHERE analysis_id = %d AND type_id = %d";
|
|
|
|
- $keggsettings = $node->hierfile;
|
|
|
|
- db_query($sql, $keggsettings, $analysis_id, $type_id);
|
|
|
|
-
|
|
|
|
- tripal_db_set_active($previous_db); // switch back to drupal database
|
|
|
|
- // Add a job if the user wants to parse the html output
|
|
|
|
- if($node->keggjob) {
|
|
|
|
- $job_args[0] = $analysis_id;
|
|
|
|
- $job_args[1] = $node->hierfile;
|
|
|
|
- $job_args[2] = base_path();
|
|
|
|
- if (is_readable($node->hierfile)) {
|
|
|
|
- $fname = preg_replace("/.*\/(.*)/", "$1", $node->hierfile);
|
|
|
|
- tripal_add_job("Parse KAAS output: $fname",'tripal_analysis_kegg',
|
|
|
|
- 'tripal_analysis_kegg_parseHierFile', $job_args, $user->uid);
|
|
|
|
- } else {
|
|
|
|
- drupal_set_message("Can not open KAAS hier.tar.gz output file. Job not scheduled.");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // set the type for this analysis
|
|
|
|
+ tripal_analysis_update_property($node->analysis->analysis_id,'analysis_type','tripal_analysis_kegg',1);
|
|
|
|
|
|
- // Create a title for the analysis node using the unique keys so when the
|
|
|
|
- // node is saved, it will have a title
|
|
|
|
- $record = new stdClass();
|
|
|
|
- // If the analysis has a name, use it as the node title. If not, construct
|
|
|
|
- // the title using program, programversion, and sourcename
|
|
|
|
- if ($node->analysisname) {
|
|
|
|
- $record->title = $node->analysisname;
|
|
|
|
- } else {
|
|
|
|
- //Construct node title as "program (version)
|
|
|
|
- $record->title = "$node->program ($node->programversion)";
|
|
|
|
- }
|
|
|
|
- $record->nid = $node->nid;
|
|
|
|
- drupal_write_record('node',$record,'nid');
|
|
|
|
- drupal_write_record('node_revisions',$record,'nid');
|
|
|
|
- }
|
|
|
|
|
|
+ // now add in the remaining settings as a single property but separated by bars
|
|
|
|
+ tripal_analysis_update_property($node->analysis_id,'analysis_kegg_settings',$node->hierfile,1);
|
|
|
|
+
|
|
|
|
+ // Add a job if the user wants to parse the html output
|
|
|
|
+ chado_analysis_kegg_submit_job($node);
|
|
}
|
|
}
|
|
/*******************************************************************************
|
|
/*******************************************************************************
|
|
* When a node is requested by the user this function is called to allow us
|
|
* When a node is requested by the user this function is called to allow us
|
|
* to add auxiliary data to the node object.
|
|
* to add auxiliary data to the node object.
|
|
*/
|
|
*/
|
|
function chado_analysis_kegg_load($node){
|
|
function chado_analysis_kegg_load($node){
|
|
- // get the analysis_id for this node:
|
|
|
|
- $sql = "SELECT analysis_id FROM {chado_analysis} WHERE vid = %d";
|
|
|
|
- $ana_node = db_fetch_object(db_query($sql, $node->vid));
|
|
|
|
- $additions = new stdClass();
|
|
|
|
- if ($ana_node) {
|
|
|
|
- // get analysis information
|
|
|
|
- $sql = "SELECT Analysis_id, name AS analysisname, description, program, ".
|
|
|
|
- " programversion, algorithm, sourcename, sourceversion, ".
|
|
|
|
- " sourceuri, timeexecuted ".
|
|
|
|
- "FROM {Analysis} ".
|
|
|
|
- "WHERE Analysis_id = $ana_node->analysis_id";
|
|
|
|
- $previous_db = tripal_db_set_active('chado'); // use chado database
|
|
|
|
- $additions = db_fetch_object(db_query($sql));
|
|
|
|
|
|
|
|
- // get cvterm_id for 'analysis_kegg_settings'
|
|
|
|
- $sql = "SELECT CVT.cvterm_id FROM {cvterm} CVT ".
|
|
|
|
- "INNER JOIN cv ON cv.cv_id = CVT.cv_id ".
|
|
|
|
- "WHERE CVT.name = 'analysis_kegg_settings' ".
|
|
|
|
- "AND CV.name = 'tripal'";
|
|
|
|
- $type_id = db_result(db_query($sql));
|
|
|
|
- // get analysisprop information
|
|
|
|
- $sql = "SELECT value FROM {analysisprop} ".
|
|
|
|
- "WHERE analysis_id = %d ".
|
|
|
|
- "AND type_id = %d";
|
|
|
|
- $analysisprop = db_result(db_query($sql, $ana_node->analysis_id, $type_id));
|
|
|
|
-
|
|
|
|
- $additions->hierfile = $analysisprop;
|
|
|
|
|
|
+ // load the default set of analysis fields
|
|
|
|
+ $additions = chado_analysis_load($node);
|
|
|
|
+
|
|
|
|
+ // create some variables for easier lookup
|
|
|
|
+ $analysis = $additions->analysis;
|
|
|
|
+ $analysis_id = $analysis->analysis_id;
|
|
|
|
+
|
|
|
|
+ // get the heirfile name
|
|
|
|
+ $hierfile = tripal_analysis_get_property($analysis_id,'analysis_kegg_settings');
|
|
|
|
+ $analysis->tripal_analysis_kegg->hierfile = $hierfile->value;
|
|
|
|
|
|
- tripal_db_set_active($previous_db); // now use drupal database
|
|
|
|
- }
|
|
|
|
- // If the analysis has a name, use it as the node title. If not, construct
|
|
|
|
- // the title using program programversion, and sourcename
|
|
|
|
- if ($additions->analysisname) {
|
|
|
|
- $additions->title = $additions->analysisname;
|
|
|
|
- } else {
|
|
|
|
- // Construct node title as "program version (source)
|
|
|
|
- $additions->title = "$additions->program ($additions->programversion)";
|
|
|
|
- }
|
|
|
|
return $additions;
|
|
return $additions;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -864,8 +590,27 @@ function tripal_analysis_kegg_theme () {
|
|
'arguments' => array('node'=> null),
|
|
'arguments' => array('node'=> null),
|
|
'template' => 'tripal_organism_kegg_summary',
|
|
'template' => 'tripal_organism_kegg_summary',
|
|
),
|
|
),
|
|
|
|
+ 'tripal_analysis_kegg_report' => array (
|
|
|
|
+ 'arguments' => array('node'=> null),
|
|
|
|
+ 'template' => 'tripal_analysis_kegg_report',
|
|
|
|
+ ),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+/**
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * @ingroup tripal_analysis_kegg
|
|
|
|
+ */
|
|
|
|
+function tripal_analysis_kegg_preprocess(&$variables){
|
|
|
|
+
|
|
|
|
+ // if the template file is the default node template file then we want
|
|
|
|
+ // to add all of our variables.
|
|
|
|
+ if($variables['template_files'][0] == 'node-chado_analysis_kegg'){
|
|
|
|
+ $analysis = $variables['node']->analysis;
|
|
|
|
+ $report = tripal_analysis_kegg_full_report($analysis->analysis_id);
|
|
|
|
+ $analysis->tripal_analysis_kegg->kegg_report = $report;
|
|
|
|
+ }
|
|
|
|
+}
|
|
/*******************************************************************************
|
|
/*******************************************************************************
|
|
*
|
|
*
|
|
*/
|
|
*/
|