function drush_tripal_phylogeny_trp_insert_phylotree

2.x tripal_phylogeny.drush.inc drush_tripal_phylogeny_trp_insert_phylotree()
3.x tripal_phylogeny.drush.inc drush_tripal_phylogeny_trp_insert_phylotree()

Deletes a phylotree record.

Executed when 'drush trp-delete-phylotree' is called.

Related topics

File

tripal_phylogeny/tripal_phylogeny.drush.inc, line 125
Contains function relating to drush-integration of this module.

Code

function drush_tripal_phylogeny_trp_insert_phylotree() {
  $username = drush_get_option('username');
  drush_tripal_core_set_user($username);

  $options = array(
    'name' => drush_get_option('name'),
    'description' => drush_get_option('description'),
    'analysis' => drush_get_option('analysis'),
    'leaf_type' => drush_get_option('leaf_type'),
    'tree_file' => drush_get_option('tree_file'),
    'format' => drush_get_option('format'),
    'dbxref' => drush_get_option('dbxref'),
    'sync' => drush_get_option('sync'),
    'match' => drush_get_option('match'),
    'name_re' => drush_get_option('name_re'),
    'load_now' => TRUE,
  );
  $errors = array();
  $warnings = array();
  if (tripal_insert_phylotree($options, $errors, $warnings)) {

    if ($options['sync']) {
      chado_node_sync_records('phylotree', FALSE, FALSE, 
      array(), $ids = array($options['phylotree_id']));

      $nid = chado_get_nid_from_id('phylotree', $options['phylotree_id']);
      tripal_add_node_variable($nid, 'phylotree_name_re', $options['name_re']);
      tripal_add_node_variable($nid, 'phylotree_use_uniquename', $options['match']);
      tripal_add_node_variable($nid, 'phylotree_tree_file', basename($options['tree_file']));
    }
  }
  drush_print("Done.");
}