|  | @@ -17,7 +17,7 @@
 | 
											
												
													
														|  |  require('api/tripal_analysis.api.inc');
 |  |  require('api/tripal_analysis.api.inc');
 | 
											
												
													
														|  |  require('includes/tripal_analysis_privacy.inc');
 |  |  require('includes/tripal_analysis_privacy.inc');
 | 
											
												
													
														|  |  require('includes/tripal_analysis.admin.inc');
 |  |  require('includes/tripal_analysis.admin.inc');
 | 
											
												
													
														|  | -require('includes/tripal_analysis-properties.inc');
 |  | 
 | 
											
												
													
														|  | 
 |  | +require('includes/tripal_analysis.form.inc');
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
										
											
												
													
														|  | @@ -27,6 +27,7 @@ require('includes/tripal_analysis-properties.inc');
 | 
											
												
													
														|  |   */
 |  |   */
 | 
											
												
													
														|  |  function tripal_analysis_init() {
 |  |  function tripal_analysis_init() {
 | 
											
												
													
														|  |    drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/tripal_analysis.js');
 |  |    drupal_add_js(drupal_get_path('theme', 'tripal') . '/js/tripal_analysis.js');
 | 
											
												
													
														|  | 
 |  | +  drupal_add_css(drupal_get_path('theme', 'tripal') . '/css/tripal_analysis.css');    
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
										
											
												
													
														|  | @@ -63,37 +64,30 @@ function tripal_analysis_menu() {
 | 
											
												
													
														|  |        'type' => MENU_NORMAL_ITEM,
 |  |        'type' => MENU_NORMAL_ITEM,
 | 
											
												
													
														|  |        'file' => 'includes/tripal_analysis.admin.inc',
 |  |        'file' => 'includes/tripal_analysis.admin.inc',
 | 
											
												
													
														|  |    );
 |  |    );
 | 
											
												
													
														|  | -  
 |  | 
 | 
											
												
													
														|  | -  //Edit/Deleting Properties-------------
 |  | 
 | 
											
												
													
														|  | -/*  $items['node/%ta_node/edit_analysis_properties'] = array(
 |  | 
 | 
											
												
													
														|  | -    'title' => 'Edit Properties',
 |  | 
 | 
											
												
													
														|  | -    'description' => 'Analysis Properties',
 |  | 
 | 
											
												
													
														|  | -    'page callback' => 'tripal_analysis_edit_ALL_properties_page',
 |  | 
 | 
											
												
													
														|  | -    'page arguments' => array(1),
 |  | 
 | 
											
												
													
														|  | 
 |  | + 
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +  // AJAX calls for adding/removing properties to a contact
 | 
											
												
													
														|  | 
 |  | +  $items['tripal_analysis/properties/add'] = array(
 | 
											
												
													
														|  | 
 |  | +    'page callback' => 'tripal_analysis_property_add',
 | 
											
												
													
														|  | 
 |  | +    'access arguments' => array('edit chado_analysis content'),
 | 
											
												
													
														|  | 
 |  | +    'type ' => MENU_CALLBACK,
 | 
											
												
													
														|  | 
 |  | +  );
 | 
											
												
													
														|  | 
 |  | +  $items['tripal_analysis/properties/description'] = array(
 | 
											
												
													
														|  | 
 |  | +    'page callback' => 'tripal_analysis_property_get_description',
 | 
											
												
													
														|  | 
 |  | +    'access arguments' => array('edit chado_analysis content'),
 | 
											
												
													
														|  | 
 |  | +    'type ' => MENU_CALLBACK,
 | 
											
												
													
														|  | 
 |  | +  );
 | 
											
												
													
														|  | 
 |  | +  $items['tripal_analysis/properties/minus/%/%'] = array(
 | 
											
												
													
														|  | 
 |  | +    'page callback' => 'tripal_analysis_property_delete',
 | 
											
												
													
														|  | 
 |  | +    'page arguments' => array(3, 4),
 | 
											
												
													
														|  |      'access arguments' => array('edit chado_analysis content'),
 |  |      'access arguments' => array('edit chado_analysis content'),
 | 
											
												
													
														|  | -    'type' => MENU_LOCAL_TASK,
 |  | 
 | 
											
												
													
														|  | -    'weight' => 8,
 |  | 
 | 
											
												
													
														|  | -  );*/
 |  | 
 | 
											
												
													
														|  | 
 |  | +    'type ' => MENU_CALLBACK,
 | 
											
												
													
														|  | 
 |  | +  );
 | 
											
												
													
														|  | 
 |  | +  
 | 
											
												
													
														|  | 
 |  | +  
 | 
											
												
													
														|  |    return $items;
 |  |    return $items;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | -/**
 |  | 
 | 
											
												
													
														|  | - * Implements Menu wildcard_load hook
 |  | 
 | 
											
												
													
														|  | - * Purpose: Allows the node ID of a chado analysis to be dynamically
 |  | 
 | 
											
												
													
														|  | - *   pulled from the path. The node is loaded from this node ID
 |  | 
 | 
											
												
													
														|  | - *   and supplied to the page as an arguement
 |  | 
 | 
											
												
													
														|  | - *
 |  | 
 | 
											
												
													
														|  | - * @ingroup tripal_analysis
 |  | 
 | 
											
												
													
														|  | - */
 |  | 
 | 
											
												
													
														|  | -function ta_node_load($nid) {  
 |  | 
 | 
											
												
													
														|  | -  if (is_numeric($nid)) {
 |  | 
 | 
											
												
													
														|  | -    $node = node_load($nid);
 |  | 
 | 
											
												
													
														|  | -    $analysis_id = chado_get_id_for_node('analysis', $node);
 |  | 
 | 
											
												
													
														|  | -    if ($analysis_id) {
 |  | 
 | 
											
												
													
														|  | -      return $node;
 |  | 
 | 
											
												
													
														|  | -    }
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  return FALSE;
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
												
													
														|  |   * Provide information to drupal about the node types that we're creating
 |  |   * Provide information to drupal about the node types that we're creating
 | 
											
										
											
												
													
														|  | @@ -194,6 +188,55 @@ function chado_analysis_insert($node) {
 | 
											
												
													
														|  |     // use by other analysis modules that may be using this function
 |  |     // use by other analysis modules that may be using this function
 | 
											
												
													
														|  |      $node->analysis = $analysis;
 |  |      $node->analysis = $analysis;
 | 
											
												
													
														|  |      $node->analysis_id = $analysis_id; // we need to set this for children
 |  |      $node->analysis_id = $analysis_id; // we need to set this for children
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    // now add the properties
 | 
											
												
													
														|  | 
 |  | +    $properties = array(); // stores all of the properties we need to add    
 | 
											
												
													
														|  | 
 |  | +    // get the list of properties for easy lookup (without doing lots of database queries
 | 
											
												
													
														|  | 
 |  | +    $properties_list = array();
 | 
											
												
													
														|  | 
 |  | +    $sql = "
 | 
											
												
													
														|  | 
 |  | +      SELECT DISTINCT CVT.cvterm_id, CVT.name, CVT.definition
 | 
											
												
													
														|  | 
 |  | +      FROM  {cvterm} CVT
 | 
											
												
													
														|  | 
 |  | +        INNER JOIN {cv} ON CVT.cv_id = CV.cv_id
 | 
											
												
													
														|  | 
 |  | +      WHERE
 | 
											
												
													
														|  | 
 |  | +        CV.name = 'analysis_property' AND
 | 
											
												
													
														|  | 
 |  | +        NOT CVT.is_obsolete = 1
 | 
											
												
													
														|  | 
 |  | +      ORDER BY CVT.name ASC
 | 
											
												
													
														|  | 
 |  | +    ";
 | 
											
												
													
														|  | 
 |  | +    $prop_types = chado_query($sql);
 | 
											
												
													
														|  | 
 |  | +    while ($prop = db_fetch_object($prop_types)) {
 | 
											
												
													
														|  | 
 |  | +    	$properties_list[$prop->cvterm_id] = $prop->name;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    // get the properties that should be added. Properties are in one of two forms:
 | 
											
												
													
														|  | 
 |  | +    //  1) prop_value-[type id]-[index]
 | 
											
												
													
														|  | 
 |  | +    //  2) new_value-[type id]-[index]
 | 
											
												
													
														|  | 
 |  | +    //  3) new_id, new_value
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    foreach ($node as $name => $value) {
 | 
											
												
													
														|  | 
 |  | +    	if (preg_match('/^new_value-(\d+)-(\d+)/', $name, $matches)) {
 | 
											
												
													
														|  | 
 |  | +    		$type_id = $matches[1];
 | 
											
												
													
														|  | 
 |  | +    		$index = $matches[2];
 | 
											
												
													
														|  | 
 |  | +    		$name = $properties_list[$type_id];
 | 
											
												
													
														|  | 
 |  | +    		$properties[$name][$index] = trim($value);
 | 
											
												
													
														|  | 
 |  | +    	}
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    if ($node->new_id and $node->new_value) {
 | 
											
												
													
														|  | 
 |  | +    	$type_id = $node->new_id;
 | 
											
												
													
														|  | 
 |  | +    	$name = $properties_list[$type_id];
 | 
											
												
													
														|  | 
 |  | +    	$index = count($properties[$name]);
 | 
											
												
													
														|  | 
 |  | +    	$properties[$name][$index] = trim($node->new_value);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    // now add in the properties
 | 
											
												
													
														|  | 
 |  | +    foreach ($properties as $property => $elements) {
 | 
											
												
													
														|  | 
 |  | +      foreach ($elements as $rank => $value) {
 | 
											
												
													
														|  | 
 |  | +    	  $status = tripal_analysis_insert_property($analysis_id, $property, $value, FALSE);
 | 
											
												
													
														|  | 
 |  | +        if (!$status) {
 | 
											
												
													
														|  | 
 |  | +            drupal_set_message("Error cannot add property: $property", "error");
 | 
											
												
													
														|  | 
 |  | +            watchdog('t_analysis', "Error cannot add property: %prop",
 | 
											
												
													
														|  | 
 |  | +              array('%property' => $property), WATCHDOG_ERROR);
 | 
											
												
													
														|  | 
 |  | +    		}
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
										
											
												
													
														|  | @@ -240,209 +283,113 @@ function chado_analysis_delete($node) {
 | 
											
												
													
														|  |   * @ingroup tripal_analysis
 |  |   * @ingroup tripal_analysis
 | 
											
												
													
														|  |   */
 |  |   */
 | 
											
												
													
														|  |  function chado_analysis_update($node) {
 |  |  function chado_analysis_update($node) {
 | 
											
												
													
														|  | -  global $user;
 |  | 
 | 
											
												
													
														|  | -  if ($node->revision) {
 |  | 
 | 
											
												
													
														|  | -    // TODO -- decide what to do about revisions
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  // 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;
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  // get the analysis_id for this node:
 |  | 
 | 
											
												
													
														|  | -  $sql = "SELECT analysis_id ".
 |  | 
 | 
											
												
													
														|  | -           "FROM {chado_analysis} ".
 |  | 
 | 
											
												
													
														|  | -           "WHERE nid = %d";
 |  | 
 | 
											
												
													
														|  | -  $analysis_id = db_fetch_object(db_query($sql, $node->nid))->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 ";
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  chado_query($sql, $node->analysisname, $node->description, $node->program,
 |  | 
 | 
											
												
													
														|  | -    $node->programversion, $node->algorithm, $node->sourcename,
 |  | 
 | 
											
												
													
														|  | -    $node->sourceversion, $node->sourceuri, $timestamp, $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;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  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');
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -/**
 |  | 
 | 
											
												
													
														|  | - *  When editing or creating a new node of type 'chado_analysis' we need
 |  | 
 | 
											
												
													
														|  | - *  a form.  This function creates the form that will be used for this.
 |  | 
 | 
											
												
													
														|  | - *
 |  | 
 | 
											
												
													
														|  | - * @ingroup tripal_analysis
 |  | 
 | 
											
												
													
														|  | - */
 |  | 
 | 
											
												
													
														|  | -function chado_analysis_form($node) {
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  $analysis = $node->analysis;
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  // add in the description column. It is a text field and may not be included
 |  | 
 | 
											
												
													
														|  | -  // if the text is too big.
 |  | 
 | 
											
												
													
														|  | -  $analysis = tripal_core_expand_chado_vars($analysis, 'field', 'analysis.description');
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  // get form defaults
 |  | 
 | 
											
												
													
														|  | -  $analysis_id = $node->analysis_id;
 |  | 
 | 
											
												
													
														|  | -  if (!$analysis_id) {
 |  | 
 | 
											
												
													
														|  | -    $analysis_id = $analysis->analysis_id;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $analysisname = $node->analysisname;
 |  | 
 | 
											
												
													
														|  | -  if (!$analysisname) {
 |  | 
 | 
											
												
													
														|  | -    $analysisname = $analysis->name;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $program = $node->program;
 |  | 
 | 
											
												
													
														|  | -  if (!$program) {
 |  | 
 | 
											
												
													
														|  | -    $program = $analysis->program;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $programversion = $node->programversion;
 |  | 
 | 
											
												
													
														|  | -  if (!$programversion) {
 |  | 
 | 
											
												
													
														|  | -    $programversion = $analysis->programversion;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $algorithm = $node->algorithm;
 |  | 
 | 
											
												
													
														|  | -  if (!$algorithm) {
 |  | 
 | 
											
												
													
														|  | -    $algorithm = $analysis->algorithm;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $sourcename = $node->sourcename;
 |  | 
 | 
											
												
													
														|  | -  if (!$sourcename) {
 |  | 
 | 
											
												
													
														|  | -    $sourcename = $analysis->sourcename;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $sourceversion = $node->sourceversion;
 |  | 
 | 
											
												
													
														|  | -  if (!$sourceversion) {
 |  | 
 | 
											
												
													
														|  | -    $sourceversion = $analysis->sourceversion;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $sourceuri = $node->sourceuri;
 |  | 
 | 
											
												
													
														|  | -  if (!$sourceuri) {
 |  | 
 | 
											
												
													
														|  | -    $sourceuri = $analysis->sourceuri;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $timeexecuted = $node->timeexecuted;
 |  | 
 | 
											
												
													
														|  | -  if (!$timeexecuted) {
 |  | 
 | 
											
												
													
														|  | -    $timeexecuted = $analysis->timeexecuted;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $description = $node->description;
 |  | 
 | 
											
												
													
														|  | -  if (!$description) {
 |  | 
 | 
											
												
													
														|  | -    $description = $analysis->description;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  $form = array();
 |  | 
 | 
											
												
													
														|  | -  $form['title']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'hidden',
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $node->title,
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['analysis_id']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'hidden',
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $analysis_id,
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['analysisname']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'textfield',
 |  | 
 | 
											
												
													
														|  | -      '#title' => t('Analysis Name'),
 |  | 
 | 
											
												
													
														|  | -      '#required' => TRUE,
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $analysisname,
 |  | 
 | 
											
												
													
														|  | -      '#description' => t("This should be a brief name that
 |  | 
 | 
											
												
													
														|  | -         describes the analysis succintly. This name will helps the user find analyses."),
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['program']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'textfield',
 |  | 
 | 
											
												
													
														|  | -      '#title' => t('Program'),
 |  | 
 | 
											
												
													
														|  | -      '#required' => TRUE,
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $program,
 |  | 
 | 
											
												
													
														|  | -      '#description' => t("Program name, e.g. blastx, blastp, sim4, genscan."),
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['programversion']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'textfield',
 |  | 
 | 
											
												
													
														|  | -      '#title' => t('Program Version'),
 |  | 
 | 
											
												
													
														|  | -      '#required' => TRUE,
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $programversion,
 |  | 
 | 
											
												
													
														|  | -      '#description' => t("Version description, e.g. TBLASTX 2.0MP-WashU [09-Nov-2000]. Enter 'n/a' if no version is available."),
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['algorithm']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'textfield',
 |  | 
 | 
											
												
													
														|  | -      '#title' => t('Algorithm'),
 |  | 
 | 
											
												
													
														|  | -      '#required' => FALSE,
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $algorithm,
 |  | 
 | 
											
												
													
														|  | -      '#description' => t("Algorithm name, e.g. blast."),
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['sourcename']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'textfield',
 |  | 
 | 
											
												
													
														|  | -      '#title' => t('Source Name'),
 |  | 
 | 
											
												
													
														|  | -      '#required' => TRUE,
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $sourcename,
 |  | 
 | 
											
												
													
														|  | -      '#description' => t('The name of the source data.  This could be a file name, data set name or a
 |  | 
 | 
											
												
													
														|  | -           small description for how the data was collected.  For long descriptions use the description field below'),
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['sourceversion']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'textfield',
 |  | 
 | 
											
												
													
														|  | -      '#title' => t('Source Version'),
 |  | 
 | 
											
												
													
														|  | -      '#required' => FALSE,
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $sourceversion,
 |  | 
 | 
											
												
													
														|  | -      '#description' => t('If the source dataset has a version, include it here'),
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['sourceuri']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'textfield',
 |  | 
 | 
											
												
													
														|  | -      '#title' => t('Source URI'),
 |  | 
 | 
											
												
													
														|  | -      '#required' => FALSE,
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $sourceuri,
 |  | 
 | 
											
												
													
														|  | -      '#description' => t("This is a permanent URL or URI for the source of the analysis.
 |  | 
 | 
											
												
													
														|  | -         Someone could recreate the analysis directly by going to this URI and
 |  | 
 | 
											
												
													
														|  | -         fetching the source data (e.g. the blast database, or the training model)."),
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  // Get time saved in chado
 |  | 
 | 
											
												
													
														|  | -  $default_time = $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,
 |  | 
 | 
											
												
													
														|  | -      ),
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -  $form['description']= array(
 |  | 
 | 
											
												
													
														|  | -      '#type' => 'textarea',
 |  | 
 | 
											
												
													
														|  | -      '#rows' => 15,
 |  | 
 | 
											
												
													
														|  | -      '#title' => t('Materials & Methods (Description and/or Program Settings)'),
 |  | 
 | 
											
												
													
														|  | -      '#required' => FALSE,
 |  | 
 | 
											
												
													
														|  | -      '#default_value' => $description,
 |  | 
 | 
											
												
													
														|  | -      '#description' => t('Please provide all necessary information to allow
 |  | 
 | 
											
												
													
														|  | -         someone to recreate the analysis, including materials and methods
 |  | 
 | 
											
												
													
														|  | -         for collection of the source data and performing the analysis'),
 |  | 
 | 
											
												
													
														|  | -  );
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  return $form;
 |  | 
 | 
											
												
													
														|  | 
 |  | +	global $user;
 | 
											
												
													
														|  | 
 |  | +	if ($node->revision) {
 | 
											
												
													
														|  | 
 |  | +		// TODO -- decide what to do about revisions
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +	// 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;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +	// get the analysis_id for this node:
 | 
											
												
													
														|  | 
 |  | +	$sql = "SELECT analysis_id ".
 | 
											
												
													
														|  | 
 |  | +			"FROM {chado_analysis} ".
 | 
											
												
													
														|  | 
 |  | +			"WHERE nid = %d";
 | 
											
												
													
														|  | 
 |  | +	$analysis_id = db_fetch_object(db_query($sql, $node->nid))->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 ";
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +	chado_query($sql, $node->analysisname, $node->description, $node->program,
 | 
											
												
													
														|  | 
 |  | +	$node->programversion, $node->algorithm, $node->sourcename,
 | 
											
												
													
														|  | 
 |  | +	$node->sourceversion, $node->sourceuri, $timestamp, $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;
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +	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 update the properties
 | 
											
												
													
														|  | 
 |  | +	$properties = array(); // stores all of the properties we need to add
 | 
											
												
													
														|  | 
 |  | +	// get the list of properties for easy lookup (without doing lots of database queries
 | 
											
												
													
														|  | 
 |  | +	$properties_list = array();
 | 
											
												
													
														|  | 
 |  | +	$sql = "
 | 
											
												
													
														|  | 
 |  | +			SELECT DISTINCT CVT.cvterm_id, CVT.name, CVT.definition
 | 
											
												
													
														|  | 
 |  | +			FROM  {cvterm} CVT
 | 
											
												
													
														|  | 
 |  | +			INNER JOIN {cv} ON CVT.cv_id = CV.cv_id
 | 
											
												
													
														|  | 
 |  | +			WHERE
 | 
											
												
													
														|  | 
 |  | +			CV.name = 'analysis_property' AND
 | 
											
												
													
														|  | 
 |  | +			NOT CVT.is_obsolete = 1
 | 
											
												
													
														|  | 
 |  | +			ORDER BY CVT.name ASC
 | 
											
												
													
														|  | 
 |  | +			";
 | 
											
												
													
														|  | 
 |  | +	$prop_types = chado_query($sql);
 | 
											
												
													
														|  | 
 |  | +	while ($prop = db_fetch_object($prop_types)) {
 | 
											
												
													
														|  | 
 |  | +		$properties_list[$prop->cvterm_id] = $prop->name;
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +	// get the properties that should be added. Properties are in one of three forms:
 | 
											
												
													
														|  | 
 |  | +	//  1) prop_value-[type id]-[index]
 | 
											
												
													
														|  | 
 |  | +	//  2) new_value-[type id]-[index]
 | 
											
												
													
														|  | 
 |  | +	//  3) new_id, new_value
 | 
											
												
													
														|  | 
 |  | +	//  dpm($node);
 | 
											
												
													
														|  | 
 |  | +	foreach ($node as $key => $value) {
 | 
											
												
													
														|  | 
 |  | +		if (preg_match('/^prop_value-(\d+)-(\d+)/', $key, $matches)) {
 | 
											
												
													
														|  | 
 |  | +			$type_id = $matches[1];
 | 
											
												
													
														|  | 
 |  | +			$index = $matches[2];
 | 
											
												
													
														|  | 
 |  | +			$name = $properties_list[$type_id];
 | 
											
												
													
														|  | 
 |  | +			$properties[$name][$index] = trim($value);
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +		if (preg_match('/^new_value-(\d+)-(\d+)/', $key, $matches)) {
 | 
											
												
													
														|  | 
 |  | +			$type_id = $matches[1];
 | 
											
												
													
														|  | 
 |  | +			$index = $matches[2];
 | 
											
												
													
														|  | 
 |  | +			$name = $properties_list[$type_id];
 | 
											
												
													
														|  | 
 |  | +			$properties[$name][$index] = trim($value);
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +	if ($node->new_id and $node->new_value) {
 | 
											
												
													
														|  | 
 |  | +		$type_id = $node->new_id;
 | 
											
												
													
														|  | 
 |  | +		$name = $properties_list[$type_id];
 | 
											
												
													
														|  | 
 |  | +		$index = count($properties[$name]);
 | 
											
												
													
														|  | 
 |  | +		$properties[$name][$index] = trim($node->new_value);
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +	// now add in the properties by first removing any the analysis
 | 
											
												
													
														|  | 
 |  | +	// already has and adding the ones we have
 | 
											
												
													
														|  | 
 |  | +	tripal_core_chado_delete('analysisprop', array('analysis_id' => $analysis_id));
 | 
											
												
													
														|  | 
 |  | +	foreach ($properties as $property => $elements) {
 | 
											
												
													
														|  | 
 |  | +		foreach ($elements as $rank => $value) {
 | 
											
												
													
														|  | 
 |  | +			$status = tripal_analysis_insert_property($analysis_id, $property, $value, FALSE);
 | 
											
												
													
														|  | 
 |  | +			if (!$status) {
 | 
											
												
													
														|  | 
 |  | +				drupal_set_message("Error cannot add property: '$property'", "error");
 | 
											
												
													
														|  | 
 |  | +				watchdog('t_analysis', "Error cannot add property: '%prop'",
 | 
											
												
													
														|  | 
 |  | +				array('%prop' => $property), WATCHDOG_ERROR);
 | 
											
												
													
														|  | 
 |  | +			}
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |   /**
 |  |   /**
 | 
											
										
											
												
													
														|  | @@ -490,106 +437,7 @@ function chado_analysis_view($node, $teaser = FALSE, $page = FALSE) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -/**
 |  | 
 | 
											
												
													
														|  | - * Validates the user input before creating an analysis node
 |  | 
 | 
											
												
													
														|  | - *
 |  | 
 | 
											
												
													
														|  | - * @ingroup tripal_analysis
 |  | 
 | 
											
												
													
														|  | - */
 |  | 
 | 
											
												
													
														|  | -function chado_analysis_validate($node, &$form) {
 |  | 
 | 
											
												
													
														|  | -   // use the analysis parent to validate the node
 |  | 
 | 
											
												
													
														|  | -  tripal_analysis_validate($node, $form);
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -/**
 |  | 
 | 
											
												
													
														|  | - * This validation is being used for three activities:
 |  | 
 | 
											
												
													
														|  | - *   CASE A: Update a node that exists in both drupal and chado
 |  | 
 | 
											
												
													
														|  | - *   CASE B: Synchronizing a node from chado to drupal
 |  | 
 | 
											
												
													
														|  | - *   CASE C: Inserting a new node that exists in niether drupal nor chado
 |  | 
 | 
											
												
													
														|  | - *
 |  | 
 | 
											
												
													
														|  | - * @ingroup tripal_analysis
 |  | 
 | 
											
												
													
														|  | - */
 |  | 
 | 
											
												
													
														|  | -function tripal_analysis_validate($node, &$form) {
 |  | 
 | 
											
												
													
														|  | -  
 |  | 
 | 
											
												
													
														|  | - 
 |  | 
 | 
											
												
													
														|  | -  // Only nodes being updated will have an nid already
 |  | 
 | 
											
												
													
														|  | -  if (!is_null($node->nid)) {    
 |  | 
 | 
											
												
													
														|  | -    // CASE A: We are validating a form for updating an existing node
 |  | 
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | -    // get the existing node    
 |  | 
 | 
											
												
													
														|  | -    $values = array('analysis_id' => $node->analysis_id);      
 |  | 
 | 
											
												
													
														|  | -    $result = tripal_core_chado_select('analysis', array('*'), $values);
 |  | 
 | 
											
												
													
														|  | -    $analysis = $result[0];
 |  | 
 | 
											
												
													
														|  | -      
 |  | 
 | 
											
												
													
														|  | -    // if the name has changed make sure it doesn't conflict with an existing name
 |  | 
 | 
											
												
													
														|  | -    if($analysis->name != $node->analysisname) {
 |  | 
 | 
											
												
													
														|  | -      $values = array('name' => $node->analysisname);
 |  | 
 | 
											
												
													
														|  | -      $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
 |  | 
 | 
											
												
													
														|  | -      if($result and count($result) > 0) {
 |  | 
 | 
											
												
													
														|  | -        form_set_error('analysisname', 'Cannot update the analysis with this analysis name. An analysis with this name already exists.');
 |  | 
 | 
											
												
													
														|  | -        return;
 |  | 
 | 
											
												
													
														|  | -      }  
 |  | 
 | 
											
												
													
														|  | -    }
 |  | 
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | -    // if the unique constraint has changed check to make sure it doesn't conflict with an
 |  | 
 | 
											
												
													
														|  | -    // existing record
 |  | 
 | 
											
												
													
														|  | -    if($analysis->program != $node->program or $analysis->programversion != $node->programversion or 
 |  | 
 | 
											
												
													
														|  | -       $analysis->sourcename != $node->sourcename) {
 |  | 
 | 
											
												
													
														|  | -      $values = array(
 |  | 
 | 
											
												
													
														|  | -        'program' => $node->program,
 |  | 
 | 
											
												
													
														|  | -        'programversion' => $node->programversion,
 |  | 
 | 
											
												
													
														|  | -        'sourcename' => $node->sourcename,
 |  | 
 | 
											
												
													
														|  | -      );
 |  | 
 | 
											
												
													
														|  | -      $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
 |  | 
 | 
											
												
													
														|  | -      if ($result and count($result) > 0) {
 |  | 
 | 
											
												
													
														|  | -        if ($analysis->program != $node->program) {
 |  | 
 | 
											
												
													
														|  | -          $field = 'program';  
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -        if ($analysis->programversion != $node->programversion) {
 |  | 
 | 
											
												
													
														|  | -          $field = 'programversion';  
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -        if ($analysis->sourcename != $node->sourcename) {
 |  | 
 | 
											
												
													
														|  | -          $field = 'sourcename';  
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -        form_set_error($field, 'Cannot update the analysis with this program,
 |  | 
 | 
											
												
													
														|  | -          program version and source name. An analysis with these values already exists.');
 |  | 
 | 
											
												
													
														|  | -        return;
 |  | 
 | 
											
												
													
														|  | -      }  
 |  | 
 | 
											
												
													
														|  | -    }
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  else{
 |  | 
 | 
											
												
													
														|  | -    // To differentiate if we are syncing or creating a new analysis altogther, see if an
 |  | 
 | 
											
												
													
														|  | -    // analysis_id already exists
 |  | 
 | 
											
												
													
														|  | -    if ($node->analysis_id and $node->analysis_id != 0) {
 |  | 
 | 
											
												
													
														|  | -      // CASE B: Synchronizing a node from chado to drupal
 |  | 
 | 
											
												
													
														|  | -      // we don't need to do anything.
 |  | 
 | 
											
												
													
														|  | -    }
 |  | 
 | 
											
												
													
														|  | -    else {
 |  | 
 | 
											
												
													
														|  | -      // CASE C: We are validating a form for inserting a new node
 |  | 
 | 
											
												
													
														|  | -      // The unique constraint for the chado analysis table is: program, programversion, sourcename
 |  | 
 | 
											
												
													
														|  | -      $values = array(
 |  | 
 | 
											
												
													
														|  | -        'program' => $node->program,
 |  | 
 | 
											
												
													
														|  | -        'programversion' => $node->programversion,
 |  | 
 | 
											
												
													
														|  | -        'sourcename' => $node->sourcename,
 |  | 
 | 
											
												
													
														|  | -      );
 |  | 
 | 
											
												
													
														|  | -      $analysis = tripal_core_chado_select('analysis', array('analysis_id'), $values);
 |  | 
 | 
											
												
													
														|  | -      if ($analysis and count($analysis) > 0) {
 |  | 
 | 
											
												
													
														|  | -        form_set_error('program', 'Cannot add the analysis with this program,
 |  | 
 | 
											
												
													
														|  | -          program version and source name. An analysis with these values already exists.');
 |  | 
 | 
											
												
													
														|  | -        return;
 |  | 
 | 
											
												
													
														|  | -      }
 |  | 
 | 
											
												
													
														|  | -      
 |  | 
 | 
											
												
													
														|  | -      // make sure we have a unique analysis name. This is not a requirement 
 |  | 
 | 
											
												
													
														|  | -      // for the analysis table but we use the analysis name for the Drupal node
 |  | 
 | 
											
												
													
														|  | -      // title, so it should be unique      
 |  | 
 | 
											
												
													
														|  | -      $values = array('name' => $node->analysisname);
 |  | 
 | 
											
												
													
														|  | -      $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
 |  | 
 | 
											
												
													
														|  | -      if($result and count($result) > 0) {
 |  | 
 | 
											
												
													
														|  | -        form_set_error('analysisname', 'Cannot add the analysis with this analysis name. An analysis with this name already exists.');
 |  | 
 | 
											
												
													
														|  | -        return;
 |  | 
 | 
											
												
													
														|  | -      }
 |  | 
 | 
											
												
													
														|  | -    }
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
												
													
														|  |   * Display help and module information
 |  |   * Display help and module information
 | 
											
										
											
												
													
														|  | @@ -681,6 +529,13 @@ function tripal_analysis_theme() {
 | 
											
												
													
														|  |        'template' => 'tripal_analysis_admin',  
 |  |        'template' => 'tripal_analysis_admin',  
 | 
											
												
													
														|  |        'arguments' =>  array(NULL),  
 |  |        'arguments' =>  array(NULL),  
 | 
											
												
													
														|  |        'path' => drupal_get_path('module', 'tripal_analysis') . '/theme', 
 |  |        'path' => drupal_get_path('module', 'tripal_analysis') . '/theme', 
 | 
											
												
													
														|  | 
 |  | +    ),
 | 
											
												
													
														|  | 
 |  | +  	 'tripal_analysis_properties' => array(
 | 
											
												
													
														|  | 
 |  | +  				'arguments' => array('node' => NULL)
 | 
											
												
													
														|  | 
 |  | +  	 ),
 | 
											
												
													
														|  | 
 |  | +    // Themed Forms
 | 
											
												
													
														|  | 
 |  | +    'chado_analysis_node_form' => array(
 | 
											
												
													
														|  | 
 |  | +      'arguments' => array('form'),
 | 
											
												
													
														|  |      ),
 |  |      ),
 | 
											
												
													
														|  |    );
 |  |    );
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
										
											
												
													
														|  | @@ -768,3 +623,11 @@ function tripal_analysis_views_api() {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +/*
 | 
											
												
													
														|  | 
 |  | + * 
 | 
											
												
													
														|  | 
 |  | + */
 | 
											
												
													
														|  | 
 |  | +function tripal_analysis_form_alter(&$form, &$form_state, $form_id) {
 | 
											
												
													
														|  | 
 |  | +  if ($form_id == "chado_analysis_node_form") {
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +}
 |