function tripal_feature_job_describe_args

2.x tripal_feature.module tripal_feature_job_describe_args($callback, $args)
3.x tripal_feature.module tripal_feature_job_describe_args($callback, $args)
1.x tripal_feature.module tripal_feature_job_describe_args($callback, $args)

Implements hook_job_describe_args() in order to describe the various feature jobs to the tripal jobs interface.

File

legacy/tripal_feature/tripal_feature.module, line 315
Basic functionality for the tripal module

Code

function tripal_feature_job_describe_args($callback, $args) {

  $new_args = array();
  if ($callback == 'tripal_feature_load_fasta') {
    $new_args['FASTA file'] = $args[0];

    // Add in the organism.
    if ($args[1] AND is_numeric($args[1])) {
      $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[1]));
      $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
    }
    $new_args['Sequence Type'] = $args[2];
    if (isset($args[14])) {
      $new_args['Name Match Type'] = $args[14];
      $new_args['Name RE'] = $args[4];
      $new_args['Unique Name RE'] = $args[5];
    }
    // add in the relationship arguments
    if ($args[8]) {
      $new_args['Relationship Type'] = $args[8];
      $new_args['Relationship Parent RE'] = $args[9];
      $new_args['Relationship Parent Type'] = $args[10];
    }

    // add in the database reference arguments
    if ($args[7] AND is_numeric($args[7])) {
      $db = chado_select_record('db', array('name'), array('db_id' => $args[7]));
      $new_args['Database Reference'] = $db[0]->name;
      $new_args['Accession RE'] = $args[6];
      $new_args['Method'] = $args[11];
    }

    // add in the analysis
    if ($args[12] AND is_numeric($args[12])) {
      $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[12]));
      $new_args['Analysis'] = $analysis[0]->name;
    }
  }
  if ($callback == 'tripal_feature_delete_features') {
    if ($args[0]) {
      $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[0]));
      $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
    }
    else {
      $new_args['Organism'] = '';
    }

    if ($args[1]) {
      $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[1]));
      $new_args['Analysis'] = $analysis[0]->name;
    }
    else {
      $new_args['Analysis'] = '';
    }

    $new_args['Sequence Type'] = $args[2];
    $new_args['Is Unique Name'] = $args[3] ? 'Yes' : 'No';
    $new_args['Features Names'] = $args[4];
  }
  elseif ($callback == 'tripal_feature_load_gff3') {

    $new_args['GFF File'] = $args[0];
    $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[1]));
    $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
    $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[2]));
    $new_args['Analysis'] = $analysis[0]->name;
    $new_args['Use a Transaction'] = ($args[7] == 1) ? "Yes" : "No";
    $new_args['Import only new features'] = ($args[3] == 1) ? "Yes" : "No";
    $new_args['Import all and update'] = ($args[4] == 1) ? "Yes" : "No";
    $new_args['Import all and replace'] = ($args[5] == 1) ? "Yes" : "No";
    $new_args['Delete features'] = ($args[6] == 1) ? "Yes" : "No";
    if ($args[8]) {
      $target_organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[8]));
      $new_args['Target organism'] = $target_organism[0]->genus . " " . $target_organism[0]->species;
    }
    else {
      $new_args['Target organism'] = '';
    }
    $new_args['Target type'] = $args[9];
    $new_args['Create target'] = ($args[10] == 1) ? "Yes" : "No";
    $new_args['Starting line'] = $args[11];
    $new_args['Landmark Type'] = $args[12];
    $new_args['Alternate ID attribute'] = $args[13];
    $new_args['Create Organism'] = ($args[14] == 1) ? "Yes" : "No";
  }
  return $new_args;
}