Tripal v1.0 (6.x-1.0)
tripal_feature.admin.inc
Go to the documentation of this file.
00001 <?php
00002 
00013 function tripal_feature_admin() {
00014 
00015   // before proceeding check to see if we have any
00016   // currently processing jobs. If so, we don't want
00017   // to give the opportunity to sync libraries
00018   $active_jobs = FALSE;
00019   if (tripal_get_module_active_jobs('tripal_feature')) {
00020     $active_jobs = TRUE;
00021   }
00022   if (!$active_jobs) {
00023 
00024     get_tripal_feature_admin_form_url_set($form);
00025 
00026     $form['browser'] = array(
00027        '#type' => 'fieldset',
00028        '#title' => t('Feature Browser'),
00029        '#collapsible' => 1,
00030        '#collapsed' => 1 ,
00031     );
00032     $allowedoptions1  = array(
00033       'show_feature_browser' => "Show the feature browser on the organism page. The browser loads when page loads. This may be slow for large sites.",
00034       'hide_feature_browser' => "Hide the feature browser on the organism page. Disables the feature browser completely.",
00035     );
00036   //      $allowedoptions ['allow_feature_browser'] = "Allow loading of the feature browsing through AJAX. For large sites the initial page load will be quick with the feature browser loading afterwards.";
00037 
00038     $form['browser']['browser_desc'] = array(
00039        '#type'        => 'markup',
00040        '#value' => 'A feature browser can be added to an organism page to allow users to quickly '.
00041           'access a feature.  This will most likely not be the ideal mechanism for accessing feature '.
00042           'information, especially for large sites, but it will alow users exploring the site (such '.
00043           'as students) to better understand the data types available on the site.',
00044 
00045     );
00046     $form['browser']['feature_types'] = array(
00047        '#title'       => t('Feature Types'),
00048        '#type'        => 'textarea',
00049        '#description' => t("Enter the Sequence Ontology (SO) terms for the feature types that " .
00050                            "will be shown in the feature browser."),
00051        '#default_value' => variable_get('chado_browser_feature_types', 'gene contig'),
00052     );
00053 
00054 
00055     $form['browser']['browse_features'] = array(
00056        '#title' => 'Feature Browser on Organism Page',
00057        '#type' => 'radios',
00058        '#options' => $allowedoptions1,
00059        '#default_value' => variable_get('tripal_feature_browse_setting', 'show_feature_browser'),
00060     );
00061 
00062     $form['browser']['browse_features_library'] = array(
00063       '#title' => 'Feature Browser on Library Page',
00064       '#type' => 'radios',
00065       '#options' => array(
00066         'show_feature_browser' => "Show the feature browse on the library page. The browser loads when page loads. This may be slow for large sites.",
00067         'hide_feature_browser' => "Hide the feature browser on the library page. Disables the feature browser completely.",
00068       ),
00069       '#default_value' => variable_get('tripal_library_feature_browse_setting', 'show_feature_browser'),
00070     );
00071 
00072     $form['browser']['browse_features_analysis'] = array(
00073       '#title' => 'Feature Browser on Analysis Page',
00074       '#type' => 'radios',
00075       '#options' => array(
00076         'show_feature_browser' => "Show the feature browse on the analysis page. The browser loads when page loads. This may be slow for large sites.",
00077         'hide_feature_browser' => "Hide the feature browser on the analysis page. Disables the feature browser completely.",
00078       ),
00079      '#default_value' => variable_get('tripal_analysis_feature_browse_setting', 'show_feature_browser'),
00080     );
00081 
00082     $form['browser']['set_browse_button'] = array(
00083        '#type' => 'submit',
00084        '#value' => t('Set Browser'),
00085        '#weight' => 2,
00086     );
00087 
00088 
00089     $form['feature_edit'] = array(
00090        '#type' => 'fieldset',
00091        '#title' => t('Feature Editing'),
00092        '#collapsible' => 1,
00093        '#collapsed' => 1 ,
00094     );
00095 
00096     $form['feature_edit']['browser_desc'] = array(
00097        '#type'        => 'markup',
00098        '#value' => 'When editing or creating a feature, a user must provide the feature type. '.
00099                    'The Sequence Ontology list is very large, therefore, to simply the list of types for the user, the following '.
00100                    'textbox allows you to specify which features types can be used. This list of terms will appear in the '.
00101                    'feature type drop down list of the feature creation/edit form.',
00102 
00103     );
00104     $form['feature_edit']['feature_edit_types'] = array(
00105        '#title'       => t('Feature Types'),
00106        '#type'        => 'textarea',
00107        '#description' => t("Enter the Sequence Ontology (SO) terms for the allowed feature types when creating or editing features."),
00108        '#default_value' => variable_get('chado_edit_feature_types', 'gene contig EST mRNA'),
00109     );
00110 
00111     $form['feature_edit']['set_feature_types'] = array(
00112        '#type' => 'submit',
00113        '#value' => t('Set Feature Types'),
00114     );
00115 
00116     $form['summary'] = array(
00117        '#type' => 'fieldset',
00118        '#title' => t('Feature Summary Report'),
00119        '#collapsible' => 1,
00120        '#collapsed' => 1 ,
00121     );
00122     $allowedoptions2 ['show_feature_summary'] = "Show the feature summary on the organism page. The summary loads when page loads.";
00123     $allowedoptions2 ['hide_feature_summary'] = "Hide the feature summary on the organism page. Disables the feature summary.";
00124 
00125     $form['summary']['feature_summary'] = array(
00126        '#title' => 'Feature Summary on Organism Page',
00127        '#description' => 'A feature summary can be added to an organism page to allow users to see the '.
00128           'type and quantity of features available for the organism.',
00129        '#type' => 'radios',
00130        '#options' => $allowedoptions2,
00131        '#default_value' => variable_get('tripal_feature_summary_setting', 'show_feature_summary'),
00132     );
00133     $form['summary']['feature_mapping'] = array(
00134        '#title' => 'Map feature types',
00135        '#description' => t('You may specify which Sequence Ontology (SO) terms to show in the '.
00136           'feature summary report by listing them in the following text area.   Enter one per line. '.
00137           'If left blank, all SO terms for all features will be shown in the report. Only those terms '.
00138           'listed below will be shown in the report. Terms will appear in the report in the same order listed. To rename a '.
00139           'SO term to be more human readable form, use an \'=\' sign after the SO term (e.g. \'polypeptide = Protein\')'),
00140        '#type' => 'textarea',
00141        '#rows' => 15,
00142        '#default_value' => variable_get('tripal_feature_summary_report_mapping', ''),
00143     );
00144     $form['summary']['set_summary_button'] = array(
00145        '#type' => 'submit',
00146        '#value' => t('Set Summary'),
00147        '#weight' => 2,
00148     );
00149 
00150     get_tripal_feature_admin_form_taxonomy_set($form);
00151     get_tripal_feature_admin_form_reindex_set($form);
00152     get_tripal_feature_admin_form_cleanup_set($form);
00153   }
00154   else {
00155     $form['notice'] = array(
00156        '#type' => 'fieldset',
00157        '#title' => t('Feature Management Temporarily Unavailable')
00158     );
00159     $form['notice']['message'] = array(
00160        '#value' => t('Currently, feature management jobs are waiting or ".
00161           "are running. Managemment features have been hidden until these ".
00162           "jobs complete.  Please check back later once these jobs have ".
00163           "finished.  You can view the status of pending jobs in the Tripal ".
00164           "jobs page.'),
00165     );
00166   }
00167   return system_settings_form($form);
00168 }
00169 
00175 function tripal_feature_admin_validate($form, &$form_state) {
00176   global $user;  // we need access to the user info
00177   $job_args = array();
00178 
00179   variable_set('chado_browser_feature_types', $form_state['values']['feature_types']);
00180 
00181   // if the user wants to sync up the chado features then
00182   // add the job to the management queue
00183   switch ($form_state['values']['op']) {
00184 
00185     case  t('Sync all Features') :
00186       tripal_add_job('Sync all features', 'tripal_feature',
00187         'tripal_feature_sync_features', $job_args, $user->uid);
00188     break;
00189 
00190     case t('Set/Reset Taxonomy for all feature nodes') :
00191     tripal_add_job('Set all feature taxonomy', 'tripal_feature',
00192       'tripal_features_set_taxonomy', $job_args, $user->uid);
00193     break;
00194 
00195     case t('Reindex all feature nodes') :
00196     tripal_add_job('Reindex all features', 'tripal_feature',
00197       'tripal_features_reindex', $job_args, $user->uid);
00198     break;
00199 
00200     case t('Clean up orphaned features') :
00201     tripal_add_job('Cleanup orphaned features', 'tripal_feature',
00202       'tripal_features_cleanup', $job_args, $user->uid);
00203     break;
00204 
00205     case t('Set Browser') :
00206       variable_set('tripal_feature_browse_setting', $form_state['values']['browse_features']);
00207       variable_set('tripal_library_feature_browse_setting', $form_state['values']['browse_features_library']);
00208       variable_set('tripal_analysis_feature_browse_setting', $form_state['values']['browse_features_analysis']);
00209     break;
00210 
00211     case t('Set Feature Types') :
00212       variable_set('tripal_feature_type_setting', $form_state['values']['feature_edit_types']);
00213     break;
00214 
00215     case t('Set Summary') :
00216       variable_set('tripal_feature_summary_setting', $form_state['values']['feature_summary']);
00217       variable_set('tripal_feature_summary_report_mapping', $form_state['values']['feature_mapping']);
00218     break;
00219 
00220     case t('Set Feature URLs') :
00221       variable_set('chado_feature_url', $form_state['values']['feature_url']);
00222       tripal_add_job('Set Feature URLs', 'tripal_feature',
00223         'tripal_feature_set_urls', $job_args, $user->uid);
00224     break;
00225     }
00226 }
00232 function get_tripal_feature_admin_form_cleanup_set(&$form) {
00233   $form['cleanup'] = array(
00234     '#type' => 'fieldset',
00235     '#title' => t('Clean Up'),
00236     '#collapsible' => 1,
00237     '#collapsed' => 1 ,
00238   );
00239   $form['cleanup']['description'] = array(
00240     '#type' => 'item',
00241     '#value' => t("With Drupal and chado residing in different databases ".
00242       "it is possible that nodes in Drupal and features in Chado become ".
00243       "\"orphaned\".  This can occur if a feature node in Drupal is ".
00244       "deleted but the corresponding chado feature is not and/or vice ".
00245       "versa.  The Cleanup function will also remove nodes for features ".
00246       "that are not in the list of allowed feature types as specified ".
00247       "above.  This is helpful when a feature type needs to be ".
00248       "removed but was previously present as Drupal nodes. ".
00249       "Click the button below to resolve these discrepancies."),
00250     '#weight' => 1,
00251   );
00252   $form['cleanup']['button'] = array(
00253     '#type' => 'submit',
00254     '#value' => t('Clean up orphaned features'),
00255     '#weight' => 2,
00256   );
00257 }
00258 
00264 function get_tripal_feature_admin_form_reindex_set(&$form) {
00265   $form['reindex'] = array(
00266     '#type' => 'fieldset',
00267     '#title' => t('Index/Reindex'),
00268     '#collapsible' => 1,
00269     '#collapsed' => 1 ,
00270   );
00271   $form['reindex']['description'] = array(
00272      '#type' => 'item',
00273      '#value' => t("Indexing or reindexing of nodes is required for Drupal's full text searching. ".
00274         "Index features for the first time to allow for searching of content, and later when content for features ".
00275         "is updated.  Depending on the number of features this may take ".
00276         "quite a while. Click the button below to begin reindexing of ".
00277         "features. "),
00278      '#weight' => 1,
00279   );
00280   $form['reindex']['button'] = array(
00281     '#type' => 'submit',
00282     '#value' => t('Reindex all feature nodes'),
00283     '#weight' => 2,
00284   );
00285 }
00286 
00292 function get_tripal_feature_admin_form_taxonomy_set(&$form) {
00293 
00294   $form['taxonomy'] = array(
00295     '#type' => 'fieldset',
00296     '#title' => t('Set Taxonomy'),
00297     '#collapsible' => 1,
00298     '#collapsed' => 1 ,
00299   );
00300 
00301   $form['taxonomy']['description'] = array(
00302      '#type' => 'item',
00303      '#value' => t("Drupal allows for assignment of \"taxonomy\" or ".
00304         "catagorical terms to nodes. These terms allow for advanced ".
00305         "filtering during searching."),
00306      '#weight' => 1,
00307   );
00308   $tax_options = array(
00309     'organism' => t('Organism name'),
00310     'feature_type'  => t('Feature Type (e.g. EST, mRNA, etc.)'),
00311     'analysis' => t('Analysis Name'),
00312     'library'  => t('Library Name'),
00313   );
00314   $form['taxonomy']['tax_classes'] = array(
00315    '#title'       => t('Available Taxonomic Classes'),
00316    '#type'        => t('checkboxes'),
00317    '#description' => t("Please select the class of terms to assign to ".
00318       "chado features"),
00319    '#required'    => FALSE,
00320    '#prefix'      => '<div id="taxclass_boxes">',
00321    '#suffix'      => '</div>',
00322    '#options'     => $tax_options,
00323    '#weight'      => 2,
00324    '#default_value' => variable_get('tax_classes', ''),
00325   );
00326   $form['taxonomy']['button'] = array(
00327     '#type' => 'submit',
00328     '#value' => t('Set/Reset Taxonomy for all feature nodes'),
00329     '#weight' => 3,
00330   );
00331 
00332 }
00333 
00334 function get_tripal_feature_admin_form_url_set(&$form) {
00335 
00336   $form['url'] = array(
00337     '#type' => 'fieldset',
00338     '#title' => t('Feature URL Path')
00339   );
00340   $form['url']['desc'] = array(
00341     '#type'        => 'markup',
00342     '#value' => t('Each synced feature will have a unique URL which consists of '.
00343                         'the site domain followed by a unique identifer: for '.
00344                         'example http://my-tripal-site.org/ID1034, where the '.
00345                         'element just after the final slash is the unique '.
00346                         'identifier for the feature.'),
00347 
00348   );
00349 
00350   $options = array(
00351     'internal ID'          => 'Internal ID (Chado feature_id)',
00352     'feature unique name'  => 'Feature unique name',
00353     'feature name'         => 'Feature name',
00354     'genus_species_uqname' => 'Genus + species + unique name (e.g. http://your.site.url/[genus]/[genus]_[species]/[unique_name]',
00355     'genus_species_name'   => 'Genus + species + name (e.g. http://your.site.url/[genus]/[genus]_[species]/[name]',
00356   );
00357   
00358   $form['url']['chado_feature_url'] = array(
00359     '#title'         => t('Unique Identifier'),
00360     '#type'          => 'radios',
00361     '#description'   => t('Choose an identifier type '.
00362                         'from the list above that is guaranteed to be unique in your synced '.
00363                         'dataset. If in doubt it is safest to coose the internal ID. '.
00364                         'The descrpitor need not be unique amont the total dataset. '.
00365                         'It only need be unique among the synced dataset.'),
00366     '#required'      => FALSE,
00367     '#options'       => $options,
00368     '#default_value' => variable_get('chado_feature_url', 'internal ID'),
00369   );
00370 
00371   $form['url']['chado_feature_accession_prefix'] = array(
00372     '#title'       => t('ID Prefix'),
00373     '#type'        => t('textfield'),
00374     '#description' => t("If you choose an Internal ID above you must also enter an ID prefix.".
00375                         "this prefix will be prepended to the internal ID number (e.g. ID38294). ".
00376                         "if you chose to use the feature name or unique name then this prfix is not used"),
00377     '#required'    => TRUE,
00378     '#default_value' => variable_get('chado_feature_accession_prefix', 'ID'),
00379   );
00380 
00381   $form['url']['button'] = array(
00382     '#type' => 'submit',
00383     '#value' => t('Set Feature URLs'),
00384     '#weight' => 3,
00385   );
00386 }
00387 
00393 function tripal_features_set_taxonomy($max_sync = 0, $job_id = NULL) {
00394 
00395   // make sure our vocabularies are cleaned and reset before proceeding
00396   tripal_feature_del_vocabulary();
00397   tripal_feature_set_vocabulary();
00398 
00399   // iterate through all drupal feature nodes and set the taxonomy
00400   $results = db_query("SELECT * FROM {chado_feature}");
00401   $nsql =  "SELECT * FROM {node} ".
00402           "WHERE nid = %d";
00403   $i = 0;
00404 
00405   // load into ids array
00406   $count = 0;
00407   $chado_features = array();
00408   while ($chado_feature = db_fetch_object($results)) {
00409     $chado_features[$count] = $chado_feature;
00410     $count++;
00411   }
00412 
00413   // Iterate through features that need to be synced
00414   $interval = intval($count * 0.01);
00415   foreach ($chado_features as $chado_feature) {
00416 
00417   // update the job status every 1% features
00418   if ($job_id and $i % $interval == 0) {
00419     tripal_job_set_progress($job_id, intval(($i/$count)*100));
00420   }
00421   print "$i of $count: ";
00422   $node = db_fetch_object(db_query($nsql, $chado_feature->nid));
00423   tripal_feature_set_taxonomy($node, $chado_feature->feature_id);
00424 
00425   $i++;
00426   }
00427 }
00428 
00434 function tripal_feature_set_taxonomy($node, $feature_id) {
00435 
00436   // iterate through the taxonomy classes that have been
00437   // selected by the admin user and make sure we only set those
00438   $tax_classes = variable_get('tax_classes', '');
00439   $do_ft = 0;
00440   $do_op = 0;
00441   $do_lb = 0;
00442   $do_an = 0;
00443   foreach ($tax_classes as $class) {
00444     if (strcmp($class , 'organism')==0) {
00445       $do_op = 1;
00446     }
00447     if (strcmp($class, 'feature_type')==0) {
00448       $do_ft = 1;
00449     }
00450     if (strcmp($class, 'library')==0) {
00451       $do_lb = 1;
00452     }
00453     if (strcmp($class, 'analysis')==0) {
00454       $do_an = 1;
00455     }
00456   }
00457 
00458 
00459   // get the list of vocabularies and find our two vocabularies of interest
00460   $vocabularies = taxonomy_get_vocabularies();
00461   $ft_vid = NULL;
00462   $op_vid = NULL;
00463   $lb_vid = NULL;
00464   $an_vid = NULL;
00465   foreach ($vocabularies as $vocab) {
00466     if ($vocab->name == 'Feature Type') {
00467       $ft_vid = $vocab->vid;
00468     }
00469     if ($vocab->name == 'Organism') {
00470       $op_vid = $vocab->vid;
00471     }
00472     if ($vocab->name == 'Library') {
00473       $lb_vid = $vocab->vid;
00474     }
00475     if ($vocab->name == 'Analysis') {
00476       $an_vid = $vocab->vid;
00477     }
00478   }
00479 
00480   // get the cvterm and the organism for this feature
00481   $sql = "SELECT CVT.name AS cvname, O.genus, O.species ".
00482         "FROM {CVTerm} CVT ".
00483         "  INNER JOIN Feature F on F.type_id = CVT.cvterm_id ".
00484         "  INNER JOIN Organism O ON F.organism_id = O.organism_id ".
00485         "WHERE F.feature_id = $feature_id";
00486   $feature = db_fetch_object(chado_query($sql));
00487 
00488   // Set the feature type for this feature
00489   if ($do_ft && $ft_vid) {
00490     $tags["$ft_vid"] = "$feature->cvname";
00491   }
00492   // Set the organism for this feature type
00493   if ($do_op && $op_vid) {
00494     $tags["$op_vid"] = "$feature->genus $feature->species";
00495   }
00496 
00497   // get the library that this feature may belong to and add it as taxonomy
00498   if ($do_lb && $lb_vid) {
00499     $sql = "SELECT L.name ".
00500            "FROM {Library} L ".
00501            "  INNER JOIN Library_feature LF ON LF.library_id = L.library_id ".
00502            "WHERE LF.feature_id = %d ";
00503     $library = db_fetch_object(chado_query($sql, $feature_id));
00504     $tags["$lb_vid"] = "$library->name";
00505   }
00506 
00507   // now add the taxonomy to the node
00508   $terms['tags'] = $tags;
00509   taxonomy_node_save($node, $terms);
00510   //   print "Setting $node->name: " . implode(", ",$tags) . "\n";
00511 
00512   // get the analysis that this feature may belong to and add it as taxonomy
00513   // We'll add each one individually since there may be more than one analysis
00514   if ($do_an && $an_vid) {
00515     $sql = "SELECT A.name ".
00516            "FROM {Analysis} A ".
00517            "  INNER JOIN Analysisfeature AF ON AF.analysis_id = A.analysis_id ".
00518            "WHERE AF.feature_id = $feature_id ";
00519     $results = chado_query($sql);
00520     $analysis_terms = array();
00521     while ($analysis=db_fetch_object($results)) {
00522       $tags2["$an_vid"] = "$analysis->name";
00523       $terms['tags'] = $tags2;
00524       taxonomy_node_save($node, $terms);
00525     }
00526   }
00527 
00528 }
00529 
00541 function tripal_features_cleanup($dummy = NULL, $job_id = NULL) {
00542 
00543   return tripal_core_clean_orphaned_nodes('feature', $job_id);
00544  
00545 }
00552 function theme_tripal_feature_search_index($node) {
00553   $feature = $node->feature;
00554   $content = '';
00555 
00556   // get the accession prefix
00557   $aprefix = variable_get('chado_feature_accession_prefix', 'ID');
00558 
00559   $content .= "<h1>$feature->uniquename</h1>. ";
00560   $content .= "<strong>$aprefix$feature->feature_id.</strong> ";
00561   $content .= "$feature->cvname ";
00562   $content .= "$feature->common_name ";
00563 
00564   // add the synonyms of this feature to the text for searching
00565   $synonyms = $node->synonyms;
00566   if (count($synonyms) > 0) {
00567     foreach ($synonyms as $result) {
00568       $content .= "$result->name ";
00569     }
00570   }
00571 
00572   return $content;
00573 }
00574 
00581 function theme_tripal_feature_search_results($node) {
00582   $feature = $node->feature;
00583   $content = '';
00584 
00585   // get the accession prefix
00586   $aprefix = variable_get('chado_feature_accession_prefix', 'ID');
00587 
00588   $content .= "Feature Name: <h1>$feature->uniquename</h1>. ";
00589   $content .= "<strong>Accession: $aprefix$feature->feature_id.</strong>";
00590   $content .= "Type: $feature->cvname. ";
00591   $content .= "Organism: $feature->common_name. ";
00592 
00593   // add the synonyms of this feature to the text for searching
00594   $synonyms = $node->synonyms;
00595   if (count($synonyms) > 0) {
00596     $content .= "Synonyms: ";
00597     foreach ($synonyms as $result) {
00598       $content .= "$result->name, ";
00599     }
00600   }
00601 
00602   return $content;
00603 }
00604 
00605 
00611 function tripal_feature_set_vocabulary() {
00612 
00613   //include the file containing the required functions for adding taxonomy vocabs
00614   module_load_include('inc', 'taxonomy', 'taxonomy.admin');
00615 
00616   // get the vocabularies so that we make sure we don't recreate
00617   // the vocabs that already exist
00618   $vocabularies = taxonomy_get_vocabularies();
00619   $ft_vid = NULL;
00620   $op_vid = NULL;
00621   $lb_vid = NULL;
00622   $an_vid = NULL;
00623 
00624   // These taxonomic terms are hard coded because we
00625   // konw we have these relationships in the chado tables
00626   // through foreign key relationships.  The tripal
00627   // modules that correspond to these chado "modules" don't
00628   // need to be installed for the taxonomy to work.
00629   foreach ($vocabularies as $vocab) {
00630     if ($vocab->name == 'Feature Type') {
00631       $ft_vid = $vocab->vid;
00632     }
00633     if ($vocab->name == 'Organism') {
00634       $op_vid = $vocab->vid;
00635     }
00636     if ($vocab->name == 'Library') {
00637       $lb_vid = $vocab->vid;
00638     }
00639     if ($vocab->name == 'Analysis') {
00640       $an_vid = $vocab->vid;
00641     }
00642   }
00643 
00644   if (!$ft_vid) {
00645     $form_state = array();
00646     $values = array(
00647        'name' => t('Feature Type'),
00648        'nodes' => array('chado_feature' => 'chado_feature'),
00649        'description' => t('The feature type (or SO cvterm for this feature).'),
00650        'help' => t('Select the term that matches the feature'),
00651        'tags' => 0,
00652        'hierarchy' => 1,
00653        'relations' => 1,
00654        'multiple' => 0,
00655        'required' => 0,
00656        'weight' => 1,
00657     );
00658     drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
00659     drupal_execute('taxonomy_form_vocabulary', $form_state);
00660   }
00661 
00662   if (!$op_vid) {
00663     $form_state = array();
00664     $values = array(
00665        'name' => t('Organism'),
00666        'nodes' => array('chado_feature' => 'chado_feature'),
00667        'description' => t('The organism to which this feature belongs.'),
00668        'help' => t('Select the term that matches the feature'),
00669        'tags' => 0,
00670        'hierarchy' => 1,
00671        'relations' => 1,
00672        'multiple' => 0,
00673        'required' => 0,
00674        'weight' => 2,
00675     );
00676     drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
00677     drupal_execute('taxonomy_form_vocabulary', $form_state);
00678   }
00679 
00680   if (!$lb_vid) {
00681     $form_state = array();
00682     $values = array(
00683        'name' => t('Library'),
00684        'nodes' => array('chado_feature' => 'chado_feature'),
00685        'description' => t('Chado features associated with a library are assigned the term associated with the library'),
00686        'help' => t('Select the term that matches the feature'),
00687        'tags' => 0,
00688        'hierarchy' => 1,
00689        'relations' => 1,
00690        'multiple' => 0,
00691        'required' => 0,
00692        'weight' => 3,
00693     );
00694     drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
00695     drupal_execute('taxonomy_form_vocabulary', $form_state);
00696   }
00697 
00698   if (!$an_vid) {
00699     $form_state = array();
00700     $values = array(
00701        'name' => t('Analysis'),
00702        'nodes' => array('chado_feature' => 'chado_feature'),
00703        'description' => t('Any analysis to which this feature belongs.'),
00704        'help' => t('Select the term that matches the feature'),
00705        'tags' => 0,
00706        'hierarchy' => 1,
00707        'relations' => 1,
00708        'multiple' => 1,
00709        'required' => 0,
00710        'weight' => 4,
00711     );
00712     drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
00713     drupal_execute('taxonomy_form_vocabulary', $form_state);
00714   }
00715 }
 All Classes Files Functions Variables