From 739345d77f309b3587ed86893353d3a60b8628fe Mon Sep 17 00:00:00 2001 From: "T.Lee" Date: Fri, 24 Mar 2017 15:46:54 -0700 Subject: [PATCH 1/5] Data type checking (removed hard-coded parts) Bug Fixes. --- README.md | 2 +- includes/admin/mcl.admin.data_valid.inc | 402 + .../chado_analysisfeature.class.inc | 367 + .../chado_table_class/chado_contact.class.inc | 28 +- .../chado_contactprop.class.inc | 21 +- .../chado_table_class/chado_cv.class.inc | 18 +- .../chado_table_class/chado_cvterm.class.inc | 64 +- .../chado_cvterm_relationship.class.inc | 22 +- .../chado_cvtermprop.class.inc | 21 +- .../chado_cvtermsynonym.class.inc | 21 +- .../chado_table_class/chado_db.class.inc | 18 +- .../chado_table_class/chado_dbxref.class.inc | 28 +- .../chado_dbxrefprop.class.inc | 21 +- .../chado_table_class/chado_eimage.class.inc | 23 +- .../chado_eimageprop.class.inc | 21 +- .../chado_table_class/chado_feature.class.inc | 45 +- .../chado_feature_contact.class.inc | 21 +- .../chado_feature_cvterm.class.inc | 22 +- .../chado_feature_dbxref.class.inc | 21 +- .../chado_feature_genotype.class.inc | 23 +- .../chado_feature_image.class.inc | 277 + .../chado_feature_nd_geolocation.class.inc | 277 + .../chado_feature_project.class.inc | 21 +- .../chado_feature_pub.class.inc | 21 +- .../chado_feature_relationship.class.inc | 22 +- .../chado_feature_stock.class.inc | 22 +- .../chado_feature_synonym.class.inc | 22 +- .../chado_featureloc.class.inc | 482 + .../chado_featuremap.class.inc | 29 +- .../chado_featuremap_contact.class.inc | 21 +- .../chado_featuremap_organism.class.inc | 21 +- .../chado_featuremap_pub.class.inc | 21 +- .../chado_featuremap_stock.class.inc | 21 +- .../chado_featuremapprop.class.inc | 21 +- .../chado_featurepos.class.inc | 26 +- .../chado_featureposprop.class.inc | 21 +- .../chado_featureprop.class.inc | 21 +- .../chado_genotype.class.inc | 27 +- .../chado_genotype_call.class.inc | 23 +- .../chado_genotypeprop.class.inc | 21 +- .../chado_table_class/chado_library.class.inc | 27 +- .../chado_library_contact.class.inc | 18 +- .../chado_library_pub.class.inc | 21 +- .../chado_library_synonym.class.inc | 22 +- .../chado_libraryprop.class.inc | 21 +- .../chado_nd_experiment.class.inc | 31 +- .../chado_nd_experiment_contact.class.inc | 277 + .../chado_nd_experiment_genotype.class.inc | 21 +- .../chado_nd_experiment_phenotype.class.inc | 21 +- .../chado_nd_experiment_project.class.inc | 21 +- .../chado_nd_experiment_pub.class.inc | 21 +- .../chado_nd_experiment_stock.class.inc | 22 +- .../chado_nd_experimentprop.class.inc | 21 +- .../chado_nd_geolocation.class.inc | 24 +- .../chado_nd_geolocationprop.class.inc | 21 +- .../chado_organism.class.inc | 30 +- .../chado_organism_dbxref.class.inc | 21 +- .../chado_organism_pub.class.inc | 21 +- .../chado_organism_relationship.class.inc | 301 + .../chado_organismprop.class.inc | 323 + .../chado_phenotype.class.inc | 27 +- .../chado_table_class/chado_project.class.inc | 29 +- .../chado_project_contact.class.inc | 21 +- .../chado_project_pub.class.inc | 21 +- .../chado_project_relationship.class.inc | 22 +- .../chado_projectprop.class.inc | 21 +- .../chado_table_class/chado_pub.class.inc | 33 +- .../chado_table_class/chado_stock.class.inc | 34 +- .../chado_stock_dbxref.class.inc | 21 +- .../chado_stock_pub.class.inc | 21 +- .../chado_stock_relationship.class.inc | 22 +- .../chado_stockprop.class.inc | 21 +- .../chado_table_class/chado_synonym.class.inc | 25 +- .../chado_table_class/chado_table.class.inc | 371 + .../data_valid/mcl_data_valid_type.class.inc | 176 + includes/class/job/mcl_job.class.inc | 85 +- includes/class/job/mcl_job_manager.class.inc | 1 + includes/class/job/mcl_job_upload.class.inc | 230 +- .../mcl_chado_contact.class.inc | 42 +- .../mcl_chado_class/mcl_chado_cv.class.inc | 57 +- .../mcl_chado_cvterm.class.inc | 180 +- .../mcl_chado_dataset.class.inc | 122 +- .../mcl_chado_class/mcl_chado_db.class.inc | 19 +- .../mcl_chado_dbxref.class.inc | 22 +- .../mcl_chado_feature.class.inc | 423 +- .../mcl_chado_featuremap.class.inc | 158 +- .../mcl_chado_featurepos.class.inc | 24 +- .../mcl_chado_genotype.class.inc | 22 +- .../mcl_chado_genotype_call.class.inc | 11 +- .../mcl_chado_class/mcl_chado_image.class.inc | 39 +- .../mcl_chado_library.class.inc | 84 +- .../mcl_chado_location.class.inc | 53 +- .../mcl_chado_nd_experiment.class.inc | 118 +- .../mcl_chado_organism.class.inc | 160 +- .../mcl_chado_phenotype.class.inc | 11 +- .../mcl_chado_class/mcl_chado_pub.class.inc | 11 +- .../mcl_chado_class/mcl_chado_stock.class.inc | 248 +- .../mcl_chado_synonym.class.inc | 11 +- .../mcl_chado_class/mcl_chado_trait.class.inc | 47 +- includes/class/mcl_class_loader.class.inc | 4 +- .../public_mcl_data_valid.class.inc | 295 + .../public_mcl_data_valid_type.class.inc | 272 + .../public_mcl_file.class.inc | 16 +- .../public_mcl_job.class.inc | 16 +- .../public_mcl_template.class.inc | 16 +- .../public_mcl_template_type.class.inc | 16 +- .../public_mcl_user.class.inc | 16 +- .../public_mcl_var.class.inc | 16 +- .../public_table_class/public_users.class.inc | 16 +- includes/class/table/mcl_table.class.inc | 52 +- .../table/mcl_table_class_writer.class.inc | 85 +- includes/class/table/mcl_table_info.class.inc | 100 +- .../class/table/mcl_table_writer.class.inc | 23 +- .../class/template/mcl_template.class.inc | 147 +- .../module/mcl_template_column.class.inc | 103 + .../module/mcl_template_contact.class.inc | 19 +- .../module/mcl_template_cross.class.inc | 49 +- .../template/module/mcl_template_cv.class.inc | 7 +- .../module/mcl_template_cvterm.class.inc | 7 +- .../module/mcl_template_dataset.class.inc | 4 +- .../template/module/mcl_template_db.class.inc | 7 +- .../module/mcl_template_descriptor.class.inc | 22 +- ...s.inc => mcl_template_fieldbook.class.inc} | 12 +- .../module/mcl_template_genotype.class.inc | 8 +- .../mcl_template_genotype_snp.class.inc | 6 +- ...plate_genotype_snp_marker_column.class.inc | 7 +- ...mplate_genotype_snp_stock_column.class.inc | 2 +- .../mcl_template_genotype_ssr.class.inc | 6 +- .../module/mcl_template_image.class.inc | 9 +- .../module/mcl_template_library.class.inc | 6 +- .../module/mcl_template_map.class.inc | 10 +- .../mcl_template_map_position.class.inc | 62 +- .../module/mcl_template_marker.class.inc | 72 +- .../module/mcl_template_mtl.class.inc | 6 +- .../module/mcl_template_organism.class.inc | 158 + .../module/mcl_template_phenotype.class.inc | 15 +- .../module/mcl_template_progeny.class.inc | 14 +- .../mcl_template_progeny_bims.class.inc | 141 + .../module/mcl_template_qtl.class.inc | 17 +- .../mcl_template_qtl_trait_data.class.inc | 12 +- .../module/mcl_template_site.class.inc | 28 +- .../module/mcl_template_site_cotton.class.inc | 157 + .../module/mcl_template_stock.class.inc | 20 +- .../mcl_template_stock_cotton.class.inc | 190 + .../module/mcl_template_trait.class.inc | 26 +- includes/form/mcl.data_query.form.inc | 268 + includes/form/mcl.form.inc | 13 + includes/form/mcl.job_view.form.inc | 78 +- includes/form/mcl.template_list.form.inc | 2 +- includes/form/mcl.upload_data.form.inc | 54 +- includes/mcl.inc | 23 + mcl.drush.inc | 135 +- mcl.info | 15 +- mcl.install | 246 +- mcl.module | 63 +- schema/drupal7.chado.sql | 23331 ++++++++++++++++ schema/drupal7.public.sql | 10716 +++++++ schema/filter.drupal7.chado.mcl.txt | 71 + schema/filter.drupal7.public.mcl.txt | 9 + theme/js/mcl.js | 2 +- 160 files changed, 43233 insertions(+), 1039 deletions(-) create mode 100644 includes/admin/mcl.admin.data_valid.inc create mode 100644 includes/class/chado_table_class/chado_analysisfeature.class.inc create mode 100644 includes/class/chado_table_class/chado_feature_image.class.inc create mode 100644 includes/class/chado_table_class/chado_feature_nd_geolocation.class.inc create mode 100644 includes/class/chado_table_class/chado_featureloc.class.inc create mode 100644 includes/class/chado_table_class/chado_nd_experiment_contact.class.inc create mode 100644 includes/class/chado_table_class/chado_organism_relationship.class.inc create mode 100644 includes/class/chado_table_class/chado_organismprop.class.inc create mode 100644 includes/class/chado_table_class/chado_table.class.inc create mode 100644 includes/class/data_valid/mcl_data_valid_type.class.inc create mode 100644 includes/class/public_table_class/public_mcl_data_valid.class.inc create mode 100644 includes/class/public_table_class/public_mcl_data_valid_type.class.inc create mode 100644 includes/class/template/module/mcl_template_column.class.inc rename includes/class/template/module/{mcl_template_field_book.class.inc => mcl_template_fieldbook.class.inc} (87%) create mode 100644 includes/class/template/module/mcl_template_organism.class.inc create mode 100644 includes/class/template/module/mcl_template_progeny_bims.class.inc create mode 100644 includes/class/template/module/mcl_template_site_cotton.class.inc create mode 100644 includes/class/template/module/mcl_template_stock_cotton.class.inc create mode 100644 includes/form/mcl.data_query.form.inc create mode 100644 schema/drupal7.chado.sql create mode 100644 schema/drupal7.public.sql create mode 100644 schema/filter.drupal7.chado.mcl.txt create mode 100644 schema/filter.drupal7.public.mcl.txt diff --git a/README.md b/README.md index 966b9a8..971025c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The Mainlab Chado Loader is created by Main Bioinformatics Lab (Main Lab) at Was ##Download The MainLab Chado Loader module can be download from GitHub: -https://www.github.com/tripal/mainlab_chado_loader +https://github.com/tripal/mainlab_chado_loader ## Installation After downloading the module, extract it into your site's module directory diff --git a/includes/admin/mcl.admin.data_valid.inc b/includes/admin/mcl.admin.data_valid.inc new file mode 100644 index 0000000..ec223e2 --- /dev/null +++ b/includes/admin/mcl.admin.data_valid.inc @@ -0,0 +1,402 @@ + 'fieldset', + '#collapsed' => FALSE, + '#collapsible' => TRUE, + '#title' => 'Data validation Type', + ); + $form['data_valid_type']['table'] = array( + '#markup' => 'Description here..', + ); + + // Adds data validation type form. + _mcl_get_mcl_data_valid_type_form($form); + + // Data validations. + $form['data_valid'] = array( + '#type' => 'fieldset', + '#collapsed' => FALSE, + '#collapsible' => TRUE, + '#title' => 'Data validation', + ); + $form['data_valid']['table'] = array( + '#markup' => 'Description here..', + ); + + // Adds data validation form. + _mcl_get_mcl_data_valid_form($form); + + // Sets properties of the form. + $form['#prefix'] = '
'; + $form['#suffix'] = '
'; + return $form; +} + +/** + * Returns the form for data validation type. + * + * @param array $form + */ +function _mcl_get_mcl_data_valid_type_form(&$form) { + + // Gets all data valid types. + $data_valid_types = MCL_DATA_VALID_TYPE::getDataValidTypes(FALSE); + $rows = array(); + foreach ($data_valid_types as $data_valid_type) { + $data_valid_type_id = $data_valid_type->getDataValidTypeID(); + $cv_id = $data_valid_type->getCvID(); + $type = $data_valid_type->getType(); + + // Gets the cv name. + $cv_name = ''; + if ($cv_id) { + $cv = MCL_CHADO_CV::byKey(array('cv_id' => $cv_id)); + $cv_name = $cv->getName(); + } + $required = ($cv_name) ? $cv_name : 'Not required'; + + // Creates 'Delete' link. + $confirm_attr = array( + 'attributes' => array( + 'id' => 'delete_data_valid_type_' . $data_valid_type_id, + 'class' => array('use-ajax', 'mcl-confirm'), + ) + ); + $delete_link = l('Delete', "mcl/delete_data_valid_type/$data_valid_type_id" , $confirm_attr); + $row = array( + $type, + $required, + $delete_link, + ); + $rows[] = $row; + } + $table_vars = array( + 'header' => array('Type', 'CV name', 'Action'), + 'rows' => $rows, + 'attributes' => array(), + ); + $form['data_valid_type']['data_valid_types'] = array( + '#type' => 'fieldset', + '#collapsed' => TRUE, + '#collapsible' => TRUE, + '#title' => 'Data validation Types', + ); + $form['data_valid_type']['data_valid_types']['table'] = array( + '#markup' => theme('table', $table_vars), + ); + $form['data_valid_type']['data_valid_types']['add_data_valid_type']['type'] = array( + '#type' => 'textfield', + '#title' => t('New data valid type'), + '#description' => t("Please type a new type for data validation"), + '#attributes' => array('style' => 'width:250px;'), + ); + $form['data_valid_type']['data_valid_types']['add_data_valid_type']['cv_name'] = array( + '#type' => 'textfield', + '#title' => t('CV name'), + '#description' => t("Please type the name of cv (e.g.) MAIN, rosaceae_trait_ontology"), + '#attributes' => array('style' => 'width:250px;'), + ); + $form['data_valid_type']['data_valid_types']['add_data_valid_type']['data_valid_type_btn'] = array( + '#type' => 'submit', + '#name' => 'data_valid_type_btn', + '#value' => 'Add new type', + '#ajax' => array( + 'callback' => "mcl_admin_data_valid_form_ajax_callback", + 'wrapper' => 'mcl-admin-data-valid-form', + 'effect' => 'fade', + 'method' => 'replace', + ), + ); +} + +/** + * Returns the form for data validation. + * + * @param array $form + */ +function _mcl_get_mcl_data_valid_form(&$form, $target_data_valid_type_id = '') { + + // Gets the site varibles. + $data_valid_types = MCL_DATA_VALID_TYPE::getDataValidTypes(FALSE); + foreach ($data_valid_types as $data_valid_type) { + $data_valid_type_id = $data_valid_type->getDataValidTypeID(); + $type = $data_valid_type->getType(); + $cv_id = $data_valid_type->getCvID(); + + // Sets IDs. + $id_fieldset = 'fs_' . $data_valid_type_id; + $id_value = 'value_' . $data_valid_type_id; + + if ($target_data_valid_type_id) { + if ($data_valid_type_id != $target_data_valid_type_id) { + continue; + } + $form['data_valid'][$id_fieldset]['#collapsed'] = FALSE; + } + else { + // Creates a fieldset. + $form['data_valid'][$id_fieldset] = array( + '#type' => 'fieldset', + '#collapsed' => TRUE, + '#collapsible' => TRUE, + '#title' => $type, + ); + } + + // Creates a table. + $data_valid_objs = $data_valid_type->getDataValidValues(); + $rows = array(); + foreach ($data_valid_objs as $obj) { + $data_valid_id = $obj->data_valid_id; + + // Creates a "Delete" link. + $confirm_attr = array( + 'attributes' => array( + 'id' => 'delete_data_valid_' . $data_valid_id, + 'class' => array('use-ajax', 'mcl-confirm'), + ) + ); + $delete_link = l('Delete', "mcl/delete_data_valid/$data_valid_id" , $confirm_attr); + + if ($cv_id) { + $row = array( + $obj->name, + $obj->cvterm_id, + $delete_link, + ); + } + else { + $row = array( + $obj->name, + $delete_link, + ); + } + $rows[] = $row; + } + + // Sets the headers. + $headers = array('Value', 'Action'); + if ($cv_id) { + $headers = array('Value', 'cvterm_id', 'Action'); + } + $table_vars = array( + 'header' => $headers, + 'rows' => $rows, + 'attributes' => array(), + ); + $form['data_valid'][$id_fieldset]['table'] = array( + '#markup' => theme('table', $table_vars), + ); + + // Adds the textfield and button. + $id_add_btn = 'data_valid_btn_' . $data_valid_type_id . '_0'; + $title = 'Value'; + $desc = ''; + $label = 'Add new value'; + if ($cv_id) { + $id_add_btn = 'data_valid_btn_' . $data_valid_type_id . '_' . $cv_id; + $title = 'cvterm ID'; + $desc = ''; + $label = 'Add cvterm ID'; + } + $form['data_valid'][$id_fieldset][$id_value] = array( + '#type' => 'textfield', + '#title' => $title, + '#description' => $desc, + '#attributes' => array('style' => 'width:250px;'), + ); + $form['data_valid'][$id_fieldset][$id_add_btn] = array( + '#type' => 'submit', + '#name' => $id_add_btn, + '#value' => $label, + '#ajax' => array( + 'callback' => "mcl_admin_data_valid_form_ajax_callback", + 'wrapper' => 'mcl-admin-data-valid-form', + 'effect' => 'fade', + 'method' => 'replace', + ), + ); + } +} + +/** + * Ajax function which returns the form via ajax. + * + * @param $form + * @param $form_state + */ +function mcl_admin_data_valid_form_ajax_callback($form, &$form_state) { + + // Checks for errors. + if (form_get_errors()) { + return $form; + } + + // Gets the trigger element. + $trigger_elem = $form_state['triggering_element']['#name']; + + // If "data_valid_type_btn" button is clicked. + if ($trigger_elem == "data_valid_type_btn") { + + // Gets the new data valid type. + $type = trim($form_state['values']['data_valid_type']['data_valid_types']['add_data_valid_type']['type']); + $cv_name = trim($form_state['values']['data_valid_type']['data_valid_types']['add_data_valid_type']['cv_name']); + + // Sets the type. + $details = array('type' => $type); + + // Gets cv_id. + if ($cv_name) { + $cv = MCL_CHADO_CV::getCV($cv_name); + $details['cv_id'] = $cv->getCvID(); + } + $mcl_data_valid_type = new MCL_DATA_VALID_TYPE($details); + if (!$mcl_data_valid_type->insert()) { + drupal_set_message("Failed to add a new type : $type"); + } + _mcl_get_mcl_data_valid_type_form($form); + } + + // If "data_valid_btn" button is clicked. + else if (preg_match("/data_valid_btn_(\d+)_(\d+)/", $trigger_elem, $matches)) { + $data_valid_type_id = $matches[1]; + $cv_id = $matches[2]; + + // Gets the value. + $id_fieldset = 'fs_' . $data_valid_type_id; + $id_value = 'value_' . $data_valid_type_id; + $value = trim($form_state['values']['data_valid'][$id_fieldset][$id_value]); + + // Add the value. + $details = array( + 'data_valid_type_id' => $data_valid_type_id, + 'name' => $value, + ); + if ($cv_id) { + $cvterm = MCL_CHADO_CVTERM::byKey(array('cvterm_id' => $value)); + $details['name'] = $cvterm->getName(); + $details['cvterm_id'] = $cvterm->getCvtermID(); + } + $data_valid = new PUBLIC_MCL_DATA_VALID($details); + if ($data_valid->insert()) { + _mcl_get_mcl_data_valid_form($form, $data_valid_type_id); + } + else { + drupal_set_message("Failed to add a new value : $value"); + } + } + return $form; +} + +/** + * Validates the form. + * + * @ingroup mcl_admin + */ +function mcl_admin_data_valid_form_validate($form, &$form_state) { + + // Gets the trigger element. + $trigger_elem = $form_state['triggering_element']['#name']; + + // If "data_valid_type_btn" button is clicked. + if ($trigger_elem == "data_valid_type_btn") { + + // Check the type. + $type = trim($form_state['values']['data_valid_type']['data_valid_types']['add_data_valid_type']['type']); + if (!$type) { + form_set_error('data_valid_type][type', t("Type cannot be empty.")); + return; + } + $keys = array('type' => $type); + + // Check cv name. + $cv_name = trim($form_state['values']['data_valid_type']['data_valid_types']['add_data_valid_type']['cv_name']); + if ($cv_name) { + $cv = MCL_CHADO_CV::getCV($cv_name); + if (!$cv) { + form_set_error('data_valid_type][cv_name', t("CV name '$cv_name' not exist in cv table.")); + return; + } + $keys['cv_id'] = $cv->getCvID(); + } + + // Checks for a duplication. + $mcl_data_valid_type = MCL_DATA_VALID_TYPE::byKey($keys); + if ($mcl_data_valid_type) { + form_set_error('data_valid_type][type', t("The type '$type' is already existed.")); + return; + } + } + + // If "data_valid_btn" button is clicked. + else if (preg_match("/^data_valid_btn_(\d+)_(\d+)$/", $trigger_elem, $matches)) { + $data_valid_type_id = $matches[1]; + $cv_id = $matches[2]; + + // Gets the value. + $id_fieldset = 'fs_' . $data_valid_type_id; + $id_value = 'value_' . $data_valid_type_id; + $value = trim($form_state['values']['data_valid'][$id_fieldset][$id_value]); + + // Checks the value for empty. + if (!$value) { + $msg = ($cv_id) ? 'Please type cvterm ID.' : 'Please type a value.'; + form_set_error("data_valid][$id_fieldset][$id_value", $msg); + return; + } + + // Checks the value for duplication. + $attr = ($cv_id) ? 'cvterm_id' : 'name'; + $data_valid = PUBLIC_MCL_DATA_VALID::byKey(array($attr => $value)); + if ($data_valid) { + $msg = "'$value' has already exists."; + form_set_error("data_valid][$id_fieldset][$id_value", $msg); + return; + } + + // Checks the value for cvterm_id. + if ($cv_id) { + $cv = MCL_CHADO_CV::byKey(array('cv_id' => $cv_id)); + if (!$cv) { + $msg = "cv ID '$cv_id' does not exist in cv table."; + form_set_error("data_valid][$id_fieldset][$id_value", $msg); + return; + } + $key = array( + 'cv_id' => $cv_id, + 'cvterm_id' => $value, + ); + $cvterm = MCL_CHADO_CVTERM::byKey($key); + if (!$cvterm) { + $msg = "cvterm ID ($value) and cv ID ($cv_id) does not exist in cvterm table."; + form_set_error("data_valid][$id_fieldset][$id_value", $msg); + return; + } + } + } +} + +/** + * Submits the form. + * + * @ingroup mcl_admin + */ +function mcl_admin_data_valid_form_submit($form, &$form_state) { + $form_state['rebuild'] = TRUE; +} +?> diff --git a/includes/class/chado_table_class/chado_analysisfeature.class.inc b/includes/class/chado_table_class/chado_analysisfeature.class.inc new file mode 100644 index 0000000..3c106d7 --- /dev/null +++ b/includes/class/chado_table_class/chado_analysisfeature.class.inc @@ -0,0 +1,367 @@ + 'serial', + 'feature_id' => 'integer', + 'analysis_id' => 'integer', + 'rawscore' => 'double', + 'normscore' => 'double', + 'significance' => 'double', + 'identity' => 'double', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->analysisfeature_id = array_key_exists('analysisfeature_id', $details) ? $details['analysisfeature_id'] : ''; + $this->feature_id = array_key_exists('feature_id', $details) ? $details['feature_id'] : ''; + $this->analysis_id = array_key_exists('analysis_id', $details) ? $details['analysis_id'] : ''; + $this->rawscore = array_key_exists('rawscore', $details) ? $details['rawscore'] : ''; + $this->normscore = array_key_exists('normscore', $details) ? $details['normscore'] : ''; + $this->significance = array_key_exists('significance', $details) ? $details['significance'] : ''; + $this->identity = array_key_exists('identity', $details) ? $details['identity'] : ''; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate CHADO_ANALYSISFEATURE by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM chado.analysisfeature WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('analysis_id' => array('fk_table' => 'analysis', 'fk_attr' => 'analysis_id')), + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['feature_id'] = $this->feature_id; + $fields['analysis_id'] = $this->analysis_id; + if (is_numeric($this->rawscore)) { $fields['rawscore'] = $this->rawscore; } + if (is_numeric($this->normscore)) { $fields['normscore'] = $this->normscore; } + if (is_numeric($this->significance)) { $fields['significance'] = $this->significance; } + if (is_numeric($this->identity)) { $fields['identity'] = $this->identity; } + + // Inserts the record. + $this->analysisfeature_id = db_insert('chado.analysisfeature') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['feature_id'] = $this->feature_id; + $fields['analysis_id'] = $this->analysis_id; + if (is_numeric($this->rawscore)) { $fields['rawscore'] = $this->rawscore; } + if (is_numeric($this->normscore)) { $fields['normscore'] = $this->normscore; } + if (is_numeric($this->significance)) { $fields['significance'] = $this->significance; } + if (is_numeric($this->identity)) { $fields['identity'] = $this->identity; } + + // Updates the record. + db_update('chado.analysisfeature') + ->fields($fields) + ->condition('analysisfeature_id', $this->analysisfeature_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('chado.analysisfeature') + ->condition('analysisfeature_id', $this->analysisfeature_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the analysisfeature_id. + * + * @retrun serial + */ + public function getAnalysisfeatureID() { + return $this->analysisfeature_id; + } + + /** + * Updates the analysisfeature_id. + * + * @param serial $analysisfeature_id + */ + public function setAnalysisfeatureID($analysisfeature_id) { + $this->analysisfeature_id = $analysisfeature_id; + } + + /** + * Retrieves the feature_id. + * + * @retrun integer + */ + public function getFeatureID() { + return $this->feature_id; + } + + /** + * Updates the feature_id. + * + * @param integer $feature_id + */ + public function setFeatureID($feature_id) { + $this->feature_id = $feature_id; + } + + /** + * Retrieves the analysis_id. + * + * @retrun integer + */ + public function getAnalysisID() { + return $this->analysis_id; + } + + /** + * Updates the analysis_id. + * + * @param integer $analysis_id + */ + public function setAnalysisID($analysis_id) { + $this->analysis_id = $analysis_id; + } + + /** + * Retrieves the rawscore. + * + * @retrun double + */ + public function getRawscore() { + return $this->rawscore; + } + + /** + * Updates the rawscore. + * + * @param double $rawscore + */ + public function setRawscore($rawscore) { + $this->rawscore = $rawscore; + } + + /** + * Retrieves the normscore. + * + * @retrun double + */ + public function getNormscore() { + return $this->normscore; + } + + /** + * Updates the normscore. + * + * @param double $normscore + */ + public function setNormscore($normscore) { + $this->normscore = $normscore; + } + + /** + * Retrieves the significance. + * + * @retrun double + */ + public function getSignificance() { + return $this->significance; + } + + /** + * Updates the significance. + * + * @param double $significance + */ + public function setSignificance($significance) { + $this->significance = $significance; + } + + /** + * Retrieves the identity. + * + * @retrun double + */ + public function getIdentity() { + return $this->identity; + } + + /** + * Updates the identity. + * + * @param double $identity + */ + public function setIdentity($identity) { + $this->identity = $identity; + } +} \ No newline at end of file diff --git a/includes/class/chado_table_class/chado_contact.class.inc b/includes/class/chado_table_class/chado_contact.class.inc index 3c53f01..e90b969 100644 --- a/includes/class/chado_table_class/chado_contact.class.inc +++ b/includes/class/chado_table_class/chado_contact.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_CONTACT class. * */ -class CHADO_CONTACT { +class CHADO_CONTACT extends CHADO_TABLE { /** * Data members for CHADO_CONTACT. @@ -93,6 +93,30 @@ class CHADO_CONTACT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'contact_id' => array( + array('table' => 'contactprop', 'attr' => 'contact_id'), + array('table' => 'feature_contact', 'attr' => 'contact_id'), + array('table' => 'featuremap_contact', 'attr' => 'contact_id'), + array('table' => 'nd_experiment_contact', 'attr' => 'contact_id'), + array('table' => 'project_contact', 'attr' => 'contact_id'), + ), + ); + } + /** * Adds a new record. */ @@ -158,7 +182,7 @@ class CHADO_CONTACT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_contactprop.class.inc b/includes/class/chado_table_class/chado_contactprop.class.inc index 140e3b8..a9852b6 100644 --- a/includes/class/chado_table_class/chado_contactprop.class.inc +++ b/includes/class/chado_table_class/chado_contactprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_CONTACTPROP class. * */ -class CHADO_CONTACTPROP { +class CHADO_CONTACTPROP extends CHADO_TABLE { /** * Data members for CHADO_CONTACTPROP. @@ -96,6 +96,23 @@ class CHADO_CONTACTPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('contact_id' => array('fk_table' => 'contact', 'fk_attr' => 'contact_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_CONTACTPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_cv.class.inc b/includes/class/chado_table_class/chado_cv.class.inc index e80f9fd..f8496c6 100644 --- a/includes/class/chado_table_class/chado_cv.class.inc +++ b/includes/class/chado_table_class/chado_cv.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_CV class. * */ -class CHADO_CV { +class CHADO_CV extends CHADO_TABLE { /** * Data members for CHADO_CV. @@ -90,6 +90,20 @@ class CHADO_CV { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +169,7 @@ class CHADO_CV { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_cvterm.class.inc b/includes/class/chado_table_class/chado_cvterm.class.inc index 7410dd0..1801c48 100644 --- a/includes/class/chado_table_class/chado_cvterm.class.inc +++ b/includes/class/chado_table_class/chado_cvterm.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_CVTERM class. * */ -class CHADO_CVTERM { +class CHADO_CVTERM extends CHADO_TABLE { /** * Data members for CHADO_CVTERM. @@ -102,6 +102,66 @@ class CHADO_CVTERM { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('dbxref_id' => array('fk_table' => 'dbxref', 'fk_attr' => 'dbxref_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'cvterm_id' => array( + array('table' => 'feature', 'attr' => 'type_id'), + array('table' => 'feature_cvterm', 'attr' => 'cvterm_id'), + array('table' => 'featureprop', 'attr' => 'type_id'), + array('table' => 'pub', 'attr' => 'type_id'), + array('table' => 'synonym', 'attr' => 'type_id'), + array('table' => 'contact', 'attr' => 'type_id'), + array('table' => 'contactprop', 'attr' => 'type_id'), + array('table' => 'cvterm_relationship', 'attr' => 'object_id'), + array('table' => 'cvterm_relationship', 'attr' => 'subject_id'), + array('table' => 'cvterm_relationship', 'attr' => 'type_id'), + array('table' => 'cvtermprop', 'attr' => 'cvterm_id'), + array('table' => 'cvtermprop', 'attr' => 'type_id'), + array('table' => 'cvtermsynonym', 'attr' => 'cvterm_id'), + array('table' => 'cvtermsynonym', 'attr' => 'type_id'), + array('table' => 'dbxrefprop', 'attr' => 'type_id'), + array('table' => 'eimageprop', 'attr' => 'type_id'), + array('table' => 'feature_genotype', 'attr' => 'cvterm_id'), + array('table' => 'feature_relationship', 'attr' => 'type_id'), + array('table' => 'feature_stock', 'attr' => 'type_id'), + array('table' => 'featuremap', 'attr' => 'unittype_id'), + array('table' => 'featuremapprop', 'attr' => 'type_id'), + array('table' => 'featureposprop', 'attr' => 'type_id'), + array('table' => 'genotype', 'attr' => 'type_id'), + array('table' => 'genotypeprop', 'attr' => 'type_id'), + array('table' => 'library', 'attr' => 'type_id'), + array('table' => 'libraryprop', 'attr' => 'type_id'), + array('table' => 'nd_experiment', 'attr' => 'type_id'), + array('table' => 'nd_experiment_stock', 'attr' => 'type_id'), + array('table' => 'nd_experimentprop', 'attr' => 'type_id'), + array('table' => 'nd_geolocationprop', 'attr' => 'type_id'), + array('table' => 'organism_relationship', 'attr' => 'type_id'), + array('table' => 'organismprop', 'attr' => 'type_id'), + array('table' => 'phenotype', 'attr' => 'assay_id'), + array('table' => 'phenotype', 'attr' => 'attr_id'), + array('table' => 'phenotype', 'attr' => 'cvalue_id'), + array('table' => 'phenotype', 'attr' => 'observable_id'), + array('table' => 'project_relationship', 'attr' => 'type_id'), + array('table' => 'projectprop', 'attr' => 'type_id'), + array('table' => 'stock', 'attr' => 'type_id'), + array('table' => 'stock_relationship', 'attr' => 'type_id'), + array('table' => 'stockprop', 'attr' => 'type_id'), + ), + ); + } + /** * Adds a new record. */ @@ -175,7 +235,7 @@ class CHADO_CVTERM { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_cvterm_relationship.class.inc b/includes/class/chado_table_class/chado_cvterm_relationship.class.inc index 6e8d105..356be96 100644 --- a/includes/class/chado_table_class/chado_cvterm_relationship.class.inc +++ b/includes/class/chado_table_class/chado_cvterm_relationship.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_CVTERM_RELATIONSHIP class. * */ -class CHADO_CVTERM_RELATIONSHIP { +class CHADO_CVTERM_RELATIONSHIP extends CHADO_TABLE { /** * Data members for CHADO_CVTERM_RELATIONSHIP. @@ -93,6 +93,24 @@ class CHADO_CVTERM_RELATIONSHIP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('object_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('subject_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -160,7 +178,7 @@ class CHADO_CVTERM_RELATIONSHIP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_cvtermprop.class.inc b/includes/class/chado_table_class/chado_cvtermprop.class.inc index c371a71..fb75522 100644 --- a/includes/class/chado_table_class/chado_cvtermprop.class.inc +++ b/includes/class/chado_table_class/chado_cvtermprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_CVTERMPROP class. * */ -class CHADO_CVTERMPROP { +class CHADO_CVTERMPROP extends CHADO_TABLE { /** * Data members for CHADO_CVTERMPROP. @@ -96,6 +96,23 @@ class CHADO_CVTERMPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('cvterm_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_CVTERMPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_cvtermsynonym.class.inc b/includes/class/chado_table_class/chado_cvtermsynonym.class.inc index a388b66..fec802e 100644 --- a/includes/class/chado_table_class/chado_cvtermsynonym.class.inc +++ b/includes/class/chado_table_class/chado_cvtermsynonym.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_CVTERMSYNONYM class. * */ -class CHADO_CVTERMSYNONYM { +class CHADO_CVTERMSYNONYM extends CHADO_TABLE { /** * Data members for CHADO_CVTERMSYNONYM. @@ -93,6 +93,23 @@ class CHADO_CVTERMSYNONYM { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('cvterm_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -158,7 +175,7 @@ class CHADO_CVTERMSYNONYM { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_db.class.inc b/includes/class/chado_table_class/chado_db.class.inc index 134d404..2593a77 100644 --- a/includes/class/chado_table_class/chado_db.class.inc +++ b/includes/class/chado_table_class/chado_db.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_DB class. * */ -class CHADO_DB { +class CHADO_DB extends CHADO_TABLE { /** * Data members for CHADO_DB. @@ -96,6 +96,20 @@ class CHADO_DB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +179,7 @@ class CHADO_DB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_dbxref.class.inc b/includes/class/chado_table_class/chado_dbxref.class.inc index 98b513f..237fba7 100644 --- a/includes/class/chado_table_class/chado_dbxref.class.inc +++ b/includes/class/chado_table_class/chado_dbxref.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_DBXREF class. * */ -class CHADO_DBXREF { +class CHADO_DBXREF extends CHADO_TABLE { /** * Data members for CHADO_DBXREF. @@ -96,6 +96,30 @@ class CHADO_DBXREF { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'dbxref_id' => array( + array('table' => 'feature', 'attr' => 'dbxref_id'), + array('table' => 'cvterm', 'attr' => 'dbxref_id'), + array('table' => 'feature_dbxref', 'attr' => 'dbxref_id'), + array('table' => 'dbxrefprop', 'attr' => 'dbxref_id'), + array('table' => 'organism_dbxref', 'attr' => 'dbxref_id'), + array('table' => 'stock', 'attr' => 'dbxref_id'), + array('table' => 'stock_dbxref', 'attr' => 'dbxref_id'), + ), + ); + } + /** * Adds a new record. */ @@ -165,7 +189,7 @@ class CHADO_DBXREF { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_dbxrefprop.class.inc b/includes/class/chado_table_class/chado_dbxrefprop.class.inc index 6219ce6..c58f9a2 100644 --- a/includes/class/chado_table_class/chado_dbxrefprop.class.inc +++ b/includes/class/chado_table_class/chado_dbxrefprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_DBXREFPROP class. * */ -class CHADO_DBXREFPROP { +class CHADO_DBXREFPROP extends CHADO_TABLE { /** * Data members for CHADO_DBXREFPROP. @@ -96,6 +96,23 @@ class CHADO_DBXREFPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('dbxref_id' => array('fk_table' => 'dbxref', 'fk_attr' => 'dbxref_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_DBXREFPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_eimage.class.inc b/includes/class/chado_table_class/chado_eimage.class.inc index b97c326..aec513a 100644 --- a/includes/class/chado_table_class/chado_eimage.class.inc +++ b/includes/class/chado_table_class/chado_eimage.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_EIMAGE class. * */ -class CHADO_EIMAGE { +class CHADO_EIMAGE extends CHADO_TABLE { /** * Data members for CHADO_EIMAGE. @@ -93,6 +93,25 @@ class CHADO_EIMAGE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'eimage_id' => array( + array('table' => 'eimageprop', 'attr' => 'eimage_id'), + array('table' => 'feature_image', 'attr' => 'eimage_id'), + ), + ); + } + /** * Adds a new record. */ @@ -160,7 +179,7 @@ class CHADO_EIMAGE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_eimageprop.class.inc b/includes/class/chado_table_class/chado_eimageprop.class.inc index d645705..10430a2 100644 --- a/includes/class/chado_table_class/chado_eimageprop.class.inc +++ b/includes/class/chado_table_class/chado_eimageprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_EIMAGEPROP class. * */ -class CHADO_EIMAGEPROP { +class CHADO_EIMAGEPROP extends CHADO_TABLE { /** * Data members for CHADO_EIMAGEPROP. @@ -96,6 +96,23 @@ class CHADO_EIMAGEPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('eimage_id' => array('fk_table' => 'eimage', 'fk_attr' => 'eimage_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -163,7 +180,7 @@ class CHADO_EIMAGEPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature.class.inc b/includes/class/chado_table_class/chado_feature.class.inc index 45f1de8..723d90d 100644 --- a/includes/class/chado_table_class/chado_feature.class.inc +++ b/includes/class/chado_table_class/chado_feature.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE class. * */ -class CHADO_FEATURE { +class CHADO_FEATURE extends CHADO_TABLE { /** * Data members for CHADO_FEATURE. @@ -120,6 +120,47 @@ class CHADO_FEATURE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('dbxref_id' => array('fk_table' => 'dbxref', 'fk_attr' => 'dbxref_id')), + array('organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'feature_id' => array( + array('table' => 'featureloc', 'attr' => 'feature_id'), + array('table' => 'featureloc', 'attr' => 'srcfeature_id'), + array('table' => 'feature_cvterm', 'attr' => 'feature_id'), + array('table' => 'feature_dbxref', 'attr' => 'feature_id'), + array('table' => 'feature_pub', 'attr' => 'feature_id'), + array('table' => 'feature_synonym', 'attr' => 'feature_id'), + array('table' => 'featureprop', 'attr' => 'feature_id'), + array('table' => 'analysisfeature', 'attr' => 'feature_id'), + array('table' => 'feature_contact', 'attr' => 'feature_id'), + array('table' => 'feature_genotype', 'attr' => 'chromosome_id'), + array('table' => 'feature_genotype', 'attr' => 'feature_id'), + array('table' => 'feature_image', 'attr' => 'feature_id'), + array('table' => 'feature_nd_geolocation', 'attr' => 'feature_id'), + array('table' => 'feature_project', 'attr' => 'feature_id'), + array('table' => 'feature_relationship', 'attr' => 'object_id'), + array('table' => 'feature_relationship', 'attr' => 'subject_id'), + array('table' => 'feature_stock', 'attr' => 'feature_id'), + array('table' => 'featurepos', 'attr' => 'feature_id'), + array('table' => 'featurepos', 'attr' => 'map_feature_id'), + array('table' => 'genotype_call', 'attr' => 'feature_id'), + ), + ); + } + /** * Adds a new record. */ @@ -203,7 +244,7 @@ class CHADO_FEATURE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_contact.class.inc b/includes/class/chado_table_class/chado_feature_contact.class.inc index 01e962d..7c5e2f8 100644 --- a/includes/class/chado_table_class/chado_feature_contact.class.inc +++ b/includes/class/chado_table_class/chado_feature_contact.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_CONTACT class. * */ -class CHADO_FEATURE_CONTACT { +class CHADO_FEATURE_CONTACT extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_CONTACT. @@ -90,6 +90,23 @@ class CHADO_FEATURE_CONTACT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('contact_id' => array('fk_table' => 'contact', 'fk_attr' => 'contact_id')), + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_FEATURE_CONTACT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_cvterm.class.inc b/includes/class/chado_table_class/chado_feature_cvterm.class.inc index a5e409d..8846412 100644 --- a/includes/class/chado_table_class/chado_feature_cvterm.class.inc +++ b/includes/class/chado_table_class/chado_feature_cvterm.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_CVTERM class. * */ -class CHADO_FEATURE_CVTERM { +class CHADO_FEATURE_CVTERM extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_CVTERM. @@ -99,6 +99,24 @@ class CHADO_FEATURE_CVTERM { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('cvterm_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -170,7 +188,7 @@ class CHADO_FEATURE_CVTERM { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_dbxref.class.inc b/includes/class/chado_table_class/chado_feature_dbxref.class.inc index 85db815..e2b5778 100644 --- a/includes/class/chado_table_class/chado_feature_dbxref.class.inc +++ b/includes/class/chado_table_class/chado_feature_dbxref.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_DBXREF class. * */ -class CHADO_FEATURE_DBXREF { +class CHADO_FEATURE_DBXREF extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_DBXREF. @@ -93,6 +93,23 @@ class CHADO_FEATURE_DBXREF { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('dbxref_id' => array('fk_table' => 'dbxref', 'fk_attr' => 'dbxref_id')), + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -160,7 +177,7 @@ class CHADO_FEATURE_DBXREF { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_genotype.class.inc b/includes/class/chado_table_class/chado_feature_genotype.class.inc index fcf2dec..78fdcce 100644 --- a/includes/class/chado_table_class/chado_feature_genotype.class.inc +++ b/includes/class/chado_table_class/chado_feature_genotype.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_GENOTYPE class. * */ -class CHADO_FEATURE_GENOTYPE { +class CHADO_FEATURE_GENOTYPE extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_GENOTYPE. @@ -102,6 +102,25 @@ class CHADO_FEATURE_GENOTYPE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('chromosome_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('cvterm_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('genotype_id' => array('fk_table' => 'genotype', 'fk_attr' => 'genotype_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -173,7 +192,7 @@ class CHADO_FEATURE_GENOTYPE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_image.class.inc b/includes/class/chado_table_class/chado_feature_image.class.inc new file mode 100644 index 0000000..a60150e --- /dev/null +++ b/includes/class/chado_table_class/chado_feature_image.class.inc @@ -0,0 +1,277 @@ + 'serial', + 'feature_id' => 'integer', + 'eimage_id' => 'integer', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->feature_image_id = array_key_exists('feature_image_id', $details) ? $details['feature_image_id'] : ''; + $this->feature_id = array_key_exists('feature_id', $details) ? $details['feature_id'] : ''; + $this->eimage_id = array_key_exists('eimage_id', $details) ? $details['eimage_id'] : ''; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate CHADO_FEATURE_IMAGE by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM chado.feature_image WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('eimage_id' => array('fk_table' => 'eimage', 'fk_attr' => 'eimage_id')), + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['feature_id'] = $this->feature_id; + $fields['eimage_id'] = $this->eimage_id; + + + // Inserts the record. + $this->feature_image_id = db_insert('chado.feature_image') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['feature_id'] = $this->feature_id; + $fields['eimage_id'] = $this->eimage_id; + + + // Updates the record. + db_update('chado.feature_image') + ->fields($fields) + ->condition('feature_image_id', $this->feature_image_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('chado.feature_image') + ->condition('feature_image_id', $this->feature_image_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the feature_image_id. + * + * @retrun serial + */ + public function getFeatureImageID() { + return $this->feature_image_id; + } + + /** + * Updates the feature_image_id. + * + * @param serial $feature_image_id + */ + public function setFeatureImageID($feature_image_id) { + $this->feature_image_id = $feature_image_id; + } + + /** + * Retrieves the feature_id. + * + * @retrun integer + */ + public function getFeatureID() { + return $this->feature_id; + } + + /** + * Updates the feature_id. + * + * @param integer $feature_id + */ + public function setFeatureID($feature_id) { + $this->feature_id = $feature_id; + } + + /** + * Retrieves the eimage_id. + * + * @retrun integer + */ + public function getEimageID() { + return $this->eimage_id; + } + + /** + * Updates the eimage_id. + * + * @param integer $eimage_id + */ + public function setEimageID($eimage_id) { + $this->eimage_id = $eimage_id; + } +} \ No newline at end of file diff --git a/includes/class/chado_table_class/chado_feature_nd_geolocation.class.inc b/includes/class/chado_table_class/chado_feature_nd_geolocation.class.inc new file mode 100644 index 0000000..03d3021 --- /dev/null +++ b/includes/class/chado_table_class/chado_feature_nd_geolocation.class.inc @@ -0,0 +1,277 @@ + 'serial', + 'feature_id' => 'integer', + 'nd_geolocation_id' => 'integer', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->feature_nd_geolocation_id = array_key_exists('feature_nd_geolocation_id', $details) ? $details['feature_nd_geolocation_id'] : ''; + $this->feature_id = array_key_exists('feature_id', $details) ? $details['feature_id'] : ''; + $this->nd_geolocation_id = array_key_exists('nd_geolocation_id', $details) ? $details['nd_geolocation_id'] : ''; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate CHADO_FEATURE_ND_GEOLOCATION by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM chado.feature_nd_geolocation WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('nd_geolocation_id' => array('fk_table' => 'nd_geolocation', 'fk_attr' => 'nd_geolocation_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['feature_id'] = $this->feature_id; + $fields['nd_geolocation_id'] = $this->nd_geolocation_id; + + + // Inserts the record. + $this->feature_nd_geolocation_id = db_insert('chado.feature_nd_geolocation') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['feature_id'] = $this->feature_id; + $fields['nd_geolocation_id'] = $this->nd_geolocation_id; + + + // Updates the record. + db_update('chado.feature_nd_geolocation') + ->fields($fields) + ->condition('feature_nd_geolocation_id', $this->feature_nd_geolocation_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('chado.feature_nd_geolocation') + ->condition('feature_nd_geolocation_id', $this->feature_nd_geolocation_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the feature_nd_geolocation_id. + * + * @retrun serial + */ + public function getFeatureNdGeolocationID() { + return $this->feature_nd_geolocation_id; + } + + /** + * Updates the feature_nd_geolocation_id. + * + * @param serial $feature_nd_geolocation_id + */ + public function setFeatureNdGeolocationID($feature_nd_geolocation_id) { + $this->feature_nd_geolocation_id = $feature_nd_geolocation_id; + } + + /** + * Retrieves the feature_id. + * + * @retrun integer + */ + public function getFeatureID() { + return $this->feature_id; + } + + /** + * Updates the feature_id. + * + * @param integer $feature_id + */ + public function setFeatureID($feature_id) { + $this->feature_id = $feature_id; + } + + /** + * Retrieves the nd_geolocation_id. + * + * @retrun integer + */ + public function getNdGeolocationID() { + return $this->nd_geolocation_id; + } + + /** + * Updates the nd_geolocation_id. + * + * @param integer $nd_geolocation_id + */ + public function setNdGeolocationID($nd_geolocation_id) { + $this->nd_geolocation_id = $nd_geolocation_id; + } +} \ No newline at end of file diff --git a/includes/class/chado_table_class/chado_feature_project.class.inc b/includes/class/chado_table_class/chado_feature_project.class.inc index 35269e3..09beeae 100644 --- a/includes/class/chado_table_class/chado_feature_project.class.inc +++ b/includes/class/chado_table_class/chado_feature_project.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_PROJECT class. * */ -class CHADO_FEATURE_PROJECT { +class CHADO_FEATURE_PROJECT extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_PROJECT. @@ -90,6 +90,23 @@ class CHADO_FEATURE_PROJECT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('project_id' => array('fk_table' => 'project', 'fk_attr' => 'project_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_FEATURE_PROJECT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_pub.class.inc b/includes/class/chado_table_class/chado_feature_pub.class.inc index 14ccc05..ac5e1ac 100644 --- a/includes/class/chado_table_class/chado_feature_pub.class.inc +++ b/includes/class/chado_table_class/chado_feature_pub.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_PUB class. * */ -class CHADO_FEATURE_PUB { +class CHADO_FEATURE_PUB extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_PUB. @@ -90,6 +90,23 @@ class CHADO_FEATURE_PUB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_FEATURE_PUB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_relationship.class.inc b/includes/class/chado_table_class/chado_feature_relationship.class.inc index d77d84a..d600421 100644 --- a/includes/class/chado_table_class/chado_feature_relationship.class.inc +++ b/includes/class/chado_table_class/chado_feature_relationship.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_RELATIONSHIP class. * */ -class CHADO_FEATURE_RELATIONSHIP { +class CHADO_FEATURE_RELATIONSHIP extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_RELATIONSHIP. @@ -99,6 +99,24 @@ class CHADO_FEATURE_RELATIONSHIP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('object_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('subject_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -170,7 +188,7 @@ class CHADO_FEATURE_RELATIONSHIP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_stock.class.inc b/includes/class/chado_table_class/chado_feature_stock.class.inc index a118c7f..7199e61 100644 --- a/includes/class/chado_table_class/chado_feature_stock.class.inc +++ b/includes/class/chado_table_class/chado_feature_stock.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_STOCK class. * */ -class CHADO_FEATURE_STOCK { +class CHADO_FEATURE_STOCK extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_STOCK. @@ -93,6 +93,24 @@ class CHADO_FEATURE_STOCK { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('stock_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -158,7 +176,7 @@ class CHADO_FEATURE_STOCK { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_feature_synonym.class.inc b/includes/class/chado_table_class/chado_feature_synonym.class.inc index 05984bd..215125c 100644 --- a/includes/class/chado_table_class/chado_feature_synonym.class.inc +++ b/includes/class/chado_table_class/chado_feature_synonym.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATURE_SYNONYM class. * */ -class CHADO_FEATURE_SYNONYM { +class CHADO_FEATURE_SYNONYM extends CHADO_TABLE { /** * Data members for CHADO_FEATURE_SYNONYM. @@ -99,6 +99,24 @@ class CHADO_FEATURE_SYNONYM { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + array('synonym_id' => array('fk_table' => 'synonym', 'fk_attr' => 'synonym_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -170,7 +188,7 @@ class CHADO_FEATURE_SYNONYM { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featureloc.class.inc b/includes/class/chado_table_class/chado_featureloc.class.inc new file mode 100644 index 0000000..83f68a3 --- /dev/null +++ b/includes/class/chado_table_class/chado_featureloc.class.inc @@ -0,0 +1,482 @@ + 'serial', + 'feature_id' => 'integer', + 'srcfeature_id' => 'integer', + 'fmin' => 'integer', + 'is_fmin_partial' => 'boolean', + 'fmax' => 'integer', + 'is_fmax_partial' => 'boolean', + 'strand' => 'smallint', + 'phase' => 'integer', + 'residue_info' => 'text', + 'locgroup' => 'integer', + 'rank' => 'integer', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->featureloc_id = array_key_exists('featureloc_id', $details) ? $details['featureloc_id'] : ''; + $this->feature_id = array_key_exists('feature_id', $details) ? $details['feature_id'] : ''; + $this->srcfeature_id = array_key_exists('srcfeature_id', $details) ? $details['srcfeature_id'] : ''; + $this->fmin = array_key_exists('fmin', $details) ? $details['fmin'] : ''; + $this->is_fmin_partial = array_key_exists('is_fmin_partial', $details) ? $details['is_fmin_partial'] : ''; + $this->fmax = array_key_exists('fmax', $details) ? $details['fmax'] : ''; + $this->is_fmax_partial = array_key_exists('is_fmax_partial', $details) ? $details['is_fmax_partial'] : ''; + $this->strand = array_key_exists('strand', $details) ? $details['strand'] : ''; + $this->phase = array_key_exists('phase', $details) ? $details['phase'] : ''; + $this->residue_info = array_key_exists('residue_info', $details) ? $details['residue_info'] : ''; + $this->locgroup = array_key_exists('locgroup', $details) ? $details['locgroup'] : 0; + $this->rank = array_key_exists('rank', $details) ? $details['rank'] : 0; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate CHADO_FEATURELOC by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM chado.featureloc WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('srcfeature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['feature_id'] = $this->feature_id; + $fields['is_fmin_partial'] = (preg_match("/^(true|false)/i", $this->is_fmin_partial)) ? "'" . $this->is_fmin_partial . "'" : 'false'; + $fields['is_fmax_partial'] = (preg_match("/^(true|false)/i", $this->is_fmax_partial)) ? "'" . $this->is_fmax_partial . "'" : 'false'; + $fields['residue_info'] = $this->residue_info; + $fields['locgroup'] = (is_numeric($this->locgroup)) ? $this->locgroup : 0; + $fields['rank'] = (is_numeric($this->rank)) ? $this->rank : 0; + if (is_numeric($this->srcfeature_id)) { $fields['srcfeature_id'] = $this->srcfeature_id; } + if (is_numeric($this->fmin)) { $fields['fmin'] = $this->fmin; } + if (is_numeric($this->fmax)) { $fields['fmax'] = $this->fmax; } + if (is_numeric($this->strand)) { $fields['strand'] = $this->strand; } + if (is_numeric($this->phase)) { $fields['phase'] = $this->phase; } + + // Inserts the record. + $this->featureloc_id = db_insert('chado.featureloc') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['feature_id'] = $this->feature_id; + $fields['is_fmin_partial'] = (preg_match("/^(true|false)/i", $this->is_fmin_partial)) ? "'" . $this->is_fmin_partial . "'" : 'false'; + $fields['is_fmax_partial'] = (preg_match("/^(true|false)/i", $this->is_fmax_partial)) ? "'" . $this->is_fmax_partial . "'" : 'false'; + $fields['residue_info'] = $this->residue_info; + $fields['locgroup'] = (is_numeric($this->locgroup)) ? $this->locgroup : 0; + $fields['rank'] = (is_numeric($this->rank)) ? $this->rank : 0; + if (is_numeric($this->srcfeature_id)) { $fields['srcfeature_id'] = $this->srcfeature_id; } + if (is_numeric($this->fmin)) { $fields['fmin'] = $this->fmin; } + if (is_numeric($this->fmax)) { $fields['fmax'] = $this->fmax; } + if (is_numeric($this->strand)) { $fields['strand'] = $this->strand; } + if (is_numeric($this->phase)) { $fields['phase'] = $this->phase; } + + // Updates the record. + db_update('chado.featureloc') + ->fields($fields) + ->condition('featureloc_id', $this->featureloc_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('chado.featureloc') + ->condition('featureloc_id', $this->featureloc_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the featureloc_id. + * + * @retrun serial + */ + public function getFeaturelocID() { + return $this->featureloc_id; + } + + /** + * Updates the featureloc_id. + * + * @param serial $featureloc_id + */ + public function setFeaturelocID($featureloc_id) { + $this->featureloc_id = $featureloc_id; + } + + /** + * Retrieves the feature_id. + * + * @retrun integer + */ + public function getFeatureID() { + return $this->feature_id; + } + + /** + * Updates the feature_id. + * + * @param integer $feature_id + */ + public function setFeatureID($feature_id) { + $this->feature_id = $feature_id; + } + + /** + * Retrieves the srcfeature_id. + * + * @retrun integer + */ + public function getSrcfeatureID() { + return $this->srcfeature_id; + } + + /** + * Updates the srcfeature_id. + * + * @param integer $srcfeature_id + */ + public function setSrcfeatureID($srcfeature_id) { + $this->srcfeature_id = $srcfeature_id; + } + + /** + * Retrieves the fmin. + * + * @retrun integer + */ + public function getFmin() { + return $this->fmin; + } + + /** + * Updates the fmin. + * + * @param integer $fmin + */ + public function setFmin($fmin) { + $this->fmin = $fmin; + } + + /** + * Retrieves the is_fmin_partial. + * + * @retrun boolean + */ + public function getIsFminPartial() { + return $this->is_fmin_partial; + } + + /** + * Updates the is_fmin_partial. + * + * @param boolean $is_fmin_partial + */ + public function setIsFminPartial($is_fmin_partial) { + $this->is_fmin_partial = $is_fmin_partial; + } + + /** + * Retrieves the fmax. + * + * @retrun integer + */ + public function getFmax() { + return $this->fmax; + } + + /** + * Updates the fmax. + * + * @param integer $fmax + */ + public function setFmax($fmax) { + $this->fmax = $fmax; + } + + /** + * Retrieves the is_fmax_partial. + * + * @retrun boolean + */ + public function getIsFmaxPartial() { + return $this->is_fmax_partial; + } + + /** + * Updates the is_fmax_partial. + * + * @param boolean $is_fmax_partial + */ + public function setIsFmaxPartial($is_fmax_partial) { + $this->is_fmax_partial = $is_fmax_partial; + } + + /** + * Retrieves the strand. + * + * @retrun smallint + */ + public function getStrand() { + return $this->strand; + } + + /** + * Updates the strand. + * + * @param smallint $strand + */ + public function setStrand($strand) { + $this->strand = $strand; + } + + /** + * Retrieves the phase. + * + * @retrun integer + */ + public function getPhase() { + return $this->phase; + } + + /** + * Updates the phase. + * + * @param integer $phase + */ + public function setPhase($phase) { + $this->phase = $phase; + } + + /** + * Retrieves the residue_info. + * + * @retrun text + */ + public function getResidueInfo() { + return $this->residue_info; + } + + /** + * Updates the residue_info. + * + * @param text $residue_info + */ + public function setResidueInfo($residue_info) { + $this->residue_info = $residue_info; + } + + /** + * Retrieves the locgroup. + * + * @retrun integer + */ + public function getLocgroup() { + return $this->locgroup; + } + + /** + * Updates the locgroup. + * + * @param integer $locgroup + */ + public function setLocgroup($locgroup) { + $this->locgroup = $locgroup; + } + + /** + * Retrieves the rank. + * + * @retrun integer + */ + public function getRank() { + return $this->rank; + } + + /** + * Updates the rank. + * + * @param integer $rank + */ + public function setRank($rank) { + $this->rank = $rank; + } +} \ No newline at end of file diff --git a/includes/class/chado_table_class/chado_featuremap.class.inc b/includes/class/chado_table_class/chado_featuremap.class.inc index fdc287a..e73dca4 100644 --- a/includes/class/chado_table_class/chado_featuremap.class.inc +++ b/includes/class/chado_table_class/chado_featuremap.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREMAP class. * */ -class CHADO_FEATUREMAP { +class CHADO_FEATUREMAP extends CHADO_TABLE { /** * Data members for CHADO_FEATUREMAP. @@ -93,6 +93,31 @@ class CHADO_FEATUREMAP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('unittype_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'featuremap_id' => array( + array('table' => 'featuremap_contact', 'attr' => 'featuremap_id'), + array('table' => 'featuremap_organism', 'attr' => 'featuremap_id'), + array('table' => 'featuremap_pub', 'attr' => 'featuremap_id'), + array('table' => 'featuremap_stock', 'attr' => 'featuremap_id'), + array('table' => 'featuremapprop', 'attr' => 'featuremap_id'), + array('table' => 'featurepos', 'attr' => 'featuremap_id'), + ), + ); + } + /** * Adds a new record. */ @@ -158,7 +183,7 @@ class CHADO_FEATUREMAP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featuremap_contact.class.inc b/includes/class/chado_table_class/chado_featuremap_contact.class.inc index 0f6ee70..9acdcae 100644 --- a/includes/class/chado_table_class/chado_featuremap_contact.class.inc +++ b/includes/class/chado_table_class/chado_featuremap_contact.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREMAP_CONTACT class. * */ -class CHADO_FEATUREMAP_CONTACT { +class CHADO_FEATUREMAP_CONTACT extends CHADO_TABLE { /** * Data members for CHADO_FEATUREMAP_CONTACT. @@ -90,6 +90,23 @@ class CHADO_FEATUREMAP_CONTACT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('contact_id' => array('fk_table' => 'contact', 'fk_attr' => 'contact_id')), + array('featuremap_id' => array('fk_table' => 'featuremap', 'fk_attr' => 'featuremap_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_FEATUREMAP_CONTACT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featuremap_organism.class.inc b/includes/class/chado_table_class/chado_featuremap_organism.class.inc index e3e1784..ee48d20 100644 --- a/includes/class/chado_table_class/chado_featuremap_organism.class.inc +++ b/includes/class/chado_table_class/chado_featuremap_organism.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREMAP_ORGANISM class. * */ -class CHADO_FEATUREMAP_ORGANISM { +class CHADO_FEATUREMAP_ORGANISM extends CHADO_TABLE { /** * Data members for CHADO_FEATUREMAP_ORGANISM. @@ -90,6 +90,23 @@ class CHADO_FEATUREMAP_ORGANISM { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('featuremap_id' => array('fk_table' => 'featuremap', 'fk_attr' => 'featuremap_id')), + array('organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_FEATUREMAP_ORGANISM { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featuremap_pub.class.inc b/includes/class/chado_table_class/chado_featuremap_pub.class.inc index 019c87d..a1729f7 100644 --- a/includes/class/chado_table_class/chado_featuremap_pub.class.inc +++ b/includes/class/chado_table_class/chado_featuremap_pub.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREMAP_PUB class. * */ -class CHADO_FEATUREMAP_PUB { +class CHADO_FEATUREMAP_PUB extends CHADO_TABLE { /** * Data members for CHADO_FEATUREMAP_PUB. @@ -90,6 +90,23 @@ class CHADO_FEATUREMAP_PUB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('featuremap_id' => array('fk_table' => 'featuremap', 'fk_attr' => 'featuremap_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_FEATUREMAP_PUB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featuremap_stock.class.inc b/includes/class/chado_table_class/chado_featuremap_stock.class.inc index d1ddf77..797c398 100644 --- a/includes/class/chado_table_class/chado_featuremap_stock.class.inc +++ b/includes/class/chado_table_class/chado_featuremap_stock.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREMAP_STOCK class. * */ -class CHADO_FEATUREMAP_STOCK { +class CHADO_FEATUREMAP_STOCK extends CHADO_TABLE { /** * Data members for CHADO_FEATUREMAP_STOCK. @@ -90,6 +90,23 @@ class CHADO_FEATUREMAP_STOCK { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('featuremap_id' => array('fk_table' => 'featuremap', 'fk_attr' => 'featuremap_id')), + array('stock_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_FEATUREMAP_STOCK { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featuremapprop.class.inc b/includes/class/chado_table_class/chado_featuremapprop.class.inc index a3c5fdf..41b5ef6 100644 --- a/includes/class/chado_table_class/chado_featuremapprop.class.inc +++ b/includes/class/chado_table_class/chado_featuremapprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREMAPPROP class. * */ -class CHADO_FEATUREMAPPROP { +class CHADO_FEATUREMAPPROP extends CHADO_TABLE { /** * Data members for CHADO_FEATUREMAPPROP. @@ -96,6 +96,23 @@ class CHADO_FEATUREMAPPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('featuremap_id' => array('fk_table' => 'featuremap', 'fk_attr' => 'featuremap_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_FEATUREMAPPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featurepos.class.inc b/includes/class/chado_table_class/chado_featurepos.class.inc index d2671de..7fd9305 100644 --- a/includes/class/chado_table_class/chado_featurepos.class.inc +++ b/includes/class/chado_table_class/chado_featurepos.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREPOS class. * */ -class CHADO_FEATUREPOS { +class CHADO_FEATUREPOS extends CHADO_TABLE { /** * Data members for CHADO_FEATUREPOS. @@ -96,6 +96,28 @@ class CHADO_FEATUREPOS { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('featuremap_id' => array('fk_table' => 'featuremap', 'fk_attr' => 'featuremap_id')), + array('map_feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'featurepos_id' => array( + array('table' => 'featureposprop', 'attr' => 'featurepos_id'), + ), + ); + } + /** * Adds a new record. */ @@ -165,7 +187,7 @@ class CHADO_FEATUREPOS { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featureposprop.class.inc b/includes/class/chado_table_class/chado_featureposprop.class.inc index 8777ebe..1ec0414 100644 --- a/includes/class/chado_table_class/chado_featureposprop.class.inc +++ b/includes/class/chado_table_class/chado_featureposprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREPOSPROP class. * */ -class CHADO_FEATUREPOSPROP { +class CHADO_FEATUREPOSPROP extends CHADO_TABLE { /** * Data members for CHADO_FEATUREPOSPROP. @@ -96,6 +96,23 @@ class CHADO_FEATUREPOSPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('featurepos_id' => array('fk_table' => 'featurepos', 'fk_attr' => 'featurepos_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_FEATUREPOSPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_featureprop.class.inc b/includes/class/chado_table_class/chado_featureprop.class.inc index 3f273b3..8408726 100644 --- a/includes/class/chado_table_class/chado_featureprop.class.inc +++ b/includes/class/chado_table_class/chado_featureprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_FEATUREPROP class. * */ -class CHADO_FEATUREPROP { +class CHADO_FEATUREPROP extends CHADO_TABLE { /** * Data members for CHADO_FEATUREPROP. @@ -96,6 +96,23 @@ class CHADO_FEATUREPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_FEATUREPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_genotype.class.inc b/includes/class/chado_table_class/chado_genotype.class.inc index a0ece32..cb2e5fe 100644 --- a/includes/class/chado_table_class/chado_genotype.class.inc +++ b/includes/class/chado_table_class/chado_genotype.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_GENOTYPE class. * */ -class CHADO_GENOTYPE { +class CHADO_GENOTYPE extends CHADO_TABLE { /** * Data members for CHADO_GENOTYPE. @@ -96,6 +96,29 @@ class CHADO_GENOTYPE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'genotype_id' => array( + array('table' => 'feature_genotype', 'attr' => 'genotype_id'), + array('table' => 'genotype_call', 'attr' => 'genotype_id'), + array('table' => 'genotypeprop', 'attr' => 'genotype_id'), + array('table' => 'nd_experiment_genotype', 'attr' => 'genotype_id'), + ), + ); + } + /** * Adds a new record. */ @@ -165,7 +188,7 @@ class CHADO_GENOTYPE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_genotype_call.class.inc b/includes/class/chado_table_class/chado_genotype_call.class.inc index 405ec6b..5301bfe 100644 --- a/includes/class/chado_table_class/chado_genotype_call.class.inc +++ b/includes/class/chado_table_class/chado_genotype_call.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_GENOTYPE_CALL class. * */ -class CHADO_GENOTYPE_CALL { +class CHADO_GENOTYPE_CALL extends CHADO_TABLE { /** * Data members for CHADO_GENOTYPE_CALL. @@ -99,6 +99,25 @@ class CHADO_GENOTYPE_CALL { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('feature_id' => array('fk_table' => 'feature', 'fk_attr' => 'feature_id')), + array('genotype_id' => array('fk_table' => 'genotype', 'fk_attr' => 'genotype_id')), + array('project_id' => array('fk_table' => 'project', 'fk_attr' => 'project_id')), + array('stock_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -170,7 +189,7 @@ class CHADO_GENOTYPE_CALL { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_genotypeprop.class.inc b/includes/class/chado_table_class/chado_genotypeprop.class.inc index 83292f0..b243b10 100644 --- a/includes/class/chado_table_class/chado_genotypeprop.class.inc +++ b/includes/class/chado_table_class/chado_genotypeprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_GENOTYPEPROP class. * */ -class CHADO_GENOTYPEPROP { +class CHADO_GENOTYPEPROP extends CHADO_TABLE { /** * Data members for CHADO_GENOTYPEPROP. @@ -96,6 +96,23 @@ class CHADO_GENOTYPEPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('genotype_id' => array('fk_table' => 'genotype', 'fk_attr' => 'genotype_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_GENOTYPEPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_library.class.inc b/includes/class/chado_table_class/chado_library.class.inc index 022c5db..fc2384c 100644 --- a/includes/class/chado_table_class/chado_library.class.inc +++ b/includes/class/chado_table_class/chado_library.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_LIBRARY class. * */ -class CHADO_LIBRARY { +class CHADO_LIBRARY extends CHADO_TABLE { /** * Data members for CHADO_LIBRARY. @@ -105,6 +105,29 @@ class CHADO_LIBRARY { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'library_id' => array( + array('table' => 'library_pub', 'attr' => 'library_id'), + array('table' => 'library_synonym', 'attr' => 'library_id'), + array('table' => 'libraryprop', 'attr' => 'library_id'), + ), + ); + } + /** * Adds a new record. */ @@ -180,7 +203,7 @@ class CHADO_LIBRARY { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_library_contact.class.inc b/includes/class/chado_table_class/chado_library_contact.class.inc index c6bd86b..04f5ba9 100644 --- a/includes/class/chado_table_class/chado_library_contact.class.inc +++ b/includes/class/chado_table_class/chado_library_contact.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_LIBRARY_CONTACT class. * */ -class CHADO_LIBRARY_CONTACT { +class CHADO_LIBRARY_CONTACT extends CHADO_TABLE { /** * Data members for CHADO_LIBRARY_CONTACT. @@ -90,6 +90,20 @@ class CHADO_LIBRARY_CONTACT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +169,7 @@ class CHADO_LIBRARY_CONTACT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_library_pub.class.inc b/includes/class/chado_table_class/chado_library_pub.class.inc index 21ae97d..bcc183e 100644 --- a/includes/class/chado_table_class/chado_library_pub.class.inc +++ b/includes/class/chado_table_class/chado_library_pub.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_LIBRARY_PUB class. * */ -class CHADO_LIBRARY_PUB { +class CHADO_LIBRARY_PUB extends CHADO_TABLE { /** * Data members for CHADO_LIBRARY_PUB. @@ -90,6 +90,23 @@ class CHADO_LIBRARY_PUB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('library_id' => array('fk_table' => 'library', 'fk_attr' => 'library_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_LIBRARY_PUB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_library_synonym.class.inc b/includes/class/chado_table_class/chado_library_synonym.class.inc index 9f23d40..38ec8d0 100644 --- a/includes/class/chado_table_class/chado_library_synonym.class.inc +++ b/includes/class/chado_table_class/chado_library_synonym.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_LIBRARY_SYNONYM class. * */ -class CHADO_LIBRARY_SYNONYM { +class CHADO_LIBRARY_SYNONYM extends CHADO_TABLE { /** * Data members for CHADO_LIBRARY_SYNONYM. @@ -99,6 +99,24 @@ class CHADO_LIBRARY_SYNONYM { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('library_id' => array('fk_table' => 'library', 'fk_attr' => 'library_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + array('synonym_id' => array('fk_table' => 'synonym', 'fk_attr' => 'synonym_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -170,7 +188,7 @@ class CHADO_LIBRARY_SYNONYM { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_libraryprop.class.inc b/includes/class/chado_table_class/chado_libraryprop.class.inc index aabf209..06ff137 100644 --- a/includes/class/chado_table_class/chado_libraryprop.class.inc +++ b/includes/class/chado_table_class/chado_libraryprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_LIBRARYPROP class. * */ -class CHADO_LIBRARYPROP { +class CHADO_LIBRARYPROP extends CHADO_TABLE { /** * Data members for CHADO_LIBRARYPROP. @@ -96,6 +96,23 @@ class CHADO_LIBRARYPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('library_id' => array('fk_table' => 'library', 'fk_attr' => 'library_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_LIBRARYPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_experiment.class.inc b/includes/class/chado_table_class/chado_nd_experiment.class.inc index d77567e..1032e18 100644 --- a/includes/class/chado_table_class/chado_nd_experiment.class.inc +++ b/includes/class/chado_table_class/chado_nd_experiment.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_EXPERIMENT class. * */ -class CHADO_ND_EXPERIMENT { +class CHADO_ND_EXPERIMENT extends CHADO_TABLE { /** * Data members for CHADO_ND_EXPERIMENT. @@ -90,6 +90,33 @@ class CHADO_ND_EXPERIMENT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('nd_geolocation_id' => array('fk_table' => 'nd_geolocation', 'fk_attr' => 'nd_geolocation_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'nd_experiment_id' => array( + array('table' => 'nd_experiment_contact', 'attr' => 'nd_experiment_id'), + array('table' => 'nd_experiment_genotype', 'attr' => 'nd_experiment_id'), + array('table' => 'nd_experiment_phenotype', 'attr' => 'nd_experiment_id'), + array('table' => 'nd_experiment_project', 'attr' => 'nd_experiment_id'), + array('table' => 'nd_experiment_pub', 'attr' => 'nd_experiment_id'), + array('table' => 'nd_experiment_stock', 'attr' => 'nd_experiment_id'), + array('table' => 'nd_experimentprop', 'attr' => 'nd_experiment_id'), + ), + ); + } + /** * Adds a new record. */ @@ -155,7 +182,7 @@ class CHADO_ND_EXPERIMENT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_experiment_contact.class.inc b/includes/class/chado_table_class/chado_nd_experiment_contact.class.inc new file mode 100644 index 0000000..0de731f --- /dev/null +++ b/includes/class/chado_table_class/chado_nd_experiment_contact.class.inc @@ -0,0 +1,277 @@ + 'serial', + 'nd_experiment_id' => 'integer', + 'contact_id' => 'integer', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->nd_experiment_contact_id = array_key_exists('nd_experiment_contact_id', $details) ? $details['nd_experiment_contact_id'] : ''; + $this->nd_experiment_id = array_key_exists('nd_experiment_id', $details) ? $details['nd_experiment_id'] : ''; + $this->contact_id = array_key_exists('contact_id', $details) ? $details['contact_id'] : ''; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate CHADO_ND_EXPERIMENT_CONTACT by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM chado.nd_experiment_contact WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('contact_id' => array('fk_table' => 'contact', 'fk_attr' => 'contact_id')), + array('nd_experiment_id' => array('fk_table' => 'nd_experiment', 'fk_attr' => 'nd_experiment_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['nd_experiment_id'] = $this->nd_experiment_id; + $fields['contact_id'] = $this->contact_id; + + + // Inserts the record. + $this->nd_experiment_contact_id = db_insert('chado.nd_experiment_contact') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['nd_experiment_id'] = $this->nd_experiment_id; + $fields['contact_id'] = $this->contact_id; + + + // Updates the record. + db_update('chado.nd_experiment_contact') + ->fields($fields) + ->condition('nd_experiment_contact_id', $this->nd_experiment_contact_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('chado.nd_experiment_contact') + ->condition('nd_experiment_contact_id', $this->nd_experiment_contact_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the nd_experiment_contact_id. + * + * @retrun serial + */ + public function getNdExperimentContactID() { + return $this->nd_experiment_contact_id; + } + + /** + * Updates the nd_experiment_contact_id. + * + * @param serial $nd_experiment_contact_id + */ + public function setNdExperimentContactID($nd_experiment_contact_id) { + $this->nd_experiment_contact_id = $nd_experiment_contact_id; + } + + /** + * Retrieves the nd_experiment_id. + * + * @retrun integer + */ + public function getNdExperimentID() { + return $this->nd_experiment_id; + } + + /** + * Updates the nd_experiment_id. + * + * @param integer $nd_experiment_id + */ + public function setNdExperimentID($nd_experiment_id) { + $this->nd_experiment_id = $nd_experiment_id; + } + + /** + * Retrieves the contact_id. + * + * @retrun integer + */ + public function getContactID() { + return $this->contact_id; + } + + /** + * Updates the contact_id. + * + * @param integer $contact_id + */ + public function setContactID($contact_id) { + $this->contact_id = $contact_id; + } +} \ No newline at end of file diff --git a/includes/class/chado_table_class/chado_nd_experiment_genotype.class.inc b/includes/class/chado_table_class/chado_nd_experiment_genotype.class.inc index efaa862..05034cc 100644 --- a/includes/class/chado_table_class/chado_nd_experiment_genotype.class.inc +++ b/includes/class/chado_table_class/chado_nd_experiment_genotype.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_EXPERIMENT_GENOTYPE class. * */ -class CHADO_ND_EXPERIMENT_GENOTYPE { +class CHADO_ND_EXPERIMENT_GENOTYPE extends CHADO_TABLE { /** * Data members for CHADO_ND_EXPERIMENT_GENOTYPE. @@ -90,6 +90,23 @@ class CHADO_ND_EXPERIMENT_GENOTYPE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('genotype_id' => array('fk_table' => 'genotype', 'fk_attr' => 'genotype_id')), + array('nd_experiment_id' => array('fk_table' => 'nd_experiment', 'fk_attr' => 'nd_experiment_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_ND_EXPERIMENT_GENOTYPE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_experiment_phenotype.class.inc b/includes/class/chado_table_class/chado_nd_experiment_phenotype.class.inc index e052f08..27f43e2 100644 --- a/includes/class/chado_table_class/chado_nd_experiment_phenotype.class.inc +++ b/includes/class/chado_table_class/chado_nd_experiment_phenotype.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_EXPERIMENT_PHENOTYPE class. * */ -class CHADO_ND_EXPERIMENT_PHENOTYPE { +class CHADO_ND_EXPERIMENT_PHENOTYPE extends CHADO_TABLE { /** * Data members for CHADO_ND_EXPERIMENT_PHENOTYPE. @@ -90,6 +90,23 @@ class CHADO_ND_EXPERIMENT_PHENOTYPE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('nd_experiment_id' => array('fk_table' => 'nd_experiment', 'fk_attr' => 'nd_experiment_id')), + array('phenotype_id' => array('fk_table' => 'phenotype', 'fk_attr' => 'phenotype_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_ND_EXPERIMENT_PHENOTYPE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_experiment_project.class.inc b/includes/class/chado_table_class/chado_nd_experiment_project.class.inc index b4b92d4..7956103 100644 --- a/includes/class/chado_table_class/chado_nd_experiment_project.class.inc +++ b/includes/class/chado_table_class/chado_nd_experiment_project.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_EXPERIMENT_PROJECT class. * */ -class CHADO_ND_EXPERIMENT_PROJECT { +class CHADO_ND_EXPERIMENT_PROJECT extends CHADO_TABLE { /** * Data members for CHADO_ND_EXPERIMENT_PROJECT. @@ -90,6 +90,23 @@ class CHADO_ND_EXPERIMENT_PROJECT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('nd_experiment_id' => array('fk_table' => 'nd_experiment', 'fk_attr' => 'nd_experiment_id')), + array('project_id' => array('fk_table' => 'project', 'fk_attr' => 'project_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_ND_EXPERIMENT_PROJECT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_experiment_pub.class.inc b/includes/class/chado_table_class/chado_nd_experiment_pub.class.inc index 60169b6..979d69f 100644 --- a/includes/class/chado_table_class/chado_nd_experiment_pub.class.inc +++ b/includes/class/chado_table_class/chado_nd_experiment_pub.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_EXPERIMENT_PUB class. * */ -class CHADO_ND_EXPERIMENT_PUB { +class CHADO_ND_EXPERIMENT_PUB extends CHADO_TABLE { /** * Data members for CHADO_ND_EXPERIMENT_PUB. @@ -90,6 +90,23 @@ class CHADO_ND_EXPERIMENT_PUB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('nd_experiment_id' => array('fk_table' => 'nd_experiment', 'fk_attr' => 'nd_experiment_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_ND_EXPERIMENT_PUB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_experiment_stock.class.inc b/includes/class/chado_table_class/chado_nd_experiment_stock.class.inc index 39e9aaf..15c68f6 100644 --- a/includes/class/chado_table_class/chado_nd_experiment_stock.class.inc +++ b/includes/class/chado_table_class/chado_nd_experiment_stock.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_EXPERIMENT_STOCK class. * */ -class CHADO_ND_EXPERIMENT_STOCK { +class CHADO_ND_EXPERIMENT_STOCK extends CHADO_TABLE { /** * Data members for CHADO_ND_EXPERIMENT_STOCK. @@ -93,6 +93,24 @@ class CHADO_ND_EXPERIMENT_STOCK { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('nd_experiment_id' => array('fk_table' => 'nd_experiment', 'fk_attr' => 'nd_experiment_id')), + array('stock_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -160,7 +178,7 @@ class CHADO_ND_EXPERIMENT_STOCK { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_experimentprop.class.inc b/includes/class/chado_table_class/chado_nd_experimentprop.class.inc index 4d41153..e370500 100644 --- a/includes/class/chado_table_class/chado_nd_experimentprop.class.inc +++ b/includes/class/chado_table_class/chado_nd_experimentprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_EXPERIMENTPROP class. * */ -class CHADO_ND_EXPERIMENTPROP { +class CHADO_ND_EXPERIMENTPROP extends CHADO_TABLE { /** * Data members for CHADO_ND_EXPERIMENTPROP. @@ -96,6 +96,23 @@ class CHADO_ND_EXPERIMENTPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('nd_experiment_id' => array('fk_table' => 'nd_experiment', 'fk_attr' => 'nd_experiment_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_ND_EXPERIMENTPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_geolocation.class.inc b/includes/class/chado_table_class/chado_nd_geolocation.class.inc index aea7118..6831bc0 100644 --- a/includes/class/chado_table_class/chado_nd_geolocation.class.inc +++ b/includes/class/chado_table_class/chado_nd_geolocation.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_GEOLOCATION class. * */ -class CHADO_ND_GEOLOCATION { +class CHADO_ND_GEOLOCATION extends CHADO_TABLE { /** * Data members for CHADO_ND_GEOLOCATION. @@ -99,6 +99,26 @@ class CHADO_ND_GEOLOCATION { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'nd_geolocation_id' => array( + array('table' => 'feature_nd_geolocation', 'attr' => 'nd_geolocation_id'), + array('table' => 'nd_experiment', 'attr' => 'nd_geolocation_id'), + array('table' => 'nd_geolocationprop', 'attr' => 'nd_geolocation_id'), + ), + ); + } + /** * Adds a new record. */ @@ -168,7 +188,7 @@ class CHADO_ND_GEOLOCATION { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_nd_geolocationprop.class.inc b/includes/class/chado_table_class/chado_nd_geolocationprop.class.inc index 705a525..b616ce4 100644 --- a/includes/class/chado_table_class/chado_nd_geolocationprop.class.inc +++ b/includes/class/chado_table_class/chado_nd_geolocationprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ND_GEOLOCATIONPROP class. * */ -class CHADO_ND_GEOLOCATIONPROP { +class CHADO_ND_GEOLOCATIONPROP extends CHADO_TABLE { /** * Data members for CHADO_ND_GEOLOCATIONPROP. @@ -96,6 +96,23 @@ class CHADO_ND_GEOLOCATIONPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('nd_geolocation_id' => array('fk_table' => 'nd_geolocation', 'fk_attr' => 'nd_geolocation_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_ND_GEOLOCATIONPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_organism.class.inc b/includes/class/chado_table_class/chado_organism.class.inc index 8c9efbd..7cf352b 100644 --- a/includes/class/chado_table_class/chado_organism.class.inc +++ b/includes/class/chado_table_class/chado_organism.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ORGANISM class. * */ -class CHADO_ORGANISM { +class CHADO_ORGANISM extends CHADO_TABLE { /** * Data members for CHADO_ORGANISM. @@ -99,6 +99,32 @@ class CHADO_ORGANISM { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'organism_id' => array( + array('table' => 'feature', 'attr' => 'organism_id'), + array('table' => 'featuremap_organism', 'attr' => 'organism_id'), + array('table' => 'library', 'attr' => 'organism_id'), + array('table' => 'organism_dbxref', 'attr' => 'organism_id'), + array('table' => 'organism_pub', 'attr' => 'organism_id'), + array('table' => 'organism_relationship', 'attr' => 'object_organism_id'), + array('table' => 'organism_relationship', 'attr' => 'subject_organism_id'), + array('table' => 'organismprop', 'attr' => 'organism_id'), + array('table' => 'stock', 'attr' => 'organism_id'), + ), + ); + } + /** * Adds a new record. */ @@ -170,7 +196,7 @@ class CHADO_ORGANISM { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_organism_dbxref.class.inc b/includes/class/chado_table_class/chado_organism_dbxref.class.inc index a650554..0622d8a 100644 --- a/includes/class/chado_table_class/chado_organism_dbxref.class.inc +++ b/includes/class/chado_table_class/chado_organism_dbxref.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ORGANISM_DBXREF class. * */ -class CHADO_ORGANISM_DBXREF { +class CHADO_ORGANISM_DBXREF extends CHADO_TABLE { /** * Data members for CHADO_ORGANISM_DBXREF. @@ -90,6 +90,23 @@ class CHADO_ORGANISM_DBXREF { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('dbxref_id' => array('fk_table' => 'dbxref', 'fk_attr' => 'dbxref_id')), + array('organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_ORGANISM_DBXREF { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_organism_pub.class.inc b/includes/class/chado_table_class/chado_organism_pub.class.inc index 2477e14..53347f2 100644 --- a/includes/class/chado_table_class/chado_organism_pub.class.inc +++ b/includes/class/chado_table_class/chado_organism_pub.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_ORGANISM_PUB class. * */ -class CHADO_ORGANISM_PUB { +class CHADO_ORGANISM_PUB extends CHADO_TABLE { /** * Data members for CHADO_ORGANISM_PUB. @@ -90,6 +90,23 @@ class CHADO_ORGANISM_PUB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_ORGANISM_PUB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_organism_relationship.class.inc b/includes/class/chado_table_class/chado_organism_relationship.class.inc new file mode 100644 index 0000000..4dcbd28 --- /dev/null +++ b/includes/class/chado_table_class/chado_organism_relationship.class.inc @@ -0,0 +1,301 @@ + 'serial', + 'subject_organism_id' => 'integer', + 'object_organism_id' => 'integer', + 'type_id' => 'integer', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->organism_relationship_id = array_key_exists('organism_relationship_id', $details) ? $details['organism_relationship_id'] : ''; + $this->subject_organism_id = array_key_exists('subject_organism_id', $details) ? $details['subject_organism_id'] : ''; + $this->object_organism_id = array_key_exists('object_organism_id', $details) ? $details['object_organism_id'] : ''; + $this->type_id = array_key_exists('type_id', $details) ? $details['type_id'] : ''; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate CHADO_ORGANISM_RELATIONSHIP by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM chado.organism_relationship WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('object_organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + array('subject_organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['subject_organism_id'] = $this->subject_organism_id; + $fields['object_organism_id'] = $this->object_organism_id; + $fields['type_id'] = $this->type_id; + + + // Inserts the record. + $this->organism_relationship_id = db_insert('chado.organism_relationship') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['subject_organism_id'] = $this->subject_organism_id; + $fields['object_organism_id'] = $this->object_organism_id; + $fields['type_id'] = $this->type_id; + + + // Updates the record. + db_update('chado.organism_relationship') + ->fields($fields) + ->condition('organism_relationship_id', $this->organism_relationship_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('chado.organism_relationship') + ->condition('organism_relationship_id', $this->organism_relationship_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the organism_relationship_id. + * + * @retrun serial + */ + public function getOrganismRelationshipID() { + return $this->organism_relationship_id; + } + + /** + * Updates the organism_relationship_id. + * + * @param serial $organism_relationship_id + */ + public function setOrganismRelationshipID($organism_relationship_id) { + $this->organism_relationship_id = $organism_relationship_id; + } + + /** + * Retrieves the subject_organism_id. + * + * @retrun integer + */ + public function getSubjectOrganismID() { + return $this->subject_organism_id; + } + + /** + * Updates the subject_organism_id. + * + * @param integer $subject_organism_id + */ + public function setSubjectOrganismID($subject_organism_id) { + $this->subject_organism_id = $subject_organism_id; + } + + /** + * Retrieves the object_organism_id. + * + * @retrun integer + */ + public function getObjectOrganismID() { + return $this->object_organism_id; + } + + /** + * Updates the object_organism_id. + * + * @param integer $object_organism_id + */ + public function setObjectOrganismID($object_organism_id) { + $this->object_organism_id = $object_organism_id; + } + + /** + * Retrieves the type_id. + * + * @retrun integer + */ + public function getTypeID() { + return $this->type_id; + } + + /** + * Updates the type_id. + * + * @param integer $type_id + */ + public function setTypeID($type_id) { + $this->type_id = $type_id; + } +} \ No newline at end of file diff --git a/includes/class/chado_table_class/chado_organismprop.class.inc b/includes/class/chado_table_class/chado_organismprop.class.inc new file mode 100644 index 0000000..2f5c75d --- /dev/null +++ b/includes/class/chado_table_class/chado_organismprop.class.inc @@ -0,0 +1,323 @@ + 'serial', + 'organism_id' => 'integer', + 'type_id' => 'integer', + 'value' => 'text', + 'rank' => 'integer', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->organismprop_id = array_key_exists('organismprop_id', $details) ? $details['organismprop_id'] : ''; + $this->organism_id = array_key_exists('organism_id', $details) ? $details['organism_id'] : ''; + $this->type_id = array_key_exists('type_id', $details) ? $details['type_id'] : ''; + $this->value = array_key_exists('value', $details) ? $details['value'] : ''; + $this->rank = array_key_exists('rank', $details) ? $details['rank'] : 0; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate CHADO_ORGANISMPROP by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM chado.organismprop WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['organism_id'] = $this->organism_id; + $fields['type_id'] = $this->type_id; + $fields['value'] = $this->value; + $fields['rank'] = (is_numeric($this->rank)) ? $this->rank : 0; + + + // Inserts the record. + $this->organismprop_id = db_insert('chado.organismprop') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['organism_id'] = $this->organism_id; + $fields['type_id'] = $this->type_id; + $fields['value'] = $this->value; + $fields['rank'] = (is_numeric($this->rank)) ? $this->rank : 0; + + + // Updates the record. + db_update('chado.organismprop') + ->fields($fields) + ->condition('organismprop_id', $this->organismprop_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('chado.organismprop') + ->condition('organismprop_id', $this->organismprop_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the organismprop_id. + * + * @retrun serial + */ + public function getOrganismpropID() { + return $this->organismprop_id; + } + + /** + * Updates the organismprop_id. + * + * @param serial $organismprop_id + */ + public function setOrganismpropID($organismprop_id) { + $this->organismprop_id = $organismprop_id; + } + + /** + * Retrieves the organism_id. + * + * @retrun integer + */ + public function getOrganismID() { + return $this->organism_id; + } + + /** + * Updates the organism_id. + * + * @param integer $organism_id + */ + public function setOrganismID($organism_id) { + $this->organism_id = $organism_id; + } + + /** + * Retrieves the type_id. + * + * @retrun integer + */ + public function getTypeID() { + return $this->type_id; + } + + /** + * Updates the type_id. + * + * @param integer $type_id + */ + public function setTypeID($type_id) { + $this->type_id = $type_id; + } + + /** + * Retrieves the value. + * + * @retrun text + */ + public function getValue() { + return $this->value; + } + + /** + * Updates the value. + * + * @param text $value + */ + public function setValue($value) { + $this->value = $value; + } + + /** + * Retrieves the rank. + * + * @retrun integer + */ + public function getRank() { + return $this->rank; + } + + /** + * Updates the rank. + * + * @param integer $rank + */ + public function setRank($rank) { + $this->rank = $rank; + } +} \ No newline at end of file diff --git a/includes/class/chado_table_class/chado_phenotype.class.inc b/includes/class/chado_table_class/chado_phenotype.class.inc index f68fab0..6c2458b 100644 --- a/includes/class/chado_table_class/chado_phenotype.class.inc +++ b/includes/class/chado_table_class/chado_phenotype.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_PHENOTYPE class. * */ -class CHADO_PHENOTYPE { +class CHADO_PHENOTYPE extends CHADO_TABLE { /** * Data members for CHADO_PHENOTYPE. @@ -105,6 +105,29 @@ class CHADO_PHENOTYPE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('assay_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('attr_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('cvalue_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + array('observable_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'phenotype_id' => array( + array('table' => 'nd_experiment_phenotype', 'attr' => 'phenotype_id'), + ), + ); + } + /** * Adds a new record. */ @@ -178,7 +201,7 @@ class CHADO_PHENOTYPE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_project.class.inc b/includes/class/chado_table_class/chado_project.class.inc index a7835dc..aaeada4 100644 --- a/includes/class/chado_table_class/chado_project.class.inc +++ b/includes/class/chado_table_class/chado_project.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_PROJECT class. * */ -class CHADO_PROJECT { +class CHADO_PROJECT extends CHADO_TABLE { /** * Data members for CHADO_PROJECT. @@ -90,6 +90,31 @@ class CHADO_PROJECT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'project_id' => array( + array('table' => 'feature_project', 'attr' => 'project_id'), + array('table' => 'genotype_call', 'attr' => 'project_id'), + array('table' => 'nd_experiment_project', 'attr' => 'project_id'), + array('table' => 'project_contact', 'attr' => 'project_id'), + array('table' => 'project_pub', 'attr' => 'project_id'), + array('table' => 'project_relationship', 'attr' => 'object_project_id'), + array('table' => 'project_relationship', 'attr' => 'subject_project_id'), + array('table' => 'projectprop', 'attr' => 'project_id'), + ), + ); + } + /** * Adds a new record. */ @@ -155,7 +180,7 @@ class CHADO_PROJECT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_project_contact.class.inc b/includes/class/chado_table_class/chado_project_contact.class.inc index 5c58eab..230a5ea 100644 --- a/includes/class/chado_table_class/chado_project_contact.class.inc +++ b/includes/class/chado_table_class/chado_project_contact.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_PROJECT_CONTACT class. * */ -class CHADO_PROJECT_CONTACT { +class CHADO_PROJECT_CONTACT extends CHADO_TABLE { /** * Data members for CHADO_PROJECT_CONTACT. @@ -90,6 +90,23 @@ class CHADO_PROJECT_CONTACT { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('contact_id' => array('fk_table' => 'contact', 'fk_attr' => 'contact_id')), + array('project_id' => array('fk_table' => 'project', 'fk_attr' => 'project_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_PROJECT_CONTACT { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_project_pub.class.inc b/includes/class/chado_table_class/chado_project_pub.class.inc index 111cab2..3234936 100644 --- a/includes/class/chado_table_class/chado_project_pub.class.inc +++ b/includes/class/chado_table_class/chado_project_pub.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_PROJECT_PUB class. * */ -class CHADO_PROJECT_PUB { +class CHADO_PROJECT_PUB extends CHADO_TABLE { /** * Data members for CHADO_PROJECT_PUB. @@ -90,6 +90,23 @@ class CHADO_PROJECT_PUB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('project_id' => array('fk_table' => 'project', 'fk_attr' => 'project_id')), + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_PROJECT_PUB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_project_relationship.class.inc b/includes/class/chado_table_class/chado_project_relationship.class.inc index 70ffe89..fee94a5 100644 --- a/includes/class/chado_table_class/chado_project_relationship.class.inc +++ b/includes/class/chado_table_class/chado_project_relationship.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_PROJECT_RELATIONSHIP class. * */ -class CHADO_PROJECT_RELATIONSHIP { +class CHADO_PROJECT_RELATIONSHIP extends CHADO_TABLE { /** * Data members for CHADO_PROJECT_RELATIONSHIP. @@ -93,6 +93,24 @@ class CHADO_PROJECT_RELATIONSHIP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('object_project_id' => array('fk_table' => 'project', 'fk_attr' => 'project_id')), + array('subject_project_id' => array('fk_table' => 'project', 'fk_attr' => 'project_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -160,7 +178,7 @@ class CHADO_PROJECT_RELATIONSHIP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_projectprop.class.inc b/includes/class/chado_table_class/chado_projectprop.class.inc index 3868a17..6b37fde 100644 --- a/includes/class/chado_table_class/chado_projectprop.class.inc +++ b/includes/class/chado_table_class/chado_projectprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_PROJECTPROP class. * */ -class CHADO_PROJECTPROP { +class CHADO_PROJECTPROP extends CHADO_TABLE { /** * Data members for CHADO_PROJECTPROP. @@ -96,6 +96,23 @@ class CHADO_PROJECTPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('project_id' => array('fk_table' => 'project', 'fk_attr' => 'project_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_PROJECTPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_pub.class.inc b/includes/class/chado_table_class/chado_pub.class.inc index e8947d7..765555b 100644 --- a/includes/class/chado_table_class/chado_pub.class.inc +++ b/includes/class/chado_table_class/chado_pub.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_PUB class. * */ -class CHADO_PUB { +class CHADO_PUB extends CHADO_TABLE { /** * Data members for CHADO_PUB. @@ -123,6 +123,35 @@ class CHADO_PUB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'pub_id' => array( + array('table' => 'feature_cvterm', 'attr' => 'pub_id'), + array('table' => 'feature_pub', 'attr' => 'pub_id'), + array('table' => 'feature_synonym', 'attr' => 'pub_id'), + array('table' => 'featuremap_pub', 'attr' => 'pub_id'), + array('table' => 'library_pub', 'attr' => 'pub_id'), + array('table' => 'library_synonym', 'attr' => 'pub_id'), + array('table' => 'nd_experiment_pub', 'attr' => 'pub_id'), + array('table' => 'organism_pub', 'attr' => 'pub_id'), + array('table' => 'project_pub', 'attr' => 'pub_id'), + array('table' => 'stock_pub', 'attr' => 'pub_id'), + ), + ); + } + /** * Adds a new record. */ @@ -208,7 +237,7 @@ class CHADO_PUB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_stock.class.inc b/includes/class/chado_table_class/chado_stock.class.inc index ea56635..92b24bd 100644 --- a/includes/class/chado_table_class/chado_stock.class.inc +++ b/includes/class/chado_table_class/chado_stock.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_STOCK class. * */ -class CHADO_STOCK { +class CHADO_STOCK extends CHADO_TABLE { /** * Data members for CHADO_STOCK. @@ -105,6 +105,36 @@ class CHADO_STOCK { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('dbxref_id' => array('fk_table' => 'dbxref', 'fk_attr' => 'dbxref_id')), + array('organism_id' => array('fk_table' => 'organism', 'fk_attr' => 'organism_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'stock_id' => array( + array('table' => 'feature_stock', 'attr' => 'stock_id'), + array('table' => 'featuremap_stock', 'attr' => 'stock_id'), + array('table' => 'genotype_call', 'attr' => 'stock_id'), + array('table' => 'nd_experiment_stock', 'attr' => 'stock_id'), + array('table' => 'stock_dbxref', 'attr' => 'stock_id'), + array('table' => 'stock_pub', 'attr' => 'stock_id'), + array('table' => 'stock_relationship', 'attr' => 'object_id'), + array('table' => 'stock_relationship', 'attr' => 'subject_id'), + array('table' => 'stockprop', 'attr' => 'stock_id'), + ), + ); + } + /** * Adds a new record. */ @@ -178,7 +208,7 @@ class CHADO_STOCK { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_stock_dbxref.class.inc b/includes/class/chado_table_class/chado_stock_dbxref.class.inc index ce7f9dc..52d93d9 100644 --- a/includes/class/chado_table_class/chado_stock_dbxref.class.inc +++ b/includes/class/chado_table_class/chado_stock_dbxref.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_STOCK_DBXREF class. * */ -class CHADO_STOCK_DBXREF { +class CHADO_STOCK_DBXREF extends CHADO_TABLE { /** * Data members for CHADO_STOCK_DBXREF. @@ -93,6 +93,23 @@ class CHADO_STOCK_DBXREF { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('dbxref_id' => array('fk_table' => 'dbxref', 'fk_attr' => 'dbxref_id')), + array('stock_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -160,7 +177,7 @@ class CHADO_STOCK_DBXREF { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_stock_pub.class.inc b/includes/class/chado_table_class/chado_stock_pub.class.inc index 7692edb..fa63627 100644 --- a/includes/class/chado_table_class/chado_stock_pub.class.inc +++ b/includes/class/chado_table_class/chado_stock_pub.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_STOCK_PUB class. * */ -class CHADO_STOCK_PUB { +class CHADO_STOCK_PUB extends CHADO_TABLE { /** * Data members for CHADO_STOCK_PUB. @@ -90,6 +90,23 @@ class CHADO_STOCK_PUB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('pub_id' => array('fk_table' => 'pub', 'fk_attr' => 'pub_id')), + array('stock_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +172,7 @@ class CHADO_STOCK_PUB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_stock_relationship.class.inc b/includes/class/chado_table_class/chado_stock_relationship.class.inc index 9099f17..4c3f6c9 100644 --- a/includes/class/chado_table_class/chado_stock_relationship.class.inc +++ b/includes/class/chado_table_class/chado_stock_relationship.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_STOCK_RELATIONSHIP class. * */ -class CHADO_STOCK_RELATIONSHIP { +class CHADO_STOCK_RELATIONSHIP extends CHADO_TABLE { /** * Data members for CHADO_STOCK_RELATIONSHIP. @@ -99,6 +99,24 @@ class CHADO_STOCK_RELATIONSHIP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('object_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + array('subject_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -170,7 +188,7 @@ class CHADO_STOCK_RELATIONSHIP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_stockprop.class.inc b/includes/class/chado_table_class/chado_stockprop.class.inc index b0c702e..d4d8a08 100644 --- a/includes/class/chado_table_class/chado_stockprop.class.inc +++ b/includes/class/chado_table_class/chado_stockprop.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_STOCKPROP class. * */ -class CHADO_STOCKPROP { +class CHADO_STOCKPROP extends CHADO_TABLE { /** * Data members for CHADO_STOCKPROP. @@ -96,6 +96,23 @@ class CHADO_STOCKPROP { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('stock_id' => array('fk_table' => 'stock', 'fk_attr' => 'stock_id')), + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +182,7 @@ class CHADO_STOCKPROP { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_synonym.class.inc b/includes/class/chado_table_class/chado_synonym.class.inc index e96ef18..8236e74 100644 --- a/includes/class/chado_table_class/chado_synonym.class.inc +++ b/includes/class/chado_table_class/chado_synonym.class.inc @@ -7,7 +7,7 @@ * The declaration of CHADO_SYNONYM class. * */ -class CHADO_SYNONYM { +class CHADO_SYNONYM extends CHADO_TABLE { /** * Data members for CHADO_SYNONYM. @@ -93,6 +93,27 @@ class CHADO_SYNONYM { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return array( + array('type_id' => array('fk_table' => 'cvterm', 'fk_attr' => 'cvterm_id')), + ); + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return array( + 'synonym_id' => array( + array('table' => 'feature_synonym', 'attr' => 'synonym_id'), + array('table' => 'library_synonym', 'attr' => 'synonym_id'), + ), + ); + } + /** * Adds a new record. */ @@ -160,7 +181,7 @@ class CHADO_SYNONYM { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/chado_table_class/chado_table.class.inc b/includes/class/chado_table_class/chado_table.class.inc new file mode 100644 index 0000000..a9ded2b --- /dev/null +++ b/includes/class/chado_table_class/chado_table.class.inc @@ -0,0 +1,371 @@ + $value) { + if ($value == '') { + return FALSE; + } + } + return TRUE; + } + + /** + * Creates a string from array. + * + * @param assoc array $args + * @param string $field_1 + * @param integer $id_1 + * @param string $field_2 + * @param string $id_2 + */ + public static function arrStr($args) { + if (empty($args)) { + return ''; + } + $keys = ''; + $values = ''; + $flag = TRUE; + foreach ($args as $key => $value) { + $prefix = ', '; + if ($flag) { + $prefix = ''; + $flag = FALSE; + } + $keys .= $prefix . $key; + $values .= $prefix . $value; + } + return "($keys) = ($values)"; + } + + /** + * Adds the message. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $key + * @param string $table + * @param array $args + */ + public static function addMsg(MCL_TEMPLATE $mcl_tmpl = NULL, $key, $table, $args) { + if ($mcl_tmpl) { + $mcl_tmpl->addMsg($key, $table, $args); + } + } + + /** + * Updates the message. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $key + * @param string $msg + */ + public static function updateMsg(MCL_TEMPLATE $mcl_tmpl = NULL, $key, $msg) { + if ($mcl_tmpl) { + $mcl_tmpl->updateMsg($key, $msg); + } + } + + /** + * Gets the property. + * + * @param string $table_name + * @param string $target_field + * @param integer $target_id + * @param integer $type_id + * + * @return string + */ + public function getProperty($table_name, $target_field, $target_id, $type_id) { + + // Gets the value of the property table. + $args = array( + $target_field => $target_id, + 'type_id' => $type_id, + ); + $class_name = strtoupper('CHADO_' . $table_name); + $obj = $class_name::byKey($args); + if ($obj) { + return $obj->getValue(); + } + else { + return ''; + } + } + + /** + * Adds one or more properties + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $table_name + * @param string $target_field + * @param integer $target_id + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addProperty(MCL_TEMPLATE $mcl_tmpl = NULL, $table_name, $target_field, $target_id, $type_id, $value, $separator = '') { + if ($value || $value == '0') { + + // Checks duplication before adding a new property. + $args = array( + $target_field => $target_id, + 'type_id' => $type_id, + ); + $class_name = strtoupper('CHADO_' . $table_name); + $obj = $class_name::byKey($args); + if ($obj) { + $this->addMsg($mcl_tmpl, 'D', $table_name, $args); + } + else { + + // Poluplates the array with values. + $value_arr = preg_split($this->getSepRegex($separator), $value, NULL, PREG_SPLIT_NO_EMPTY); + + // Adds each property. + $rank = 0; + foreach ($value_arr as $val) { + $args['value'] = $val; + $args['rank'] = $rank++; + + $obj = new $class_name($args); + if ($obj->insert()) { + $this->addMsg($mcl_tmpl, 'N', $table_name, $args); + return TRUE; + } + else { + $this->addMsg($mcl_tmpl, 'E', $table_name, $args); + } + } + } + } + return FALSE; + } + + /** + * Adds one property with the specified rank. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $table_name + * @param string $target_field + * @param integer $target_id + * @param integer $type_id + * @param string $value + * @param integer $rank + * + * @return boolean + */ + public function addPropertyRanked(MCL_TEMPLATE $mcl_tmpl = NULL, $table_name, $target_field, $target_id, $type_id, $value, $rank) { + if ($value) { + + // Checks duplication before adding a new property. + $args = array( + $target_field => $target_id, + 'type_id' => $type_id, + 'rank' => $rank, + ); + $class_name = strtoupper('CHADO_' . $table_name); + $obj = $class_name::byKey($args); + if ($obj) { + $this->addMsg($mcl_tmpl, 'D', $table_name, $args); + } + else { + + // Adds a property. + $obj = new $class_name($args); + if ($obj->insert()) { + $this->addMsg($mcl_tmpl, 'N', $table_name, $args); + return TRUE; + } + else { + $this->addMsg($mcl_tmpl, 'E', $table_name, $args); + } + } + } + } + + /** + * Adds a relationship. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $table_name + * @param string $subject_field + * @param integer $subject_id + * @param string $object_field + * @param string $object_id + * @param integer $type_id + * + * @return boolean + */ + public function addRelationship(MCL_TEMPLATE $mcl_tmpl = NULL, $table_name, $subject_field, $subject_id, $object_field, $object_id, $type_id) { + if ($subject_id && $object_id && $type_id) { + + // Checks duplication before adding a new relationship. + $args = array( + $subject_field => $subject_id, + $object_field => $object_id, + 'type_id' => $type_id, + ); + $class_name = strtoupper('CHADO_' . $table_name); + $obj = $class_name::byKey($args); + if ($obj) { + $this->addMsg($mcl_tmpl, 'D', $table_name, $args); + } + else { + + // Adds a new relationship. + $obj = new $class_name($args); + if ($obj->insert()) { + $this->addMsg($mcl_tmpl, 'N', $table_name, $args); + return TRUE; + } + else { + $this->addMsg($mcl_tmpl, 'E', $table_name, $args); + } + } + } + return FALSE; + } + + /** + * Adds a link (Adding to a linking table). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $table_name + * @param string $field_1 + * @param integer $id_1 + * @param string $field_2 + * @param string $id_2 + * + * @return boolean + */ + public function addLink(MCL_TEMPLATE $mcl_tmpl = NULL, $table_name, $field_1, $id_1, $field_2, $id_2, $type_id = NULL) { + if ($id_1 && $id_2) { + + // Checks for a duplication before adding a new relationship. + $args = array( + $field_1 => $id_1, + $field_2 => $id_2, + ); + if ($type_id) { + $args['type_id'] = $type_id; + } + $class_name = strtoupper('CHADO_' . $table_name); + $obj = $class_name::byKey($args); + if ($obj) { + $this->addMsg($mcl_tmpl, 'D', $table_name, $args); + } + else { + + // Adds a new link. + $obj = new $class_name($args); + if ($obj->insert()) { + $this->addMsg($mcl_tmpl, 'N', $table_name, $args); + return TRUE; + } + else { + $this->addMsg($mcl_tmpl, 'E', $table_name, $args); + } + } + } + return FALSE; + } +} \ No newline at end of file diff --git a/includes/class/data_valid/mcl_data_valid_type.class.inc b/includes/class/data_valid/mcl_data_valid_type.class.inc new file mode 100644 index 0000000..ec2902b --- /dev/null +++ b/includes/class/data_valid/mcl_data_valid_type.class.inc @@ -0,0 +1,176 @@ +getMemberArr()); + } + return NULL; + } + + /** + * @see MCL_DATA_VALID_TYPE::__destruct() + */ + public function __destruct() { + parent::__destruct(); + } + + /** + * @see MCL_DATA_VALID_TYPE::insert() + */ + public function insert() { + + // Insert a new file. + return parent::insert(); + } + + /** + * @see PUBLIC_MCL_FILE::update() + */ + public function update() { + + // Updates the user properties. + return parent::update(); + } + + /** + * @see PUBLIC_MCL_FILE::delete() + */ + public function delete() { + + // Deletes all records in mcl_data_valid fist. + db_delete('mcl_data_valid') + ->condition('data_valid_type_id', $this->data_valid_type_id) + ->execute(); + parent::delete(); + } + + /** + * Returns the options for the data valid types. + * + * @param string $type + * + * @return array + */ + public static function getOptions($type) { + + // Gets MCL_DATA_VALID_TYPE. + $mcl_data_valid_type = MCL_DATA_VALID_TYPE::byKey(array('type' => $type)); + $data_valid_type_id = $mcl_data_valid_type->getDataValidTypeID(); + $cv_id = $mcl_data_valid_type->getCvID(); + + // Gets all cvterm ID or values. + $sql = " + SELECT name, cvterm_id + FROM {mcl_data_valid} + WHERE data_valid_type_id = :data_valid_type_id + ORDER BY name + "; + $result = db_query($sql, array('data_valid_type_id' => $data_valid_type_id)); + $options = array(); + while ($obj = $result->fetchObject()) { + if ($cv_id) { + $options[$obj->cvterm_id] = $obj->name; + } + else { + $options[$obj->name] = $obj->name; + } + } + return $options; + } + + /** + * Returns all data valid types. + * + * @return array of MCL_DATA_VALID_TYPE objects. + */ + public static function getDataValidTypes() { + $data_valid_types = array(); + + $sql = "SELECT DVT.data_valid_type_id FROM {mcl_data_valid_type} DVT ORDER BY DVT.type"; + $result = db_query($sql); + while ($data_valid_type_id = $result->fetchField()) { + $data_valid_types[] = MCL_DATA_VALID_TYPE::byKey(array('data_valid_type_id' => $data_valid_type_id)); + } + return $data_valid_types; + } + + /** + * Returns all data valid values of this type. + * + * @return array of objects. + */ + public function getDataValidValues() { + $objects = array(); + + // Gets all values. + $sql = " + SELECT DV.* + FROM {mcl_data_valid} DV + WHERE DV.data_valid_type_id = :data_valid_type_id + ORDER BY DV.name + "; + $args = array( + 'data_valid_type_id' => $this->data_valid_type_id, + ); + $result = db_query($sql, $args); + while ($obj = $result->fetchObject()) { + $objects []= $obj; + } + return $objects; + } + + /** + * Validates the value for the provided data valid type. + * + * @param string $data_valid_type + * @param string $value + * + * @return boolean + */ + public static function validate($data_valid_type, $value) { + if ($value) { + // Gets data_valid_type_id. + $mcl_data_valid_type = MCL_DATA_VALID_TYPE::byKey(array('type' => $data_valid_type)); + $data_valid_type_id = $mcl_data_valid_type->getDataValidTypeID(); + + // Checks the value. + $sql = " + SELECT COUNT(data_valid_id) + FROM {mcl_data_valid} + WHERE data_valid_type_id = :data_valid_type_id AND LOWER(name) = LOWER(:name) + "; + $args = array( + ':data_valid_type_id' => $data_valid_type_id, + ':name' => $value, + ); + $num = db_query($sql, $args)->fetchField(); + return ($num) ? TRUE : FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ +} \ No newline at end of file diff --git a/includes/class/job/mcl_job.class.inc b/includes/class/job/mcl_job.class.inc index 45666b2..cdc49b8 100644 --- a/includes/class/job/mcl_job.class.inc +++ b/includes/class/job/mcl_job.class.inc @@ -15,7 +15,6 @@ class MCL_JOB extends PUBLIC_MCL_JOB { protected $job_dir = NULL; protected $log_dir = NULL; protected $file_dir = NULL; - protected $progress = NULL; protected $pid = NULL; // Message types. @@ -93,10 +92,6 @@ class MCL_JOB extends PUBLIC_MCL_JOB { if ($file_dir) { $this->file_dir = $file_dir; } - $progress = $this->getPropByKey('progress'); - if ($progress) { - $this->progress = $progress; - } $pid = $this->getPropByKey('pid'); if ($pid) { $this->pid = $pid; @@ -153,7 +148,6 @@ class MCL_JOB extends PUBLIC_MCL_JOB { $this->setPropByKey('job_dir', $this->job_dir); $this->setPropByKey('log_dir', $this->log_dir); $this->setPropByKey('file_dir', $this->file_dir); - $this->setPropByKey('progress', $this->progress); $this->setPropByKey('pid', $this->pid); $this->update(); @@ -385,6 +379,57 @@ class MCL_JOB extends PUBLIC_MCL_JOB { return $this->msg_types[$type]; } + /** + * Resets the progress file. + */ + public function resetProgress() { + $progress_file = $this->getJobDir() . '/progress'; + if (file_exists($progress_file)) { + unlink($progress_file); + } + + // Creates a progress file. + file_put_contents($progress_file, 'RESET PROGRESS'); + } + + /** + * Retrieves the progress of the job. + * + * @retrun string + */ + public function getProgress() { + + // Gets the process file. + $progress_file = $this->getJobDir() . '/progress'; + if (file_exists($progress_file)) { + return file_get_contents($progress_file); + } + else { + return 'No progress report.'; + } + } + + /** + * Updates the progress of the job. + * + * @param string $progress + * @param boolean $append + */ + public function setProgress($progress, $append = FALSE) { + + // Gets the process file. + $progress_file = $this->getJobDir() . '/progress'; + + // Appends the previous message. + $old_progress = ''; + if ($append) { + if (file_exists($progress_file)) { + $old_progress = file_get_contents($progress_file) . "\n"; + } + } + file_put_contents($progress_file, $old_progress . $progress); + } + /* * Defines getters and setters below. */ @@ -511,7 +556,7 @@ class MCL_JOB extends PUBLIC_MCL_JOB { } /** - * Retrieves the progress ID. + * Retrieves the process ID. * * @retrun integer */ @@ -520,7 +565,7 @@ class MCL_JOB extends PUBLIC_MCL_JOB { } /** - * Updates the progress ID. + * Updates the process ID. * * @param integer $pid */ @@ -530,30 +575,6 @@ class MCL_JOB extends PUBLIC_MCL_JOB { $this->update(); } - /** - * Retrieves the progress of the job. - * - * @retrun string - */ - public function getProgress() { - return $this->progress; - } - - /** - * Updates the progress of the job. - * - * @param string $progress - * @param boolean $append - */ - public function setProgress($progress, $append = FALSE) { - $new_progress = $progress; - if ($append) { - $new_progress = $this->progress . '
' . $progress; - } - $this->setPropByKey('progress', $new_progress); - $this->update(); - } - /** * Returns the value of the given key in param. */ diff --git a/includes/class/job/mcl_job_manager.class.inc b/includes/class/job/mcl_job_manager.class.inc index eaddfca..db49f39 100644 --- a/includes/class/job/mcl_job_manager.class.inc +++ b/includes/class/job/mcl_job_manager.class.inc @@ -139,6 +139,7 @@ class MCL_JOB_MANAGER { $lock_file = $mcl_job->getJobDir() . '/run.lock'; $fp = fopen($lock_file, 'w+'); if (flock($fp, LOCK_EX|LOCK_NB)) { + chmod($lock_file, 0777); mcl_print("Processing job : " . $mcl_job->getName() . " [" . $mcl_job->getJobID() . "]", 1, 2); // Clears previous log files. diff --git a/includes/class/job/mcl_job_upload.class.inc b/includes/class/job/mcl_job_upload.class.inc index 2e4888e..ba59078 100644 --- a/includes/class/job/mcl_job_upload.class.inc +++ b/includes/class/job/mcl_job_upload.class.inc @@ -35,8 +35,23 @@ class MCL_JOB_UPLOAD extends MCL_JOB { if ($file_id) { $this->upload_file = MCL_FILE::byKey(array('file_id' => $file_id)); } + + // Sets job properties. $this->force = $this->getPropByKey('force'); $this->csv_dir = $this->getPropByKey('csv_dir'); + + // Creates folders for CSV files. + if ($this->csv_dir && !file_exists($this->csv_dir)) { + mcl_create_dir($this->csv_dir); + } + + // Resets 'columns' in job properties. + $this->setPropByKey('columns', array()); + + // Resets new log files. + if ($this->job_id) { + $this->resetNewLogFiles(); + } } /** @@ -55,7 +70,6 @@ class MCL_JOB_UPLOAD extends MCL_JOB { */ public function insert() { if (parent::insert()) { - // Creates folders for CSV files. $csv_dir = $this->job_dir . '/csv'; if (!file_exists($csv_dir)) { @@ -203,11 +217,9 @@ class MCL_JOB_UPLOAD extends MCL_JOB { mcl_print("-- Log file ($status-$type) for $template created", 2); fclose($fdw); - // Copies new data log to 'new_data' directory. + // Keeps the all logs for new data for later use. if ($type == 'N') { - $new_data_log = "$dir_new_data/$template-" . date("Y-m-d-G-i-s") . '.log'; - $cmd = "cp $filepath $new_data_log"; - exec($cmd); + $this->addNewLogFile($template, $filepath); } } } @@ -225,6 +237,50 @@ class MCL_JOB_UPLOAD extends MCL_JOB { return !$error_flag; } + /** + * Adds a filepath of a log file for new data. + * + * @param string $template + * @param string $filepath + * + * @return boolean + */ + public function addNewLogFile($template, $filepath) { + + // Gets the new data logs. + $new_data_logs = $this->getPropByKey('new_data_logs'); + if ($new_data_logs) { + $new_data_logs[$template]= $filepath; + } + else { + $new_data_logs = array($template => $filepath); + } + $this->setPropByKey('new_data_logs', $new_data_logs); + return $this->update(); + } + + /** + * Returns an array of the filepaths of logs file for new data. + * + * @return array + */ + public function getNewLogFiles() { + + // Gets the new data logs. + $new_data_logs = $this->getPropByKey('new_data_logs'); + if (!$new_data_logs) { + $new_data_logs = array(); + } + return $new_data_logs; + } + + /** + * Resets log files for new data. + */ + public function resetNewLogFiles() { + $this->setPropByKey('new_data_logs', ''); + } + /** * @see MCL_JOB::getJobInfoTable() */ @@ -288,8 +344,16 @@ class MCL_JOB_UPLOAD extends MCL_JOB { */ public function run() { + // Sets the transaction. + $transaction = NULL; + $trans = $this->getTransaction(); + if ($trans) { + $transaction = db_transaction(); + } + // Runs uploading job. try { + $this->resetProgress(); $job_id = $this->getJobID(); // Initializes the job. @@ -366,7 +430,7 @@ class MCL_JOB_UPLOAD extends MCL_JOB { $this->setStatus(100); $this->update(); $this->sendCompleteEmail(); - $this->setProgress(''); + $this->setProgress('COMPLETED'); } } catch (Exception $e) { @@ -374,14 +438,32 @@ class MCL_JOB_UPLOAD extends MCL_JOB { // Sends an error notifiation email. $this->sendError(); + // If error occurs, rollbacks transactions. + if ($transaction) { + $transaction->rollback(); + } + // Sets the status as 'FAILED' $this->setStatus(-200); $this->update(); + $this->setProgress('FAILED'); // Keeps the error message. watchdog('mcl', $e->getMessage(), array(), WATCHDOG_ERROR); return FALSE; } + + // No error has occured. So copy the logs file for new data. + $new_log_files = $this->getNewLogFiles(); + if ($new_log_files) { + $date_str = date("Y-m-d-G-i-s"); + $dir_new_data = $this->getNewDataLogDir(); + foreach ($new_log_files as $template => $log_file) { + $new_data_log = "$dir_new_data/$template" . '-' . $date_str . '.log'; + $cmd = "cp $log_file $new_data_log"; + exec($cmd); + } + } return TRUE; } @@ -396,22 +478,13 @@ class MCL_JOB_UPLOAD extends MCL_JOB { $err_msg = ''; // Sends a syntax error email. - if ($this->status == 30) { - - - } + if ($this->status == 30) {} // Sends a data uploading error email. - else if ($this->status == 40) { - - - } + else if ($this->status == 40) {} // Sends a data uploading error email. - else if ($this->status == 50) { - - - } + else if ($this->status == 50) {} // Sends an error message. if ($err_msg) { @@ -555,12 +628,14 @@ class MCL_JOB_UPLOAD extends MCL_JOB { */ private function _convertExcel2CSV($filepath) { - // Includes PHPExcel libararies. $lib_path = 'sites/all/libraries'; require_once("$lib_path/PHPExcel/PHPExcel.php"); require_once("$lib_path/PHPExcel/PHPExcel/IOFactory.php"); + // Sets the line ending. + $line_ending = '&&&&&'; + // Gets Excel file type [Excel5 | ]. $file_type = PHPExcel_IOFactory::identify($filepath); @@ -572,6 +647,7 @@ class MCL_JOB_UPLOAD extends MCL_JOB { $reader->setReadDataOnly(true); $excel = $reader->load($filepath); $num_sheets = $excel->getSheetCount(); + print "\tExcel has $num_sheets sheets\n\n"; // Re-set the precision. It seems that PHPExcel change the precision. ini_set('precision', $def_precision); @@ -592,6 +668,7 @@ class MCL_JOB_UPLOAD extends MCL_JOB { for ($i = 0; $i < $num_sheets; $i++) { $excel->setActiveSheetIndex($i); $template = strtolower($excel->getActiveSheet()->getTitle()); + print "\tcopying $template\n\n"; // Renames the template if necessary. if (array_key_exists($template, $template_map)) { @@ -615,11 +692,39 @@ class MCL_JOB_UPLOAD extends MCL_JOB { // Write to a CSV file. $writer->setSheetIndex($i); + $writer->setLineEnding($line_ending); $writer->save($csv_filepath); - // Adds the template name at begining of the file. + // Replace newline characters in cell value with white spaces. $file_contents = file_get_contents($csv_filepath); - file_put_contents($csv_filepath, "#$template\n" . $file_contents); + $file_contents = str_replace("\n", ' ', $file_contents); + $file_contents = str_replace($line_ending, "\n", $file_contents); + file_put_contents($csv_filepath, $file_contents); + + // Opens the cvs file. + if (!($fdr = fopen($csv_filepath, 'r'))) { + return FALSE; + } + + // Adds the template name at begining of the file. + $file_contents = "#$template\n"; + + // Cleanup the contents of the file. + while (!feof($fdr)) { + $line = trim(fgets($fdr)); + + // Exits if no data in the line. + $check = preg_replace("/[\",\s]/", '', $line); + if ($check == '') { + break; + } + // Adds the data line. + $file_contents .= "$line\n"; + } + fclose($fdr); + + // Updates the contents of the file. + file_put_contents($csv_filepath, $file_contents); // Creates MCL_FILE if not exists. if (!$this->existCSV($template)) { @@ -698,6 +803,15 @@ class MCL_JOB_UPLOAD extends MCL_JOB { if (!is_array($csv_files)) { $csv_files = array(); } + + // Removes if exists. + foreach ($csv_files as $file_id => $csv_filename) { + if ($csv_filename == $csv_file->getFilename()) { + unset($csv_files[$file_id]); + } + } + + // Updates $this->csv_files. $csv_files[$csv_file->getFileID()] = $csv_file->getFilename(); $this->setPropByKey('csv_files', $csv_files); return $this->update(); @@ -724,18 +838,21 @@ class MCL_JOB_UPLOAD extends MCL_JOB { $csv_file = MCL_FILE_CSV::byKey(array('file_id' => $mcl_file_id)); // Skips if the error checking has been completed. - /* if ($csv_file->hasPassed($this->status_int['syntax error']) && !$this->getForce()) { - mcl_print("Skipped - Syntax error has already been checked", 3, 2); + mcl_print(" > Skipped - Syntax error has already been checked", 2, 2); continue; } - */ // Resets the logs. $this->resetLogs($csv_file->getTemplate()); // Runs the syntax error checking. $tmpl_obj = MCL_TEMPLATE::getTemplateClass($this, $csv_file); + if (!$tmpl_obj) { + $no_error_flag = FALSE; + mcl_print("Cannot found template class", 2, 2); + continue; + } $this->setProgress("Running syntax error check for " . $tmpl_obj->getTemplate()); if ($tmpl_obj->runErrorCheckSyntax()) { $csv_file->setPassed($this->status_int['syntax error'], TRUE); @@ -789,16 +906,16 @@ class MCL_JOB_UPLOAD extends MCL_JOB { // completed. mcl_print("[$mcl_file_id] $filename", 1); mcl_print("- Running the data error checking", 2); -// if ($csv_file->hasPassed($this->status_int['data error']) && !$this->getForce()) { -// mcl_print("Skipped - Data error has already been checked", 3, 2); -// } -// else { + if ($csv_file->hasPassed($this->status_int['data error']) && !$this->getForce()) { + mcl_print(" > Skipped - Data error has already been checked", 2, 2); + } + else { // Runs the data error checking. $this->setProgress("Running data error check for " . $tmpl_obj->getTemplate()); if ($tmpl_obj->runErrorCheckData()) { $csv_file->setPassed($this->status_int['data error'], TRUE); - mcl_print("Data error check passed", 3, 2); + mcl_print("Data error check passed", 2, 2); } $this->setProgress("Done data error check for " . $tmpl_obj->getTemplate()); @@ -808,37 +925,27 @@ class MCL_JOB_UPLOAD extends MCL_JOB { $this->writeLog(); return FALSE; } -// } + } // Uploads CSV data file. mcl_print("- Uploading data file", 2); // Skips if the data has been uploaded. - /* - if ($csv_file->hasPassed($this->status_int['uploading'])) { - mcl_print("Skipped - Data has already been uploaded", 3, 2); + if ($csv_file->hasPassed($this->status_int['uploading']) && !$this->getForce()) { + mcl_print(" > Skipped - Data has already been uploaded", 2, 2); continue; - }*/ + } // Upload the data file. - $trans = $this->getTransaction(); - if ($trans) { - $transaction = db_transaction(); - } $this->setProgress("Uploading data for " . $tmpl_obj->getTemplate()); if ($tmpl_obj->uploadData()) { - //$csv_file->setPassed($this->status_int['uploading'], TRUE); - mcl_print("Data has been uploaded for $template", 3, 2); - $this->setProgress("Done uploading data for " . $tmpl_obj->getTemplate()); + $csv_file->setPassed($this->status_int['uploading'], TRUE); + mcl_print("Data have been uploaded to $template", 2, 2); + $this->setProgress("Done uploading data to " . $tmpl_obj->getTemplate()); } else { $this->setProgress("Failed to upload data for " . $tmpl_obj->getTemplate()); - // If error occurs, rollbacks transaction for this CSV file. - if ($trans) { - $transaction->rollback(); - } - // Detetes the log for new data. $this->deleteMsg('N'); } @@ -871,14 +978,25 @@ class MCL_JOB_UPLOAD extends MCL_JOB { // Gets the rank of csv file. $mcl_file_csv = MCL_FILE_CSV::byKey(array('file_id' => $file_id)); $rank = MCL_TEMPLATE::getRank($mcl_file_csv->getTemplate()); - $info = array('csv_filename' => $csv_filename, 'file_id' => $file_id); - $csv_files_unsorted[$rank] = $info; + $info = array( + 'file_id' => $file_id, + 'csv_filename' => $csv_filename, + 'rank' => $rank + ); + $csv_files_unsorted[] = $info; } // Sorts CSV files. - ksort($csv_files_unsorted); + usort($csv_files_unsorted, + function($a, $b) { + if ($a['rank'] == $b['rank']) { + return $a['csv_filename'] < $b['csv_filename']; + } + return $a['rank'] > $b['rank']; + } + ); $csv_files_sorted = array(); - foreach ($csv_files_unsorted as $rank => $info) { + foreach ($csv_files_unsorted as $info) { $csv_files_sorted[$info['file_id']] = $info['csv_filename']; } return $csv_files_sorted; @@ -897,10 +1015,12 @@ class MCL_JOB_UPLOAD extends MCL_JOB { $csv_files = $this->getPropByKey('csv_files'); if (is_array($csv_files)) { foreach ($csv_files as $file_id => $csv_filename) { - $csv_file = MCL_FILE_CSV::byKey(array('file_id' => $file_id)); - $csv_template = $csv_file->getTemplate(); - if ($template == $csv_file->getTemplate()) { - return TRUE; + $csv_file = MCL_FILE_CSV::byKey(array('file_id' => $file_id)); + if ($csv_file) { + $csv_template = $csv_file->getTemplate(); + if ($template == $csv_file->getTemplate()) { + return TRUE; + } } } } @@ -1014,7 +1134,7 @@ class MCL_JOB_UPLOAD extends MCL_JOB { if (!empty($log_files)) { // Sort by date-time. - // usort($log_files, $this->_cmpDate); + // usort($log_files, $this->_cmpDate); $all_logs['N']['40'] = $log_files; } return $all_logs; diff --git a/includes/class/mcl_chado_class/mcl_chado_contact.class.inc b/includes/class/mcl_chado_class/mcl_chado_contact.class.inc index 5f77e96..4ca37b4 100644 --- a/includes/class/mcl_chado_class/mcl_chado_contact.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_contact.class.inc @@ -41,20 +41,24 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { * @param MCL_TEMPLATE $mcl_tmpl * @param string $contact * @param string $separator + * + * @return boolean */ - public static function checkContact(MCL_TEMPLATE $mcl_tmpl, $contact, $separator = '') { + public static function checkContact(MCL_TEMPLATE $mcl_tmpl = NULL, $contact, $separator = '') { + $flag = TRUE; if ($contact) { - // Gets contacts. - $names = preg_split($mcl_tmpl->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); + // Gets the contacts. + $names = preg_split(self::getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { - $name = trim($name); - $mcl_contact = MCL_CHADO_CONTACT::getContact($name); + $mcl_contact = MCL_CHADO_CONTACT::getContact(trim($name)); if (!$mcl_contact) { - $mcl_tmpl->updateMsg('E', "(name) = ($name) not found in contact"); + self::updateMsg($mcl_tmpl, 'E', "(name) = ($name) not found in contact"); + $flag = FALSE; } } } + return $flag; } /** @@ -76,7 +80,7 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { * * @return MCL_CHADO_CONTACT */ - public static function addContact(MCL_TEMPLATE $mcl_tmpl, $name, $type_id, $description) { + public static function addContact(MCL_TEMPLATE $mcl_tmpl = NULL, $name, $type_id, $description) { // Sets the arguments. $args = array( @@ -84,26 +88,27 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_contact = MCL_CHADO_CONTACT::byKey($args); if ($mcl_contact) { - $mcl_tmpl->addMsg('D', 'contact', $args); + self::addMsg($mcl_tmpl, 'D', 'contact', $args); } else { // Adds a new contact. - $args['type_id'] = $type_id; - $args['description'] = $description; + $args['type_id'] = $type_id; + $args['description'] = $description; $mcl_contact = new MCL_CHADO_CONTACT($args); if ($mcl_contact->insert()) { - $mcl_tmpl->addMsg('N', 'contact', $args); + self::addMsg($mcl_tmpl, 'N', 'contact', $args); } else { - $mcl_tmpl->addMsg('E', 'contact', $args); + self::addMsg($mcl_tmpl, 'E', 'contact', $args); + return NULL; } } return $mcl_contact; @@ -117,9 +122,14 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('contactprop', 'contact_id', $this->contact_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'contactprop', 'contact_id', $this->contact_id, $type_id, $value, $separator); + } + return TRUE; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_cv.class.inc b/includes/class/mcl_chado_class/mcl_chado_cv.class.inc index e7697b8..99e52b0 100644 --- a/includes/class/mcl_chado_class/mcl_chado_cv.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_cv.class.inc @@ -35,21 +35,61 @@ class MCL_CHADO_CV extends CHADO_CV { } /** - * Checks the existance of cv. If not, write the error messasge + * Checks the existance of cv by name. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl * @param string $name + * @param boolean $req + * + * @return boolean */ - public static function checkCV(MCL_TEMPLATE $mcl_tmpl, $name) { + public static function checkCV(MCL_TEMPLATE $mcl_tmpl = NULL, $name, $req = FALSE) { if ($name) { // Gets the cv. $mcl_cv = MCL_CHADO_CV::getCV($name); if (!$mcl_cv) { - $mcl_tmpl->updateMsg('E', "(name) = ($name) not found in cv"); + self::updateMsg($mcl_tmpl, 'E', "(name) = ($name) not found in cv"); + return FALSE; + } + } + else { + if ($req) { + self::updateMsg($mcl_tmpl, 'E', "name is empty"); + return FALSE; } } + return TRUE; + } + + /** + * Checks the existance of cv by cv_id. If not, write the error messasge + * to the log. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $cv_id + * @param boolean $req + * + * @return boolean + */ + public static function checkCVByID(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_id, $req = FALSE) { + if ($cv_id) { + + // Gets the cv. + $mcl_cv = MCL_CHADO_CV::byKey(array('cv_id' => $cv_id)); + if (!$mcl_cv) { + self::updateMsg($mcl_tmpl, 'E', "(cv_id) = ($cv_id) not found in cv"); + return FALSE; + } + } + else { + if ($req) { + self::updateMsg($mcl_tmpl, 'E', "cv_id is empty"); + return FALSE; + } + } + return TRUE; } /** @@ -99,20 +139,20 @@ class MCL_CHADO_CV extends CHADO_CV { * * return MCL_CHADO_CV */ - public static function addCV(MCL_TEMPLATE $mcl_tmpl, $name, $definition) { + public static function addCV(MCL_TEMPLATE $mcl_tmpl = NULL, $name, $definition) { // Sets the arguments. $args = array('name' => $name); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_cv = MCL_CHADO_CV::byKey($args); if ($mcl_cv) { - $mcl_tmpl->addMsg('D', 'cv', $args); + self::addMsg($mcl_tmpl, 'D', 'cv', $args); } else { @@ -120,10 +160,11 @@ class MCL_CHADO_CV extends CHADO_CV { $args['definition'] = $definition; $mcl_cv = new MCL_CHADO_CV($args); if ($mcl_cv->insert()) { - $mcl_tmpl->addMsg('N', 'cv', $args); + self::addMsg($mcl_tmpl, 'N', 'cv', $args); } else { - $mcl_tmpl->addMsg('E', 'cv', $args); + self::addMsg($mcl_tmpl, 'E', 'cv', $args); + return NULL; } } return $mcl_cv; diff --git a/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc b/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc index 5d04759..f70b493 100644 --- a/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc @@ -40,15 +40,20 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * @param MCL_TEMPLATE $mcl_tmpl * @param string $cv_name * @param string $cvterm_name + * + * @return boolean */ - public static function checkCvterm(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name) { + public static function checkCvterm(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name) { if ($cv_name && $cvterm_name) { + // Gets the cvterm. $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); if (!$mcl_cvterm) { - $mcl_tmpl->updateMsg('E', "(cv_name, cvterm_name) = ($cv_name, $cvterm_name) not found in cvterm"); + self::updateMsg($mcl_tmpl, 'E', "(cv_name, cvterm_name) = ($cv_name, $cvterm_name) not found in cvterm"); + return FALSE; } } + return TRUE; } /** @@ -57,8 +62,11 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * @param MCL_TEMPLATE $mcl_tmpl * @param string $data_type * @param string $values + * + * @return boolean */ - public static function checkValues(MCL_TEMPLATE $mcl_tmpl, $data_type, $values) { + public static function checkValues(MCL_TEMPLATE $mcl_tmpl = NULL, $data_type, $values) { + $flag = TRUE; // Checks only for quantitative_code and code. if (preg_match("/^(code|quantitative_code)$/i", $data_type)) { @@ -73,19 +81,41 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { // Checks a rank. if (is_infinite($rank)) { - $mcl_tmpl->updateMsg('E', "Rank should be an integer ($rank was given)"); + self::updateMsg($mcl_tmpl, 'E', "Rank should be an integer ($rank was given)"); + $flag = FALSE; } // Checks a value. if (!$value) { - $mcl_tmpl->updateMsg('E', "Value must be non-empty"); + self::updateMsg($mcl_tmpl, 'E', "Value must be non-empty"); + $flag = FALSE; } } } else { - $mcl_tmpl->updateMsg('E', "values cannot be empty for $data_type."); + self::updateMsg($mcl_tmpl, 'E', "values cannot be empty for $data_type."); + $flag = FALSE; } } + return $flag; + } + + + /** + * Check categorical values. + * + * Examples of categorical values. + * White/Yellow/Red + * melting/non-melting/slow softening + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $categories + * + * @return boolean + */ + public static function checkCategories(MCL_TEMPLATE $mcl_tmpl = NULL, $categories) { + if ($categories) {} + return TRUE; } /** @@ -168,7 +198,15 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * * @return MCL_CHADO_CVTERM */ - public static function addCvterm(MCL_TEMPLATE $mcl_tmpl, $db_name, $cv_name, $cvterm_name, $definition, $accession = '') { + public static function addCvterm(MCL_TEMPLATE $mcl_tmpl = NULL, $db_name, $cv_name, $cvterm_name, $definition, $accession = '') { + + // Updates DB and CV names. + if ($db_name == '') { + $db_name = 'SITE_DB'; + } + if ($cv_name == '') { + $cv_name = 'SITE_CV'; + } // Checks parameters. $args = array( @@ -178,28 +216,28 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); if ($mcl_cvterm) { - $mcl_tmpl->updateMsg('D', "(cv.name, cvterm.name) = ($cv_name, $cvterm_name) found in cvterm"); + self::updateMsg($mcl_tmpl, 'D', "(cv.name, cvterm.name) = ($cv_name, $cvterm_name) found in cvterm"); } else { // Gets db. $mcl_db = MCL_CHADO_DB::getDB($db_name); if (!$mcl_db) { - $mcl_tmpl->updateMsg('E', "(db.name) = ($db_name) not found in db"); + self::updateMsg($mcl_tmpl, 'E', "(db.name) = ($db_name) not found in db"); return NULL; } // Gets cv. $mcl_cv = MCL_CHADO_CV::getCV($cv_name); if (!$mcl_cv) { - $mcl_tmpl->updateMsg('E', "(cv.name) = ($cv_name) not found in cv"); + self::updateMsg($mcl_tmpl, 'E', "(cv.name) = ($cv_name) not found in cv"); return NULL; } @@ -219,10 +257,11 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { // Adds a new dbxref. $mcl_dbxref = new MCL_CHADO_DBXREF($args); if ($mcl_dbxref->insert()) { - $mcl_tmpl->addMsg('N', 'dbxref', $args); + self::addMsg($mcl_tmpl, 'N', 'dbxref', $args); } else { - $mcl_tmpl->addMsg('E', 'dbxref', $args); + self::addMsg($mcl_tmpl, 'E', 'dbxref', $args); + return NULL; } } @@ -236,10 +275,11 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { ); $mcl_cvterm = new MCL_CHADO_CVTERM($args); if ($mcl_cvterm->insert()) { - $mcl_tmpl->addMsg('N', 'cvterm', $args); + self::addMsg($mcl_tmpl, 'N', 'cvterm', $args); } else { - $mcl_tmpl->addMsg('E', 'cvterm', $args); + self::addMsg($mcl_tmpl, 'E', 'cvterm', $args); + return NULL; } } } @@ -253,11 +293,16 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * @param string $cv_name * @param string $cvterm_name * @param string $value - * @param boolean $multiple + * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $multiple = FALSE) { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('cvtermprop', 'cvterm_id', $this->cvterm_id, $type_id, $value, $multiple); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'cvtermprop', 'cvterm_id', $this->cvterm_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -268,16 +313,24 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * @param string $cvterm_name * @param string $alias * @param string $separator + * + * @return boolean */ - public function addAlias(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $alias, $separator = '') { - + public function addAlias(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $alias, $separator = '') { + $flag = TRUE; if ($alias) { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); + + // Gets cvterm. + if (!MCL_CHADO_CVTERM::checkCvterm($mcl_tmpl, $cv_name, $cvterm_name)) { + $this->updateMsg($mcl_tmpl, 'E', "(cv_name, cvterm_name) = ($cv_name, $cvterm_name) not found in cvterm"); + return FALSE; + } + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); // Poluplates the array with aliases. $alias_arr = array(); if ($separator) { - $alias_arr = preg_split($mcl_tmpl->getSepRegex($separator), $value, NULL, PREG_SPLIT_NO_EMPTY); + $alias_arr = preg_split($this->getSepRegex($separator), $value, NULL, PREG_SPLIT_NO_EMPTY); } else { $alias_arr []= $value; @@ -290,22 +343,24 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { ); $rank = 0; foreach ($alias_arr as $val) { - $args['synonym'] = $val; - $cvtermsynonym = CHADO_CVTERMSYNONYM::byKey($args); + $args['synonym'] = $val; + $cvtermsynonym = CHADO_CVTERMSYNONYM::byKey($args); if ($cvtermsynonym) { - $mcl_tmpl->addMsg('D', 'cvtermsynonym', $args); + $this->addMsg($mcl_tmpl, 'D', 'cvtermsynonym', $args); } else { $cvtermsynonym = new CHADO_CVTERMSYNONYM($args); if ($cvtermsynonym->insert()) { - $mcl_tmpl->addMsg('N', 'cvtermsynonym', $args); + $this->addMsg($mcl_tmpl, 'N', 'cvtermsynonym', $args); } else { - $mcl_tmpl->addMsg('E', 'cvtermsynonym', $args); + $this->addMsg($mcl_tmpl, 'E', 'cvtermsynonym', $args); + $flag = FALSE; } } } } + return $flag; } /** @@ -327,34 +382,51 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * @param MCL_TEMPLATE $mcl_tmpl * @param string $data_type * @param string $values + * + * @return boolean */ - public function addValues(MCL_TEMPLATE $mcl_tmpl, $data_type, $values) { - - // Adds the values for quantitative_code and code. - if (preg_match("/^(code|quantitative_code)$/i", $data_type)) { - - // Gets type_id. - $cvterm_id_code = $mcl_tmpl->getCvtermID('SITE_CV', 'code'); + public function addValues(MCL_TEMPLATE $mcl_tmpl = NULL, $data_type, $values) { + $flag = TRUE; + if ($values) { + + // Adds the values for quantitative_code and code. + if (preg_match("/^(code|quantitative_code)$/i", $data_type)) { + + // Gets type_id. + $cvterm = MCL_CHADO_CVTERM::getCvterm('SITE_CV', 'code'); + if (!$cvterm) { + $this->updateMsg($mcl_tmpl, 'E', "(cv_name, cvterm_name) = ('SITE_CV', 'code') does not exist in cvterm"); + return FALSE; + } + $cvterm_id_code = $cvterm->getCvtermID(); - // Saves the all codes in cvtermprop table. - $this->addProp($mcl_tmpl, 'SITE_CV', 'code_ref', $values); + // Saves the all codes in cvtermprop table. + if (!$this->addProp($mcl_tmpl, 'SITE_CV', 'code_ref', $values)) { + $flag = FALSE; + } - // Parses out the values to the codes. - $codes = preg_split("/[;]/", $values, NULL, PREG_SPLIT_NO_EMPTY); - foreach ($codes as $code) { - $tmp = preg_split("/[:=]/", $code, NULL, PREG_SPLIT_NO_EMPTY); - $rank = trim($tmp[0]); - $value = trim($tmp[1]); + // Parses out the values to the codes. + $codes = preg_split("/[;]/", $values, NULL, PREG_SPLIT_NO_EMPTY); + foreach ($codes as $code) { + $tmp = preg_split("/[:=]/", $code, NULL, PREG_SPLIT_NO_EMPTY); + $rank = trim($tmp[0]); + $value = trim($tmp[1]); - // Adds a property. - $mcl_tmpl->addPropertyRanked('cvtermprop', 'cvterm_id', $cvterm_id_code, $type_id, $value, $rank); + // Adds a property. + if(!$this->addPropertyRanked($mcl_tmpl, 'cvtermprop', 'cvterm_id', $this->cvterm_id, $cvterm_id_code, $value, $rank)) { + $flag = FALSE; + } + } } - } - // Adds the values for qualitative. - else if ($data_type == 'qualitative') { - $this->addProp($this, 'SITE_CV', 'qualitative', $values, '[;,]'); + // Adds the values for qualitative. + else if ($data_type == 'qualitative') { + if (!$this->addProp($mcl_tmpl, 'SITE_CV', 'qualitative', $values, '[;,]')) { + $flag = FALSE; + } + } } + return $flag; } /** @@ -362,14 +434,16 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_CVTERM $cv_name + * + * @return boolean */ - public function linkTrait(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_CVTERM $trait) { - + public function linkTrait(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_CVTERM $trait) { if ($trait) { // Links a descriptor and a trait. - $type_id = $mcl_tmpl->getCvtermID('SITE_CV', 'belongs_to'); - $mcl_tmpl->addLink('cvterm_relationship', 'subject_id', $this->cvterm_id, 'object_id', $trait->getCvtermID(), $type_id); + $type_id = MCL_CHADO_CVTERM::getCvterm('SITE_CV', 'belongs_to')->getCvtermID(); + return $this->addLink($mcl_tmpl, 'cvterm_relationship', 'subject_id', $this->cvterm_id, 'object_id', $trait->getCvtermID(), $type_id); } + return TRUE; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc b/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc index 91ea6dc..7e45f09 100644 --- a/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc @@ -40,16 +40,42 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { * * @param MCL_TEMPLATE $mcl_tmpl * @param string $name + * + * @return boolean */ - public static function checkDataset(MCL_TEMPLATE $mcl_tmpl, $name) { + public static function checkDataset(MCL_TEMPLATE $mcl_tmpl = NULL, $name) { if ($name) { // Gets the dataset. $mcl_dataset = MCL_CHADO_DATASET::getDataset($name); if (!$mcl_dataset) { - $mcl_tmpl->updateMsg('E', "(name) = ($name) not found in project"); + self::updateMsg($mcl_tmpl, 'E', "(name) = ($name) not found in project"); + return FALSE; } } + return TRUE; + } + + /** + * Checks the existance of dataset by ID. If not, write the error messasge + * to the log. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $project_id + * + * @return boolean + */ + public static function checkDatasetByID(MCL_TEMPLATE $mcl_tmpl = NULL, $project_id) { + if ($project_id) { + + // Gets the dataset. + $mcl_dataset = MCL_CHADO_DATASET::byKey(array('project_id' => $project_id)); + if (!$mcl_dataset) { + self::updateMsg($mcl_tmpl, 'E', "(project_id) = ($project_id) not found in project"); + return FALSE; + } + } + return TRUE; } /** @@ -63,6 +89,19 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { return MCL_CHADO_DATASET::bykey(array('name' => $name)); } + /** + * Gets property. + * + * @param string $cv_name + * @param string $cvterm_name + * + * @return string + */ + public function getProp($cv_name, $cvterm_name) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->getProperty('projectprop', 'project_id', $this->project_id, $type_id); + } + /** * Adds a dataset. * @@ -74,30 +113,31 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { * * @return MCL_CHADO_DATASET */ - public static function addDataset(MCL_TEMPLATE $mcl_tmpl, $name) { + public static function addDataset(MCL_TEMPLATE $mcl_tmpl = NULL, $name) { // Sets the arguments. $args = array('name' => $name); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_dataset = MCL_CHADO_DATASET::byKey($args); if ($mcl_dataset) { - $mcl_tmpl->addMsg('D', 'project', $args); + self::addMsg($mcl_tmpl, 'D', 'project', $args); } else { // Adds a new dataset. $mcl_dataset = new MCL_CHADO_DATASET($args); if ($mcl_dataset->insert()) { - $mcl_tmpl->addMsg('N', 'project', $args); + self::addMsg($mcl_tmpl, 'N', 'project', $args); } else { - $mcl_tmpl->addMsg('E', 'project', $args); + self::addMsg($mcl_tmpl, 'E', 'project', $args); + return NULL; } } return $mcl_dataset; @@ -111,25 +151,16 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { * @param string $cvterm_name * @param string $value * @param string $separator - */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('projectprop', 'project_id', $this->project_id, $type_id, $value, $separator); - } - - /** - * Gets property. * - * @param MCL_TEMPLATE $mcl_tmpl - * @param string $cv_name - * @param string $cvterm_name - * - * @return string + * @return boolean */ - public function getProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name) { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - return $mcl_tmpl->getProperty('projectprop', 'project_id', $this->project_id, $type_id); - } + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'projectprop', 'project_id', $this->project_id, $type_id, $value, $separator); + } + return TRUE; + } /** * Adds contact to project_contact. @@ -137,18 +168,26 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { * @param MCL_TEMPLATE $mcl_tmpl * @param string $contact * @param string $separator + * + * @return boolean */ - public function addContact(MCL_TEMPLATE $mcl_tmpl, $contact, $separator = '') { + public function addContact(MCL_TEMPLATE $mcl_tmpl = NULL, $contact, $separator = '') { + $flag = TRUE; if ($contact) { - $names = preg_split($mcl_tmpl->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); + $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { - $name = trim($name); - $mcl_contact = MCL_CHADO_CONTACT::byKey(array('name' => $name)); + $mcl_contact = MCL_CHADO_CONTACT::byKey(array('name' => trim($name))); if ($mcl_contact) { - $mcl_tmpl->addLink('project_contact', 'project_id', $this->project_id, 'contact_id', $mcl_contact->getContactID()); + if (!$this->addLink($mcl_tmpl, 'project_contact', 'project_id', $this->project_id, 'contact_id', $mcl_contact->getContactID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -156,15 +195,18 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { * * @param MCL_TEMPLATE $mcl_tmpl * @param string $dataset_name + * + * @return boolean */ - public function addParentDataset(MCL_TEMPLATE $mcl_tmpl, $dataset_name) { + public function addParentDataset(MCL_TEMPLATE $mcl_tmpl = NULL, $dataset_name) { if ($dataset_name) { $parent = MCL_CHADO_DATASET::getDataset($dataset_name); if ($parent) { - $type_id = $mcl_tmpl->getCvtermID('SITE_CV', 'is_a_subproject_of'); - $mcl_tmpl->addLink('project_relationship', 'subject_project_id', $this->project_id, 'object_project_id', $parent->getProjectID(), $type_id); + $type_id = MCL_CHADO_CVTERM::getCvterm('SITE_CV', 'is_a_subproject_of')->getCvtermID(); + return $this->addLink($mcl_tmpl, 'project_relationship', 'subject_project_id', $this->project_id, 'object_project_id', $parent->getProjectID(), $type_id); } } + return TRUE; } /** @@ -173,17 +215,27 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addReference(MCL_TEMPLATE $mcl_tmpl, $reference, $separator = '') { + public function addReference(MCL_TEMPLATE $mcl_tmpl = NULL, $reference, $separator = '') { + + $flag = TRUE; if ($reference) { - $pub_ids = preg_split($mcl_tmpl->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); + $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); if ($mcl_pub) { - $mcl_tmpl->addLink('project_pub', 'project_id', $this->project_id, 'pub_id', $pub_id); + if ($this->addLink($mcl_tmpl, 'project_pub', 'project_id', $this->project_id, 'pub_id', $pub_id)) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_db.class.inc b/includes/class/mcl_chado_class/mcl_chado_db.class.inc index 1b53cd2..1ba0703 100644 --- a/includes/class/mcl_chado_class/mcl_chado_db.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_db.class.inc @@ -40,16 +40,20 @@ class MCL_CHADO_DB extends CHADO_DB { * * @param MCL_TEMPLATE $mcl_tmpl * @param string $db + * + * @return boolean */ - public static function checkDB(MCL_TEMPLATE $mcl_tmpl, $db) { + public static function checkDB(MCL_TEMPLATE $mcl_tmpl = NULL, $db) { if ($db) { // Gets the db. $mcl_db = MCL_CHADO_DB::getDB($db); if (!$mcl_db) { - $mcl_tmpl->updateMsg('E', "(name) = ($db) not found in db"); + self::updateMsg($mcl_tmpl, 'E', "(name) = ($db) not found in db"); + return FALSE; } } + return TRUE; } /** @@ -98,20 +102,20 @@ class MCL_CHADO_DB extends CHADO_DB { * * @return MCL_CHADO_DB */ - public static function addDB(MCL_TEMPLATE $mcl_tmpl, $name, $prefix_url, $url, $definition) { + public static function addDB(MCL_TEMPLATE $mcl_tmpl = NULL, $name, $prefix_url, $url, $definition) { // Sets the arguments. $args = array('name' => $name); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_db = MCL_CHADO_DB::byKey($args); if ($mcl_db) { - $mcl_tmpl->addMsg('D', 'db', $args); + self::addMsg($mcl_tmpl, 'D', 'db', $args); } else { @@ -121,10 +125,11 @@ class MCL_CHADO_DB extends CHADO_DB { $args['definition'] = $definition; $mcl_db = new MCL_CHADO_DB($args); if ($mcl_db->insert()) { - $mcl_tmpl->addMsg('N', 'db', $args); + self::addMsg($mcl_tmpl, 'N', 'db', $args); } else { - $mcl_tmpl->addMsg('E', 'db', $args); + self::addMsg($mcl_tmpl, 'E', 'db', $args); + return NULL; } } return $mcl_db; diff --git a/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc b/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc index af921a6..e02e3ec 100644 --- a/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc @@ -68,7 +68,7 @@ class MCL_CHADO_DBXREF extends CHADO_DBXREF { * * @return MCL_CHADO_DBXREF */ - public static function addDBXref(MCL_TEMPLATE $mcl_tmpl, $db_id, $accession) { + public static function addDBXref(MCL_TEMPLATE $mcl_tmpl = NULL, $db_id, $accession) { // Sets the arguments. $args = array( @@ -77,24 +77,25 @@ class MCL_CHADO_DBXREF extends CHADO_DBXREF { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_dbxref = MCL_CHADO_DBXREF::byKey($args); if ($mcl_dbxref) { - $mcl_tmpl->addMsg('D', 'dbxref', $args); + self::addMsg($mcl_tmpl, 'D', 'dbxref', $args); } else { // Adds a new dbxref. $mcl_dbxref = new MCL_CHADO_DBXREF($args); if ($mcl_dbxref->insert()) { - $mcl_tmpl->addMsg('N', 'dbxref', $args); + self::addMsg($mcl_tmpl, 'N', 'dbxref', $args); } else { - $mcl_tmpl->addMsg('E', 'dbxref', $args); + self::addMsg($mcl_tmpl, 'E', 'dbxref', $args); + return NULL; } } return $mcl_dbxref; @@ -108,9 +109,14 @@ class MCL_CHADO_DBXREF extends CHADO_DBXREF { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('dbxrefrop', 'dbxref_id', $this->dbxref_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'dbxrefrop', 'dbxref_id', $this->dbxref_id, $type_id, $value, $separator); + } + return TRUE; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_feature.class.inc b/includes/class/mcl_chado_class/mcl_chado_feature.class.inc index 42bc70e..81f7657 100644 --- a/includes/class/mcl_chado_class/mcl_chado_feature.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_feature.class.inc @@ -44,8 +44,11 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param string $species * @param integer $type_id * @param string $separator + * + * @return boolean */ - public static function checkFeature(MCL_TEMPLATE $mcl_tmpl, $feature, $genus, $species, $type_id, $separator = '') { + public static function checkFeature(MCL_TEMPLATE $mcl_tmpl = NULL, $feature, $genus, $species, $type_id, $separator = '') { + $flag = TRUE; // Checks the organism_id. $organism_id = ''; @@ -55,13 +58,13 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $organism_id = $mcl_organism->getOrganismID(); } else { - $mcl_tmpl->updateMsg('E', "$genus $species not found in organism"); - return; + self::updateMsg($mcl_tmpl, 'E', "$genus $species not found in organism"); + return FALSE; } } // Gets the uniquenames. - $uniquenames = preg_split($mcl_tmpl->getSepRegex($separator), $feature, NULL, PREG_SPLIT_NO_EMPTY); + $uniquenames = preg_split(self::getSepRegex($separator), $feature, NULL, PREG_SPLIT_NO_EMPTY); foreach ($uniquenames as $uniquename) { $uniquename = trim($uniquename); @@ -84,17 +87,19 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $args['organism_id'] = $diff_organism->getOrganismID(); } else { - $mcl_tmpl->updateMsg('E', "$genus $species not found in organism"); - return; + self::updateMsg($mcl_tmpl, 'E', "$genus $species not found in organism"); + $flag = FALSE; } } // Checks the feature. $mcl_feature = MCL_CHADO_FEATURE::byKey($args); if (!$mcl_feature) { - $mcl_tmpl->updateMsg('E', $mcl_tmpl->arrStr($args) . " not found in feature"); + self::updateMsg($mcl_tmpl, 'E', self::arrStr($args) . " not found in feature"); + $flag = FALSE; } } + return $flag; } /** @@ -103,6 +108,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param string $uniquename * @param string $genus * @param string $species + * @param integer $type_id * * @return MCL_CHADO_FEATURE */ @@ -131,6 +137,116 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { return MCL_CHADO_FEATURE::bykey($args); } + /** + * Returns the feature by uniquename, genus, species and type_id. + * Search uniquename for alias if it does not exist in feature table. + * + * @param string $uniquename + * @param string $genus + * @param string $species + * @param integer $type_id + * + * @return MCL_CHADO_FEATURE + */ + public static function getFeatureAlias($uniquename, $genus, $species, $type_id) { + + // Gets the organism_id. + $organism_id = ''; + if ($genus && $species) { + $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if ($mcl_organism) { + $organism_id = $mcl_organism->getOrganismID(); + } + else { + return NULL; + } + } + + // Gets the feature. + $args = array( + 'uniquename' => $uniquename, + 'type_id' => $type_id, + ); + if ($organism_id) { + $args['organism_id'] = $organism_id; + } + $feature = MCL_CHADO_FEATURE::bykey($args); + if ($feature) { + return $feature; + } + + // Search for alias. + $sql = " + SELECT COUNT(S.synonym_id) + FROM {chado.synonym} S + INNER JOIN {chado.feature_synonym} FS on FS.synonym_id = S.synonym_id + WHERE LOWER(S.name) = LOWER(:name) + "; + $num = db_query($sql, array(':name' => $uniquename))->fetchField(); + if ($num == 1) { + $sql = " + SELECT FS.feature_id + FROM {chado.synonym} S + INNER JOIN {chado.feature_synonym} FS on FS.synonym_id = S.synonym_id + WHERE LOWER(S.name) = LOWER(:name) + "; + $feature_id = db_query($sql, array(':name' => $uniquename))->fetchField(); + return MCL_CHADO_FEATURE::bykey(array('feature_id' => $feature_id)); + } + return NULL; + } + + /** + * Returns the number of features with the same uniquename and type_id but + * different organism_id. + * + * @param string $uniquename + * @param integer $type_id + * + * @return integer + */ + public static function countFeatures($uniquename, $type_id) { + + // Gets the features. + $sql = " + SELECT COUNT(F.feature_id) + FROM chado.feature F + WHERE LOWER(F.uniquename) = LOWER(:uniquename) + AND F.type_id = :type_id + "; + $args = array( + 'uniquename' => $uniquename, + 'type_id' => $type_id, + ); + $result = db_query($sql, $args); + return $result->fetchField(); + } + + /** + * Returns the feature by uniquename, genus, species and type_id. + * + * @param string $cv_name + * @param string $cvterm_name + * + * @return string + */ + public function getFeatureprop($cv_name, $cvterm_name) { + + // Gets cvterm. + $cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); + if ($cvterm) { + $details = array( + 'feature_id' => $this->feature_id, + 'type_id' => $cvterm->getCvtermID(), + ); + $featureprop = CHADO_FEATUREPROP::byKey($details); + if ($featureprop) { + return $featureprop->getValue(); + } + } + return ''; + } + /** * Adds a feature. * @@ -142,7 +258,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * * @return MCL_CHADO_FEATURE */ - public static function addFeature(MCL_TEMPLATE $mcl_tmpl, $uniquename, $name, $type_id, $organism_id) { + public static function addFeature(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $name, $type_id, $organism_id) { // Sets the arguments. $args = array( @@ -152,14 +268,14 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $feature = MCL_CHADO_FEATURE::byKey($args); if ($feature) { - $mcl_tmpl->addMsg('D', 'feature', $args); + self::addMsg($mcl_tmpl, 'D', 'feature', $args); } else { @@ -167,10 +283,11 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $args['name'] = $name; $feature = new MCL_CHADO_FEATURE($args); if ($feature->insert()) { - $mcl_tmpl->addMsg('N', 'feature', $args); + self::addMsg($mcl_tmpl, 'N', 'feature', $args); } else { - $mcl_tmpl->addMsg('E', 'feature', $args); + self::addMsg($mcl_tmpl, 'E', 'feature', $args); + return NULL; } } return $feature; @@ -184,10 +301,15 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('featureprop', 'feature_id', $this->feature_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'featureprop', 'feature_id', $this->feature_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -196,26 +318,37 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_FEATURE $mcl_feature * @param integer $type_id + * + * @return boolean */ - public function addRelatedFeature(MCL_TEMPLATE $mcl_tmpl, $mcl_feature, $type_id) { + public function addRelatedFeature(MCL_TEMPLATE $mcl_tmpl = NULL, $mcl_feature, $type_id, $swap = FALSE) { if ($mcl_feature) { - $mcl_tmpl->addRelationship('feature_relationship', 'subject_id', $this->feature_id, 'object_id', $mcl_feature->getFeatureID(), $type_id); + if ($swap) { + return $this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $mcl_feature->getFeatureID(), 'object_id', $this->feature_id, $type_id); + } + else { + return $this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $this->feature_id, 'object_id', $mcl_feature->getFeatureID(), $type_id); + } } + return TRUE; } /** * Adds related features to feature_relationship. * * @param MCL_TEMPLATE $mcl_tmpl - * @param string $marker + * @param string $features * @param integer $feature_type_id * @param integer $relationship_type_id * @param boollean $use_organism_id * @param string $separator + * + * @return boolean */ - public function addRelatedFeatures(MCL_TEMPLATE $mcl_tmpl, $features, $feature_type_id, $use_organism_id, $relationship_type_id, $separator = '') { + public function addRelatedFeatures(MCL_TEMPLATE $mcl_tmpl = NULL, $features, $feature_type_id, $use_organism_id, $relationship_type_id, $separator = '') { + $flag = TRUE; if ($features) { - $uniquenames = preg_split($mcl_tmpl->getSepRegex($separator), $features, NULL, PREG_SPLIT_NO_EMPTY); + $uniquenames = preg_split($this->getSepRegex($separator), $features, NULL, PREG_SPLIT_NO_EMPTY); foreach ($uniquenames as $uniquename) { $uniquename = trim($uniquename); @@ -241,10 +374,13 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { // Adds a feature. $mcl_feature = MCL_CHADO_FEATURE::byKey($args); if ($mcl_feature) { - $mcl_tmpl->addRelationship('feature_relationship', 'subject_id', $this->feature_id, 'object_id', $mcl_feature->getFeatureID(), $relationship_type_id); + if (!$this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $this->feature_id, 'object_id', $mcl_feature->getFeatureID(), $relationship_type_id)) { + $flag = FALSE; + } } } } + return $flag; } /** @@ -255,9 +391,13 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param string $prefix * @param integer $type_id_feature * @param integer $type_id_relationship + * @param boolean $swap + * Swaps subject_id and object_id. * + * @return boolean */ - public function addSequence(MCL_TEMPLATE $mcl_tmpl, $line, $prefix, $type_id_feature, $type_id_relationship) { + public function addSequence(MCL_TEMPLATE $mcl_tmpl = NULL, $line, $prefix, $type_id_feature, $type_id_relationship, $swap = FALSE) { + $flag = TRUE; // Builds the pattern. $pattern = "^$prefix(\d+)_(seq|name)"; @@ -283,10 +423,10 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { // Checks the matching columns. if (!array_key_exists('seq', $info) || !array_key_exists('name', $info)) { if (array_key_exists('seq', $info) && $info['seq']) { - $mcl_tmpl->updateMsg('W', "$col_name columns is missing. So it will be skipped"); + $this->updateMsg($mcl_tmpl, 'W', "$col_name columns is missing. So it will be skipped"); } else if (array_key_exists('name', $info) && $info['name']) { - $mcl_tmpl->updateMsg('W', "$col_seq columns is missing. So it will be skipped"); + $this->updateMsg($mcl_tmpl, 'W', "$col_seq columns is missing. So it will be skipped"); } } else { @@ -298,7 +438,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { // If one of matching columns is empty, adds warning. else if (empty($info['seq']) || empty($info['name'])) { - $mcl_tmpl->updateMsg('W', "Either $col_name or $col_seq are missing. So it will be skipped"); + $this->updateMsg($mcl_tmpl, 'W', "Either $col_name or $col_seq are missing. So it will be skipped"); } // Adds the matching columns. @@ -318,7 +458,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { ); $mcl_feature = MCL_CHADO_FEATURE::byKey($args); if ($mcl_feature) { - $mcl_tmpl->addMsg('D', 'feature', $args); + $this->addMsg($mcl_tmpl, 'D', 'feature', $args); } else { @@ -326,16 +466,18 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $args['residues'] = $seq; $mcl_feature = new MCL_CHADO_FEATURE($args); if ($mcl_feature->insert()) { - $mcl_tmpl->addMsg('N', 'feature', $args); + $this->addMsg($mcl_tmpl, 'N', 'feature', $args); // Adds a relationship. - $this->addRelatedFeature($mcl_tmpl, $mcl_feature, $type_id_relationship); + $this->addRelatedFeature($mcl_tmpl, $mcl_feature, $type_id_relationship, $swap); } else { - $mcl_tmpl->addMsg('E', 'feature', $args); + $this->addMsg($mcl_tmpl, 'E', 'feature', $args); + $flag = FALSE; } } } + return $flag; } /** @@ -345,18 +487,27 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param integer $db_id * @param string $dbxref * @param string $separator + * + * @return boolean */ - public function addDBXref(MCL_TEMPLATE $mcl_tmpl, $db_id, $dbxref, $separator = '') { + public function addDBXref(MCL_TEMPLATE $mcl_tmpl = NULL, $db_id, $dbxref, $separator = '') { + $flag = TRUE; if ($dbxref) { - $accessions = preg_split($mcl_tmpl->getSepRegex($separator), $dbxref, NULL, PREG_SPLIT_NO_EMPTY); + $accessions = preg_split($this->getSepRegex($separator), $dbxref, NULL, PREG_SPLIT_NO_EMPTY); foreach ($accessions as $accession) { $accession = trim($accession); $mcl_dbxref = MCL_CHADO_DBXREF::addDBXref($mcl_tmpl, $db_id, $accession); if ($mcl_dbxref) { - $mcl_tmpl->addLink('feature_dbxref', 'feature_id', $this->getFeatureID(), 'dbxref_id', $mcl_dbxref->getDbxrefID()); + if (!$this->addLink($mcl_tmpl, 'feature_dbxref', 'feature_id', $this->getFeatureID(), 'dbxref_id', $mcl_dbxref->getDbxrefID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -364,8 +515,10 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_TRAIT $trait + * + * @return boolean */ - public function addTrait(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_TRAIT $trait) { + public function addTrait(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_TRAIT $trait) { // Adds the trait. if ($trait) { @@ -378,20 +531,22 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { // Checks for duplication. $chado_feature_cvterm = CHADO_FEATURE_CVTERM::byKey($args); if ($chado_feature_cvterm) { - $mcl_tmpl->addMsg('D', 'feature_cvterm', $args); + $this->addMsg($mcl_tmpl, 'D', 'feature_cvterm', $args); } else { // Adds a new relationship. $chado_feature_cvterm = new CHADO_FEATURE_CVTERM($args); if ($chado_feature_cvterm->insert()) { - $mcl_tmpl->addMsg('N', 'feature_cvterm', $args); + $this->addMsg($mcl_tmpl, 'N', 'feature_cvterm', $args); } else { - $mcl_tmpl->addMsg('E', 'feature_cvterm', $args); + $this->addMsg($mcl_tmpl, 'E', 'feature_cvterm', $args); + return FALSE; } } } + return TRUE; } /** @@ -401,8 +556,11 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param string $alias * @param integer $type_id * @param string $separator + * + * @return boolean */ - public function addAlias(MCL_TEMPLATE $mcl_tmpl, $type_id, $alias, $separator = '') { + public function addAlias(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $alias, $separator = '') { + $flag = TRUE; // Sets the arguments. $args = array( @@ -411,7 +569,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { ); // Checks arguements. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!$this->checkReqArgs($args)) { return NULL; } @@ -419,18 +577,18 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $synonym_sgml = ''; // Adds a synonym. - $names = preg_split($mcl_tmpl->getSepRegex($separator), $alias, NULL, PREG_SPLIT_NO_EMPTY); + $names = preg_split($this->getSepRegex($separator), $alias, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); - // Checks for duplication. + // Checks for duplication [synonym]. $args = array( 'type_id' => $type_id, 'name' => $name, ); $chado_synonym = CHADO_SYNONYM::byKey($args); if ($chado_synonym) { - $mcl_tmpl->addMsg('D', 'synonym', $args); + $this->addMsg($mcl_tmpl, 'D', 'synonym', $args); } else { @@ -438,35 +596,39 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $args['synonym_sgml'] = $synonym_sgml; $chado_synonym = new CHADO_SYNONYM($args); if ($chado_synonym->insert()) { - $mcl_tmpl->addMsg('N', 'synonym', $args); - - // Checks for duplication. - $args = array( - 'pub_id' => MCL_VAR::getValueByName('PUB_ID'), - 'feature_id' => $this->feature_id, - 'synonym_id' => $chado_synonym->getSynonymID(), - ); - $chado_feature_synonym = CHADO_FEATURE_SYNONYM::byKey($args); - if ($chado_feature_synonym) { - $mcl_tmpl->addMsg('D', 'feature_synonym', $args); - } - else { + $this->addMsg($mcl_tmpl, 'N', 'synonym', $args); + } + else { + $this->addMsg($mcl_tmpl, 'E', 'synonym', $args); + $flag = FALSE; + continue; + } + } - // Adds a new relationship. - $chado_feature_synonym = new CHADO_FEATURE_SYNONYM($args); - if ($chado_feature_synonym->insert()) { - $mcl_tmpl->addMsg('N', 'feature_synonym', $args); - } - else { - $mcl_tmpl->addMsg('E', 'feature_synonym', $args); - } - } + // Checks for duplication [feature_synonym]. + $args = array( + 'pub_id' => MCL_VAR::getValueByName('PUB_ID'), + 'feature_id' => $this->feature_id, + 'synonym_id' => $chado_synonym->getSynonymID(), + ); + $chado_feature_synonym = CHADO_FEATURE_SYNONYM::byKey($args); + if ($chado_feature_synonym) { + $this->addMsg($mcl_tmpl, 'D', 'feature_synonym', $args); + } + else { + + // Adds a new relationship. + $chado_feature_synonym = new CHADO_FEATURE_SYNONYM($args); + if ($chado_feature_synonym->insert()) { + $this->addMsg($mcl_tmpl, 'N', 'feature_synonym', $args); } else { - $mcl_tmpl->addMsg('E', 'synonym', $args); + $this->addMsg($mcl_tmpl, 'E', 'feature_synonym', $args); + $flag = FALSE; } } } + return $flag; } /** @@ -474,8 +636,10 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_SYNONYM $mcl_synonym + * + * @return boolean */ - public function addSynonym(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_SYNONYM $mcl_synonym) { + public function addSynonym(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_SYNONYM $mcl_synonym) { if ($mcl_synonym) { // Checks for duplication. @@ -486,20 +650,22 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { ); $chado_feature_synonym = CHADO_FEATURE_SYNONYM::byKey($args); if ($chado_feature_synonym) { - $mcl_tmpl->addMsg('D', 'feature_synonym', $args); + $this->addMsg($mcl_tmpl, 'D', 'feature_synonym', $args); } else { // Adds a new relationship. $chado_feature_synonym = new CHADO_FEATURE_SYNONYM($args); if ($chado_feature_synonym->insert()) { - $mcl_tmpl->addMsg('N', 'feature_synonym', $args); + $this->addMsg($mcl_tmpl, 'N', 'feature_synonym', $args); } else { - $mcl_tmpl->addMsg('E', 'feature_synonym', $args); + $this->addMsg($mcl_tmpl, 'E', 'feature_synonym', $args); + return FALSE; } } } + return TRUE; } /** @@ -508,18 +674,27 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param MCL_TEMPLATE $mcl_tmpl * @param string $contact * @param string $separator + * + * @return boolean */ - public function addContact(MCL_TEMPLATE $mcl_tmpl, $contact, $separator = '') { + public function addContact(MCL_TEMPLATE $mcl_tmpl = NULL, $contact, $separator = '') { + $flag = TRUE; if ($contact) { - $names = preg_split($mcl_tmpl->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); + $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); $mcl_contact = MCL_CHADO_CONTACT::getContact($name); if ($mcl_contact) { - $mcl_tmpl->addLink('feature_contact', 'feature_id', $this->feature_id, 'contact_id', $mcl_contact->getContactID()); + if (!$this->addLink($mcl_tmpl, 'feature_contact', 'feature_id', $this->feature_id, 'contact_id', $mcl_contact->getContactID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -528,18 +703,54 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param MCL_TEMPLATE $mcl_tmpl * @param string $dataset_name * @param string $separator + * + * @return boolean */ - public function addDataset(MCL_TEMPLATE $mcl_tmpl, $dataset_name, $separator = '') { + public function addDataset(MCL_TEMPLATE $mcl_tmpl = NULL, $dataset_name, $separator = '') { + $flag = TRUE; if ($dataset_name) { - $names = preg_split($mcl_tmpl->getSepRegex($separator), $dataset_name, NULL, PREG_SPLIT_NO_EMPTY); + $names = preg_split($this->getSepRegex($separator), $dataset_name, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { - $name = trim($name); - $mcl_dataset = MCL_CHADO_DATASET::getDataset($name); - if ($mcl_dataset) { - $mcl_tmpl->addLink('feature_project', 'feature_id', $this->feature_id, 'project_id', $mcl_dataset->getProjectID()); + $dataset = MCL_CHADO_DATASET::getDataset(trim($name)); + if ($dataset) { + if (!$this->addLink($mcl_tmpl, 'feature_project', 'feature_id', $this->feature_id, 'project_id', $dataset->getProjectID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; + } + } + } + return $flag; + } + + /** + * Adds site to feature_nd_geolocation. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $site_name + * @param string $separator + * + * @return boolean + */ + public function addSite(MCL_TEMPLATE $mcl_tmpl = NULL, $site_name, $separator = '') { + $flag = TRUE; + if ($dataset_name) { + $names = preg_split($this->getSepRegex($separator), $site_name, NULL, PREG_SPLIT_NO_EMPTY); + foreach ($names as $name) { + $nd_geolocation_id = MCL_CHADO_LOCATION::getLocationIDBySite(trim($name)); + if ($nd_geolocation_id) { + if (!$this->addLink($mcl_tmpl, 'feature_nd_geolocation', 'feature_id', $this->feature_id, 'nd_geolocation_id', $nd_geolocation_id)) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -550,15 +761,18 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param string $genus * @param string $species * @param string $separator + * + * @return boolean */ - public function addStock(MCL_TEMPLATE $mcl_tmpl, $stock, $genus, $species, $type_id, $separator = '') { + public function addStock(MCL_TEMPLATE $mcl_tmpl = NULL, $stock, $genus, $species, $type_id, $separator = '') { + $flag = TRUE; if ($stock) { // Gets orgaims_id. $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); if ($mcl_organism) { - $uniquenames = preg_split($mcl_tmpl->getSepRegex($separator), $stock, NULL, PREG_SPLIT_NO_EMPTY); + $uniquenames = preg_split($this->getSepRegex($separator), $stock, NULL, PREG_SPLIT_NO_EMPTY); foreach ($uniquenames as $uniquename) { $uniquename = trim($uniquename); $organism_id = $mcl_organism->getOrganismID(); @@ -575,14 +789,21 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { // Adds a stock. $mcl_stock = MCL_CHADO_STOCK::byKey(array('uniquename' => $uniquename, 'organism_id' => $organism_id)); if ($mcl_stock) { - $mcl_tmpl->addLink('feature_stock', 'feature_id', $this->feature_id, 'stock_id', $mcl_stock->getStockID(), $type_id); + if (!$this->addLink($mcl_tmpl, 'feature_stock', 'feature_id', $this->feature_id, 'stock_id', $mcl_stock->getStockID(), $type_id)) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } else { $this->updateMsg('E', "(genus, species) = ($genus, $species) not found in organism"); + $flag = FALSE; } } + return $flag; } /** @@ -592,8 +813,10 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param string $stock * @param integer $cvterm_id * @param MCL_CHADO_GENOTYPE $genotype + * + * @return boolean */ - public function addGenotype(MCL_TEMPLATE $mcl_tmpl, $stock, $genus, $cvterm_id, MCL_CHADO_GENOTYPE $genotype) { + public function addGenotype(MCL_TEMPLATE $mcl_tmpl = NULL, $stock, $genus, $cvterm_id, MCL_CHADO_GENOTYPE $genotype) { // Checks feature_genotype for duplication. $args = array( @@ -603,7 +826,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { ); $chado_feature_genotype = CHADO_FEATURE_GENOTYPE::byKey($args); if ($chado_feature_genotype) { - $mcl_tmpl->addMsg('D', 'feature_genotype', $args); + $this->addMsg($mcl_tmpl, 'D', 'feature_genotype', $args); } else { @@ -611,12 +834,14 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $args['cgroup'] = 1; $chado_feature_genotype = new CHADO_FEATURE_GENOTYPE($args); if ($chado_feature_genotype->insert()) { - $mcl_tmpl->addMsg('N', 'feature_genotype', $args); + $this->addMsg($mcl_tmpl, 'N', 'feature_genotype', $args); } else { - $mcl_tmpl->addMsg('E', 'feature_genotype', $args); + $this->addMsg($mcl_tmpl, 'E', 'feature_genotype', $args); + return FALSE;; } } + return TRUE; } /** @@ -625,18 +850,27 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addImage(MCL_TEMPLATE $mcl_tmpl, $image, $separator = '') { + public function addImage(MCL_TEMPLATE $mcl_tmpl = NULL, $image, $separator = '') { + $flag = TRUE; if ($image) { - $eimage_ids = preg_split($mcl_tmpl->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); + $eimage_ids = preg_split($this->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); foreach ($eimage_ids as $eimage_id) { $eimage_id = trim($eimage_id); $mcl_image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); if ($mcl_image) { - $mcl_tmpl->addLink('feature_image', 'feature_id', $this->feature_id, 'eimage_id', $mcl_image->getEimageID()); + if (!$this->addLink($mcl_tmpl, 'feature_image', 'feature_id', $this->feature_id, 'eimage_id', $mcl_image->getEimageID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -645,17 +879,26 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addReference(MCL_TEMPLATE $mcl_tmpl, $reference, $separator = '') { + public function addReference(MCL_TEMPLATE $mcl_tmpl = NULL, $reference, $separator = '') { + $flag = TRUE; if ($reference) { - $pub_ids = preg_split($mcl_tmpl->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); + $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); if ($mcl_pub) { - $mcl_tmpl->addLink('feature_pub', 'feature_id', $this->feature_id, 'pub_id', $pub_id); + if (!$this->addLink($mcl_tmpl, 'feature_pub', 'feature_id', $this->feature_id, 'pub_id', $pub_id)) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc b/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc index a758017..3afdcb6 100644 --- a/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc @@ -41,18 +41,25 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * @param MCL_TEMPLATE $mcl_tmpl * @param string $map * @param string $separator + * + * @return boolean */ - public static function checkMap(MCL_TEMPLATE $mcl_tmpl, $map, $separator = '') { - - // Gets contact names. - $names = preg_split($mcl_tmpl->getSepRegex($separator), $map, NULL, PREG_SPLIT_NO_EMPTY); - foreach ($names as $name) { - $name = trim($name); - $mcl_map = MCL_CHADO_FEATUREMAP::getMap($name); - if (!$mcl_map) { - $mcl_tmpl->updateMsg('E', "(name) = ($name) not found in featuremap"); + public static function checkMap(MCL_TEMPLATE $mcl_tmpl = NULL, $map, $separator = '') { + $flag = TRUE; + if ($map) { + + // Gets contact names. + $names = preg_split(self::getSepRegex($separator), $map, NULL, PREG_SPLIT_NO_EMPTY); + foreach ($names as $name) { + $name = trim($name); + $mcl_map = MCL_CHADO_FEATUREMAP::getMap($name); + if (!$mcl_map) { + self::updateMsg($mcl_tmpl, 'E', "(name) = ($name) not found in featuremap"); + $flag = FALSE; + } } } + return $flag; } /** @@ -61,15 +68,18 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * * @param MCL_TEMPLATE $mcl_tmpl * @param string $map_unit - * @param string $separator + * + * @return boolean */ - public static function checkMapUnit(MCL_TEMPLATE $mcl_tmpl, $map_unit, $separator = '') { + public static function checkMapUnit(MCL_TEMPLATE $mcl_tmpl = NULL, $map_unit) { // Gets cvterm for the map unit. $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm('SITE_CV', $map_unit); if (!$mcl_cvterm) { - $mcl_tmpl->updateMsg('E', "(map_unit) = ($map_unit) not found in cvterm"); + self::updateMsg($mcl_tmpl, 'E', "(map_unit) = ($map_unit) not found in cvterm"); + return FALSE; } + return TRUE; } /** @@ -93,27 +103,27 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * * @return MCL_CHADO_FEATUREMAP */ - public static function addMap(MCL_TEMPLATE $mcl_tmpl, $name, $map_unit, $description) { + public static function addMap(MCL_TEMPLATE $mcl_tmpl = NULL, $name, $map_unit, $description) { // Sets the arguments. $args = array('name' => $name); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_featuremap = MCL_CHADO_FEATUREMAP::byKey($args); if ($mcl_featuremap) { - $mcl_tmpl->addMsg('D', 'featuremap', $args); + self::addMsg($mcl_tmpl, 'D', 'featuremap', $args); } else { // Gets unittype_id from map_unit. $cvterm = MCL_CHADO_CVTERM::getCvterm('SITE_CV', $map_unit); if (!$cvterm) { - $mcl_tmpl->updateMsg('E', "map_unit : '$map_unit' found in cvterm"); + self::updateMsg($mcl_tmpl, 'E', "map_unit : '$map_unit' found in cvterm"); return NULL; } @@ -122,10 +132,11 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { $args['description'] = $description; $mcl_featuremap = new MCL_CHADO_FEATUREMAP($args); if ($mcl_featuremap->insert()) { - $mcl_tmpl->addMsg('N', 'featuremap', $args); + self::addMsg($mcl_tmpl, 'N', 'featuremap', $args); } else { - $mcl_tmpl->addMsg('E', 'featuremap', $args); + self::addMsg($mcl_tmpl, 'E', 'featuremap', $args); + return NULL; } } return $mcl_featuremap; @@ -139,10 +150,15 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('featuremapprop', 'featuremap_id', $this->featuremap_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'featuremapprop', 'featuremap_id', $this->featuremap_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -152,23 +168,30 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * @param string $genus * @param integer $species * @param string $separator + * + * @return boolean */ - public function addOrganism(MCL_TEMPLATE $mcl_tmpl, $genus, $species, $separator = '') { + public function addOrganism(MCL_TEMPLATE $mcl_tmpl = NULL, $genus, $species, $separator = '') { + $flag = TRUE; if ($genus && $species) { - $sps = preg_split($mcl_tmpl->getSepRegex($separator), $species, NULL, PREG_SPLIT_NO_EMPTY); + $sps = preg_split($this->getSepRegex($separator), $species, NULL, PREG_SPLIT_NO_EMPTY); foreach ($sps as $sp) { $sp = trim($sp); // Gets the organism. $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $sp); if ($mcl_organism) { - $mcl_tmpl->addLink('featuremap_organism', 'featuremap_id', $this->featuremap_id, 'organism_id', $mcl_organism->getOrganismID()); + if (!$this->addLink($mcl_tmpl, 'featuremap_organism', 'featuremap_id', $this->featuremap_id, 'organism_id', $mcl_organism->getOrganismID())) { + $flag = FALSE; + } } else { - $mcl_tmpl->updateMsg('E', "(genus, species) = ($genus, $sp) not found in organism"); + $this->updateMsg($mcl_tmpl, 'E', "(genus, species) = ($genus, $sp) not found in organism"); + $flag = FALSE; } } } + return $flag; } /** @@ -178,32 +201,49 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * @param string $stock * @param integer $organism_id * @param string $separator + * + * @return boolean */ - public function addStock(MCL_TEMPLATE $mcl_tmpl, $stock, $genus, $species, $separator = '') { + public function addStock(MCL_TEMPLATE $mcl_tmpl = NULL, $stock, $genus, $species, $separator = '') { + $flag = TRUE; if ($stock) { - // Gets orgaims_id. - $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); - if ($mcl_organism) { - $organism_id = $mcl_organism->getOrganismID(); - - // Adds a stock. - $uniquenames = preg_split($mcl_tmpl->getSepRegex($separator), $stock, NULL, PREG_SPLIT_NO_EMPTY); - foreach ($uniquenames as $uniquename) { - $uniquename = trim($uniquename); - $mcl_stock = MCL_CHADO_STOCK::byKey(array('uniquename' => $uniquename, 'organism_id' => $organism_id)); - if ($mcl_stock) { - $mcl_tmpl->addLink('featuremap_stock', 'featuremap_id', $this->featuremap_id, 'stock_id', $mcl_stock->getStockID()); - } - else { - $this->updateMsg('E', "(uniquename, organism_id) = ($uniquename, $organism_id) not found in stock"); - } + // Gets the organism_id. + $organism_id = NULL; + if ($genus && $species) { + $organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if (!$organism) { + $this->updateMsg($mcl_tmpl, 'E', "$genus $species not found in organism"); + return FALSE; } + $organism_id = $organism->getOrganismID(); } - else { - $this->updateMsg('E', "(genus, species) = ($genus, $species) not found in organism"); + + // Adds a stock. + $uniquenames = preg_split($this->getSepRegex($separator), $stock, NULL, PREG_SPLIT_NO_EMPTY); + foreach ($uniquenames as $uniquename) { + $uniquename = trim($uniquename); + + // Sets the arguments. + $args = array('uniquename' => $uniquename); + if ($organism_id) { + $args['organism_id'] = $organism_id; + } + + // Gets the stock and add it. + $mcl_stock = MCL_CHADO_STOCK::byKey($args); + if ($mcl_stock) { + if (!$this->addLink($mcl_tmpl, 'featuremap_stock', 'featuremap_id', $this->featuremap_id, 'stock_id', $mcl_stock->getStockID())) { + $flag = FALSE; + } + } + else { + $this->updateMsg($mcl_tmpl, 'E', "(uniquename, organism_id) = ($uniquename, $organism_id) not found in stock"); + $flag = FALSE; + } } } + return $flag; } /** @@ -212,18 +252,27 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * @param MCL_TEMPLATE $mcl_tmpl * @param string $contact * @param string $separator + * + * @return boolean */ - public function addContact(MCL_TEMPLATE $mcl_tmpl, $contact, $separator = '') { + public function addContact(MCL_TEMPLATE $mcl_tmpl = NULL, $contact, $separator = '') { + $flag = TRUE; if ($contact) { - $names = preg_split($mcl_tmpl->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); + $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); $mcl_contact = MCL_CHADO_CONTACT::getContact($name); if ($mcl_contact) { - $mcl_tmpl->addLink('featuremap_contact', 'featuremap_id', $this->featuremap_id, 'contact_id', $mcl_contact->getContactID()); + if (!$this->addLink($mcl_tmpl, 'featuremap_contact', 'featuremap_id', $this->featuremap_id, 'contact_id', $mcl_contact->getContactID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -232,17 +281,26 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addReference(MCL_TEMPLATE $mcl_tmpl, $reference, $separator = '') { + public function addReference(MCL_TEMPLATE $mcl_tmpl = NULL, $reference, $separator = '') { + $flag = TRUE; if ($reference) { - $pub_ids = preg_split($mcl_tmpl->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); + $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); if ($mcl_pub) { - $mcl_tmpl->addLink('featuremap_pub', 'featuremap_id', $this->featuremap_id, 'pub_id', $pub_id); + if (!$this->addLink($mcl_tmpl, 'featuremap_pub', 'featuremap_id', $this->featuremap_id, 'pub_id', $pub_id)) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc b/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc index 23efe3d..40f2828 100644 --- a/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc @@ -44,7 +44,7 @@ class MCL_CHADO_FEATUREPOS extends CHADO_FEATUREPOS { * * @return MCL_CHADO_FEATUREPOS */ - public static function addFeaturepos(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_FEATRUE $feature, MCL_CHADO_FEATRUEMAP $map, MCL_CHADO_FEATRUE $map_feature) { + public static function addFeaturepos(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_FEATRUE $feature, MCL_CHADO_FEATRUEMAP $map, MCL_CHADO_FEATRUE $map_feature) { // Sets the arguments. $args = array( @@ -54,25 +54,26 @@ class MCL_CHADO_FEATUREPOS extends CHADO_FEATUREPOS { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $featurepos = MCL_CHADO_FEATUREPOS::byKey($args); if ($featurepos) { - $mcl_tmpl->addMsg('D', 'featurepos', $args); + self::addMsg($mcl_tmpl, 'D', 'featurepos', $args); } else { // Adds a new featurepos. $args['mappos'] = 0.0; - $featurepos = new MCL_CHADO_FEATUREPOS($args); + $featurepos = new MCL_CHADO_FEATUREPOS($args); if ($featurepos->insert()) { - $mcl_tmpl->addMsg('N', 'featurepos', $args); + self::addMsg($mcl_tmpl, 'N', 'featurepos', $args); } else { - $mcl_tmpl->addMsg('E', 'featurepos', $args); + self::addMsg($mcl_tmpl, 'E', 'featurepos', $args); + return NULL; } } return $featurepos; @@ -86,9 +87,14 @@ class MCL_CHADO_FEATUREPOS extends CHADO_FEATUREPOS { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('featureposprop', 'featurepos_id', $this->featurepos_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value || $value == '0') { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'featureposprop', 'featurepos_id', $this->featurepos_id, $type_id, $value, $separator); + } + return TRUE; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_genotype.class.inc b/includes/class/mcl_chado_class/mcl_chado_genotype.class.inc index ecf38fb..603c0e1 100644 --- a/includes/class/mcl_chado_class/mcl_chado_genotype.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_genotype.class.inc @@ -44,7 +44,7 @@ class MCL_CHADO_GENOTYPE extends CHADO_GENOTYPE { * * @return MCL_CHADO_GENOTYPE */ - public static function addGenotype(MCL_TEMPLATE $mcl_tmpl, $uniquename, $type_id, $description) { + public static function addGenotype(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $type_id, $description) { // Sets the arguments. $args = array( @@ -53,14 +53,14 @@ class MCL_CHADO_GENOTYPE extends CHADO_GENOTYPE { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_genotype = MCL_CHADO_GENOTYPE::byKey($args); if ($mcl_genotype) { - $mcl_tmpl->addMsg('D', 'genotype', $args); + self::addMsg($mcl_tmpl, 'D', 'genotype', $args); } else { @@ -68,10 +68,11 @@ class MCL_CHADO_GENOTYPE extends CHADO_GENOTYPE { $args['description'] = $description; $mcl_genotype = new MCL_CHADO_GENOTYPE($args); if ($mcl_genotype->insert()) { - $mcl_tmpl->addMsg('N', 'genotype', $args); + self::addMsg($mcl_tmpl, 'N', 'genotype', $args); } else { - $mcl_tmpl->addMsg('E', 'genotype', $args); + self::addMsg($mcl_tmpl, 'E', 'genotype', $args); + return NULL; } } return $mcl_genotype; @@ -85,9 +86,14 @@ class MCL_CHADO_GENOTYPE extends CHADO_GENOTYPE { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('genotypeprop', 'genotype_id', $this->genotype_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'genotypeprop', 'genotype_id', $this->genotype_id, $type_id, $value, $separator); + } + return TRUE; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_genotype_call.class.inc b/includes/class/mcl_chado_class/mcl_chado_genotype_call.class.inc index c4b8786..aa58d08 100644 --- a/includes/class/mcl_chado_class/mcl_chado_genotype_call.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_genotype_call.class.inc @@ -41,27 +41,28 @@ class MCL_CHADO_GENOTYPE_CALL extends CHADO_GENOTYPE_CALL { * * @return MCL_CHADO_GENOTYPE_CALL */ - public static function addGenotypeCall(MCL_TEMPLATE $mcl_tmpl, $args) { + public static function addGenotypeCall(MCL_TEMPLATE $mcl_tmpl = NULL, $args) { // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_genotype_call = MCL_CHADO_GENOTYPE_CALL::byKey($args); if ($mcl_genotype_call) { - $mcl_tmpl->addMsg('D', 'genotype_call', $args); + self::addMsg($mcl_tmpl, 'D', 'genotype_call', $args); } else { // Adds a new genotype. $mcl_genotype_call = new MCL_CHADO_GENOTYPE_CALL($args); if ($mcl_genotype_call->insert()) { - $mcl_tmpl->addMsg('N', 'genotype_call', $args); + self::addMsg($mcl_tmpl, 'N', 'genotype_call', $args); } else { - $mcl_tmpl->addMsg('E', 'genotype_call', $args); + self::addMsg($mcl_tmpl, 'E', 'genotype_call', $args); + return NULL; } } return $mcl_genotype_call; diff --git a/includes/class/mcl_chado_class/mcl_chado_image.class.inc b/includes/class/mcl_chado_class/mcl_chado_image.class.inc index bcb49cc..0253619 100644 --- a/includes/class/mcl_chado_class/mcl_chado_image.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_image.class.inc @@ -41,21 +41,31 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { * @param MCL_TEMPLATE $mcl_tmpl * @param string $image * @param string $separator + * + * @return boolean */ - public static function checkImage(MCL_TEMPLATE $mcl_tmpl, $image, $separator = '') { + public static function checkImage(MCL_TEMPLATE $mcl_tmpl = NULL, $image, $separator = '') { + $flag = TRUE; if ($image) { // Gets eimage_id. - $eimage_ids = preg_split($mcl_tmpl->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); + $eimage_ids = preg_split(self::getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); foreach ($eimage_ids as $eimage_id) { $eimage_id = trim($eimage_id); + if (!is_int($eimage_id)) { + self::updateMsg($mcl_tmpl, 'E', "$eimage_id is not an integer. It must be eimage_id"); + $flag = FALSE; + continue; + } $args = array('eimage_id' => $eimage_id); $mcl_image = MCL_CHADO_IMAGE::byKey($args); if (!$mcl_image) { - $mcl_tmpl->addMsg('D', 'eimage', $args); + self::addMsg($mcl_tmpl, 'E', 'eimage', $args); + $flag = FALSE; } } } + return $flag; } /** @@ -68,7 +78,7 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { * * @return MCL_CHADO_DBXREF */ - public static function addImage(MCL_TEMPLATE $mcl_tmpl, $eimage_data, $eimage_type, $image_uri) { + public static function addImage(MCL_TEMPLATE $mcl_tmpl = NULL, $eimage_data, $eimage_type, $image_uri) { // Sets the arguments. $args = array( @@ -78,20 +88,24 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { ); // Checks parameters. - if ($eimage_data && $eimage_type && $image_uri) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_image = MCL_CHADO_IMAGE::byKey($args); if ($mcl_image) { - $mcl_tmpl->addMsg('D', 'eimage', $args); + self::updateMsg($mcl_tmpl, 'D', 'eimage', $args); } else { // Adds a new image. $mcl_image = new MCL_CHADO_IMAGE($args); if ($mcl_image->insert()) { - $mcl_tmpl->addMsg('N', 'eimage', $args); + self::updateMsg($mcl_tmpl, 'N', 'eimage', $args); + } + else { + self::addMsg($mcl_tmpl, 'E', 'eimage', $args); + return NULL; } } return $mcl_image; @@ -105,9 +119,14 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('eimageprop', 'eimage_id', $this->eimage_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'eimageprop', 'eimage_id', $this->eimage_id, $type_id, $value, $separator); + } + return TRUE; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_library.class.inc b/includes/class/mcl_chado_class/mcl_chado_library.class.inc index 34237a5..f54148a 100644 --- a/includes/class/mcl_chado_class/mcl_chado_library.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_library.class.inc @@ -41,8 +41,10 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { * @param string $uniquename * @param integer $type_id * @param integer $organism_id + * + * @return boolean */ - public static function checkLibrary(MCL_TEMPLATE $mcl_tmpl, $uniquename, $type_id, $organism_id = NULL) { + public static function checkLibrary(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $type_id, $organism_id = NULL) { if ($uniquename && $type_id) { // Updates the organism_id if not provided. @@ -53,14 +55,11 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { // Gets the library. $mcl_library = MCL_CHADO_LIBRARY::getLibrary($uniquename, $type_id, $organism_id); if (!$mcl_library) { - $args = array( - 'uniquename' => $uniquename, - 'type_id' => $type_id, - 'organism_id' => $organism_id, - ); - $mcl_tmpl->updateMsg('E', $mcl_tmpl->arrStr($args) . " not found in library"); + self::updateMsg($mcl_tmpl, 'E', "(uniquename, type_id, organism_id) = ($uniquename, $type_id, $organism_id) not found in library"); + return FALSE; } } + return TRUE; } /** @@ -83,7 +82,7 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { 'type_id' => $type_id, 'organism_id' => $organism_id, ); - return MCL_CHADO_LIBRARY::bykey($keys); + return MCL_CHADO_LIBRARY::bykey($keys); } /** @@ -95,7 +94,7 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { * * @return MCL_CHADO_LIBRARY */ - public static function addLibrary(MCL_TEMPLATE $mcl_tmpl, $uniquename, $type_id, $organism_id = NULL) { + public static function addLibrary(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $type_id, $organism_id = NULL) { // Updates the organism_id if not provided. if (!$organism_id) { @@ -110,14 +109,14 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_library = MCL_CHADO_LIBRARY::byKey($args); if ($mcl_library) { - $mcl_tmpl->addMsg('D', 'library', $args); + self::addMsg($mcl_tmpl, 'D', 'library', $args); } else { @@ -125,10 +124,11 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { $args['name'] = $uniquename; $mcl_library = new MCL_CHADO_LIBRARY($args); if ($mcl_library->insert()) { - $mcl_tmpl->addMsg('N', 'library', $args); + self::addMsg($mcl_tmpl, 'N', 'library', $args); } else { - $mcl_tmpl->addMsg('E', 'library', $args); + self::addMsg($mcl_tmpl, 'E', 'library', $args); + return NULL; } } return $mcl_library; @@ -142,10 +142,15 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('libraryprop', 'library_id', $this->library_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'libraryprop', 'library_id', $this->library_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -153,32 +158,36 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { * * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_SYNONYM $mcl_synonym + * + * @return boolean */ - public function addSynonym(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_SYNONYM $mcl_synonym) { + public function addSynonym(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_SYNONYM $mcl_synonym) { if ($mcl_synonym) { // Checks for duplication. $args = array( - 'synonym_id' => $mcl_synonym->getSynonymID(), - 'library_id' => $this->library_id, - 'pub_id' => MCL_VAR::getValueByName('PUB_ID'), + 'synonym_id' => $mcl_synonym->getSynonymID(), + 'library_id' => $this->library_id, + 'pub_id' => MCL_VAR::getValueByName('PUB_ID'), ); $chado_library_synonym = CHADO_LIBRARY_SYNONYM::byKey($args); if ($chado_library_synonym) { - $mcl_tmpl->addMsg('D', 'library_synonym', $args); + $this->addMsg($mcl_tmpl, 'D', 'library_synonym', $args); } else { // Adds a new relationship. $chado_library_synonym = new CHADO_LIBRARY_SYNONYM($args); if ($chado_library_synonym->insert()) { - $mcl_tmpl->addMsg('N', 'library_synonym', $args); + $this->addMsg($mcl_tmpl, 'N', 'library_synonym', $args); } else { - $mcl_tmpl->addMsg('E', 'library_synonym', $args); + $this->addMsg($mcl_tmpl, 'E', 'library_synonym', $args); + return FALSE; } } } + return TRUE; } /** @@ -187,18 +196,27 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { * @param MCL_TEMPLATE $mcl_tmpl * @param string $contact * @param string $separator + * + * @return boolean */ - public function addContact(MCL_TEMPLATE $mcl_tmpl, $contact, $separator = '') { + public function addContact(MCL_TEMPLATE $mcl_tmpl = NULL, $contact, $separator = '') { + $flag = TRUE; if ($contact) { - $names = preg_split($mcl_tmpl->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); + $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); $mcl_contact = MCL_CHADO_CONTACT::byKey(array('name' => $name)); if ($mcl_contact) { - $mcl_tmpl->addLink('library_contact', 'library_id', $this->library_id, 'contact_id', $mcl_contact->getContactID()); + if (!$this->addLink($mcl_tmpl, 'library_contact', 'library_id', $this->library_id, 'contact_id', $mcl_contact->getContactID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -207,17 +225,25 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addReference(MCL_TEMPLATE $mcl_tmpl, $reference, $separator = '') { + public function addReference(MCL_TEMPLATE $mcl_tmpl = NULL, $reference, $separator = '') { + $flag = TRUE; if ($reference) { - $pub_ids = preg_split($mcl_tmpl->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); + $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); if ($mcl_pub) { - $mcl_tmpl->addLink('library_pub', 'library_id', $this->library_id, 'pub_id', $pub_id); + $this->addLink($mcl_tmpl, 'library_pub', 'library_id', $this->library_id, 'pub_id', $pub_id); + } + else { + $this->updateMsg($mcl_tmpl, 'E', "(pub_id) = ($pub_id) not found in pub"); + $flag = FALSE; } } } + return $flag; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_location.class.inc b/includes/class/mcl_chado_class/mcl_chado_location.class.inc index 2caac87..d12a615 100644 --- a/includes/class/mcl_chado_class/mcl_chado_location.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_location.class.inc @@ -37,8 +37,10 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { * * @param MCL_TEMPLATE $mcl_tmpl * @param string site_code + * + * @return boolean */ - public static function checkSiteCode(MCL_TEMPLATE $mcl_tmpl, $site_code) { + public static function checkSiteCode(MCL_TEMPLATE $mcl_tmpl = NULL, $site_code) { if ($site_code) { // TODO: @@ -50,9 +52,11 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { ); $bim_location = MCL_CHADO_LOCATION::byKey($args); if (!$bim_location) { - $mcl_tmpl->addMsg('E', 'nd_geolocation', $args); + self::addMsg($mcl_tmpl, 'E', 'nd_geolocation', $args); + return FALSE; } } + return TRUE; } /** @@ -64,7 +68,9 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { * @return integer nd_geolocation_id */ public static function getLocationIDBySiteCode($site_code) { - $nd_geolocation_id = NULL; + + // Sets the default nd_geolocation_id. + $nd_geolocation_id = MCL_VAR::getValueByName('ND_GEOLOCATION_ID'); if ($site_code) { @@ -80,14 +86,9 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { $nd_geolocation_id = $mcl_location->getNdGeolocationID(); } else { - $mcl_tmpl->addMsg('E', 'nd_geolocation', $args); + return NULL; } } - else { - - // Returns a default nd_geolocation_id. - $nd_geolocation_id = MCL_VAR::getValueByName('ND_GEOLOCATION_ID'); - } return $nd_geolocation_id; } @@ -96,8 +97,10 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { * * @param MCL_TEMPLATE $mcl_tmpl * @param string $site_name + * + * @return boolean */ - public static function checkSite(MCL_TEMPLATE $mcl_tmpl, $site_name) { + public static function checkSite(MCL_TEMPLATE $mcl_tmpl = NULL, $site_name) { if ($site_name) { // Gets nd_geolocation. @@ -106,9 +109,11 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { ); $bim_location = MCL_CHADO_LOCATION::byKey($args); if (!$bim_location) { - $mcl_tmpl->updateMsg('E', "(description) = ($site_name) not found in nd_geolocation"); + self::updateMsg($mcl_tmpl, 'E', "(description) = ($site_name) not found in nd_geolocation"); + return FALSE; } } + return TRUE; } /** @@ -136,7 +141,7 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { $nd_geolocation_id = $mcl_location->getNdGeolocationID(); } else { - $mcl_tmpl->addMsg('E', 'nd_geolocation', $args); + return NULL; } } return $nd_geolocation_id; @@ -175,13 +180,13 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { * * @return MCL_CHADO_LOCATION */ - public static function addLocation(MCL_TEMPLATE $mcl_tmpl, $name, $loc_info = NULL) { + public static function addLocation(MCL_TEMPLATE $mcl_tmpl = NULL, $name, $loc_info = NULL) { // Sets the arguments. $args = array('description' => $name); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } @@ -190,7 +195,7 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { $valid_keys = array('latitude', 'longitude', 'altitude', 'geodetic_datum'); foreach ($loc_info as $key => $value) { if (!in_array($key, $valid_keys)) { - $mcl_tmpl->updateMsg('E', "$key is an invalid attribute of nd_geolocation table"); + self::updateMsg($mcl_tmpl, 'E', "$key is an invalid attribute of nd_geolocation table"); return NULL; } } @@ -199,7 +204,7 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { // Checks for duplication. $mcl_location = MCL_CHADO_LOCATION::byKey($args); if ($mcl_location) { - $mcl_tmpl->addMsg('D', 'nd_geolocation', $args); + self::addMsg($mcl_tmpl, 'D', 'nd_geolocation', $args); } else { @@ -212,10 +217,11 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { // Adds a new location. $mcl_location = new MCL_CHADO_LOCATION($args); if ($mcl_location->insert()) { - $mcl_tmpl->addMsg('N', 'nd_geolocation', $args); + self::addMsg($mcl_tmpl, 'N', 'nd_geolocation', $args); } else { - $mcl_tmpl->addMsg('E', 'nd_geolocation', $args); + self::addMsg($mcl_tmpl, 'E', 'nd_geolocation', $args); + return NULL; } } return $mcl_location; @@ -229,9 +235,14 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('nd_geolocationprop', 'nd_geolocation_id', $this->nd_geolocation_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'nd_geolocationprop', 'nd_geolocation_id', $this->nd_geolocation_id, $type_id, $value, $separator); + } + return TRUE; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc b/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc index 29447a4..8751223 100644 --- a/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc @@ -39,18 +39,24 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * to the log. * * @param MCL_TEMPLATE $mcl_tmpl - * @param string $contact - * @param string $separator + * @param integer $project_id + * @param string $cross_number * @param integer $ne_type_id * @param integer $nep_type_id + * + * @return boolean */ - public static function checkCrossNumber(MCL_TEMPLATE $mcl_tmpl, $dataset_name, $cross_number, $ne_type_id, $nep_type_id) { + public static function checkCrossNumber(MCL_TEMPLATE $mcl_tmpl = NULL, $project_id, $cross_number, $ne_type_id, $nep_type_id) { + if ($project_id && $cross_number) { - // Gets the cross. - $cross = MCL_CHADO_ND_EXPERIMENT::byCrossNumber($dataset_name, $cross_number, $ne_type_id, $nep_type_id); - if (!$cross) { - $mcl_tmpl->updateMsg('E', "cross ($dataset_name, $cross_number) not found in nd_experiment"); + // Gets the cross. + $cross = MCL_CHADO_ND_EXPERIMENT::byCrossNumber($project_id, $cross_number, $ne_type_id, $nep_type_id); + if (!$cross) { + self::updateMsg($mcl_tmpl, 'E', "cross ($project_id, $cross_number) not found in nd_experiment"); + return FALSE; + } } + return TRUE; } /** @@ -75,16 +81,16 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { /** * Returns parent by cross number. * - * @param string $dataset_name + * @param integer $dataset_name * @param string $cross_number * @param integer $ne_type_id * @param integer $nep_type_id * * @return MCL_CHADO_ND_EXPERIMENT */ - public static function byCrossNumber($dataset_name, $cross_number, $ne_type_id, $nep_type_id) { + public static function byCrossNumber($project_id, $cross_number, $ne_type_id, $nep_type_id) { - if ($dataset_name && $cross_number) { + if ($project_id && $cross_number) { // Gets the stock_id of the specified parent. $sql= " @@ -96,7 +102,7 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { AND LOWER(NEP.value) = LOWER(:cross_number) "; $args = array( - ':cross_number' => $dataset_name . '_' . $cross_number, + ':cross_number' => $project_id . '_' . $cross_number, ':ne_type_id' => $ne_type_id, ':nep_type_id' => $nep_type_id, ); @@ -119,7 +125,7 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * * @return MCL_CHADO_ND_EXPERIMENT */ - public static function addNdExperiment(MCL_TEMPLATE $mcl_tmpl, $type_id, $nd_geolocation_id, $cvterm_id, $dup_value) { + public static function addNdExperiment(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $nd_geolocation_id, $cvterm_id, $dup_value) { // Sets the arguments. $args = array( @@ -130,7 +136,7 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } @@ -141,7 +147,7 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { ); $chado_nd_experimentprop = CHADO_ND_EXPERIMENTPROP::byKey($args); if ($chado_nd_experimentprop) { - $mcl_tmpl->updateMsg('D', "nd_experiment of the dup_value ($dup_value) for $cvterm_id already exists"); + self::updateMsg($mcl_tmpl, 'D', "nd_experiment of the dup_value ($dup_value) for $cvterm_id already exists"); $mcl_nd_experiment = MCL_CHADO_ND_EXPERIMENT::byKey(array('nd_experiment_id' => $chado_nd_experimentprop->getNdExperimentID())); } else { @@ -153,7 +159,7 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { ); $mcl_nd_experiment = new MCL_CHADO_ND_EXPERIMENT($args); if ($mcl_nd_experiment->insert()) { - $mcl_tmpl->addMsg('N', 'nd_experiment', $args); + self::addMsg($mcl_tmpl, 'N', 'nd_experiment', $args); // Adds a new nd_experimentprop. $args = array( @@ -163,14 +169,16 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { ); $chado_nd_experimentprop = new CHADO_ND_EXPERIMENTPROP($args); if ($chado_nd_experimentprop->insert()) { - $mcl_tmpl->addMsg('N', 'nd_experimentprop', $args); + self::addMsg($mcl_tmpl, 'N', 'nd_experimentprop', $args); } else { - $mcl_tmpl->addMsg('E', 'nd_experimentprop', $args); + self::addMsg($mcl_tmpl, 'E', 'nd_experimentprop', $args); + return NULL; } } else { - $mcl_tmpl->addMsg('E', 'nd_experiment', $args); + self::addMsg($mcl_tmpl, 'E', 'nd_experiment', $args); + return NULL; } } return $mcl_nd_experiment; @@ -184,10 +192,15 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('nd_experimentprop', 'nd_experiment_id', $this->nd_experiment_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'nd_experimentprop', 'nd_experiment_id', $this->nd_experiment_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -195,11 +208,14 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_STOCK $stock + * + * @return boolean */ - public function addStock(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_STOCK $mcl_stock, $type_id) { + public function addStock(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_STOCK $mcl_stock, $type_id) { if ($mcl_stock && $type_id) { - $mcl_tmpl->addLink('nd_experiment_stock', 'nd_experiment_id', $this->nd_experiment_id, 'stock_id', $mcl_stock->getStockID(), $type_id); + return $this->addLink($mcl_tmpl, 'nd_experiment_stock', 'nd_experiment_id', $this->nd_experiment_id, 'stock_id', $mcl_stock->getStockID(), $type_id); } + return TRUE; } /** @@ -207,11 +223,14 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_PHENOTYPE $phenotype + * + * @return boolean */ - public function addPhenotype(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_PHENOTYPE $mcl_phenotype) { + public function addPhenotype(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_PHENOTYPE $mcl_phenotype) { if ($mcl_phenotype) { - $mcl_tmpl->addLink('nd_experiment_phenotype', 'nd_experiment_id', $this->nd_experiment_id, 'phenotype_id', $mcl_phenotype->getPhenotypeID()); + return $this->addLink($mcl_tmpl, 'nd_experiment_phenotype', 'nd_experiment_id', $this->nd_experiment_id, 'phenotype_id', $mcl_phenotype->getPhenotypeID()); } + return TRUE; } /** @@ -219,11 +238,14 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_GENOTYPE $genotype + * + * @return boolean */ - public function addGenotype(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_GENOTYPE $mcl_genotype) { + public function addGenotype(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_GENOTYPE $mcl_genotype) { if ($mcl_genotype) { - $mcl_tmpl->addLink('nd_experiment_genotype', 'nd_experiment_id', $this->nd_experiment_id, 'genotype_id', $mcl_genotype->getGenotypeID()); + return $this->addLink($mcl_tmpl, 'nd_experiment_genotype', 'nd_experiment_id', $this->nd_experiment_id, 'genotype_id', $mcl_genotype->getGenotypeID()); } + return TRUE; } /** @@ -231,12 +253,18 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * * @param MCL_TEMPLATE $mcl_tmpl * @param string $dataset_name + * + * @return boolean */ - public function addDataset(MCL_TEMPLATE $mcl_tmpl, $dataset_name) { + public function addDataset(MCL_TEMPLATE $mcl_tmpl = NULL, $dataset_name) { if ($dataset_name) { - $mcl_dataset = MCL_CHADO_DATASET::getDataset($dataset_name); - $mcl_tmpl->addLink('nd_experiment_project', 'nd_experiment_id', $this->nd_experiment_id, 'project_id', $mcl_dataset->getProjectID()); + $dataset = MCL_CHADO_DATASET::getDataset($dataset_name); + if (!$dataset) { + return FALSE; + } + return $this->addLink($mcl_tmpl, 'nd_experiment_project', 'nd_experiment_id', $this->nd_experiment_id, 'project_id', $dataset->getProjectID()); } + return TRUE; } /** @@ -245,18 +273,27 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * @param MCL_TEMPLATE $mcl_tmpl * @param string $contact * @param string $separator + * + * @return boolean */ - public function addContact(MCL_TEMPLATE $mcl_tmpl, $contact, $separator = '') { + public function addContact(MCL_TEMPLATE $mcl_tmpl = NULL, $contact, $separator = '') { + $flag = TRUE; if ($contact) { - $names = preg_split($mcl_tmpl->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); + $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); $mcl_contact = MCL_CHADO_CONTACT::getContact($name); if ($mcl_contact) { - $mcl_tmpl->addLink('nd_experiment_contact', 'nd_experiment_id', $this->nd_experiment_id, 'contact_id', $mcl_contact->getContactID()); + if (!$this->addLink($mcl_tmpl, 'nd_experiment_contact', 'nd_experiment_id', $this->nd_experiment_id, 'contact_id', $mcl_contact->getContactID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -265,17 +302,26 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addReference(MCL_TEMPLATE $mcl_tmpl, $reference, $separator = '') { + public function addReference(MCL_TEMPLATE $mcl_tmpl = NULL, $reference, $separator = '') { + $flag = TRUE; if ($reference) { - $pub_ids = preg_split($mcl_tmpl->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); + $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); if ($mcl_pub) { - $mcl_tmpl->addLink('nd_experiment_pub', 'nd_experiment_id', $this->nd_experiment_id, 'pub_id', $pub_id); + if (!$this->addLink($mcl_tmpl, 'nd_experiment_pub', 'nd_experiment_id', $this->nd_experiment_id, 'pub_id', $pub_id)) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_organism.class.inc b/includes/class/mcl_chado_class/mcl_chado_organism.class.inc index ff6c362..1799fb0 100644 --- a/includes/class/mcl_chado_class/mcl_chado_organism.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_organism.class.inc @@ -61,21 +61,26 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { * @param string $genus * @param string $species * @param string separator + * + * @return boolean */ - public static function checkOrganism(MCL_TEMPLATE $mcl_tmpl, $genus, $species, $separator = '') { + public static function checkOrganism(MCL_TEMPLATE $mcl_tmpl = NULL, $genus, $species, $separator = '') { + $flag = TRUE; if ($genus && $species) { - $sps = preg_split($mcl_tmpl->getSepRegex($separator), $species, NULL, PREG_SPLIT_NO_EMPTY); + $sps = preg_split(self::getSepRegex($separator), $species, NULL, PREG_SPLIT_NO_EMPTY); foreach ($sps as $sp) { $sp = trim($sp); // Gets the orgainsm. $mcl_orgainsm = MCL_CHADO_ORGANISM::getOrganism($genus, $sp); if (!$mcl_orgainsm) { - $mcl_tmpl->updateMsg('E', "(genus, species) = ($genus, $sp) not found in organism"); + self::updateMsg($mcl_tmpl, 'E', "(genus, species) = ($genus, $sp) not found in organism"); + $flag = FALSE; } } } + return $flag; } /** @@ -94,6 +99,50 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { return MCL_CHADO_ORGANISM::bykey($args); } + /** + * Adds a orgainsm. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $genus + * @param string $species + * + * @return MCL_CHADO_ORGANISM + */ + public static function addOrganism(MCL_TEMPLATE $mcl_tmpl = NULL, $genus, $species) { + + // Sets the arguments. + $args = array( + 'genus' => $genus, + 'species' => $species, + ); + + // Checks the arguments. + if (!self::checkReqArgs($args)) { + return NULL; + } + + // Checks for duplication. + $mcl_orgainsm = MCL_CHADO_ORGANISM::byKey($args); + if ($mcl_orgainsm) { + self::addMsg($mcl_tmpl, 'D', 'orgainsm', $args); + } + else { + + // Adds a new orgainsm. + $args['type_id'] = $type_id; + $args['description'] = $description; + $mcl_orgainsm = new MCL_CHADO_ORGANISM($args); + if ($mcl_orgainsm->insert()) { + self::addMsg($mcl_tmpl, 'N', 'orgainsm', $args); + } + else { + self::addMsg($mcl_tmpl, 'E', 'orgainsm', $args); + return NULL; + } + } + return $mcl_orgainsm; + } + /** * Adds N/A organism. * @@ -115,4 +164,109 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { } return $mcl_organism; } + + /** + * Adds a property. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $cv_name + * @param string $cvterm_name + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'organismprop', 'organism_id', $this->organism_id, $type_id, $value, $separator); + } + return TRUE; + } + + /** + * Adds a related organism. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param MCL_CHADO_ORGANISM $organism + * @param integer $type_id_relationship + * + * @return boolean + */ + public function addRelatedOrganism(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_ORGANISM $organism, $type_id_relationship) { + if ($organism) { + return $this->addRelationship($mcl_tmpl, 'organism_relationship', 'subject_organism_id', $this->organism_id, 'object_organism_id', $organism->getOrganismID(), $type_id_relationship); + } + return TRUE; + } + + /** + * Adds a dbxref to organism_dbxref. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param MCL_CHADO_DBXREF $dbxref + * + * @return boolean + */ + public function addDBXref(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_DBXREF $dbxref) { + return $this->addLink($mcl_tmpl, 'organism_dbxref', 'organism_id', $this->organism_id, 'dbxref_id', $dbxref->getDbxrefID()); + } + + /** + * Adds image to organism_image. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $reference + * @param string $separator + * + * @return boolean + */ + public function addImage(MCL_TEMPLATE $mcl_tmpl = NULL, $image, $separator = '') { + $flag = TRUE; + if ($image) { + $eimage_ids = preg_split($this->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); + foreach ($eimage_ids as $eimage_id) { + $eimage_id = trim($eimage_id); + $mcl_image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); + if ($mcl_image) { + if (!$this->addLink($mcl_tmpl, 'organism_image', 'organism_id', $this->organism_id, 'eimage_id', $mcl_image->getEimageID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; + } + } + } + return $flag; + } + + /** + * Adds reference to organism_pub. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $reference + * @param string $separator + * + * @return boolean + */ + public function addReference(MCL_TEMPLATE $mcl_tmpl = NULL, $reference, $separator = '') { + $flag = TRUE; + if ($reference) { + $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); + foreach ($pub_ids as $pub_id) { + $pub_id = trim($pub_id); + $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); + if ($mcl_pub) { + if (!$this->addLink($mcl_tmpl, 'organism_pub', 'organism_id', $this->organism_id, 'pub_id', $pub_id)) { + $flag = FALSE; + } + } + else { + $flag = FALSE; + } + } + } + return $flag; + } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_phenotype.class.inc b/includes/class/mcl_chado_class/mcl_chado_phenotype.class.inc index de6ed17..83347c5 100644 --- a/includes/class/mcl_chado_class/mcl_chado_phenotype.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_phenotype.class.inc @@ -36,20 +36,20 @@ class MCL_CHADO_PHENOTYPE extends CHADO_PHENOTYPE { * * @return MCL_CHADO_PHENOTYPE */ - public static function addPhenotype(MCL_TEMPLATE $mcl_tmpl, $uniquename, $attr_id, $value) { + public static function addPhenotype(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $attr_id, $value) { // Sets the arguments. $args = array('uniquename' => $uniquename); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_phenotype = MCL_CHADO_PHENOTYPE::byKey($args); if ($mcl_phenotype) { - $mcl_tmpl->addMsg('D', 'phenotype', $args); + self::addMsg($mcl_tmpl, 'D', 'phenotype', $args); } else { @@ -58,10 +58,11 @@ class MCL_CHADO_PHENOTYPE extends CHADO_PHENOTYPE { $args['attr_id'] = $attr_id; $mcl_phenotype = new MCL_CHADO_PHENOTYPE($args); if ($mcl_phenotype->insert()) { - $mcl_tmpl->addMsg('N', 'phenotype', $args); + self::addMsg($mcl_tmpl, 'N', 'phenotype', $args); } else { - $mcl_tmpl->addMsg('E', 'phenotype', $args); + self::addMsg($mcl_tmpl, 'E', 'phenotype', $args); + return NULL; } } return $mcl_phenotype; diff --git a/includes/class/mcl_chado_class/mcl_chado_pub.class.inc b/includes/class/mcl_chado_class/mcl_chado_pub.class.inc index ac1cbb6..490432d 100644 --- a/includes/class/mcl_chado_class/mcl_chado_pub.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_pub.class.inc @@ -41,20 +41,25 @@ class MCL_CHADO_PUB extends CHADO_PUB { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public static function checkPUB(MCL_TEMPLATE $mcl_tmpl, $reference, $separator) { + public static function checkPUB(MCL_TEMPLATE $mcl_tmpl = NULL, $reference, $separator) { + $flag = TRUE; if ($reference) { // Checks the pub. - $pub_ids = preg_split($mcl_tmpl->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); + $pub_ids = preg_split(self::getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); $pub = MCL_CHADO_PUB::getPub($pub_id); if (!$pub) { - $mcl_tmpl->updateMsg('E', "(pub_id) = ($pub_id) not found in pub"); + self::updateMsg($mcl_tmpl, 'E', "(pub_id) = ($pub_id) not found in pub"); + $flag = FALSE; } } } + return $flag; } /** diff --git a/includes/class/mcl_chado_class/mcl_chado_stock.class.inc b/includes/class/mcl_chado_class/mcl_chado_stock.class.inc index f8f7550..a3f2bc4 100644 --- a/includes/class/mcl_chado_class/mcl_chado_stock.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_stock.class.inc @@ -61,26 +61,6 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { return $stock_arr; } - /** - * Checks the type of stock. If not, write the error messasge to the log. - * - * @param MCL_TEMPLATE $mcl_tmpl - * @param string $stock_type - */ - public static function checkType(MCL_TEMPLATE $mcl_tmpl, $stock_type) { - if ($stock_type) { - if (!in_array(strtolower($stock_type), $mcl_tmpl->valid_stock_types)) { - $mcl_tmpl->updateMsg('E', "Error - germplasm_type : '$stock_type' is not valid germplasm type"); - } - else { - $cvterm = MCL_CHADO_CVTERM::getCvterm('SITE_CV', $stock_type); - if (!$cvterm) { - $mcl_tmpl->updateMsg('E', "Error - germplasm_type : '$stock_type' does not exist"); - } - } - } - } - /** * Checks the existance of stock. If not, write the error messasge * to the log. @@ -90,19 +70,26 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param string $genus * @param string $species * @param string $separator + * + * @return boolean */ - public static function checkStock(MCL_TEMPLATE $mcl_tmpl, $stock, $genus = '', $species = '', $separator = '') { + public static function checkStock(MCL_TEMPLATE $mcl_tmpl = NULL, $stock, $genus = '', $species = '', $separator = '') { + $flag = TRUE; if ($stock) { // Gets the organism_id. $organism_id = NULL; if ($genus && $species) { $organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if (!$organism) { + self::updateMsg($mcl_tmpl, 'E', "$genus $species not found in organism"); + return FALSE; + } $organism_id = $organism->getOrganismID(); } // Gets the uniquenames. - $uniquenames = preg_split($mcl_tmpl->getSepRegex($separator), $stock, NULL, PREG_SPLIT_NO_EMPTY); + $uniquenames = preg_split(self::getSepRegex($separator), $stock, NULL, PREG_SPLIT_NO_EMPTY); foreach ($uniquenames as $uniquename) { $uniquename = trim($uniquename); @@ -122,18 +109,20 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { $args['organism_id'] = $diff_organism->getOrganismID(); } else { - $mcl_tmpl->updateMsg('E', "$genus $species not found in organism"); - return; + self::updateMsg($mcl_tmpl, 'E', "$genus $species not found in organism"); + $flag = FALSE; } } // Checks the stock. $mcl_stock = MCL_CHADO_STOCK::byKey($args); if (!$mcl_stock) { - $mcl_tmpl->updateMsg('E', $mcl_tmpl->arrStr($args) . " not found in stock"); + self::updateMsg($mcl_tmpl, 'E', self::arrStr($args) . " not found in stock"); + $flag = FALSE; } } } + return $flag; } /** @@ -142,20 +131,25 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param MCL_TEMPLATE $mcl_tmpl * @param string $alias * @param string $separator + * + * @return boolean */ - public static function checkAlias(MCL_TEMPLATE $mcl_tmpl, $alias, $separator = '') { + public static function checkAlias(MCL_TEMPLATE $mcl_tmpl = NULL, $alias, $separator = '') { + $flag = TRUE; if ($alias) { // Gets the alias. - $aliases = preg_split($mcl_tmpl->getSepRegex($separator), $alias, NULL, PREG_SPLIT_NO_EMPTY); + $aliases = preg_split(self::getSepRegex($separator), $alias, NULL, PREG_SPLIT_NO_EMPTY); foreach ($aliases as $value) { $tmp = preg_split("/:/", $value); $num_elem = sizeof($tmp); if ($num_elem > 2) { - $mcl_tmpl->updateMsg('E', "$value is not a valid format. It should be alias_type:alias"); + self::updateMsg($mcl_tmpl, 'E', "$value is not a valid format. It should be alias_type:alias"); + $flag = FALSE; } } } + return $flag; } /** @@ -187,13 +181,13 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * * @param MCL_TEMPLATE $mcl_tmpl * @param string $uniquename + * @param string $name * @param integer $organism_id * @param integer $type_id - * @param string $name * * @return MCL_CHADO_STOCK */ - public static function addStock(MCL_TEMPLATE $mcl_tmpl, $uniquename, $name, $organism_id, $type_id) { + public static function addStock(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $name, $organism_id, $type_id) { // Sets the arguments. $args = array( @@ -202,14 +196,14 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_stock = MCL_CHADO_STOCK::byKey($args); if ($mcl_stock) { - $mcl_tmpl->addMsg('D', 'stock', $args); + self::addMsg($mcl_tmpl, 'D', 'stock', $args); } else { @@ -218,10 +212,78 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { $args['name'] = $name; $mcl_stock = new MCL_CHADO_STOCK($args); if ($mcl_stock->insert()) { - $mcl_tmpl->addMsg('N', 'stock', $args); + self::addMsg($mcl_tmpl, 'N', 'stock', $args); + } + else { + self::addMsg($mcl_tmpl, 'E', 'stock', $args); + return NULL; + } + } + return $mcl_stock; + } + + /** + * Adds a stock by a secondary ID. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $uniquename + * @param string $secondary_id + * @param integer $organism_id + * @param integer $type_id + * + * @return MCL_CHADO_STOCK + */ + public static function addStockBy2ndID(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $secondary_id, $organism_id, $type_id) { + + // Sets the arguments. + $args = array( + 'uniquename' => $uniquename, + 'name' => $secondary_id, + 'organism_id' => $organism_id, + ); + + // Checks the arguments. + if (!self::checkReqArgs($args)) { + return NULL; + } + + // Checks for duplication with the secondary ID. + $args = array( + 'name' => $secondary_id, + 'organism_id' => $organism_id, + ); + $mcl_stock = MCL_CHADO_STOCK::byKey($args); + if ($mcl_stock) { + self::addMsg($mcl_tmpl, 'D', 'stock', $args); + } + else { + + // Checks for duplication with the uniquename. + $args = array( + 'uniquename' => $uniquename, + 'organism_id' => $organism_id, + ); + $mcl_stock = MCL_CHADO_STOCK::byKey($args); + if ($mcl_stock) { + self::updateMsg($mcl_tmpl, 'E', "The uniquename ($uniquename) has a different secondary ID"); } else { - $mcl_tmpl->addMsg('E', 'stock', $args); + + // Adds a new stock. + $args = array( + 'uniquename' => $uniquename, + 'name' => $secondary_id, + 'organism_id' => $organism_id, + 'type_id' => $type_id, + ); + $mcl_stock = new MCL_CHADO_STOCK($args); + if ($mcl_stock->insert()) { + self::addMsg($mcl_tmpl, 'N', 'stock', $args); + } + else { + self::addMsg($mcl_tmpl, 'E', 'stock', $args); + return NULL; + } } } return $mcl_stock; @@ -235,10 +297,15 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param string $cvterm_name * @param string $value * @param string $separator + * + * @return boolean */ - public function addProp(MCL_TEMPLATE $mcl_tmpl, $cv_name, $cvterm_name, $value, $separator = '') { - $type_id = $mcl_tmpl->getCvtermID($cv_name, $cvterm_name); - $mcl_tmpl->addProperty('stockprop', 'stock_id', $this->stock_id, $type_id, $value, $separator); + public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { + if ($value) { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->addProperty($mcl_tmpl, 'stockprop', 'stock_id', $this->stock_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -247,11 +314,14 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_STOCK $stock * @param integer $type_id_relationship + * + * @return boolean */ - public function addRelatedStock(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_STOCK $stock, $type_id_relationship) { + public function addRelatedStock(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_STOCK $stock, $type_id_relationship) { if ($stock) { - $mcl_tmpl->addRelationship('stock_relationship', 'subject_id', $this->stock_id, 'object_id', $stock->getStockID(), $type_id_relationship); + return $this->addRelationship($mcl_tmpl, 'stock_relationship', 'subject_id', $this->stock_id, 'object_id', $stock->getStockID(), $type_id_relationship); } + return TRUE; } /** @@ -260,13 +330,14 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_ND_EXPERIMENT $cross * @param integer $type_id + * + * @return boolean */ - public function addCross(MCL_TEMPLATE $mcl_tmpl, $cross, $type_id) { + public function addCross(MCL_TEMPLATE $mcl_tmpl = NULL, $cross, $type_id) { if ($cross) { - - // Links this progeny and dataset cross_number. - $mcl_tmpl->addLink('nd_experiment_stock', 'stock_id', $this->stock_id, 'nd_experiment_id', $cross->getNdExperimentID(), $type_id); + return $this->addLink($mcl_tmpl, 'nd_experiment_stock', 'stock_id', $this->stock_id, 'nd_experiment_id', $cross->getNdExperimentID(), $type_id); } + return TRUE; } /** @@ -276,8 +347,10 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param string $uniquename * @param integer $organism_id * @param integer $type_id_relationship + * + * @return boolean */ - public function addParent(MCL_TEMPLATE $mcl_tmpl, $uniquename, $organism_id, $type_id_relationship) { + public function addParent(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $organism_id, $type_id_relationship) { if ($uniquename && $type_id_relationship) { // If '::' found in uniquename, update uniquename and organism_id. @@ -298,12 +371,16 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { } $parent = MCL_CHADO_STOCK::byKey($args); if ($parent) { - $parent->addRelatedStock($mcl_tmpl, $this, $type_id_relationship); + if (!$parent->addRelatedStock($mcl_tmpl, $this, $type_id_relationship)) { + return FALSE; + } } else { - $mcl_tmpl->updateMsg('E', "Parent '$uniquename' dose not exists in stock table."); + $this->updateMsg($mcl_tmpl, 'E', "Parent '$uniquename' dose not exists in stock table."); + return FALSE; } } + return TRUE; } /** @@ -312,10 +389,13 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addAlias(MCL_TEMPLATE $mcl_tmpl, $alias, $separator = '') { + public function addAlias(MCL_TEMPLATE $mcl_tmpl = NULL, $alias, $separator = '') { + $flag = TRUE; if ($alias) { - $aliases = preg_split($mcl_tmpl->getSepRegex($separator), $alias, NULL, PREG_SPLIT_NO_EMPTY); + $aliases = preg_split($this->getSepRegex($separator), $alias, NULL, PREG_SPLIT_NO_EMPTY); foreach ($aliases as $value) { $tmp = preg_split("/:/", $value); $alias_type = 'alias'; @@ -324,9 +404,12 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { $value = $tmp[1]; } $alias_type = (strtolower($alias_type) == 'cultivar') ? 'cultivar' : 'alias'; - $this->addProp($mcl_tmpl, 'SITE_CV', $alias_type, $value); + if (!$this->addProp($mcl_tmpl, 'SITE_CV', $alias_type, $value)) { + $flag = FALSE; + } } } + return $flag; } /** @@ -334,9 +417,14 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * * @param MCL_TEMPLATE $mcl_tmpl * @param MCL_CHADO_DBXREF $dbxref + * + * @return boolean */ - public function addDBXref(MCL_TEMPLATE $mcl_tmpl, MCL_CHADO_DBXREF $dbxref) { - $mcl_tmpl->addLink('stock_dbxref', 'stock_id', $this->stock_id, 'dbxref_id', $dbxref->getDbxrefID()); + public function addDBXref(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_DBXREF $dbxref) { + if ($dbxref) { + return $this->addLink($mcl_tmpl, 'stock_dbxref', 'stock_id', $this->stock_id, 'dbxref_id', $dbxref->getDbxrefID()); + } + return TRUE; } /** @@ -345,18 +433,27 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param MCL_TEMPLATE $mcl_tmpl * @param string $contact * @param string $separator + * + * @return boolean - public function addContact(MCL_TEMPLATE $mcl_tmpl, $contact, $separator = '') { + public function addContact(MCL_TEMPLATE $mcl_tmpl = NULL, $contact, $separator = '') { + $flag = TRUE; if ($contact) { - $names = preg_split($mcl_tmpl->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); + $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); $mcl_contact = MCL_CHADO_CONTACT::getContact($name); if ($mcl_contact) { - $mcl_tmpl->addLink('stock_contact', 'stock_id', $this->stock_id, 'contact_id', $mcl_contact->getContactID()); + if (!$this->addLink($mcl_tmpl, 'stock_contact', 'stock_id', $this->stock_id, 'contact_id', $mcl_contact->getContactID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } */ /** @@ -365,18 +462,27 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addImage(MCL_TEMPLATE $mcl_tmpl, $image, $separator = '') { + public function addImage(MCL_TEMPLATE $mcl_tmpl = NULL, $image, $separator = '') { + $flag = TRUE; if ($image) { - $eimage_ids = preg_split($mcl_tmpl->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); + $eimage_ids = preg_split($this->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); foreach ($eimage_ids as $eimage_id) { $eimage_id = trim($eimage_id); $mcl_image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); if ($mcl_image) { - $mcl_tmpl->addLink('stock_image', 'stock_id', $this->stock_id, 'eimage_id', $mcl_image->getEimageID()); + if (!$this->addLink($mcl_tmpl, 'stock_image', 'stock_id', $this->stock_id, 'eimage_id', $mcl_image->getEimageID())) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -385,18 +491,27 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @param MCL_TEMPLATE $mcl_tmpl * @param string $reference * @param string $separator + * + * @return boolean */ - public function addReference(MCL_TEMPLATE $mcl_tmpl, $reference, $separator = '') { + public function addReference(MCL_TEMPLATE $mcl_tmpl = NULL, $reference, $separator = '') { + $flag = TRUE; if ($reference) { - $pub_ids = preg_split($mcl_tmpl->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); + $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); if ($mcl_pub) { - $mcl_tmpl->addLink('stock_pub', 'stock_id', $this->stock_id, 'pub_id', $pub_id); + if (!$this->addLink($mcl_tmpl, 'stock_pub', 'stock_id', $this->stock_id, 'pub_id', $pub_id)) { + $flag = FALSE; + } + } + else { + $flag = FALSE; } } } + return $flag; } /** @@ -404,8 +519,11 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * * @param MCL_TEMPLATE $mcl_tmpl * @param string $previous_entry + * + * @return boolean */ - public function addPreviousEntry(MCL_TEMPLATE $mcl_tmpl, $previous_entry) { + public function addPreviousEntry(MCL_TEMPLATE $mcl_tmpl = NULL, $previous_entry) { + $flag = TRUE; if ($previous_entry) { // Checks the sample. @@ -413,11 +531,15 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { if ($sample) { // Adds the sample_id in stockprop. - $this->addProp($mcl_tmpl, 'SITE_CV', 'previous_entry', $sample->getStockID()); + if (!$this->addProp($mcl_tmpl, 'SITE_CV', 'previous_entry', $sample->getStockID())) { + $flag = FALSE; + } } else { - $mcl_tmpl->updateMsg('E', "Error - sample : '$previous_entry' does not exist"); + $this->updateMsg($mcl_tmpl, 'E', "Error - sample : '$previous_entry' does not exist"); + $flag = FALSE; } } + return $flag; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_synonym.class.inc b/includes/class/mcl_chado_class/mcl_chado_synonym.class.inc index 0ca8ae7..4c8dbcd 100644 --- a/includes/class/mcl_chado_class/mcl_chado_synonym.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_synonym.class.inc @@ -59,7 +59,7 @@ class MCL_CHADO_SYNONYM extends CHADO_SYNONYM { * * @return MCL_CHADO_SYNONYM */ - public static function addSynonym(MCL_TEMPLATE $mcl_tmpl, $name, $type_id) { + public static function addSynonym(MCL_TEMPLATE $mcl_tmpl = NULL, $name, $type_id) { // Sets the arguments. $args = array( @@ -68,24 +68,25 @@ class MCL_CHADO_SYNONYM extends CHADO_SYNONYM { ); // Checks the arguments. - if (!$mcl_tmpl->checkReqArgs($args)) { + if (!self::checkReqArgs($args)) { return NULL; } // Checks for duplication. $mcl_synonym = MCL_CHADO_SYNONYM::byKey($args); if ($mcl_synonym) { - $mcl_tmpl->addMsg('D', 'synonym', $args); + self::addMsg($mcl_tmpl, 'D', 'synonym', $args); } else { // Adds a new synonym. $mcl_synonym = new MCL_CHADO_SYNONYM($args); if ($mcl_synonym->insert()) { - $mcl_tmpl->addMsg('N', 'synonym', $args); + self::addMsg($mcl_tmpl, 'N', 'synonym', $args); } else { - $mcl_tmpl->addMsg('E', 'synonym', $args); + self::addMsg($mcl_tmpl, 'E', 'synonym', $args); + return NULL; } } return $mcl_synonym; diff --git a/includes/class/mcl_chado_class/mcl_chado_trait.class.inc b/includes/class/mcl_chado_class/mcl_chado_trait.class.inc index 1830ef7..e69fbb9 100644 --- a/includes/class/mcl_chado_class/mcl_chado_trait.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_trait.class.inc @@ -40,8 +40,10 @@ class MCL_CHADO_TRAIT extends MCL_CHADO_CVTERM { * @param MCL_TEMPLATE $mcl_tmpl * @param string $cvterm_name * @param string $cv_name + * + * @return boolean */ - public static function checkTrait(MCL_TEMPLATE $mcl_tmpl, $cvterm_name, $cv_name = NULL) { + public static function checkTrait(MCL_TEMPLATE $mcl_tmpl = NULL, $cvterm_name, $cv_name = NULL) { // Updates cv.name if (!$cv_name) { @@ -50,28 +52,15 @@ class MCL_CHADO_TRAIT extends MCL_CHADO_CVTERM { // Checks cvterm. if ($cv_name && $cvterm_name) { + // Gets the cvterm. $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); if (!$mcl_cvterm) { - $mcl_tmpl->updateMsg('E', "(cv_name, cvterm_name) = ($cv_name, $cvterm_name) not found in cvterm"); - } - } - } - - /** - * Checks the trait category. All valid trait ontologies are liste in the - * "valid_trait_categories" array. - * - * @param MCL_TEMPLATE $mcl_tmpl - * @param string $cv_name - * @param string $cvterm_name - */ - public static function checkCategory(MCL_TEMPLATE $mcl_tmpl, $trait_category) { - if ($trait_category) { - if (!in_array(strtolower($trait_category), $mcl_tmpl->valid_trait_categories)) { - $mcl_tmpl->updateMsg('E', "Error - trait category : '$trait_category' is not a valid trait category"); + self::updateMsg($mcl_tmpl, 'E', "(cv_name, cvterm_name) = ($cv_name, $cvterm_name) not found in cvterm"); + return FALSE; } } + return TRUE; } /** @@ -105,11 +94,14 @@ class MCL_CHADO_TRAIT extends MCL_CHADO_CVTERM { * * @return MCL_CHADO_TRAIT */ - public static function addTrait(MCL_TEMPLATE $mcl_tmpl, $cvterm_name, $definition = '', $accession = '') { + public static function addTrait(MCL_TEMPLATE $mcl_tmpl = NULL, $cvterm_name, $definition = '', $accession = '') { $db_name = MCL_VAR::getValueByName('SITE_DB'); $cv_name = MCL_VAR::getValueByName('SITE_TRAIT_ONTOLOGY'); - $mcl_cvterm = MCL_CHADO_CVTERM::addCvterm($mcl_tmpl, $db_name, $cv_name, $cvterm_name, $definition, $accession); - return MCL_CHADO_TRAIT::byKey(array('cvterm_id' => $mcl_cvterm->getCvtermID())); + $cvterm = MCL_CHADO_CVTERM::addCvterm($mcl_tmpl, $db_name, $cv_name, $cvterm_name, $definition, $accession); + if ($cvterm) { + return MCL_CHADO_TRAIT::byKey(array('cvterm_id' => $cvterm->getCvtermID())); + } + return NULL; } /** @@ -119,20 +111,27 @@ class MCL_CHADO_TRAIT extends MCL_CHADO_CVTERM { * @param string $trait_category * @param integer $type_id * @param string $separator + * + * @return boolean */ - public function addCategory(MCL_TEMPLATE $mcl_tmpl, $trait_category, $type_id, $separator = '') { + public function addCategory(MCL_TEMPLATE $mcl_tmpl = NULL, $trait_category, $type_id, $separator = '') { + $flag = TRUE; if ($trait_category) { $categories = preg_split("/[,;]/", $trait_category, NULL, PREG_SPLIT_NO_EMPTY); $cv_name = MCL_VAR::getValueByName('SITE_TRAIT_ONTOLOGY'); foreach ($categories as $category) { $mcl_category = MCL_CHADO_CVTERM::getCvterm($cv_name, $category); if ($mcl_category) { - $mcl_tmpl->addRelationship('cvterm_relationship', 'subject_id', $this->cvterm_id, 'object_id', $mcl_category->getCvtermID(), $type_id); + if (!$this->addRelationship($mcl_tmpl, 'cvterm_relationship', 'subject_id', $this->cvterm_id, 'object_id', $mcl_category->getCvtermID(), $type_id)) { + $flag = FALSE; + } } else { - $mcl_tmpl->updateMsg('W', "Warning trait_category : '$category' not found cvterm"); + $this->updateMsg($mcl_tmpl, 'E', "Warning trait_category : '$category' not found cvterm"); + $flag = FALSE; } } } + return $flag; } } \ No newline at end of file diff --git a/includes/class/mcl_class_loader.class.inc b/includes/class/mcl_class_loader.class.inc index fee596d..5644be6 100644 --- a/includes/class/mcl_class_loader.class.inc +++ b/includes/class/mcl_class_loader.class.inc @@ -65,7 +65,9 @@ class MCL_CLASS_LOADER { else if (preg_match("/^MCL_JOB/", $class_name, $matches)) { $path .= 'job/'; } - + else if (preg_match("/^MCL_DATA_VALID/", $class_name, $matches)) { + $path .= 'data_valid/'; + } else if (preg_match("/^MCL_TABLE/", $class_name, $matches)) { $path .= 'table/'; } diff --git a/includes/class/public_table_class/public_mcl_data_valid.class.inc b/includes/class/public_table_class/public_mcl_data_valid.class.inc new file mode 100644 index 0000000..09ea532 --- /dev/null +++ b/includes/class/public_table_class/public_mcl_data_valid.class.inc @@ -0,0 +1,295 @@ + 'serial', + 'data_valid_type_id' => 'integer', + 'name' => 'character_varying(255)', + 'cvterm_id' => 'integer', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->data_valid_id = array_key_exists('data_valid_id', $details) ? $details['data_valid_id'] : ''; + $this->data_valid_type_id = array_key_exists('data_valid_type_id', $details) ? $details['data_valid_type_id'] : ''; + $this->name = array_key_exists('name', $details) ? $details['name'] : ''; + $this->cvterm_id = array_key_exists('cvterm_id', $details) ? $details['cvterm_id'] : ''; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate PUBLIC_MCL_DATA_VALID by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM mcl_data_valid WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['data_valid_type_id'] = $this->data_valid_type_id; + $fields['name'] = $this->name; + if (is_numeric($this->cvterm_id)) { $fields['cvterm_id'] = $this->cvterm_id; } + + // Inserts the record. + $this->data_valid_id = db_insert('mcl_data_valid') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['data_valid_type_id'] = $this->data_valid_type_id; + $fields['name'] = $this->name; + if (is_numeric($this->cvterm_id)) { $fields['cvterm_id'] = $this->cvterm_id; } + + // Updates the record. + db_update('mcl_data_valid') + ->fields($fields) + ->condition('data_valid_id', $this->data_valid_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('mcl_data_valid') + ->condition('data_valid_id', $this->data_valid_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the data_valid_id. + * + * @retrun serial + */ + public function getDataValidID() { + return $this->data_valid_id; + } + + /** + * Updates the data_valid_id. + * + * @param serial $data_valid_id + */ + public function setDataValidID($data_valid_id) { + $this->data_valid_id = $data_valid_id; + } + + /** + * Retrieves the data_valid_type_id. + * + * @retrun integer + */ + public function getDataValidTypeID() { + return $this->data_valid_type_id; + } + + /** + * Updates the data_valid_type_id. + * + * @param integer $data_valid_type_id + */ + public function setDataValidTypeID($data_valid_type_id) { + $this->data_valid_type_id = $data_valid_type_id; + } + + /** + * Retrieves the name. + * + * @retrun character_varying(255) + */ + public function getName() { + return $this->name; + } + + /** + * Updates the name. + * + * @param character_varying(255) $name + */ + public function setName($name) { + $this->name = $name; + } + + /** + * Retrieves the cvterm_id. + * + * @retrun integer + */ + public function getCvtermID() { + return $this->cvterm_id; + } + + /** + * Updates the cvterm_id. + * + * @param integer $cvterm_id + */ + public function setCvtermID($cvterm_id) { + $this->cvterm_id = $cvterm_id; + } +} \ No newline at end of file diff --git a/includes/class/public_table_class/public_mcl_data_valid_type.class.inc b/includes/class/public_table_class/public_mcl_data_valid_type.class.inc new file mode 100644 index 0000000..98d1d33 --- /dev/null +++ b/includes/class/public_table_class/public_mcl_data_valid_type.class.inc @@ -0,0 +1,272 @@ + 'serial', + 'type' => 'character_varying(255)', + 'cv_id' => 'integer', + ); + + /** + * Implements the class constructor. + * + * @param $details + */ + public function __construct($details = array()) { + // Initializes data members. + $this->member_arr = $details; + $this->data_valid_type_id = array_key_exists('data_valid_type_id', $details) ? $details['data_valid_type_id'] : ''; + $this->type = array_key_exists('type', $details) ? $details['type'] : ''; + $this->cv_id = array_key_exists('cv_id', $details) ? $details['cv_id'] : ''; + } + + /** + * Implements the class destructor. + */ + public function __destruct() { + } + + /** + * Generate PUBLIC_MCL_DATA_VALID_TYPE by key(s). + */ + public static function byKey($keys) { + + // Returns NULL if non-integer value are given to the data member whose + // data type is 'integer'. + $where_arr = array(); + $args = array(); + foreach ($keys as $key => $value) { + + // Returns NULL if $value is empty string. + if ($value === '') { + return NULL; + } + + // Gets data type. + $data_type = self::$data_types[$key]; + + // Checks the value if data type is 'integer'. + if (in_array($data_type, array('serial', 'integer'))) { + if (!is_int((int)$value)) { + return NULL; + } + } + + // Adds LOWER() function to the characters. + if (preg_match("/^(char|text)/", $data_type)) { + $where_arr []= " LOWER($key) = LOWER(:$key) "; + } + else { + $where_arr []= " $key = :$key "; + } + $args[":$key"] = $keys[$key]; + } + + // Gets the table properties. + $sql = "SELECT * FROM mcl_data_valid_type WHERE " . implode(" AND " , $where_arr); + $details = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + if ($details) { + return new self($details); + } + return NULL; + } + + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + + /** + * Adds a new record. + */ + public function insert() { + + $transaction = db_transaction(); + try { + + // TODO:Checks for duplication. + $dup = FALSE; + + // Inserts the record if not duplicated. + if (!$dup) { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['type'] = $this->type; + if (is_numeric($this->cv_id)) { $fields['cv_id'] = $this->cv_id; } + + // Inserts the record. + $this->data_valid_type_id = db_insert('mcl_data_valid_type') + ->fields($fields) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Updates the record. + */ + public function update() { + + $transaction = db_transaction(); + try { + + // Populates all fields. The attribute with 'NOT NULL' would be skipped + // if the value is empty. + $fields = array(); + $fields['type'] = $this->type; + if (is_numeric($this->cv_id)) { $fields['cv_id'] = $this->cv_id; } + + // Updates the record. + db_update('mcl_data_valid_type') + ->fields($fields) + ->condition('data_valid_type_id', $this->data_valid_type_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /** + * Deletes the record. + */ + public function delete() { + + $transaction = db_transaction(); + try { + + db_delete('mcl_data_valid_type') + ->condition('data_valid_type_id', $this->data_valid_type_id, '=') + ->execute(); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog('mod', $e->getMessage(), array(), WATCHDOG_ERROR); + return FALSE; + } + return TRUE; + } + + /* + * Defines getters and setters below. + */ + /** + * Retrieves the data type of the member. + * + * @retrun various + */ + public function getDataType($member) { + return $this->data_types[$member]; + } + + /** + * Retrieves the data member array. + * + * @retrun array + */ + public function getMemberArr() { + return $this->member_arr; + } + + /** + * Updates the data member array. + * + * @param array $member_arr + */ + public function setMemberArr($member_arr) { + $this->member_arr = $member_arr; + } + + /** + * Retrieves the data_valid_type_id. + * + * @retrun serial + */ + public function getDataValidTypeID() { + return $this->data_valid_type_id; + } + + /** + * Updates the data_valid_type_id. + * + * @param serial $data_valid_type_id + */ + public function setDataValidTypeID($data_valid_type_id) { + $this->data_valid_type_id = $data_valid_type_id; + } + + /** + * Retrieves the type. + * + * @retrun character_varying(255) + */ + public function getType() { + return $this->type; + } + + /** + * Updates the type. + * + * @param character_varying(255) $type + */ + public function setType($type) { + $this->type = $type; + } + + /** + * Retrieves the cv_id. + * + * @retrun integer + */ + public function getCvID() { + return $this->cv_id; + } + + /** + * Updates the cv_id. + * + * @param integer $cv_id + */ + public function setCvID($cv_id) { + $this->cv_id = $cv_id; + } +} \ No newline at end of file diff --git a/includes/class/public_table_class/public_mcl_file.class.inc b/includes/class/public_table_class/public_mcl_file.class.inc index 378c780..c3b385d 100644 --- a/includes/class/public_table_class/public_mcl_file.class.inc +++ b/includes/class/public_table_class/public_mcl_file.class.inc @@ -111,6 +111,20 @@ class PUBLIC_MCL_FILE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -188,7 +202,7 @@ class PUBLIC_MCL_FILE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/public_table_class/public_mcl_job.class.inc b/includes/class/public_table_class/public_mcl_job.class.inc index 46c1296..a3bb35d 100644 --- a/includes/class/public_table_class/public_mcl_job.class.inc +++ b/includes/class/public_table_class/public_mcl_job.class.inc @@ -111,6 +111,20 @@ class PUBLIC_MCL_JOB { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -188,7 +202,7 @@ class PUBLIC_MCL_JOB { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/public_table_class/public_mcl_template.class.inc b/includes/class/public_table_class/public_mcl_template.class.inc index 84317da..a8dd721 100644 --- a/includes/class/public_table_class/public_mcl_template.class.inc +++ b/includes/class/public_table_class/public_mcl_template.class.inc @@ -93,6 +93,20 @@ class PUBLIC_MCL_TEMPLATE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -158,7 +172,7 @@ class PUBLIC_MCL_TEMPLATE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/public_table_class/public_mcl_template_type.class.inc b/includes/class/public_table_class/public_mcl_template_type.class.inc index da25817..2890fc8 100644 --- a/includes/class/public_table_class/public_mcl_template_type.class.inc +++ b/includes/class/public_table_class/public_mcl_template_type.class.inc @@ -90,6 +90,20 @@ class PUBLIC_MCL_TEMPLATE_TYPE { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -155,7 +169,7 @@ class PUBLIC_MCL_TEMPLATE_TYPE { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/public_table_class/public_mcl_user.class.inc b/includes/class/public_table_class/public_mcl_user.class.inc index fb0e35c..ae52027 100644 --- a/includes/class/public_table_class/public_mcl_user.class.inc +++ b/includes/class/public_table_class/public_mcl_user.class.inc @@ -96,6 +96,20 @@ class PUBLIC_MCL_USER { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -167,7 +181,7 @@ class PUBLIC_MCL_USER { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/public_table_class/public_mcl_var.class.inc b/includes/class/public_table_class/public_mcl_var.class.inc index 3c13d3d..9a61f1e 100644 --- a/includes/class/public_table_class/public_mcl_var.class.inc +++ b/includes/class/public_table_class/public_mcl_var.class.inc @@ -96,6 +96,20 @@ class PUBLIC_MCL_VAR { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -165,7 +179,7 @@ class PUBLIC_MCL_VAR { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/public_table_class/public_users.class.inc b/includes/class/public_table_class/public_users.class.inc index 3f3c97d..056cf7c 100644 --- a/includes/class/public_table_class/public_users.class.inc +++ b/includes/class/public_table_class/public_users.class.inc @@ -129,6 +129,20 @@ class PUBLIC_USERS { return NULL; } + /** + * Returns the foreign keys. + */ + public static function getFK() { + return NULL; + } + + /** + * Returns the related tables. + */ + public static function getRelTable() { + return NULL; + } + /** * Adds a new record. */ @@ -222,7 +236,7 @@ class PUBLIC_USERS { } /** - * Delete the record. + * Deletes the record. */ public function delete() { diff --git a/includes/class/table/mcl_table.class.inc b/includes/class/table/mcl_table.class.inc index fe75376..714235a 100644 --- a/includes/class/table/mcl_table.class.inc +++ b/includes/class/table/mcl_table.class.inc @@ -14,6 +14,8 @@ class MCL_TABLE { private $attrs = NULL; private $primary_key = NULL; private $unique_keys = NULL; + private $foreign_keys = NULL; + private $rel_tables = NULL; private $sqls = NULL; private $data_types = NULL; private $constraints = NULL; @@ -26,6 +28,8 @@ class MCL_TABLE { $this->schema_name = $schema_name; $this->attrs = array(); $this->unique_keys = array(); + $this->foreign_keys = array(); + $this->rel_tables = array(); $this->sqls = array(); // Sets class name. @@ -65,6 +69,7 @@ class MCL_TABLE { // Adds a SQL. if (in_array($type, $this->constraints)) { + if (array_key_exists($type, $this->sqls)) { $this->sqls[$type][] = $sql; } @@ -81,19 +86,18 @@ class MCL_TABLE { * Return the SQL statement. * * @param string $type + * @param boolean $flag * - * @return string + * @return string or array */ - public function getSQL($type) { - $sqls = ''; + public function getSQL($type, $flag = FALSE) { + $sqls = NULL; // Returns the SQL. if (in_array($type, $this->constraints)) { if (array_key_exists($type, $this->sqls)) { $arr = $this->sqls[$type]; - if ($arr) { - $sqls = implode("\n", $arr); - } + return ($flag) ? $arr : implode("\n", $arr); } } else { @@ -303,6 +307,42 @@ class MCL_TABLE { $this->primary_key = $primary_key; } + /** + * Retrieves the foreign keys. + * + * @retrun array + */ + public function getForeignKeys() { + return $this->foreign_keys; + } + + /** + * Updates the foreign keys. + * + * @param array $foreign_keys + */ + public function setForeignKeys($foreign_keys) { + $this->foreign_keys = $foreign_keys; + } + + /** + * Retrieves the related tables. + * + * @retrun array + */ + public function getRelTables() { + return $this->rel_tables; + } + + /** + * Updates the related tables. + * + * @param array $rel_tables + */ + public function setRelTables($rel_tables) { + $this->rel_tables = $rel_tables; + } + /** * Retrieves the unique keys. * diff --git a/includes/class/table/mcl_table_class_writer.class.inc b/includes/class/table/mcl_table_class_writer.class.inc index aca8378..1d07413 100644 --- a/includes/class/table/mcl_table_class_writer.class.inc +++ b/includes/class/table/mcl_table_class_writer.class.inc @@ -20,13 +20,12 @@ class MCL_TABLE_CLASS_WRITER { * * @param MCL_TABLE $table * @param MCL_TABLE_WRITER $writer - * @param string $extends */ - public function __construct($table, $writer, $extends = '') { + public function __construct($table, $writer) { $this->table = $table; $this->output_dir = $writer->getOutputDir(); $this->namespace = $writer->getNamespace(); - $this->extends = $extends; + $this->extends = $writer->getExtends(); // Updates the data type arrays. $this->data_type_numeric = $table->getDataTypes('NUMERIC'); @@ -271,7 +270,9 @@ class MCL_TABLE_CLASS_WRITER { $data_types = $this->getDataTypes(); $constructor = $this->getConstructor(); $destructor = $this->getDestructor(); - $generate_by_key = $this->getGenerateByKey('drupal'); + $func_bykey = $this->getFuncByKey('drupal'); + $func_getfk = $this->getFuncGetFK(); + $func_getRelTable = $this->getFuncGetRelTable(); $func_insert = $this->getFuncInsert('drupal'); $func_update = $this->getFuncUpdate('drupal'); $func_delete = $this->getFuncDelete('drupal'); @@ -317,7 +318,17 @@ $destructor /** * Generate $class_name by key(s). */ -$generate_by_key +$func_bykey + + /** + * Returns the foreign keys. + */ +$func_getfk + + /** + * Returns the related tables. + */ +$func_getRelTable /** * Adds a new record. @@ -330,7 +341,7 @@ $func_insert $func_update /** - * Delete the record. + * Deletes the record. */ $func_delete @@ -465,7 +476,7 @@ CLASS_CODE; /** * Returns the generate by key(s) of this class. */ - function getGenerateByKey($type = NULL) { + function getFuncByKey($type = NULL) { $table = $this->table; $table_name = $table->getName(); $schema_name = $this->table->getSchemaName(); @@ -522,6 +533,66 @@ CLASS_CODE; return $code; } + /** + * Returns getFK function(). + */ + function getFuncGetFK() { + $fk = 'return NULL;'; + + // Gets the foreign keys. + $f_keys = $this->table->getForeignKeys(); + if (!empty($f_keys)) { + $fk = "return array(\n"; + $rows = array(); + foreach ($f_keys as $attr => $info) { + $fk_table = $info['fk_table']; + $fk_attr = $info['fk_attr']; + $fk .= " array('$attr' => array('fk_table' => '$fk_table', 'fk_attr' => '$fk_attr')),\n"; + } + $fk .= ' );'; + } + + // getFK function. + $code = <<< CLASS_CODE + public static function getFK() { + $fk + } +CLASS_CODE; + return $code; + } + + /** + * Returns getRelTable function(). + */ + function getFuncGetRelTable() { + $rel = 'return NULL;'; + + // Gets the related tables. + $rel_tables = $this->table->getRelTables(); + if (!empty($rel_tables)) { + $rel = "return array(\n"; + $rows = array(); + foreach ($rel_tables as $attr => $table_info) { + $rel .= " '$attr' => array(\n"; + foreach ($table_info as $info) { + $fk_table = $info['table']; + $fk_attr = $info['attr']; + $rel .= " array('table' => '$fk_table', 'attr' => '$fk_attr'),\n"; + } + $rel .= " ),\n"; + } + $rel .= ' );'; + } + + // getRelTable function. + $code = <<< CLASS_CODE + public static function getRelTable() { + $rel + } +CLASS_CODE; + return $code; + } + /** * Returns insert function(). */ diff --git a/includes/class/table/mcl_table_info.class.inc b/includes/class/table/mcl_table_info.class.inc index 2661437..8572bf0 100644 --- a/includes/class/table/mcl_table_info.class.inc +++ b/includes/class/table/mcl_table_info.class.inc @@ -110,7 +110,7 @@ class MCL_TABLE_INFO { } continue; } - else if (preg_match("/^ALTER SEQUENCE ([A-Za-z0-9_]+) OWNED BY ([A-Za-z0-9_]+)\.([A-Za-z0-9_]+)/i", $line, $matches)) { + else if (preg_match("/^ALTER SEQUENCE ([A-Za-z0-9\_]+) OWNED BY ([A-Za-z0-9\_]+)\.([A-Za-z0-9\_]+)/i", $line, $matches)) { $seq_table_name = strtolower($matches[2]); $seq_attr_name = strtolower($matches[3]); if (in_array($seq_table_name, $target_tables)) { @@ -151,15 +151,15 @@ class MCL_TABLE_INFO { if ($flag_constraint) { if ($cur_table) { $const = $this->parseConstraint($line); - if ($const['type'] == 'PRIMARY') { + if ($const['type'] == 'primary') { $cur_table->setPrimaryKey($const['attr']); $cur_table->addSQL($const['type'], $sql . $line_orig); } - else if ($const['type'] == 'UNIQUE') { + else if ($const['type'] == 'unique') { $cur_table->addUniqueKey($const); $cur_table->addSQL($const['type'], $sql . $line_orig); } - else if ($const['type'] == 'FOREIGN') { + else if ($const['type'] == 'foreign') { $cur_table->addSQL($const['type'], $sql . $line_orig); } } @@ -170,9 +170,15 @@ class MCL_TABLE_INFO { } fclose($fdr); - // Updates primary key. + // Updates the primary key. $this->updatePrimaryKey($table_info); + // Updates the foreign keys. + $this->updateForeignKeys($table_info); + + // Updates the related tables. + $this->updateRelTables($table_info); + // Sets the table information. $this->setTableInfo($table_info); @@ -193,7 +199,7 @@ class MCL_TABLE_INFO { } /** - * Updates primary key. It sometimes primary key is not set. So finds a + * Updates the primary key. It sometimes primary key is not set. So finds a * field (attribute) that satisfies the following conditions and marks it * as primary key. * Conditions: @@ -218,9 +224,9 @@ class MCL_TABLE_INFO { } // Checks (3) one sequence exists. - $attrs = $info->getAttrs(); - $num_serial = 0; - $primary_key = ''; + $attrs = $info->getAttrs(); + $num_serial = 0; + $primary_key = ''; foreach ($attrs as $attr_name => $attr) { if ($attr->getDataType() == 'serial') { $num_serial++; @@ -235,6 +241,76 @@ class MCL_TABLE_INFO { } } + /** + * Updates the foreign keys. + * + * @param $table_info + */ + private function updateForeignKeys(&$table_info) { + + // Gets all foreign keys. + $fks = array(); + foreach ($table_info as $table_name => $info) { + $sqls = $info->getSQL('foreign', TRUE); + if (empty($sqls)) { + continue; + } + foreach ($sqls as $sql) { + if (preg_match("/FOREIGN KEY \(([a-z\_]+)\) REFERENCES ([a-z\_]+)\s*\(([a-z\_]+)\)/", $sql, $matches)) { + $attr = trim($matches[1]); + $fk_table = trim($matches[2]); + $fk_attr = trim($matches[3]); + $fks[$table_name][$attr] = array( + 'fk_table' => $fk_table, + 'fk_attr' => $fk_attr, + ); + } + } + } + + // Sets the foreign keys. + foreach ($table_info as $table_name => $info) { + if (array_key_exists($table_name, $fks)) { + $table_info[$table_name]->setForeignKeys($fks[$table_name]); + } + } + } + + /** + * Updates the related tables. + * + * @param $table_info + */ + private function updateRelTables(&$table_info) { + + // Gets all foreign keys. + $rel = array(); + foreach ($table_info as $table_name => $info) { + $sqls = $info->getSQL('foreign', TRUE); + if (empty($sqls)) { + continue; + } + foreach ($sqls as $sql) { + if (preg_match("/FOREIGN KEY \(([a-z\_]+)\) REFERENCES ([a-z\_]+)\s*\(([a-z\_]+)\)/", $sql, $matches)) { + $attr = trim($matches[1]); + $fk_table = trim($matches[2]); + $fk_attr = trim($matches[3]); + $rel[$fk_table][$fk_attr][] = array( + 'table' => $table_name, + 'attr' => $attr, + ); + } + } + } + + // Sets the related tables. + foreach ($table_info as $table_name => $info) { + if (array_key_exists($table_name, $rel)) { + $table_info[$table_name]->setRelTables($rel[$table_name]); + } + } + } + /** * Parse constraint line. */ @@ -246,7 +322,7 @@ class MCL_TABLE_INFO { $attr = strtolower($matches[2]); $const = array( 'name' => $const_name, - 'type' => 'PRIMARY', + 'type' => 'primary', 'attr' => $attr, ); } @@ -255,7 +331,7 @@ class MCL_TABLE_INFO { $attrs = strtolower($matches[2]); $const = array( 'name' => $const_name, - 'type' => 'UNIQUE', + 'type' => 'unique', 'attrs' => preg_split("/\s*,\s*/", $attrs), ); } @@ -266,7 +342,7 @@ class MCL_TABLE_INFO { $fk_attr = strtolower($matches[4]); $const = array( 'name' => $const_name, - 'type' => 'FOREIGN', + 'type' => 'foreign', 'fk_table' => $fk_table, 'fk_attr' => $fk_attr, ); diff --git a/includes/class/table/mcl_table_writer.class.inc b/includes/class/table/mcl_table_writer.class.inc index f3b8576..161cd94 100644 --- a/includes/class/table/mcl_table_writer.class.inc +++ b/includes/class/table/mcl_table_writer.class.inc @@ -11,6 +11,7 @@ class MCL_TABLE_WRITER { private $output_dir = NULL; private $table_info = NULL; private $namespace = NULL; + private $extends = NULL; /** * Implements the class constructor. @@ -18,10 +19,11 @@ class MCL_TABLE_WRITER { * @param MCL_TABLE_INFO $table_info * @param string $output_dir */ - public function __construct(MCL_TABLE_INFO $table_info, $output_dir, $namespace = '') { + public function __construct(MCL_TABLE_INFO $table_info, $output_dir, $namespace = '', $extends = '') { $this->table_info = $table_info; $this->output_dir = $output_dir; $this->namespace = $namespace; + $this->extends = $extends; } /** @@ -89,6 +91,7 @@ class MCL_TABLE_WRITER { fputs($fdw, $code); fclose($fdw); } + // Writes the table definition to an individula file. else { foreach ($tables as $table_name => $table) { @@ -153,4 +156,22 @@ class MCL_TABLE_WRITER { public function setNamespace($namespace) { $this->namespace = $namespace; } + + /** + * Retrieves the extends. + * + * @retrun string + */ + public function getExtends() { + return $this->extends; + } + + /** + * Updates the extends. + * + * @param string $extends + */ + public function setExtends($extends) { + $this->extends = $extends; + } } \ No newline at end of file diff --git a/includes/class/template/mcl_template.class.inc b/includes/class/template/mcl_template.class.inc index bae46be..fdcab78 100644 --- a/includes/class/template/mcl_template.class.inc +++ b/includes/class/template/mcl_template.class.inc @@ -77,17 +77,22 @@ class MCL_TEMPLATE extends PUBLIC_MCL_TEMPLATE { ); // Special column table. - $desc_REQ = "The star symbol indicates a required column. All the values in this column must be provided"; - $desc_PROP = "A column name followed by double pound signs must be a cvterm name. The cvterm is used as a type of a property table."; - $desc_DESC = "A column name followed by single pound sign must be a cvterm name. The cvterm is used as a descriptor of evaluation data in the column." . - "
(e.g.) #brix #pH #fruit_weight"; - $desc_SEQ = "A column name followed by a tilde symbol indicates that the column holds sequnce information."; - + $desc_REQ = 'The star symbol indicates a required column. All the values in this column must be provided'; + $desc_DESC = 'A column name followed by single pound sign must be a cvterm name. The cvterm is used as a descriptor of evaluation data in the column.' . + '
(e.g.) #brix #pH #fruit_weight'; + $desc_SEQ = 'A column name followed by a tilde symbol indicates that the column holds sequnce information.'; + $desc_MARKER = 'A column name followed by a dollar symbol indicates that the column holds marker name.'; + $desc_STOCK = 'A column name followed by a percent symbol indicates that the column holds stock name.'; + $desc_PROP = 'A column name followed by double special characters must be a cvterm name. The cvterm is used as a type of a property table.' . + '
The following special characters can be used : #, @, % and $' . + '
(e.g.) ##cvterm_name @@cvterm_name %%cvterm_name and $$cvterm_name'; $rows = array( array('*', 'required', $desc_REQ), - array('##', 'property', $desc_PROP), array('#', 'descriptor', $desc_DESC), - array('~', 'descriptor', $desc_SEQ), + array('$', 'marker', $desc_MARKER), + array('%', 'stock', $desc_STOCK), + array('~', 'sequence', $desc_SEQ), + array('(sp)(sp)', 'property', $desc_PROP), ); $table_vars = array( 'header' => $headers, @@ -141,7 +146,7 @@ DESC; * @return string */ public function getRegExSpCol() { - return "/^[#$@~]/"; + return "/^[#$%@~]{1,2}/"; } /** @@ -362,6 +367,11 @@ DESC; */ public static function validateTemplate($template) { + // Updates the template name. + if (MCL_TEMPLATE::isColumnTemplate($template)) { + $template = 'COLUMN'; + } + // Checks if a template for this template exists. $mcl_template = MCL_TEMPLATE::byKey(array('template' => $template)); if ($mcl_template) { @@ -373,6 +383,7 @@ DESC; return FALSE; } + /** * Gets the rank of the template. The rank is based on the type of template. * @@ -384,6 +395,11 @@ DESC; */ public static function getRank($template) { + // Updates the template name. + if (preg_match("/^([A-Za-z0-9\_]+)_column$/", $template, $matches)) { + $template = $matches[1]; + } + // Gets the rank of the template. $mcl_template = MCL_TEMPLATE::byKey(array('template' => $template)); return $mcl_template->template_type->getRank(); @@ -399,12 +415,41 @@ DESC; */ public static function getTemplateClass(MCL_JOB_UPLOAD $job, MCL_FILE_CSV $csv) { + // Gets and updates the template. + $template = $csv->getTemplate(); + if (MCL_TEMPLATE::isColumnTemplate($template)) { + $template = 'column'; + } + // Gets the child class object of MCL_TEMPLATE. - $class_name = 'MCL_TEMPLATE_' . strtoupper($csv->getTemplate()); - $mcl_template = $class_name::byKey(array('template' => $csv->getTemplate())); - $mcl_template->setJob($job); - $mcl_template->setCSV($csv); - return $mcl_template; + $class_name = 'MCL_TEMPLATE_' . strtoupper($template); + $mcl_template = $class_name::byKey(array('template' => $template)); + if ($mcl_template) { + $mcl_template->setJob($job); + $mcl_template->setCSV($csv); + return $mcl_template; + } + return NULL; + } + + /** + * Returns MCL_TEMPLATE object. + * + * @param string $template + * + * @return Descendance of MCL_TEMPLATE + */ + public static function getByTemplate($template) { + + // Gets the template. + $mcl_template = MCL_TEMPLATE::byKey(array('template' => $template)); + + // Gets the child class object of MCL_TEMPLATE. + $class_name = 'MCL_TEMPLATE_' . strtoupper($template); + if (!class_exists($class_name)) { + return NULL; + } + return $class_name::byKey(array('template_id' => $mcl_template->getTemplateID())); } /** @@ -622,7 +667,7 @@ DESC; } /** - * Runs syntax error check. + * Runs syntax error check for regular template. * * The input file should have * 1st line : pound sign (#) and template name. @@ -734,6 +779,7 @@ DESC; if ($prop['req']) { $col = $this->headers[$column]['col']; $value = $columns[$col]; + if (!$value && $value === '') { $this->updateMsg('E', "Error : Missing data on column [$column]"); } @@ -745,6 +791,20 @@ DESC; return $this->isPassed(); } + /** + * Checks if the provided column is a valid column name for a column-template. + * + * @param string $column + * + * @return boolean + */ + public function isValidColumnTemplateHeaders($column) { + $valid_arr = array( + 'name', 'alias', 'cv_name', 'description' + ); + return in_array($column, $valid_arr); + } + /** * Cleanup the input line and return it in an array. * Removes double quote. If $headers is TRUE, remove '*'. It returns @@ -969,6 +1029,33 @@ DESC; // Defined in child class. } + /** + * Adds custom columns. + * + * @param string $prefix + * @param MCL_TEMPLATE $mcl_template + * @param array $line + */ + public function addCustomColumns($prefix, MCL_TEMPLATE $mcl_template, $line) { + + // Checks if a column-template exists. + $columns = $this->job->getPropByKey('columns'); + $column_arr = array(); + if (array_key_exists($this->getTemplate(), $columns)) { + $column_arr = $columns[$this->getTemplate()]; + } + + // Uploads a custom columns for this line. + if (!empty($column_arr)) { + foreach ($column_arr as $cvterm_name => $cv_name) { + $value = $line[$prefix . $cvterm_name]; + if ($value) { + $mcl_template->addProp($this, $cv_name, $cvterm_name, $value); + } + } + } + } + /** * Adds one or more properties * @@ -995,7 +1082,7 @@ DESC; else { // Poluplates the array with values. - $value_arr = preg_split($this->getSepRegex($separator), $value, NULL, PREG_SPLIT_NO_EMPTY); + $value_arr = preg_split(CHADO_TABLE::getSepRegex($separator), $value, NULL, PREG_SPLIT_NO_EMPTY); // Adds each property. $rank = 0; @@ -1154,6 +1241,16 @@ DESC; } } + /** + * Tests templates. + * + * @param array $templates + * @param string $tmp_dir + */ + public function testTemplates($templates, $tmp_dir) { + foreach ($templates as $template) {} + } + /** * Returns the template summary. */ @@ -1199,15 +1296,6 @@ DESC; return "($keys) = ($values)"; } - /** - * Returns the regular expression of the separator. - * - * @param string - */ - public function getSepRegex($separator) { - return ($separator) ? "/$separator/" : '/@@@@@/'; - } - /** * Retrieves the cvterm_id. * @@ -1255,6 +1343,15 @@ DESC; return empty($data_str); } + /** + * Returns if this is a column-template. + * + * @return boolean + */ + public static function isColumnTemplate($template) { + return preg_match("/_column$/i", $template); + } + /* * Defines getters and setters below. */ diff --git a/includes/class/template/module/mcl_template_column.class.inc b/includes/class/template/module/mcl_template_column.class.inc new file mode 100644 index 0000000..4f7ccb3 --- /dev/null +++ b/includes/class/template/module/mcl_template_column.class.inc @@ -0,0 +1,103 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for column sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the cvterm."), + 'alias' => array('req' => FALSE, 'width' => 15, 'desc' => "Alias of the cvterm."), + 'cv_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the control vocabulary."), + 'definition' => array('req' => FALSE, 'width' => 15, 'desc' => "Definition of the control vocabulary."), + ); + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks db. + MCL_CHADO_DB::checkDB($this, MCL_VAR::getValueByName('SITE_DB')); + + // Checks cv. + MCL_CHADO_CV::checkCV($this, $line['cv_name']); + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Gets the template name for this columns. + $csv_filepath = $this->csv->getFilepath(); + if (preg_match("/\/([A-Za-z0-9\_]+)_column.csv$/", $csv_filepath, $matches)) { + $template = $matches[1]; + } + + // Gets db. + $db = MCL_CHADO_DB::getDB(MCL_VAR::getValueByName('SITE_DB')); + + // Adds a cvterm. + $accession = $line['name']; + $cvterm = MCL_CHADO_CVTERM::addCvterm($this, $db->getName(), $line['cv_name'], $line['name'], $line['definition'], $accession); + if ($cvterm) { + + // Gets cv. + $cv = MCL_CHADO_CV::byKey(array('cv_id' => $cvterm->getCvID())); + + // Saves in job properties. + $prop = $this->job->getPropByKey('columns'); + if (array_key_exists($template, $prop)) { + $prop[$template][$cvterm->getName()] = $cv->getName(); + } + else { + $prop[$template] = array($cvterm->getName() => $cv->getName()); + } + $this->job->setPropByKey('columns', $prop); + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_contact.class.inc b/includes/class/template/module/mcl_template_contact.class.inc index 4abb990..5e5a187 100644 --- a/includes/class/template/module/mcl_template_contact.class.inc +++ b/includes/class/template/module/mcl_template_contact.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_CONTACT extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_UPLOAD::__construct() */ @@ -95,20 +95,19 @@ class MCL_TEMPLATE_CONTACT extends MCL_TEMPLATE { public function runErrorCheckDataLine($line) { // Checks contact type. - $first_name = $line['first_name']; - $last_name = $line['last_name']; - $type = $line['type']; + $type = $line['type']; if ($type == 'person') { + $first_name = $line['first_name']; + $last_name = $line['last_name']; if (!$first_name || !$last_name) { $this->updateMsg('E', "type : first_name and last_name must be not empty"); } } else { - // Checks for the cvterm_id of the type. - $valid_types = array('person', 'institution', 'lab', 'organization', 'database', 'company'); - if (!in_array($type, $valid_types)) { - $this->updateMsg('E', "Invalid contact type : $type not found in cvterm"); + // Checks for the contact type. + if (!MCL_DATA_VALID_TYPE::validate('contact_type', $type)) { + $this->updateMsg('E', "Invalid contact type : $type"); } } } diff --git a/includes/class/template/module/mcl_template_cross.class.inc b/includes/class/template/module/mcl_template_cross.class.inc index 729ca19..4698b4a 100644 --- a/includes/class/template/module/mcl_template_cross.class.inc +++ b/includes/class/template/module/mcl_template_cross.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_CROSS extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_UPLOAD::__construct() */ @@ -24,7 +24,7 @@ class MCL_TEMPLATE_CROSS extends MCL_TEMPLATE { if ($parent) { return new self($parent->getMemberArr()); } - } + } /** * @see MCL_TEMPLATE::defineDescription() @@ -78,10 +78,14 @@ class MCL_TEMPLATE_CROSS extends MCL_TEMPLATE { MCL_CHADO_LOCATION::checkSite($this, $line['site_name']); // Checks maternal parent. - MCL_CHADO_STOCK::checkStock($this, $line['mother']); + if ($line['mother'] != 'N/A') { + MCL_CHADO_STOCK::checkStock($this, $line['mother']); + } // Checks paternal parent. - MCL_CHADO_STOCK::checkStock($this, $line['father']); + if ($line['father'] != 'N/A') { + MCL_CHADO_STOCK::checkStock($this, $line['father']); + } } /** @@ -92,27 +96,34 @@ class MCL_TEMPLATE_CROSS extends MCL_TEMPLATE { // Gets nd_geolocation_id. $nd_geolocation_id = MCL_CHADO_LOCATION::getLocationIDBySite($line['site_name']); - // Adds a nd_experiment. - $dup_key = $line['dataset_name'] . '_' . $line['cross_number']; - $nd_experiment = MCL_CHADO_ND_EXPERIMENT::addNdExperiment($this, $this->cvterms['SITE_CV']['cross_experiment'], $nd_geolocation_id, $this->cvterms['SITE_CV']['cross_number'], $dup_key); - if ($nd_experiment) { + // Gets dataset. + $dataset = MCL_CHADO_DATASET::getDataset($line['dataset_name']); + + // Adds a cross. + $dup_key = $dataset->getProjectID() . '_' . $line['cross_number']; + $cross = MCL_CHADO_ND_EXPERIMENT::addNdExperiment($this, $this->cvterms['SITE_CV']['cross_experiment'], $nd_geolocation_id, $this->cvterms['SITE_CV']['cross_experiment'], $dup_key); + if ($cross) { // Adds properties. - $nd_experiment->addProp($this, 'SITE_CV', 'cross_number', $line['cross_number']); - $nd_experiment->addProp($this, 'SITE_CV', 'cross_date', $line['cross_date']); - $nd_experiment->addProp($this, 'SITE_CV', 'mother_location', $line['mother_location']); - $nd_experiment->addProp($this, 'SITE_CV', 'father_location', $line['father_location']); + $cross->addProp($this, 'SITE_CV', 'cross_number', $line['cross_number']); + $cross->addProp($this, 'SITE_CV', 'cross_date', $line['cross_date']); + $cross->addProp($this, 'SITE_CV', 'mother_location', $line['mother_location']); + $cross->addProp($this, 'SITE_CV', 'father_location', $line['father_location']); // Adds a dataset. - $nd_experiment->addDataset($this, $line['dataset_name']); + $cross->addDataset($this, $line['dataset_name']); // Adds a maternal parent. - $maternal_parent = MCL_CHADO_STOCK::getStock($line['mother']); - $nd_experiment->addStock($this, $maternal_parent, $this->cvterms['SITE_CV']['maternal_parent']); + if ($line['mother'] != 'N/A') { + $maternal_parent = MCL_CHADO_STOCK::getStock($line['mother']); + $cross->addStock($this, $maternal_parent, $this->cvterms['SITE_CV']['maternal_parent']); + } // Adds a paternal parent. - $paternal_parent = MCL_CHADO_STOCK::getStock($line['father']); - $nd_experiment->addStock($this, $paternal_parent, $this->cvterms['SITE_CV']['paternal_parent']);; + if ($line['father'] != 'N/A') { + $paternal_parent = MCL_CHADO_STOCK::getStock($line['father']); + $cross->addStock($this, $paternal_parent, $this->cvterms['SITE_CV']['paternal_parent']);; + } } } } \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_cv.class.inc b/includes/class/template/module/mcl_template_cv.class.inc index f60105a..3059f46 100644 --- a/includes/class/template/module/mcl_template_cv.class.inc +++ b/includes/class/template/module/mcl_template_cv.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_CV extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -15,6 +15,7 @@ class MCL_TEMPLATE_CV extends MCL_TEMPLATE { $details['template_type'] = 'CV'; parent::__construct($details); } + /** * @see MCL_TEMPLATE::byKey() */ diff --git a/includes/class/template/module/mcl_template_cvterm.class.inc b/includes/class/template/module/mcl_template_cvterm.class.inc index a6fb7b4..5285891 100644 --- a/includes/class/template/module/mcl_template_cvterm.class.inc +++ b/includes/class/template/module/mcl_template_cvterm.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_CVTERM extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -15,6 +15,7 @@ class MCL_TEMPLATE_CVTERM extends MCL_TEMPLATE { $details['template_type'] = 'CVTERM'; parent::__construct($details); } + /** * @see MCL_TEMPLATE::byKey() */ diff --git a/includes/class/template/module/mcl_template_dataset.class.inc b/includes/class/template/module/mcl_template_dataset.class.inc index 30bf0fd..06ce4c2 100644 --- a/includes/class/template/module/mcl_template_dataset.class.inc +++ b/includes/class/template/module/mcl_template_dataset.class.inc @@ -6,8 +6,8 @@ class MCL_TEMPLATE_DATASET extends MCL_TEMPLATE { /** - * Class data members. - */ + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ diff --git a/includes/class/template/module/mcl_template_db.class.inc b/includes/class/template/module/mcl_template_db.class.inc index c4661ed..751c21a 100644 --- a/includes/class/template/module/mcl_template_db.class.inc +++ b/includes/class/template/module/mcl_template_db.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_DB extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -15,6 +15,7 @@ class MCL_TEMPLATE_DB extends MCL_TEMPLATE { $details['template_type'] = 'DB'; parent::__construct($details); } + /** * @see MCL_TEMPLATE::byKey() */ diff --git a/includes/class/template/module/mcl_template_descriptor.class.inc b/includes/class/template/module/mcl_template_descriptor.class.inc index b7b4389..d337360 100644 --- a/includes/class/template/module/mcl_template_descriptor.class.inc +++ b/includes/class/template/module/mcl_template_descriptor.class.inc @@ -8,17 +8,6 @@ class MCL_TEMPLATE_DESCRIPTOR extends MCL_TEMPLATE { /** * Class data members. */ - // Valid descriptor types. - private $valid_descriptor_types = array( - 'qualitative', - 'quantitative_code', - 'quantitative', - 'code', - 'date', - 'filepath', - 'text' - ); - /** * @see MCL_TEMPLATE::__construct() */ @@ -58,7 +47,6 @@ class MCL_TEMPLATE_DESCRIPTOR extends MCL_TEMPLATE { 'values' => array('req' => FALSE, 'width' => 10, 'desc' => "Code definition for a coded descriptor."), 'data_unit' => array('req' => FALSE, 'width' => 10, 'desc' => "Unit for the trait descriptor."), 'definition' => array('req' => FALSE, 'width' => 90, 'desc' => "Definition of the descriptor."), -// 'image_file' => array('req' => FALSE, 'width' => 10, 'desc' => "The image file for the descriptor."), ); return $headers; } @@ -84,10 +72,10 @@ class MCL_TEMPLATE_DESCRIPTOR extends MCL_TEMPLATE { */ public function runErrorCheckDataLine($line) { - // Checks SITE_DB. + // Checks db. MCL_CHADO_DB::checkDB($this, MCL_VAR::getValueByName('SITE_DB')); - // Checks CV for trait_descriptor_set. + // Checks cv for trait_descriptor_set. MCL_CHADO_CV::checkCV($this, $line['trait_descriptor_set']); // Checks values. @@ -96,9 +84,9 @@ class MCL_TEMPLATE_DESCRIPTOR extends MCL_TEMPLATE { // Checks trait_name. MCL_CHADO_CVTERM::checkCvterm($this, MCL_VAR::getValueByName('SITE_TRAIT_ONTOLOGY'), $line['trait_name']); - // Checks data type. - if (!in_array($line['data_type'], $this->valid_descriptor_types)) { - $this->updateMsg('E', "Error - data type : '" . $line['data_type'] . "' is not valid descriptor type"); + // Checks descirptor type. + if (!MCL_DATA_VALID_TYPE::validate('descirptor_type', $line['data_type'])) { + $this->updateMsg('E', 'Invalid descirptor type : ' . $line['data_type']); } } diff --git a/includes/class/template/module/mcl_template_field_book.class.inc b/includes/class/template/module/mcl_template_fieldbook.class.inc similarity index 87% rename from includes/class/template/module/mcl_template_field_book.class.inc rename to includes/class/template/module/mcl_template_fieldbook.class.inc index 0e75e15..b8a2134 100644 --- a/includes/class/template/module/mcl_template_field_book.class.inc +++ b/includes/class/template/module/mcl_template_fieldbook.class.inc @@ -1,13 +1,13 @@ addProp($this, 'SITE_CV', 'comments', $line['comments']); // Adds a stock. - $nd_experiment->addStock($this, $sample); + $nd_experiment->addStock($this, $sample, ''); // Adds evaluators. $nd_experiment->addContact($this, $line['experimenter'], "[;]"); diff --git a/includes/class/template/module/mcl_template_genotype_snp.class.inc b/includes/class/template/module/mcl_template_genotype_snp.class.inc index debddb3..1e45215 100644 --- a/includes/class/template/module/mcl_template_genotype_snp.class.inc +++ b/includes/class/template/module/mcl_template_genotype_snp.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_GENOTYPE_SNP extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ diff --git a/includes/class/template/module/mcl_template_genotype_snp_marker_column.class.inc b/includes/class/template/module/mcl_template_genotype_snp_marker_column.class.inc index 3f3499d..afcdf4f 100644 --- a/includes/class/template/module/mcl_template_genotype_snp_marker_column.class.inc +++ b/includes/class/template/module/mcl_template_genotype_snp_marker_column.class.inc @@ -45,8 +45,8 @@ class MCL_TEMPLATE_GENOTYPE_SNP_MARKER_COLUMN extends MCL_TEMPLATE { $headers = array( 'dataset_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the genotyping dataset. It should match a dataset_name in 'Dataset' sheet."), 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match an 'stock_name' of the 'Stock' sheet."), - 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => "Genus of the stock"), - 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "Species of the stock"), + 'genus' => array('req' => FALSE, 'width' => 10, 'desc' => "Genus of the stock"), + 'species' => array('req' => FALSE, 'width' => 10, 'desc' => "Species of the stock"), '$marker_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Special columns ($) : followed by marker name"), ); return $headers; @@ -93,6 +93,7 @@ class MCL_TEMPLATE_GENOTYPE_SNP_MARKER_COLUMN extends MCL_TEMPLATE { // Adds genotype_call for each marker. $marker_cols = $this->getJob()->getParamByKey('marker_cols'); + foreach ($marker_cols as $marker_name => $feature_id) { // Adds genotype. @@ -120,7 +121,7 @@ class MCL_TEMPLATE_GENOTYPE_SNP_MARKER_COLUMN extends MCL_TEMPLATE { private function _checkMarkers($line) { // This should be called once. - if ($line['line_no'] != 3) { + if ($line['line_no'] != 3 || $this->getJob()->getParamByKey('marker_cols')) { return; } diff --git a/includes/class/template/module/mcl_template_genotype_snp_stock_column.class.inc b/includes/class/template/module/mcl_template_genotype_snp_stock_column.class.inc index d7977d2..e32038d 100644 --- a/includes/class/template/module/mcl_template_genotype_snp_stock_column.class.inc +++ b/includes/class/template/module/mcl_template_genotype_snp_stock_column.class.inc @@ -120,7 +120,7 @@ class MCL_TEMPLATE_GENOTYPE_SNP_STOCK_COLUMN extends MCL_TEMPLATE { private function _checkStocks($line) { // This should be called once. - if ($line['line_no'] != 3) { + if ($line['line_no'] != 3 || $this->getJob()->getParamByKey('stock_cols')) { return; } diff --git a/includes/class/template/module/mcl_template_genotype_ssr.class.inc b/includes/class/template/module/mcl_template_genotype_ssr.class.inc index 792ecf5..5e7bdb9 100644 --- a/includes/class/template/module/mcl_template_genotype_ssr.class.inc +++ b/includes/class/template/module/mcl_template_genotype_ssr.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_GENOTYPE_SSR extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ diff --git a/includes/class/template/module/mcl_template_image.class.inc b/includes/class/template/module/mcl_template_image.class.inc index fec40ae..4090926 100644 --- a/includes/class/template/module/mcl_template_image.class.inc +++ b/includes/class/template/module/mcl_template_image.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_IMAGE extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -60,8 +60,7 @@ class MCL_TEMPLATE_IMAGE extends MCL_TEMPLATE { /** * @see MCL_TEMPLATE::runErrorCheckDataLine() */ - public function runErrorCheckDataLine($line) { - } + public function runErrorCheckDataLine($line) {} /** * @see MCL_TEMPLATE::uploadDataLine() diff --git a/includes/class/template/module/mcl_template_library.class.inc b/includes/class/template/module/mcl_template_library.class.inc index 414ea6a..90c951d 100644 --- a/includes/class/template/module/mcl_template_library.class.inc +++ b/includes/class/template/module/mcl_template_library.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_LIBRARY extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ diff --git a/includes/class/template/module/mcl_template_map.class.inc b/includes/class/template/module/mcl_template_map.class.inc index ca9b475..49e58c1 100644 --- a/includes/class/template/module/mcl_template_map.class.inc +++ b/includes/class/template/module/mcl_template_map.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_MAP extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -87,7 +87,7 @@ class MCL_TEMPLATE_MAP extends MCL_TEMPLATE { MCL_CHADO_FEATUREMAP::checkMapUnit($this, $line['map_unit']); // Checks stock. - MCL_CHADO_STOCK::checkStock($this, $line['population_name'], $line['genus'], $line['species'], "[,;]"); + MCL_CHADO_STOCK::checkStock($this, $line['population_name'], '', '', "[,;]"); // Checks contacts. MCL_CHADO_CONTACT::checkContact($this, $line['contact'], '[;]'); @@ -119,7 +119,7 @@ class MCL_TEMPLATE_MAP extends MCL_TEMPLATE { $map->addOrganism($this, $line['genus'], $line['species'], "[,;]"); // Adds stocks. - $map->addStock($this, $line['population_name'], $line['genus'], $line['species'], "[,;]"); + $map->addStock($this, $line['population_name'], '', '', "[,;]"); // Adds contacts. $map->addContact($this, $line['contact'], "[;]"); diff --git a/includes/class/template/module/mcl_template_map_position.class.inc b/includes/class/template/module/mcl_template_map_position.class.inc index f8521fe..83691d8 100644 --- a/includes/class/template/module/mcl_template_map_position.class.inc +++ b/includes/class/template/module/mcl_template_map_position.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -87,19 +87,22 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { // Checks map. MCL_CHADO_FEATUREMAP::checkMap($this, $line['map_name']); - // Checks marker_qtl_mtl. It must be generic marker, MTL or QTL. + // Checks feature. It must be generic marker, MTL or QTL. $marker_qtl_mtl = $line['marker_qtl_mtl']; - $args = array( - 'uniquename' => $marker_qtl_mtl, - 'type_id' => $this->cvterms['sequence']['genetic_marker'], - ); - $feature = MCL_CHADO_FEATURE::byKey($args); + + // Gets genetic marker. + $feature = MCL_CHADO_FEATURE::getFeatureAlias($marker_qtl_mtl, $genus, $species, $this->cvterms['sequence']['genetic_marker']); if (!$feature) { - $args['type_id'] = $this->cvterms['sequence']['qtl']; + // Gets the QTL. + $args = array( + 'uniquename' => $marker_qtl_mtl, + 'type_id' => $this->cvterms['sequence']['qtl'], + ); $feature = MCL_CHADO_FEATURE::byKey($args); if (!$feature) { + // Gets the MTL. $args['type_id'] = $this->cvterms['sequence']['heritable_phenotypic_marker']; $feature = MCL_CHADO_FEATURE::byKey($args); if (!$feature) { @@ -114,25 +117,34 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { */ public function uploadDataLine($line) { - // Gets the feature. It must be marker, QTL or MTL. + // Gets the feature. It must be genetic marker, QTL or MTL. $marker_qtl_mtl = $line['marker_qtl_mtl']; - $args = array( - 'uniquename' => $marker_qtl_mtl, - 'type_id' => $this->cvterms['sequence']['genetic_marker'], - ); - $feature = MCL_CHADO_FEATURE::byKey($args); + + // Gets the genetic marker. + $feature = MCL_CHADO_FEATURE::getFeatureAlias($marker_qtl_mtl, $genus, $species, $this->cvterms['sequence']['genetic_marker']); if (!$feature) { - $args['type_id'] = $this->cvterms['sequence']['qtl']; + + // Gets the QTL. + $args = array( + 'uniquename' => $marker_qtl_mtl, + 'type_id' => $this->cvterms['sequence']['qtl'], + ); $feature = MCL_CHADO_FEATURE::byKey($args); if (!$feature) { + + // Gets the MTL. $args['type_id'] = $this->cvterms['sequence']['heritable_phenotypic_marker']; $feature = MCL_CHADO_FEATURE::byKey($args); } } - $organism_id = $feature->getOrganismID(); + + // Updates $organism_id and $marker_qtl_mtl. + $marker_qtl_mtl = $feature->getUniquename(); + $organism_id = $feature->getOrganismID(); // Adds a locus if this is a genetic marker. If locus name is empty, // use $marker_qtl_mtl. + $locus = NULL; if ($feature->getTypeID() == $this->cvterms['sequence']['genetic_marker']) { $locus_name = ($line['locus_name']) ? $line['locus_name'] : $marker_qtl_mtl; $locus = MCL_CHADO_FEATURE::addFeature($this, $locus_name, $locus_name, $this->cvterms['sequence']['marker_locus'], $organism_id); @@ -147,7 +159,7 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { $map = MCL_CHADO_FEATUREMAP::byKey(array('name' => $line['map_name'])); // Adds a linkage group. - $linkage_group = $link['linkage_group']; + $linkage_group = $line['linkage_group']; // Gets organism ID for a linkage group. $organism_id_lg = MCL_VAR::getValueByName('ORGANISM_ID'); @@ -175,7 +187,7 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { $bin_name = $line['bin_name']; if ($bin_name) { $uniquename = $map->getName() . '.' . $bin_name; - $bin = MCL_CHADO_FEATURE::addFeature($this, $uniquename, '', $chromosome_arm_name, $this->cvterms['SITE_CV']['bin'], $organism_id); + $bin = MCL_CHADO_FEATURE::addFeature($this, $uniquename, '', $this->cvterms['SITE_CV']['bin'], $organism_id); if ($bin) { // Adds a relationship. @@ -193,10 +205,13 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { $stop = $line['stop']; $qtl_peak = $line['qtl_peak']; $data = trim($start.$stop.$qtl_peak); - if ($data && $linkage_group) { + if ($linkage_group && ($data || $data == '0')) { + + // Sets the target feature. + $target_feature = ($locus) ? $locus : $feature; // Adds a featurepos. - $featurepos = MCL_CHADO_FEATUREPOS::addFeaturepos($this, $feature, $map, $linkage_group); + $featurepos = MCL_CHADO_FEATUREPOS::addFeaturepos($this, $target_feature, $map, $linkage_group); if ($featurepos) { // Adds properties. @@ -205,8 +220,7 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { $featurepos->addProp($this, 'SITE_CV', 'qtl_peak', $line['qtl_peak']); $featurepos->addProp($this, 'SITE_CV', 'comments', $line['comments']); - - // Adds a featurepos if the linkage_group, the bin and either start or stop exist. + // Adds a featurepos for the bin if exists. $data = trim($start.$stop); if ($data && $linkage_group && $bin) { diff --git a/includes/class/template/module/mcl_template_marker.class.inc b/includes/class/template/module/mcl_template_marker.class.inc index a979ed0..5d2caf6 100644 --- a/includes/class/template/module/mcl_template_marker.class.inc +++ b/includes/class/template/module/mcl_template_marker.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_MARKER extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -39,40 +39,40 @@ class MCL_TEMPLATE_MARKER extends MCL_TEMPLATE { */ public function defineHeaders() { $headers = array( - 'marker_name' => array('req' => TRUE, 'width' => 10, 'desc' =>"Name of the marker."), - 'marker_type' => array('req' => FALSE, 'width' => 10, 'desc' =>"Marker type such as SSR, RFLP, RAPD, STS, SCAR, overgo probe and Isozyme. Refer to the available marker_type page for each database."), - 'genus' => array('req' => TRUE, 'width' => 10, 'desc' =>"The genus name of the organism from which the marker was developed."), - 'species' => array('req' => TRUE, 'width' => 10, 'desc' =>"The species name of the organism from which the marker was developed. Enter 'sp.' to represent one unknown species, 'spp.' to represent multiple unknown species."), - 'alias' => array('req' => FALSE, 'width' => 10, 'desc' =>"Other names used for the marker. Multiple aliases, separated by a semicolon (;), can be added."), - 'marker_sequence' => array('req' => FALSE, 'width' => 10, 'desc' =>"Sequence of the marker when available. For SNP, it should be in the format of 5'flanking sequence[A/T] 3'flanking sequence."), - 'gb_id' => array('req' => FALSE, 'width' => 10, 'desc' =>"Associated GenBank ID of the marker or the source of the marker (eg. EST)."), - 'dbsnp_id' => array('req' => FALSE, 'width' => 10, 'desc' =>"Associated dbSNP_ID. #ss number should be used."), - 'five_prime_flanking_seq' => array('req' => FALSE, 'width' => 10, 'desc' =>"5' flanking sequence of SNP or Indel."), - 'three_prime_flanking_seq' => array('req' => FALSE, 'width' => 10, 'desc' =>"3' flanking sequence of SNP or Indel."), - 'shared_species' => array('req' => FALSE, 'width' => 10, 'desc' =>"Species names of organisms that have been found to have the same SNP. If there are more than one other species, using ';' to separate."), - 'repeat_motif' => array('req' => FALSE, 'width' => 10, 'desc' =>"Repeat motif for SSR markers."), + 'marker_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the marker."), + 'marker_type' => array('req' => TRUE, 'width' => 10, 'desc' => "Marker type such as SSR, RFLP, RAPD, STS, SCAR, overgo probe and Isozyme. Refer to the available marker_type page for each database."), + 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => "The genus name of the organism from which the marker was developed."), + 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "The species name of the organism from which the marker was developed. Enter 'sp.' to represent one unknown species, 'spp.' to represent multiple unknown species."), + 'alias' => array('req' => FALSE, 'width' => 10, 'desc' => "Other names used for the marker. Multiple aliases, separated by a semicolon (;), can be added."), + 'marker_sequence' => array('req' => FALSE, 'width' => 10, 'desc' => "Sequence of the marker when available. For SNP, it should be in the format of 5'flanking sequence[A/T] 3'flanking sequence."), + 'gb_id' => array('req' => FALSE, 'width' => 10, 'desc' => "Associated GenBank ID of the marker or the source of the marker (eg. EST)."), + 'dbsnp_id' => array('req' => FALSE, 'width' => 10, 'desc' => "Associated dbSNP_ID. #ss number should be used."), + 'five_prime_flanking_seq' => array('req' => FALSE, 'width' => 10, 'desc' => "5' flanking sequence of SNP or Indel."), + 'three_prime_flanking_seq' => array('req' => FALSE, 'width' => 10, 'desc' => "3' flanking sequence of SNP or Indel."), + 'shared_species' => array('req' => FALSE, 'width' => 10, 'desc' => "Species names of organisms that have been found to have the same SNP. If there are more than one other species, using ';' to separate."), + 'repeat_motif' => array('req' => FALSE, 'width' => 10, 'desc' => "Repeat motif for SSR markers."), 'snp_chip_name' => array('req' => FALSE, 'width' => 10, 'desc' => "SNP chip name when SNPs belong to a chip (the name should match 'name' in Library sheet."), 'snp_chip_id' => array('req' => FALSE, 'width' => 10, 'desc' => "SNP chip ID if there is a specific ID for the specific SNP chip entered in 'SNP_chip_ID'."), - 'restriction_enzyme' => array('req' => FALSE, 'width' => 10, 'desc' =>"Restriction Enzyme used for CAPS marker or other markers that use restriction enzymes."), - 'product_length' => array('req' => FALSE, 'width' => 10, 'desc' =>"The PCR product length from the source species of the marker."), - 'max_length' => array('req' => FALSE, 'width' => 10, 'desc' =>"The maximum product size that have been observed."), - 'min_length' => array('req' => FALSE, 'width' => 10, 'desc' =>"The minimum product size that have been observed."), - 'is_codominant' => array('req' => FALSE, 'width' => 10, 'desc' =>"Yes if the marker is codominant, No otherwise."), - 'pcr_condition' => array('req' => FALSE, 'width' => 10, 'desc' =>"PCR condition for PCR-based markers."), - 'screening_method' => array('req' => FALSE, 'width' => 10, 'desc' =>"Gel type, % etc (eg. 2% agarose) for PCR product visualization and any other screening methods for other types of markers."), - 'monomorphic_population' => array('req' => FALSE, 'width' => 10, 'desc' =>"The name of the mapping population of which the marker was monomorphic."), - 'source_marker_name' => array('req' => FALSE, 'width' => 10, 'desc' =>"The name of the marker from which the marker is generated (STS, SSR or SCAR markers are often generated from other markers). The detail of the source marker should be given in a separate row."), - 'source_description' => array('req' => FALSE, 'width' => 10, 'desc' =>"Whether the marker was developed from the sequence of EST, BAC, cDNA, genomic clone, or WGS."), - 'indel_seq' => array('req' => FALSE, 'width' => 10, 'desc' =>"sequences of indel (eg. ATT)."), - 'alleles' => array('req' => FALSE, 'width' => 10, 'desc' =>"Alleles for the SNP marker (eg. A/T)."), - 'gel_picture_file_name' => array('req' => FALSE, 'width' => 10, 'desc' =>"File name of the gel picture if available."), - 'gel_picture_legend' => array('req' => FALSE, 'width' => 10, 'desc' =>"Legend of the gel picture if available."), - 'comments' => array('req' => FALSE, 'width' => 10, 'desc' =>"Any comments about the marker."), - 'variety' => array('req' => FALSE, 'width' => 10, 'desc' =>"The variety from which the marker was developed. It should match a 'stock_name' in the Stock sheet."), - 'image' => array('req' => FALSE, 'width' => 10, 'desc' =>"Image_ID of any associated image (Detailed info in 'Image' sheet.) Multiple images, separated by comma, can be added."), - 'contact' => array('req' => FALSE, 'width' => 10, 'desc' =>"Contact person for the marker (Please provide the contact info of these researchers in 'Contact' sheet)."), - 'reference' => array('req' => FALSE, 'width' => 10, 'desc' =>"Reference where the marker is originally described (pub_id), Multiple references, separated by comma, can be added."), - '~idendifier' => array('req' => FALSE, 'width' => 10, 'desc' =>"Special columns (~) : An identifier must be either primer or probe followed by numerical number and name or seq. (e.g.) primer1_seq and primer1_name."), + 'restriction_enzyme' => array('req' => FALSE, 'width' => 10, 'desc' => "Restriction Enzyme used for CAPS marker or other markers that use restriction enzymes."), + 'product_length' => array('req' => FALSE, 'width' => 10, 'desc' => "The PCR product length from the source species of the marker."), + 'max_length' => array('req' => FALSE, 'width' => 10, 'desc' => "The maximum product size that have been observed."), + 'min_length' => array('req' => FALSE, 'width' => 10, 'desc' => "The minimum product size that have been observed."), + 'is_codominant' => array('req' => FALSE, 'width' => 10, 'desc' => "Yes if the marker is codominant, No otherwise."), + 'pcr_condition' => array('req' => FALSE, 'width' => 10, 'desc' => "PCR condition for PCR-based markers."), + 'screening_method' => array('req' => FALSE, 'width' => 10, 'desc' => "Gel type, % etc (eg. 2% agarose) for PCR product visualization and any other screening methods for other types of markers."), + 'monomorphic_population' => array('req' => FALSE, 'width' => 10, 'desc' => "The name of the mapping population of which the marker was monomorphic."), + 'source_marker_name' => array('req' => FALSE, 'width' => 10, 'desc' => "The name of the marker from which the marker is generated (STS, SSR or SCAR markers are often generated from other markers). The detail of the source marker should be given in a separate row."), + 'source_description' => array('req' => FALSE, 'width' => 10, 'desc' => "Whether the marker was developed from the sequence of EST, BAC, cDNA, genomic clone, or WGS."), + 'indel_seq' => array('req' => FALSE, 'width' => 10, 'desc' => "sequences of indel (eg. ATT)."), + 'alleles' => array('req' => FALSE, 'width' => 10, 'desc' => "Alleles for the SNP marker (eg. A/T)."), + 'gel_picture_file_name' => array('req' => FALSE, 'width' => 10, 'desc' => "File name of the gel picture if available."), + 'gel_picture_legend' => array('req' => FALSE, 'width' => 10, 'desc' => "Legend of the gel picture if available."), + 'comments' => array('req' => FALSE, 'width' => 10, 'desc' => "Any comments about the marker."), + 'variety' => array('req' => FALSE, 'width' => 10, 'desc' => "The variety from which the marker was developed. It should match a 'stock_name' in the Stock sheet."), + 'image' => array('req' => FALSE, 'width' => 10, 'desc' => "Image_ID of any associated image (Detailed info in 'Image' sheet.) Multiple images, separated by comma, can be added."), + 'contact' => array('req' => FALSE, 'width' => 10, 'desc' => "Contact person for the marker (Please provide the contact info of these researchers in 'Contact' sheet)."), + 'reference' => array('req' => FALSE, 'width' => 10, 'desc' => "Reference where the marker is originally described (pub_id), Multiple references, separated by comma, can be added."), + '~idendifier' => array('req' => FALSE, 'width' => 10, 'desc' => "Special columns (~) : An identifier must be either primer or probe followed by numerical number and name or seq. (e.g.) primer1_seq and primer1_name."), ); // Adds labels. @@ -246,7 +246,7 @@ class MCL_TEMPLATE_MARKER extends MCL_TEMPLATE { $marker->addSequence($this, $line, '~primer', $this->cvterms['sequence']['primer'], $this->cvterms['relationship']['adjacent_to']); // Adds probe sequences. - $marker->addSequence($this, $line, '~probe', $this->cvterms['sequence']['probe'], $this->cvterms['sequence']['associated_with']); + $marker->addSequence($this, $line, '~probe', $this->cvterms['sequence']['probe'], $this->cvterms['sequence']['associated_with'], TRUE); } } } \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_mtl.class.inc b/includes/class/template/module/mcl_template_mtl.class.inc index f60f248..621efd0 100644 --- a/includes/class/template/module/mcl_template_mtl.class.inc +++ b/includes/class/template/module/mcl_template_mtl.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_MTL extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ diff --git a/includes/class/template/module/mcl_template_organism.class.inc b/includes/class/template/module/mcl_template_organism.class.inc new file mode 100644 index 0000000..17a50e7 --- /dev/null +++ b/includes/class/template/module/mcl_template_organism.class.inc @@ -0,0 +1,158 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for db sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => "Genus of the organism."), + 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "Species of the organism."), + 'family' => array('req' => FALSE, 'width' => 10, 'desc' => "Family of the organism."), + 'geographic_origin' => array('req' => FALSE, 'width' => 10, 'desc' => "Geographic origin of the organism."), + 'genome_group' => array('req' => FALSE, 'width' => 10, 'desc' => "Genome group of the organism."), + 'haploid_chromosome_number' => array('req' => FALSE, 'width' => 10, 'desc' => "Haploid chromosome number of the organism."), + 'genome_size' => array('req' => FALSE, 'width' => 10, 'desc' => "Genome size of the organism."), + 'ploidy' => array('req' => FALSE, 'width' => 10, 'desc' => "Ploidy of the organism."), + 'growth_habit' => array('req' => FALSE, 'width' => 10, 'desc' => "Growth Habit of the organism."), + 'propagation_method' => array('req' => FALSE, 'width' => 10, 'desc' => "Propagation method of the organism."), + 'usage' => array('req' => FALSE, 'width' => 10, 'desc' => "Usage of the organism."), + 'hybrid_parentage' => array('req' => FALSE, 'width' => 10, 'desc' => "Hybrid parentage of the organism."), + 'resistance_to_biotic_stress' => array('req' => FALSE, 'width' => 10, 'desc' => "Resistance to biotic stress of the organism."), + 'resistance_to_abiotic_stress' => array('req' => FALSE, 'width' => 10, 'desc' => "Resistance to abiotic stress of the organism."), + 'alias_scientific' => array('req' => FALSE, 'width' => 10, 'desc' => "Alias scientific of the organism."), + 'alias_synonym' => array('req' => FALSE, 'width' => 10, 'desc' => "alias_synonym of the organism."), + 'alias_common' => array('req' => FALSE, 'width' => 10, 'desc' => "alias common of the organism."), + 'fertile_with' => array('req' => FALSE, 'width' => 10, 'desc' => "fertile with the organism."), + 'sterile_with' => array('req' => FALSE, 'width' => 10, 'desc' => "sterile with the organism."), + 'incompatible_with' => array('req' => FALSE, 'width' => 10, 'desc' => "incompatible with the organism."), + 'grin_id' => array('req' => FALSE, 'width' => 10, 'desc' => "GRIN taxonomy ID of the organism."), + 'image' => array('req' => FALSE, 'width' => 10, 'desc' => "Image of the organism."), + 'reference' => array('req' => FALSE, 'width' => 10, 'desc' => "pub_id if any publication is associated with the organism."), + 'comments' => array('req' => FALSE, 'width' => 10, 'desc' => "Any comments for the organism."), + ); + + // Adds labels. + $headers['grin_id']['label'] = 'GRIN Taxonomy ID'; + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['family'] = -1; + $cvterms['SITE_CV']['geographic_origin'] = -1; + $cvterms['SITE_CV']['genome_group'] = -1; + $cvterms['SITE_CV']['haploid_chromosome_number'] = -1; + $cvterms['SITE_CV']['genome_size'] = -1; + $cvterms['SITE_CV']['ploidy'] = -1; + $cvterms['SITE_CV']['growth_habit'] = -1; + $cvterms['SITE_CV']['propagation_method'] = -1; + $cvterms['SITE_CV']['usage'] = -1; + $cvterms['SITE_CV']['hybrid_parentage'] = -1; + $cvterms['SITE_CV']['resistance_to_biotic_stress'] = -1; + $cvterms['SITE_CV']['resistance_to_abiotic_stress'] = -1; + $cvterms['SITE_CV']['alias_scientific'] = -1; + $cvterms['SITE_CV']['alias_synonym'] = -1; + $cvterms['SITE_CV']['alias_common'] = -1; + $cvterms['SITE_CV']['comments'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks DB for GRIN. + MCL_CHADO_DB::checkDB($this, 'GRIN'); + + // Checks images. + MCL_CHADO_IMAGE::checkImage($this, $line['image'], '[;,]'); + + // Checks references. + MCL_CHADO_PUB::checkPub($this, $line['reference'], '[;,]'); + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Adds an organism. + $organism = MCL_CHADO_ORGANISM::addOrganism($this, $line['genus'], $line['species']); + if ($organism) { + + // Adds properties. + $organism->addProp($this, 'SITE_CV', 'family', $line['family']); + $organism->addProp($this, 'SITE_CV', 'geographic_origin', $line['geographic_origin']); + $organism->addProp($this, 'SITE_CV', 'genome_group', $line['genome_group']); + $organism->addProp($this, 'SITE_CV', 'haploid_chromosome_number', $line['haploid_chromosome_number']); + $organism->addProp($this, 'SITE_CV', 'genome_size', $line['genome_size']); + $organism->addProp($this, 'SITE_CV', 'ploidy', $line['ploidy']); + $organism->addProp($this, 'SITE_CV', 'growth_habit', $line['growth_habit']); + $organism->addProp($this, 'SITE_CV', 'propagation_method', $line['propagation_method']); + $organism->addProp($this, 'SITE_CV', 'usage', $line['usage']); + $organism->addProp($this, 'SITE_CV', 'hybrid_parentage', $line['hybrid_parentage']); + $organism->addProp($this, 'SITE_CV', 'resistance_to_biotic_stress', $line['resistance_to_biotic_stress']); + $organism->addProp($this, 'SITE_CV', 'resistance_to_abiotic_stress', $line['resistance_to_abiotic_stress']); + $organism->addProp($this, 'SITE_CV', 'alias_scientific', $line['alias_scientific'], "[;,]"); + $organism->addProp($this, 'SITE_CV', 'alias_synonym', $line['alias_synonym'], "[;,]"); + $organism->addProp($this, 'SITE_CV', 'alias_common', $line['alias_common'], "[;,]"); + + // Adds related organisms. + //$organism->addRelatedOrganism($this, 'SITE_CV', 'fertile_with', $line['fertile_with'], "[;,]"); + //$organism->addRelatedOrganism($this, 'SITE_CV', 'sterile_with', $line['sterile_with'], "[;,]"); + //$organism->addRelatedOrganism($this, 'SITE_CV', 'sterile_with', $line['incompatible_with'], "[;,]"); + + // Gets db of GRIN and add a dbxref. + $db = MCL_CHADO_DB::getDB('GRIN'); + $dbxref = MCL_CHADO_DBXREF::addDBXref($this, $db->getDbID(), $line['grin_id']); + if ($dbxref) { + + // Adds dbxref to organism_dbxref table. + $organism->addDBXref($this, $dbxref); + } + + // Adds images. + $organism->addImage($this, $line['image'], "[,;]"); + + // Adds references. + $organism->addReference($this, $line['reference'], "[,;]"); + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_phenotype.class.inc b/includes/class/template/module/mcl_template_phenotype.class.inc index 1191531..345a9f4 100644 --- a/includes/class/template/module/mcl_template_phenotype.class.inc +++ b/includes/class/template/module/mcl_template_phenotype.class.inc @@ -220,6 +220,7 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { // Adds properties. $nd_experiment->addProp($this, 'SITE_CV', 'data_year', $line['data_year']); + $nd_experiment->addProp($this, 'SITE_CV', 'evaluation_date', $line['evaluation_date']); // Adds evaluators. @@ -241,33 +242,27 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { * Checks trait descriptors for cvterm_id. Save them in job.param. * * @param array $line - * @param string $dataset_name */ private function _checkDescriptors($line, $dataset_name) { // This should be called once. - if ($line['line_no'] != 3) { + if ($line['line_no'] != 3 || $this->getJob()->getParamByKey('descriptors')) { return; } // Gets the project ID and check for trait_descriptor. - $dataset = MCL_CHADO_DATASET::getDataset($dataset_name); + $dataset = MCL_CHADO_DATASET::getDataset($line['dataset_name']); $project_id = $dataset->getProjectID(); - $cv_name = $dataset->getProp($this, 'SITE_CV', 'trait_descriptor'); + $cv_name = $dataset->getProp('SITE_CV', 'trait_descriptor'); if (!$cv_name) { $this->updateMsg('E', "$dataset_name does not have trait_descriptor as a project property"); return; } - // Skips if the descriptors has been checked for this dataset. - if (array_key_exists($project_id, $this->descriptors)) { - return; - } - // Go through headers stord in the line array. $descriptors = array(); foreach ($line as $column => $value) { - if (preg_match("/^#[A-Za-z]/", $column)) { + if (preg_match("/^#[A-Za-z0-9\_]/", $column)) { $cvterm_name = str_replace('#', '', $column); $cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); diff --git a/includes/class/template/module/mcl_template_progeny.class.inc b/includes/class/template/module/mcl_template_progeny.class.inc index 38df242..4fc8baf 100644 --- a/includes/class/template/module/mcl_template_progeny.class.inc +++ b/includes/class/template/module/mcl_template_progeny.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_PROGENY extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -81,7 +81,8 @@ class MCL_TEMPLATE_PROGENY extends MCL_TEMPLATE { MCL_CHADO_ORGANISM::checkOrganism($this, $line['genus'], $line['species']); // Checks cross_number. - MCL_CHADO_ND_EXPERIMENT::checkCrossNumber($this, $line['dataset_name'], $line['cross_number'], $this->cvterms['SITE_CV']['cross_experiment'], $this->cvterms['SITE_CV']['cross_number']); + $dataset = MCL_CHADO_DATASET::getDataset($line['dataset_name']); + MCL_CHADO_ND_EXPERIMENT::checkCrossNumber($this, $dataset->getProjectID(), $line['cross_number'], $this->cvterms['SITE_CV']['cross_experiment'], $this->cvterms['SITE_CV']['cross_experiment']); } /** @@ -93,12 +94,15 @@ class MCL_TEMPLATE_PROGENY extends MCL_TEMPLATE { $organism = MCL_CHADO_ORGANISM::getOrganism($line['genus'], $line['species']); $organism_id = $organism->getOrganismID(); + // Gets the dataset. + $dataset = MCL_CHADO_DATASET::getDataset($line['dataset_name']); + // Adds a progeny. $progeny = MCL_CHADO_STOCK::addStock($this, $line['progeny_name'], '', $organism_id, $this->cvterms['SITE_CV']['breeding_research_material']); if ($progeny) { // Gets the cross. - $cross = MCL_CHADO_ND_EXPERIMENT::byCrossNumber($line['dataset_name'], $line['cross_number'], $this->cvterms['SITE_CV']['cross_experiment'], $this->cvterms['SITE_CV']['cross_number']); + $cross = MCL_CHADO_ND_EXPERIMENT::byCrossNumber($dataset->getProjectID(), $line['cross_number'], $this->cvterms['SITE_CV']['cross_experiment'], $this->cvterms['SITE_CV']['cross_experiment']); // Adds parents and links this progeny and cross. if ($cross) { diff --git a/includes/class/template/module/mcl_template_progeny_bims.class.inc b/includes/class/template/module/mcl_template_progeny_bims.class.inc new file mode 100644 index 0000000..dccfcdc --- /dev/null +++ b/includes/class/template/module/mcl_template_progeny_bims.class.inc @@ -0,0 +1,141 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for field book sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'progeny_name' => array('req' => TRUE, 'width' => 14, 'desc' => ""), + 'alias' => array('req' => FALSE, 'width' => 14, 'desc' => "Record all the aliases for the cross here. The format is 'Alias type1:Alias1; Alias type2:Alias2'. When there is no specific type for an alias, just write the aliases without the specific type. (eg. Breeder:LG98-942; Institution:4321;2-F04-01)."), + 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => ""), + 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "When only the genus is known, write 'sp.' in the species."), + 'cross_number' => array('req' => TRUE, 'width' => 10, 'desc' => "Specific ID of a cross that generated the progeny; Must also be found in the Cross table."), + 'description' => array('req' => FALSE, 'width' => 14, 'desc' => "Any other descriptive data about the selection or seedling."), + 'advanced_to_2nd' => array('req' => FALSE, 'width' => 10, 'desc' => "Yes if it is advanced to 2nd phase, No otherwise. Leave it empty if the selection decision is yet to be made."), + 'advanced_to_3rd' => array('req' => FALSE, 'width' => 10, 'desc' => "Yes if it is advanced to 3rd phase, No otherwise."), + 'advanced_to_4th' => array('req' => FALSE, 'width' => 10, 'desc' => "Yes if it is advanced to 4th phase, No otherwise."), + ); + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['progeny'] = -1; + $cvterms['SITE_CV']['breeding_research_material'] = -1; + $cvterms['SITE_CV']['cross_number'] = -1; + $cvterms['SITE_CV']['cross_experiment'] = -1; + $cvterms['SITE_CV']['maternal_parent'] = -1; + $cvterms['SITE_CV']['paternal_parent'] = -1; + $cvterms['SITE_CV']['is_a_maternal_parent_of'] = -1; + $cvterms['SITE_CV']['is_a_paternal_parent_of'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks program_id. + $program_id = $this->getJob()->getParamByKey('program_id'); + if (!$program_id) { + $this->updateMsg('E', "program_id not found in job.param"); + } + + // Checks cross dataset. + $project_id_cross = $this->getJob()->getParamByKey('project_id_cross'); + if ($project_id_cross) { + MCL_CHADO_DATASET::checkDatasetByID($this, $project_id_cross); + } + else { + $this->updateMsg('E', "program_id not found in job.param"); + } + + // Checks organism. + MCL_CHADO_ORGANISM::checkOrganism($this, $line['genus'], $line['species']); + + // Checks cross_number. + MCL_CHADO_ND_EXPERIMENT::checkCrossNumber($this, $project_id_cross, $line['cross_number'], $this->cvterms['SITE_CV']['cross_experiment'], $this->cvterms['SITE_CV']['cross_experiment']); + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Gets the organism. + $organism = MCL_CHADO_ORGANISM::getOrganism($line['genus'], $line['species']); + $organism_id = $organism->getOrganismID(); + + // Sets the uniquename [program_id + stock_name]. + $program_id = $this->getJob()->getParamByKey('program_id'); + $uniquename = $program_id . '.' . $line['progeny_name']; + + // Gets cross dataset. + $project_id_cross = $this->getJob()->getParamByKey('project_id_cross'); + + // Adds a progeny. + $progeny = MCL_CHADO_STOCK::addStock($this, $uniquename, $line['progeny_name'], $organism_id, $this->cvterms['SITE_CV']['breeding_research_material']); + if ($progeny) { + + // Gets the cross. + $cross = MCL_CHADO_ND_EXPERIMENT::byCrossNumber($project_id_cross, $line['cross_number'], $this->cvterms['SITE_CV']['cross_experiment'], $this->cvterms['SITE_CV']['cross_experiment']); + + // Adds parents and links this progeny and cross. + if ($cross) { + + // Adds the cross. + $progeny->addCross($this, $cross, $this->cvterms['SITE_CV']['progeny']); + + // Adds the maternal parent. + $mother = $cross->getRelatedStock($this->cvterms['SITE_CV']['maternal_parent']); + if ($mother) { + $progeny->addRelatedStock($this, $mother, $this->cvterms['SITE_CV']['is_a_maternal_parent_of']); + } + + // Adds the paternal parent. + $father = $cross->getRelatedStock($this->cvterms['SITE_CV']['paternal_parent']); + if ($mother) { + $progeny->addRelatedStock($this, $mother, $this->cvterms['SITE_CV']['is_a_paternal_parent_of']); + } + } + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_qtl.class.inc b/includes/class/template/module/mcl_template_qtl.class.inc index 46bb153..45a0fb4 100644 --- a/includes/class/template/module/mcl_template_qtl.class.inc +++ b/includes/class/template/module/mcl_template_qtl.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_QTL extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -46,6 +46,7 @@ class MCL_TEMPLATE_QTL extends MCL_TEMPLATE { 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "The species of the phenotyping material."), 'trait_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Descriptive name for trait, it should be one of the crop trait ontology and should match a term in 'Trait' sheet."), 'trait_descriptor_set' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the crop trait ontology (entered by the curator who loads the data into the database). If not provided, the site trait ontology will be used."), + 'site_name' => array('req' => FALSE, 'width' => 10, 'desc' => "It should match 'site_name' in the 'Site' sheet."), 'alias' => array('req' => FALSE, 'width' => 10, 'desc' => "Other names for the trait, multiple aliases, separated by a semicolon (;) can be added."), 'r2' => array('req' => FALSE, 'width' => 10, 'desc' => "Fraction of the total variation explained by the QTLs."), 'lod' => array('req' => FALSE, 'width' => 10, 'desc' => "QTL Likelihood of odds."), @@ -117,6 +118,9 @@ class MCL_TEMPLATE_QTL extends MCL_TEMPLATE { // Checks trait. MCL_CHADO_TRAIT::checkTrait($this, $line['trait_name'], $line['trait_descriptor_set']); + // Checks site. + MCL_CHADO_LOCATION::checkSite($this, $line['site_name']); + // Checks colocalized_markers. MCL_CHADO_FEATURE::checkFeature($this, $line['colocalized_marker'], '', '', $this->cvterms['sequence']['genetic_marker'], '[;,]'); @@ -169,10 +173,13 @@ class MCL_TEMPLATE_QTL extends MCL_TEMPLATE { // Adds dataset. $qtl->addDataset($this, $line['dataset_name']); - // Adds colocalized_markers. + // Adds site. + $qtl->addSite($this, $line['site_name']); + + // Adds colocalized markers. $qtl->addRelatedFeatures($this, $line['colocalized_marker'], $this->cvterms['sequence']['genetic_marker'], FALSE, $this->cvterms['relationship']['adjacent_to'], "[,;]"); - // Adds neighboring_markers. + // Adds neighboring markers. $qtl->addRelatedFeatures($this, $line['neighboring_marker'], $this->cvterms['sequence']['genetic_marker'], FALSE, $this->cvterms['relationship']['located_in'], "[,;]"); // Adds stocks. diff --git a/includes/class/template/module/mcl_template_qtl_trait_data.class.inc b/includes/class/template/module/mcl_template_qtl_trait_data.class.inc index 8474b90..8e3a02c 100644 --- a/includes/class/template/module/mcl_template_qtl_trait_data.class.inc +++ b/includes/class/template/module/mcl_template_qtl_trait_data.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_QTL_TRAIT_DATA extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -55,7 +55,9 @@ name of the QTL trait study, the dataset_name should exist in 'dataset_name' col 'descriptor' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the trait. It should exist in 'trait_name' column of the 'Trait' sheet and 'QTL' sheet."), 'trait_descriptor_set' => array('req' => FALSE, 'width' => 20, 'desc' => "The name of the crop trait ontology that is stored in cv table of chado (eg. 'rosaceae_trait_ontology' for GDR, 'cotton_trait_ontology' for cotton). In Main Lab, we develop crop trait ontology for Rosaceae, cool season food legumes, cotton and citrus, and map them to the Plant Trait Ontology. If not provided, the site trait ontology will be used."), 'site_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Location/environment where the plant was grown. Site_name should exist in 'site_name' column of the 'Site' sheet. If the phenotypic measurement has bee done in multiple years, create multiple site_code even if it is done in the same location."), - 'mean' => array('req' => TRUE, 'width' => 10, 'desc' => "Mean value of the traits for each parent and progeny."), + 'mean' => array('req' => TRUE, 'width' => 10, 'desc' => "The mean value of the traits for each parent and progeny."), + 'min_value' => array('req' => FALSE, 'width' => 10, 'desc' => "The minimum value of the traits for each parent and progeny."), + 'max_value' => array('req' => FALSE, 'width' => 10, 'desc' => "The maximum value of the traits for each parent and progeny."), 'standard_deviation' => array('req' => FALSE, 'width' => 10, 'desc' => ""), 'coefficient_of_variation' => array('req' => FALSE, 'width' => 10, 'desc' => ""), 'skewness' => array('req' => FALSE, 'width' => 10, 'desc' => ""), @@ -140,6 +142,8 @@ name of the QTL trait study, the dataset_name should exist in 'dataset_name' col $nd_experiment = MCL_CHADO_ND_EXPERIMENT::addNdExperiment($this, $this->cvterms['SITE_CV']['statistical'], $nd_geolocation_id, $this->cvterms['SITE_CV']['statistical'], $value); // Adds properties. + $nd_experiment->addProp($this, 'SITE_CV', 'min_value', $line['min_value']); + $nd_experiment->addProp($this, 'SITE_CV', 'max_value', $line['max_value']); $nd_experiment->addProp($this, 'SITE_CV', 'standard_deviation', $line['standard_deviation']); $nd_experiment->addProp($this, 'SITE_CV', 'coefficient_of_variation', $line['coefficient_of_variation']); $nd_experiment->addProp($this, 'SITE_CV', 'skewness', $line['skewness']); diff --git a/includes/class/template/module/mcl_template_site.class.inc b/includes/class/template/module/mcl_template_site.class.inc index e43521d..401212b 100644 --- a/includes/class/template/module/mcl_template_site.class.inc +++ b/includes/class/template/module/mcl_template_site.class.inc @@ -5,9 +5,9 @@ */ class MCL_TEMPLATE_SITE extends MCL_TEMPLATE { - /** - * Class data members. - */ + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -59,13 +59,14 @@ class MCL_TEMPLATE_SITE extends MCL_TEMPLATE { */ public function defineCvterms() { $cvterms = array(); - $cvterms['SITE_CV']['type'] = -1; - $cvterms['SITE_CV']['country'] = -1; - $cvterms['SITE_CV']['state'] = -1; - $cvterms['SITE_CV']['region'] = -1; - $cvterms['SITE_CV']['address'] = -1; - $cvterms['SITE_CV']['comments'] = -1; - $cvterms['SITE_CV']['site_code'] = -1; + $cvterms['SITE_CV']['type'] = -1; + $cvterms['SITE_CV']['site_long_name'] = -1; + $cvterms['SITE_CV']['country'] = -1; + $cvterms['SITE_CV']['state'] = -1; + $cvterms['SITE_CV']['region'] = -1; + $cvterms['SITE_CV']['address'] = -1; + $cvterms['SITE_CV']['comments'] = -1; + $cvterms['SITE_CV']['site_code'] = -1; return $cvterms; } @@ -73,7 +74,11 @@ class MCL_TEMPLATE_SITE extends MCL_TEMPLATE { * @see MCL_TEMPLATE::runErrorCheckDataLine() */ public function runErrorCheckDataLine($line) { - // Checks data here ... + + // Checks for the contact type. + if (!MCL_DATA_VALID_TYPE::validate('location_type', $line['type'])) { + $this->updateMsg('E', 'Invalid location type : ' . $line['type']); + } } /** @@ -100,6 +105,7 @@ class MCL_TEMPLATE_SITE extends MCL_TEMPLATE { // Adds properties. $location->addProp($this, 'SITE_CV', 'type', $line['type']); + $location->addProp($this, 'SITE_CV', 'site_long_name', $line['site_long_name']); $location->addProp($this, 'SITE_CV', 'country', $line['country']); $location->addProp($this, 'SITE_CV', 'state', $line['state']); $location->addProp($this, 'SITE_CV', 'region', $line['region']); diff --git a/includes/class/template/module/mcl_template_site_cotton.class.inc b/includes/class/template/module/mcl_template_site_cotton.class.inc new file mode 100644 index 0000000..a120e9c --- /dev/null +++ b/includes/class/template/module/mcl_template_site_cotton.class.inc @@ -0,0 +1,157 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for site sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'site_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Curator-assigned name of the site."), + 'site_long_name' => array('req' => FALSE, 'width' => 10, 'desc' => "long name of the site."), + 'latitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The decimal latitude coordinate of the georeference, using positive and negative sign to indicate N and S, respectively."), + 'longitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The decimal longitude coordinate of the georeference, using positive and negative sign to indicate E and W, respectively."), + 'altitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The altitude (elevation) of the location in meters. If the altitude is only known as a range, this is the average, and altitude_dev will hold half of the width of the range."), + 'geodetic_datum' => array('req' => FALSE, 'width' => 10, 'desc' => "The geodetic system on which the geo-reference coordinates are based. For geo-references measured between 1984 and 2010, this will typically be WGS84."), + 'type' => array('req' => FALSE, 'width' => 10, 'desc' => "'orchard', 'nursery' or any other types of location."), + 'country' => array('req' => FALSE, 'width' => 10, 'desc' => "Country where the site belongs to."), + 'state' => array('req' => FALSE, 'width' => 10, 'desc' => "State where the site belongs to."), + 'region' => array('req' => FALSE, 'width' => 10, 'desc' => "Region where the site belongs to."), + 'address' => array('req' => FALSE, 'width' => 10, 'desc' => "The entire address except the country."), + 'comments' => array('req' => FALSE, 'width' => 10, 'desc' => "Any further comments on the site."), + 'data_year' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'experimental_design' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'replications' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'plants_per_replication' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'plant_date' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'plot_distance' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'row_distance' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'plant_distance' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'irrigation' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'soil_type' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'agronomic_control' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'pick_date' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + 'evaluation_date' => array('req' => FALSE, 'width' => 10, 'desc' => ""), + ); + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + + $cvterms = array(); + $cvterms['SITE_CV']['type'] = -1; + $cvterms['SITE_CV']['site_long_name'] = -1; + $cvterms['SITE_CV']['country'] = -1; + $cvterms['SITE_CV']['state'] = -1; + $cvterms['SITE_CV']['region'] = -1; + $cvterms['SITE_CV']['address'] = -1; + $cvterms['SITE_CV']['comments'] = -1; + $cvterms['SITE_CV']['data_year'] = -1; + $cvterms['SITE_CV']['experimental_design'] = -1; + $cvterms['SITE_CV']['replications'] = -1; + $cvterms['SITE_CV']['plants_per_replication'] = -1; + $cvterms['SITE_CV']['plant_date'] = -1; + $cvterms['SITE_CV']['plot_distance'] = -1; + $cvterms['SITE_CV']['row_distance'] = -1; + $cvterms['SITE_CV']['plant_distance'] = -1; + $cvterms['SITE_CV']['irrigation'] = -1; + $cvterms['SITE_CV']['soil_type'] = -1; + $cvterms['SITE_CV']['agronomic_control'] = -1; + $cvterms['SITE_CV']['pick_date'] = -1; + $cvterms['SITE_CV']['evaluation_date'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks for the contact type. + if (!MCL_DATA_VALID_TYPE::validate('location_type', $line['type'])) { + $this->updateMsg('E', 'Invalid location type : ' . $line['type']); + } + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Adds a location. + $loc_info = array(); + if ($line['latitude']) { + $loc_info['latitude'] = $line['latitude']; + } + if ($line['longitude']) { + $loc_info['longitude'] = $line['longitude']; + } + if ($line['altitude']) { + $loc_info['altitude'] = $line['altitude']; + } + if ($line['geodetic_datum']) { + $loc_info['geodetic_datum'] = $line['geodetic_datum']; + } + $location = MCL_CHADO_LOCATION::addLocation($this, $line['site_name'], $loc_info); + if ($location) { + + // Adds properties. + $location->addProp($this, 'SITE_CV', 'type', $line['type']); + $location->addProp($this, 'SITE_CV', 'site_long_name', $line['site_long_name']); + $location->addProp($this, 'SITE_CV', 'country', $line['country']); + $location->addProp($this, 'SITE_CV', 'state', $line['state']); + $location->addProp($this, 'SITE_CV', 'region', $line['region']); + $location->addProp($this, 'SITE_CV', 'address', $line['address']); + $location->addProp($this, 'SITE_CV', 'country', $line['country']); + $location->addProp($this, 'SITE_CV', 'comments', $line['comments']); + $location->addProp($this, 'SITE_CV', 'data_year', $line['data_year']); + $location->addProp($this, 'SITE_CV', 'experimental_design', $line['experimental_design']); + $location->addProp($this, 'SITE_CV', 'replications', $line['replications']); + $location->addProp($this, 'SITE_CV', 'plants_per_replication', $line['plants_per_replication']); + $location->addProp($this, 'SITE_CV', 'plant_date', $line['plant_date']); + $location->addProp($this, 'SITE_CV', 'plot_distance', $line['plot_distance']); + $location->addProp($this, 'SITE_CV', 'row_distance', $line['row_distance']); + $location->addProp($this, 'SITE_CV', 'plant_distance', $line['plant_distance']); + $location->addProp($this, 'SITE_CV', 'irrigation', $line['irrigation']); + $location->addProp($this, 'SITE_CV', 'soil_type', $line['soil_type']); + $location->addProp($this, 'SITE_CV', 'agronomic_control', $line['agronomic_control']); + $location->addProp($this, 'SITE_CV', 'pick_date', $line['pick_date']); + $location->addProp($this, 'SITE_CV', 'evaluation_date', $line['evaluation_date']); + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_stock.class.inc b/includes/class/template/module/mcl_template_stock.class.inc index 23ac16b..3c5d665 100644 --- a/includes/class/template/module/mcl_template_stock.class.inc +++ b/includes/class/template/module/mcl_template_stock.class.inc @@ -5,15 +5,9 @@ */ class MCL_TEMPLATE_STOCK extends MCL_TEMPLATE { - /** - * Class data members. - */ - // Valid stock types. - public $valid_stock_types = array( - 'variety', 'cultivar', 'breeding_research_material', 'population', - 'wild_unimproved', 'tbd', 'landrace', 'germplasm', 'species' - ); - + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -120,9 +114,6 @@ class MCL_TEMPLATE_STOCK extends MCL_TEMPLATE { // Checks organism. MCL_CHADO_ORGANISM::checkOrganism($this, $line['genus'], $line['species']); - // Checks germplasm type. - MCL_CHADO_STOCK::checkType($this, $line['germplasm_type']); - // Checks aliases. MCL_CHADO_STOCK::checkAlias($this, $line['alias'], '[;,]'); @@ -131,6 +122,11 @@ class MCL_TEMPLATE_STOCK extends MCL_TEMPLATE { // Checks references. MCL_CHADO_PUB::checkPub($this, $line['reference'], '[;,]'); + + // Checks germplasm type. + if (!MCL_DATA_VALID_TYPE::validate('stock_type', $line['germplasm_type'])) { + $this->updateMsg('E', 'Invalid stock type : ' . $line['germplasm_type']); + } } /** diff --git a/includes/class/template/module/mcl_template_stock_cotton.class.inc b/includes/class/template/module/mcl_template_stock_cotton.class.inc new file mode 100644 index 0000000..5d7802e --- /dev/null +++ b/includes/class/template/module/mcl_template_stock_cotton.class.inc @@ -0,0 +1,190 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for stock sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Primary ID or name of stock. The most important ID or name (unique and stable at least within the breeding program) should be in this column. For mapping population, follow the naming convention of each database."), + 'germplasm_type' => array('req' => TRUE, 'width' => 10, 'desc' => "Select from the three choices (cultivar, breeding_research_material, or wild_unimproved) for an individual germplasm or 'population' for a group of individual."), + 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => "Genus to which the stock belongs to."), + 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "Species name. Enter 'sp.' to represent one unknown species, 'spp.' to represent multiple unknown species."), + 'grin_id' => array('req' => FALSE, 'width' => 10, 'desc' => "Accession ID (ACID) in the GRIN database, if it is known."), + 'subspecies' => array('req' => FALSE, 'width' => 10, 'desc' => "Subspecies name."), + 'description' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name for the pollen parent of this entry. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'secondary_id' => array('req' => TRUE, 'width' => 10, 'desc' => "Alternate ID or name that is commonly used to refer to the entry."), + 'paternal_parent' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name for the pollen parent of this entry. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'maternal_parent' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name for the seed parent of this entry. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'mutation_parent' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name of the mutaion parent. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'selfing_parent' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name of the selfing parent. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'alias' => array('req' => FALSE, 'width' => 10, 'desc' => "A concatenation of all other less commonly used names or designations for the entry. the aliases. The format is 'Alias type1:Alias1; Alias type2:Alias2'. When there is no specific type for aliases, just write the aliases without the specific type. (eg. Collector:98HT-227; Site:W6 21306; ABC-1; 21306) The format is 'Alias type1:Alias1; Alias type2:Alias2'. When there is no specific type for an alias, just write the aliases without the specific type. (eg. Collector:98HT-227; Site:W6 21306; ABC-1; 21306)."), + 'cultivar' => array('req' => FALSE, 'width' => 10, 'desc' => "Cultivar name if It is a named, cultivated variety."), + 'pedigree' => array('req' => FALSE, 'width' => 10, 'desc' => "Any additional pedigree information: When the exact parents are not known, or any additional information beyond just parents (eg. Red-fruit sport of Jonathan, Pyrus sp. X Cydonia sp., etc)."), + 'origin' => array('req' => FALSE, 'width' => 10, 'desc' => "The original country for the variety (especially for wild variety)."), + 'population_size' => array('req' => FALSE, 'width' => 10, 'desc' => "Only for type 'population'."), + 'germplasm_center' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock center or lab where the stock is distributed. Otherwise, provide the details of the contact person in contact column (from whom the material can be obtained) in the 'Contact' sheet."), + 'description' => array('req' => FALSE, 'width' => 10, 'desc' => "any description for the stock."), + 'comments' => array('req' => FALSE, 'width' => 10, 'desc' => "Any comments on the stock."), + 'image' => array('req' => FALSE, 'width' => 10, 'desc' => "Image_ID of any associated image (Detailed info in 'Image' sheet.) Multiple images, separated by comma, can be added."), + 'reference' => array('req' => FALSE, 'width' => 10, 'desc' => "pub_id if any publication is associated with the stock."), + ); + + // Adds labels. + $headers['grin_id']['label'] = 'GRIN_ID'; + $headers['secondary_id']['label'] = 'secondary_ID'; + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['alias'] = -1; + $cvterms['SITE_CV']['secondary_id'] = -1; + $cvterms['SITE_CV']['germplasm_center'] = -1; + $cvterms['SITE_CV']['variety'] = -1; + $cvterms['SITE_CV']['cultivar'] = -1; + $cvterms['SITE_CV']['breeding_research_material'] = -1; + $cvterms['SITE_CV']['wild_unimproved'] = -1; + $cvterms['SITE_CV']['tbd'] = -1; + $cvterms['SITE_CV']['landrace'] = -1; + $cvterms['SITE_CV']['germplasm'] = -1; + $cvterms['SITE_CV']['population'] = -1; + $cvterms['SITE_CV']['species'] = -1; + $cvterms['SITE_CV']['is_a_maternal_parent_of'] = -1; + $cvterms['SITE_CV']['is_a_paternal_parent_of'] = -1; + $cvterms['SITE_CV']['is_a_mutation_parent_of'] = -1; + $cvterms['SITE_CV']['is_a_selfing_parent_of'] = -1; + $cvterms['SITE_CV']['maternal_parent'] = -1; + $cvterms['SITE_CV']['paternal_parent'] = -1; + $cvterms['SITE_CV']['mutation_parent'] = -1; + $cvterms['SITE_CV']['selfing_parent'] = -1; + $cvterms['SITE_CV']['pedigree'] = -1; + $cvterms['SITE_CV']['description'] = -1; + $cvterms['SITE_CV']['origin'] = -1; + $cvterms['SITE_CV']['comments'] = -1; + $cvterms['SITE_CV']['population_size'] = -1; + $cvterms['SITE_CV']['subspecies'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks DB for GRIN. + MCL_CHADO_DB::checkDB($this, 'GRIN'); + + // Checks organism. + MCL_CHADO_ORGANISM::checkOrganism($this, $line['genus'], $line['species']); + + // Checks aliases. + MCL_CHADO_STOCK::checkAlias($this, $line['alias'], '[;,]'); + + // Checks images. + MCL_CHADO_IMAGE::checkImage($this, $line['image'], '[;,]'); + + // Checks references. + MCL_CHADO_PUB::checkPub($this, $line['reference'], '[;,]'); + + // Checks germplasm type. + if (!MCL_DATA_VALID_TYPE::validate('stock_type', $line['germplasm_type'])) { + $this->updateMsg('E', 'Invalid stock type : ' . $line['germplasm_type']); + } + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Gets the organism. + $organism = MCL_CHADO_ORGANISM::getOrganism($line['genus'], $line['species']); + $organism_id = $organism->getOrganismID(); + + // Gets type_id. + $type_id = $this->cvterms['SITE_CV'][strtolower($line['germplasm_type'])]; + + // Adds a stock. + $stock = MCL_CHADO_STOCK::addStockBy2ndID($this, $line['stock_name'], $line['secondary_id'], $organism_id, $type_id); + if ($stock) { + + // Gets db. + $db = MCL_CHADO_DB::getDB('GRIN'); + + // Adds a dbxref. + $dbxref = MCL_CHADO_DBXREF::addDBXref($this, $db->getDbID(), $line['grin_id']); + if ($dbxref) { + + // Adds dbxref to stock_dbxref table. + $stock->addDBXref($this, $dbxref); + + // Updates stock.dbxref_id. + $stock->setDbxrefID($dbxref->getDbxrefID()); + $stock->update(); + } + + // Adds properties. + $stock->addProp($this, 'SITE_CV', 'secondary_id', $line['secondary_id']); + $stock->addProp($this, 'SITE_CV', 'description', $line['description']); + $stock->addProp($this, 'SITE_CV', 'cultivar', $line['cultivar']); + $stock->addProp($this, 'SITE_CV', 'pedigree', $line['pedigree']); + $stock->addProp($this, 'SITE_CV', 'origin', $line['origin']); + $stock->addProp($this, 'SITE_CV', 'population_size', $line['population_size']); + $stock->addProp($this, 'SITE_CV', 'subspecies', $line['subspecies']); + $stock->addProp($this, 'SITE_CV', 'germplasm_center', $line['germplasm_center']); + $stock->addProp($this, 'SITE_CV', 'comments', $line['comments']); + + // Adds aliases. + $stock->addAlias($this, $line['alias'], "[,;]"); + + // Adds parents. + $stock->addParent($this, $line['paternal_parent'], '', $this->cvterms['SITE_CV']['is_a_maternal_parent_of']); + $stock->addParent($this, $line['maternal_parent'], '', $this->cvterms['SITE_CV']['is_a_paternal_parent_of']); + $stock->addParent($this, $line['mutation_parent'], '', $this->cvterms['SITE_CV']['is_a_mutation_parent_of']); + $stock->addParent($this, $line['selfing_parent'], '', $this->cvterms['SITE_CV']['is_a_selfing_parent_of']); + + // Adds images. + $stock->addImage($this, $line['image'], "[,;]"); + + // Adds references. + $stock->addReference($this, $line['reference'], "[,;]"); + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_trait.class.inc b/includes/class/template/module/mcl_template_trait.class.inc index f21cb20..049da90 100644 --- a/includes/class/template/module/mcl_template_trait.class.inc +++ b/includes/class/template/module/mcl_template_trait.class.inc @@ -5,15 +5,9 @@ */ class MCL_TEMPLATE_TRAIT extends MCL_TEMPLATE { - /** - * Class data members. - */ - public $valid_trait_categories = array( - 'biochemical trait', 'growth and development trait', - 'anatomy and morphology trait', 'quality trait', 'stature or vigor trait', - 'sterility or fertility trait', 'stress trait', 'yield trait', 'physiological trait', - ); - + /** + * Class data members. + */ /** * @see MCL_TEMPLATE::__construct() */ @@ -60,14 +54,6 @@ class MCL_TEMPLATE_TRAIT extends MCL_TEMPLATE { $cvterms = array(); $cvterms['SITE_CV']['abbreviation'] = -1; $cvterms['relationship']['is_a'] = -1; - $cvterms['SITE_TRAIT_ONTOLOGY']['biochemical trait'] = -1; - $cvterms['SITE_TRAIT_ONTOLOGY']['growth and development trait'] = -1; - $cvterms['SITE_TRAIT_ONTOLOGY']['anatomy and morphology trait'] = -1; - $cvterms['SITE_TRAIT_ONTOLOGY']['quality trait'] = -1; - $cvterms['SITE_TRAIT_ONTOLOGY']['stature or vigor trait'] = -1; - $cvterms['SITE_TRAIT_ONTOLOGY']['sterility or fertility trait'] = -1; - $cvterms['SITE_TRAIT_ONTOLOGY']['stress trait'] = -1; - $cvterms['SITE_TRAIT_ONTOLOGY']['yield trait'] = -1; return $cvterms; } @@ -76,8 +62,10 @@ class MCL_TEMPLATE_TRAIT extends MCL_TEMPLATE { */ public function runErrorCheckDataLine($line) { - // Checks for trait category. - MCL_CHADO_TRAIT::checkCategory($this, $line['trait_category']); + // Checks for the trait category. + if (!MCL_DATA_VALID_TYPE::validate('trait_category', $line['trait_category'])) { + $this->updateMsg('E', 'Invalid trait category : ' . $line['trait_category']); + } } /** diff --git a/includes/form/mcl.data_query.form.inc b/includes/form/mcl.data_query.form.inc new file mode 100644 index 0000000..ed03954 --- /dev/null +++ b/includes/form/mcl.data_query.form.inc @@ -0,0 +1,268 @@ + $user->uid)); + + // Creates a form. + $form = array(); + $form['#tree'] = TRUE; + + // Saves the type. + $form['query_type'] = array( + '#type' => 'value', + '#value' => $type, + ); + + // Data query. + $form['data_query'] = array( + '#type' => 'fieldset', + '#collapsed' => FALSE, + '#collapsible' => FALSE, + '#title' => 'Data Query : ' . $type, + ); + $form['data_query']['uniquename'] = array( + '#type' => 'textfield', + '#title' => 'uniquename', + '#attributes' => array('style' => 'width:400px;'), + ); + $form['data_query']['feature_id'] = array( + '#type' => 'textfield', + '#title' => 'feature_id', + '#attributes' => array('style' => 'width:400px;'), + ); + $form['data_query']['search_btn'] = array( + '#type' => 'button', + '#value' => 'Search', + '#name' => 'search_btn', + '#suffix' => '

', + '#attributes' => array('style' => 'width:100px;'), + '#ajax' => array( + 'callback' => "mcl_data_query_form_ajax_callback", + 'wrapper' => 'mcl-data-query-form', + 'effect' => 'fade', + 'method' => 'replace', + ), + ); + + // Adds form elements for search results. + if (array_key_exists('values', $form_state)) { + $query_type = $form_state['values']['query_type']; + + // Gets the results. + if ($query_type == 'feature') { + + // Search the related tables for the features. + $cvterm = MCL_CHADO_CVTERM::getCvterm('sequence', 'genetic_marker'); + $type_id = $cvterm->getCvtermID(); + + // Gets uniquename. + $uniquename = trim($form_state['values']['data_query']['uniquename']); + if (!$uniquename) { + $feature_id = trim($form_state['values']['data_query']['feature_id']); + $feature = CHADO_FEATURE::byKey(array('feature_id' => $feature_id)); + $uniquename = $feature->getUniquename(); + } + _mcl_get_result_feature($form, $uniquename, $type_id); + } + else if ($query_type == 'stock') { + _mcl_get_result_stock($form, $uniquename); + } + } + + // Sets form properties. + $form['#prefix'] = '
'; + $form['#suffix'] = '
'; + return $form; +} + +/** + * Ajax function which returns the form via ajax. + * + * @param $form + * @param $form_state + */ +function mcl_data_query_form_ajax_callback($form, &$form_state) { + return $form; +} + +/** + * Returns the results. + * + * @param arary $form + * @param string $uniquename + * @param integer $type_id + * + * @return string + */ +function _mcl_get_result_feature(&$form, $uniquename, $type_id) { + + // Adds a fieldset for the feature. + $form['data_query']['results']['feature'] = array( + '#type' => 'fieldset', + '#collapsed' => FALSE, + '#collapsible' => FALSE, + '#title' => "Feature : $uniquename", + ); + + // Gets all features with the same uniquename. + $sql = " + SELECT F.feature_id, F.uniquename, O.genus, O.species + FROM chado.feature F + INNER JOIN chado.organism O on O.organism_id = F.organism_id + WHERE F.type_id = :type_id AND uniquename = :uniquename + "; + $features = array(); + $args = array( + ':type_id' => $type_id, + ':uniquename' => $uniquename, + ); + $results = db_query($sql, $args); + while ($obj = $results->fetchObject()) { + $features []= $obj; + } + + if (empty($features)) { + $form['data_query']['results']['feature']['table'] = array( + '#markup' => "'$uniquename' not found in feature", + ); + } + else { + $form['data_query']['results']['feature']['table'] = array( + '#markup' => sizeof($features) . " features have the same uniquename.

", + ); + + // Sets the search_path to chado, public for create_point function. + $sql = "SET SEARCH_PATH TO chado, public;"; + db_query($sql); + + // Searches for related tables for each feature. + foreach ($features as $feature) { + $feature_id = $feature->feature_id; + $genus = $feature->genus; + $species = $feature->species; + + // Adds a fieldset for the feature. + $form['data_query']['results']['feature'][$feature_id] = array( + '#type' => 'fieldset', + '#collapsed' => TRUE, + '#collapsible' => TRUE, + '#title' => "Feature ID : $feature_id ($genus $species)", + ); + + $sql = "SET SEARCH_PATH TO chado, public;"; + db_query($sql); + + // Checks feature_id for the related tables. + $rel_tables = MCL_CHADO_FEATURE::getRelTable(); + $no_rel_table = TRUE; + foreach ($rel_tables['feature_id'] as $table_info) { + $fk_table = $table_info['table']; + $fk_attr = $table_info['attr']; + + // Checks if feature_id exists in the related table. + $sql = "SELECT COUNT($fk_attr) FROM chado.$fk_table WHERE $fk_attr = :feature_id"; + $num = db_query($sql, array(':feature_id' => $feature_id))->fetchField(); + if ($num) { + $no_rel_table = FALSE; + $form['data_query']['results']['feature'][$feature_id][$fk_table] = array( + '#type' => 'fieldset', + '#collapsed' => TRUE, + '#collapsible' => TRUE, + '#title' => "$fk_table ($num)", + ); + $sql = "SELECT * FROM chado.$fk_table WHERE $fk_attr = :feature_id"; + $results = db_query($sql, array(':feature_id' => $feature_id)); + $tables = ''; + while ($arr = $results->fetch(PDO::FETCH_ASSOC)) { + $rows = array(); + foreach ($arr as $key => $value) { + $rows []= array($key, $value); + } + $table_vars = array( + 'header' => array('attr', 'value'), + 'rows' => $rows, + 'attributes' => array(), + ); + $tables .= theme('table', $table_vars); + } + $form['data_query']['results']['feature'][$feature_id][$fk_table]['tables'] = array( + '#markup' => $tables, + ); + } + } + if ($no_rel_table) { + $form['data_query']['results']['feature'][$feature_id]['tables'] = array( + '#markup' => 'Not found in related tables.', + ); + } + } + } +} + +/** + * Returns the results. + * + * @param array $uniquenames + * + * @return string + */ +function _mcl_get_result_stock($uniquenames) { + $results = ''; + + foreach ($uniquenames as $uniquename) { + $feature = MCL_CHADO_STOCK::byKey(array('uniquename' => $uniquename)); + if ($feature) { + + } + else { + $results .= "$uniquename not found in $type
"; + } + } + return $results; +} + +/** + * Validates the form. + * + * @param $form + * @param $form_state + */ +function mcl_data_query_form_validate($form, &$form_state) { + + // Gets the trigger element. + $trigger_elem = $form_state['triggering_element']['#name']; + + // If the 'program_list' was changed. + if ($trigger_elem == 'search_btn') { + $query_type = $form_state['values']['query_type']; + + // Feature. + if ($query_type == 'feature') { + $uniquename = trim($form_state['values']['data_query']['uniquename']); + $feature_id = trim($form_state['values']['data_query']['feature_id']); + if (($uniquename && $feature_id) || (!$uniquename && !$feature_id)) { + form_set_error('data_query][uniquename', t("Please type uniquename or feature_id")); + return; + } + } + } +} + +/** + * Submits the form. + * + * @param $form + * @param $form_state + */ +function mcl_data_query_form_submit($form, &$form_state) {} diff --git a/includes/form/mcl.form.inc b/includes/form/mcl.form.inc index 483ac48..c1644e4 100644 --- a/includes/form/mcl.form.inc +++ b/includes/form/mcl.form.inc @@ -48,6 +48,19 @@ function mcl_form($form, &$form_state) { // Adds the link to the list of drush commands. if (user_access('admin_mcl')) { $items[] = l('Drush commands', '/mcl/drush'); + $items []= array( + 'data' => 'Data Queries', + 'children' => array( + array( + 'data' => l('Feature', '/mcl/data_query/feature'), + 'style' => array('list-style-type:disc;'), + ), + array( + 'data' => l('Stock', '/mcl/data_query/stock'), + 'style' => array('list-style-type:disc;'), + ), + ), + ); } $form['mcl']['page_link'] = array( '#markup' => theme('item_list', array('items' => $items)), diff --git a/includes/form/mcl.job_view.form.inc b/includes/form/mcl.job_view.form.inc index a9c22ac..9227489 100644 --- a/includes/form/mcl.job_view.form.inc +++ b/includes/form/mcl.job_view.form.inc @@ -1,7 +1,7 @@ $job_id)); if ($mcl_job) { + // Adds the refresh button. + $url = "mcl/job_view/$job_id"; + $button = ""; + + $form['refresh_page'] = array( + '#markup' => $button, + ); + // Adds the table for job details. $form['job_view']['details'] = array( '#markup' => _mcl_get_detail_table($mcl_job), @@ -61,6 +69,19 @@ function mcl_job_view_form($form, &$form_state, $job_id = NULL) { 'file_validate_extensions' => array('xls xlsx zip csv'), ), ); + $form['job_rerun']['force_cb'] = array( + '#type' => 'checkbox', + '#title' => 'Force to upload data', + '#description' => "Check if new data were added to the template which has already been uploaded.", + '#default_value' => FALSE, + ); + $default = ($mcl_job->getPropByKey('transaction')) ? FALSE : TRUE; + $form['job_rerun']['no_transaction_cb'] = array( + '#type' => 'checkbox', + '#title' => 'No transaction', + '#description' => "Check if the size of your uploading file are large.", + '#default_value' => $default, + ); $form['job_rerun']['rerun_btn'] = array( '#type' => 'submit', '#name' => 'rerun_btn', @@ -140,7 +161,7 @@ function _mcl_get_all_logs(MCL_JOB_UPLOAD $mcl_job) { $files = file_scan_directory("$recent_dir/$object", "/\.log$/"); $log_files = array(); foreach ($files as $filepath => $file) { - preg_match("/-([A-Za-z\_]+)\.log$/", $filepath, $matches2); + preg_match("/-([A-Za-z0-9\_]+)\.log$/", $filepath, $matches2); $key = $matches2[1]; $log_files []= array( 'key' => $key, @@ -324,8 +345,8 @@ function _mcl_get_detail_table(MCL_JOB_UPLOAD $mcl_job) { global $base_root; // Adds the link to the uploaded file. - $mcl_file = $mcl_job->getMCLFile(); - $link_template = l('download', 'mcl/download_file/' . $mcl_file->getFileID()); + $mcl_file = $mcl_job->getMCLFile(); + $link_template = l('download', 'mcl/download_file/' . $mcl_file->getFileID()); // Adds the link to download all log files in zip. $link_log = l('download all', 'mcl/download_log/' . $mcl_job->getJobID()); @@ -336,11 +357,22 @@ function _mcl_get_detail_table(MCL_JOB_UPLOAD $mcl_job) { $complete_date = 'N/A'; } - // Sets status. - $status = $mcl_job->getStatusLabel(); - $run_lock = $mcl_job->getJobDir() . '/run.lock'; - if (file_exists($run_lock)) { - $status = "Running"; + // Sets the status. + $status = $mcl_job->getStatus(); + $status_label = $mcl_job->getStatusLabel(); + if ($status > 0 && $status < 100) { + + // Checks process ID to make sure it is actually running. + $pid = $mcl_job->getPID(); + $proc_file = "/proc/$pid"; + if (file_exists($proc_file)) { + $status_label = "Running [$pid]"; + } + else { + $status_label = "Failed"; + $mcl_job->setStatus(-200); + $mcl_job->update(); + } } // Sets the last run date. @@ -352,7 +384,9 @@ function _mcl_get_detail_table(MCL_JOB_UPLOAD $mcl_job) { $rows []= array(array('data' => 'Job ID', 'style' => 'width:160px;'), $mcl_job->getJobID()); $rows []= array('Name', $mcl_job->getName()); $rows []= array('Data Template File', $link_template); - $rows []= array('Status', $status); + $rows []= array('File Name', $mcl_file->getFilename()); + $rows []= array('File Size', mcl_format_bytes($mcl_file->getFilesize())); + $rows []= array('Status', $status_label); // Adds progress row if not empty. $progress = $mcl_job->getProgress(); @@ -423,8 +457,30 @@ function mcl_job_view_form_submit($form, &$form_state) { ->condition('fid', $drupal_file->fid, '=') ->execute(); + // Gets 'force' option. + $opt_force = ''; + $force_cb = trim($form_state['values']['job_rerun']['force_cb']); + if ($force_cb) { + $opt_force = '--force'; + } + + // Gets 'no_transaction' option. + $opt_no_transaction = ''; + $trans = TRUE; + $no_transaction_cb = trim($form_state['values']['job_rerun']['no_transaction_cb']); + if ($no_transaction_cb) { + $opt_no_transaction = '--no_transaction'; + $trans = FALSE; + } + + // Gets MCL_JOB_UPLOAD and updates the properties. + $mcl_job = MCL_JOB_UPLOAD::byKey(array('job_id' => $job_id)); + $mcl_job->setPropByKey('transaction', $trans); + $mcl_job->setStatus(0); + $mcl_job->update(); + // Submits the re-uploading job. - $cmd = "drush mcl-rerun-job $job_id $dest_filepath --move_input > /dev/null 2>/dev/null & "; + $cmd = "drush mcl-rerun-job $job_id $dest_filepath --move_input $opt_force $opt_no_transaction > /dev/null 2>/dev/null & "; $pid = exec($cmd, $output, $return_var); if ($return_var) { drupal_set_message("Failed to re-run the job"); diff --git a/includes/form/mcl.template_list.form.inc b/includes/form/mcl.template_list.form.inc index b5de904..831d6ed 100644 --- a/includes/form/mcl.template_list.form.inc +++ b/includes/form/mcl.template_list.form.inc @@ -67,7 +67,7 @@ function _mcl_get_template_table() { // Skips if the template is not public. if ($mcl_template->getPublic() != 1) { - //continue; + continue; } // Checks if class has been defined. diff --git a/includes/form/mcl.upload_data.form.inc b/includes/form/mcl.upload_data.form.inc index 26a7fcd..bec08a5 100644 --- a/includes/form/mcl.upload_data.form.inc +++ b/includes/form/mcl.upload_data.form.inc @@ -92,11 +92,12 @@ function _mcl_get_uploading_job_table() { // Sets the headers. $headers = array( - array('data' => 'Job ID', 'style' => 'width:80px'), + array('data' => 'Job ID', 'style' => 'width:70px'), array('data' => 'Status', 'style' => 'width:60px'), array('data' => 'Name', 'style' => ''), - array('data' => 'Last Run', 'style' => 'width:150px'), - array('data' => 'Submit Date', 'style' => 'width:150px'), + array('data' => 'Filesize', 'style' => 'width:90px'), + array('data' => 'Last Run', 'style' => 'width:100px'), + array('data' => 'Submit Date', 'style' => 'width:100px'), array('data' => 'Details', 'style' => 'width:40px'), array('data' => 'Action', 'style' => 'width:40px'), ); @@ -125,15 +126,37 @@ function _mcl_get_uploading_job_table() { // Sets the last run date. $last_run = $mcl_job->getPropByKey('last_run'); - $last_run_date = ($last_run) ? $last_run : 'N/A'; + $last_run_date = 'N/A'; + if ($last_run) { + $tmp = explode(" ", $last_run); + $d = $tmp[0]; + $t = $tmp[1]; + $last_run_date = "$d"; + } + + // Sets the submit date. + $submit = $mcl_job->getSubmitDate(); + $submit_date = 'N/A'; + if ($submit) { + $tmp = explode(" ", $submit); + $d = $tmp[0]; + $t = $tmp[1]; + $submit_date = "$d"; + } + + // Gets filesize. + $file_id = $mcl_job->getFileID(); + $mcl_file = MCL_FILE::byKey(array('file_id' => $file_id)); + $filesize = $mcl_file->getFilesize(); // Adds the row. $row = array( $job_id, $status, $mcl_job->getName(), + mcl_format_bytes($filesize), $last_run_date, - $mcl_job->getSubmitDate(), + $submit_date, l('view', "/mcl/job_view/$job_id"), $delete_link, ); @@ -183,6 +206,12 @@ function _mcl_get_add_job_form(&$form, MCL_USER $mcl_user) { 'file_validate_extensions' => array('xls xlsx zip csv'), ), ); + $form['add_upload_job']['no_transaction_cb'] = array( + '#type' => 'checkbox', + '#title' => 'No transaction', + '#description' => "Check if the size of your uploading file are large.", + '#default_value' => FALSE, + ); $form['add_upload_job']['add_btn'] = array( '#type' => 'submit', '#name' => 'add_btn', @@ -214,6 +243,7 @@ function mcl_upload_data_form_validate($form, &$form_state) { $mcl_job = MCL_JOB::byKey(array('name' => $name, 'user_id' => $user->uid)); if ($mcl_job) { form_set_error('add_upload_job][name', t("The job name '$name' exists. Please change the name of the job.")); + return; } } @@ -250,6 +280,9 @@ function mcl_upload_data_form_submit($form, &$form_state) { ->condition('fid', $drupal_file->fid, '=') ->execute(); + // Gets Drupal user directory. + $drupal_user_directory = dirname($mcl_user->getUserDir()); + // Creates a MCL_JOB_UPLOAD and gets job ID. $details = array( 'name' => $job_name, @@ -258,7 +291,7 @@ function mcl_upload_data_form_submit($form, &$form_state) { 'status' => 0, 'user_id' => $user->uid, 'submit_date' => date("Y-m-d G:i:s"), - 'prop' => json_encode(array('working_dir' => $mcl_user->getUserDir())), + 'prop' => json_encode(array('working_dir' => $drupal_user_directory)), ); $mcl_job = new MCL_JOB_UPLOAD($details); if ($mcl_job->insert()) { @@ -281,8 +314,15 @@ function mcl_upload_data_form_submit($form, &$form_state) { $mcl_job->setFileID($upload_file->getFileID()); if ($mcl_job->update()) { + // Gets 'no_transaction' option. + $opt_no_transaction = ''; + $no_transaction_cb = trim($form_state['values']['add_upload_job']['no_transaction_cb']); + if ($no_transaction_cb) { + $opt_no_transaction = '--no_transaction'; + } + // Runs the job. - $cmd = "drush mcl-rerun-job $job_id $dest_filepath --move_input > /dev/null 2>/dev/null & "; + $cmd = "drush mcl-rerun-job $job_id $dest_filepath --move_input $opt_no_transaction > /dev/null 2>/dev/null & "; $pid = exec($cmd, $output, $return_var); if ($return_var) { drupal_set_message("Failed to add a uploading job"); diff --git a/includes/mcl.inc b/includes/mcl.inc index 1b5e366..577ce56 100644 --- a/includes/mcl.inc +++ b/includes/mcl.inc @@ -152,6 +152,29 @@ function mcl_retrive_files($target_dir, $pattern) { return $file_list; } +/** + * Function taken from php.net + * @param $bytes + * The size of the file in bytes + * @param $precision + * The number of decimal places to use in the final number if needed + * @return string + * A formatted string indicating the size of the file + */ +function mcl_format_bytes($bytes, $precision = 2) { + $units = array('B', 'KB', 'MB', 'GB', 'TB'); + + $bytes = max($bytes, 0); + $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); + $pow = min($pow, count($units) - 1); + + // Uncomment one of the following alternatives + $bytes /= pow(1024, $pow); + // $bytes /= (1 << (10 * $pow)); + + return round($bytes, $precision) . ' ' . $units[$pow]; +} + /** * Download all log files. * diff --git a/mcl.drush.inc b/mcl.drush.inc index de65b4e..bd5b93f 100644 --- a/mcl.drush.inc +++ b/mcl.drush.inc @@ -73,6 +73,16 @@ function mcl_drush_command() { 'Standard example' => 'drush mcl-rerun-job [job_id] [filepath] --status=0 --force --working_dir=/yourpath', ), ); + $items['mcl-test-template'] = array( + 'description' => t('Test templates.'), + 'arguments' => array(), + 'options' => array( + 'filepath' => t('List of templates to be tested.'), + ), + 'examples' => array( + 'Standard example' => 'drush mcl-test-template --filepath=/filepath', + ), + ); $items['mcl-get-template'] = array( 'description' => t('Generates a template in Excel format.'), 'arguments' => array( @@ -143,6 +153,7 @@ function mcl_drush_command() { ), 'options' => array( 'namespace' => t('Specifies the namespace.'), + 'extends' => t('Specifies the extends.'), 'overwrite' => t('Overwrite all class files in the class directory.'), 'working_dir' => t('Specifies the working directory.'), 'class_dir' => t('Specifies the class directory.'), @@ -155,7 +166,8 @@ function mcl_drush_command() { $items['mcl-fix-data'] = array( 'description' => t('Fix data.'), 'arguments' => array( - 'input_file' => t('The input filename.'), + 'inc_file' => t('The include filename.'), + 'input_file' => t('The input filename.'), ), 'options' => array(), 'examples' => array( @@ -213,11 +225,9 @@ function drush_mcl_rerun_job($job_id, $filepath) { // Checks arguments. $args = array( - 'job_id' => $job_id, + 'job_id' => $job_id, + 'filepath' => $filepath, ); - if ($filepath) { - $args['filepath'] = $filepath; - } if (!mcl_check_arguments($args)) { mcl_print("Error : Please check arguments", 1, 3); exit; @@ -301,6 +311,11 @@ function drush_mcl_rerun_job($job_id, $filepath) { $mcl_job->setStatus(0); } + // Gets process ID. + $pid = getmypid(); + $mcl_job->setPID($pid); + print "\tProcess ID = $pid\n\n"; + // Updates all changes of the job properties. $mcl_job->update(); @@ -456,6 +471,56 @@ function drush_mcl_delete_jobs($job_ids) { } } +/** + * Callback for testing templates. + * + * @param string $template + * + * @return boolean + */ +function drush_mcl_test_template() { + + // Gets all templates to be tested. If the filepath option is provided, + // the listed tempate in the file are tested. + $templates = MCL_TEMPLATE::getTemplates(); + $filepath = drush_get_option('filepath'); + if ($filepath) { + $templates = array(); + if (!file_exists($filepath)) { + mcl_print("Error : The file ($filepath) dose not exist", 1, 3); + exit; + } + if (!($fdr = fopen($filepath, 'r'))) { + mcl_print("Error : Cannot open file ($filepath)", 1, 3); + exit; + } + while (!feof($fdr)) { + $template = trim(fgets($fdr)); + if ($template) { + $templates []= MCL_TEMPLATE::getByTemplate($template); + } + } + fclose($fdr); + } + + // Creates a temporary directory. + $tmp_dir = file_directory_temp() . '/mcl-test-temp-' . date(Y-m-d-G-i-s); + if (!mcl_create_dir($tmp_dir)) { + mcl_print("Error : Failed to create temporary directory for MCL test templates", 1, 3); + exit; + } + + // Tests templates. + //MCL_TEMPLATE::testTemplates($templates, $tmp_dir); + + // Cleanup the emporary directory. + if (!mcl_remove_dir($tmp_dir)) { + mcl_print("Error : Failed to remove temporary directory for MCL test templates", 1, 3); + exit; + } + mcl_print("Done testing templates", 1, 3); +} + /** * Callback for uploading cvterms from an Excel file. * @@ -574,7 +639,7 @@ function drush_mcl_upload_data($username, $filepath) { // Gets the transaction option. $no_transaction = drush_get_option('no_transaction'); - $transaction = ($no_transaction) ? FALSE : TRUE; + $trans = ($no_transaction) ? FALSE : TRUE; // Check the move_input option. $move_input = drush_get_option('move_input'); @@ -600,7 +665,7 @@ function drush_mcl_upload_data($username, $filepath) { $mcl_user = MCL_USER::byKey(array('name' => $username)); // Prepares a uploading job. - $mcl_job = mcl_prepare_uploading_job($mcl_user, $filepath, $move_input, $working_dir, $job_name, $param); + $mcl_job = mcl_prepare_uploading_job($mcl_user, $filepath, $move_input, $trans, $working_dir, $job_name, $param); if (!$mcl_job) { mcl_print("Error : Failed to prepare a uploading job", 1, 3); exit; @@ -610,6 +675,7 @@ function drush_mcl_upload_data($username, $filepath) { $pid = getmypid(); $mcl_job->setPID($pid); $mcl_job->update(); + print "\tProcess ID = $pid\n\n"; // Uploads the file. $job_id = $mcl_job->getJobID(); @@ -631,7 +697,7 @@ function drush_mcl_upload_data($username, $filepath) { $job_id = $mcl_job->getJobID(); $opt_working_dir = ($working_dir) ? "--working_dir=$working_dir" : ''; $opt_move_input = ($move_input) ? '--move_input' : ''; - $opt_transaction = ($transaction) ? '' : '--no_transaction'; + $opt_transaction = ($trans) ? '' : '--no_transaction'; mcl_print("DONE : The job (Job ID = $job_id) was completed with some errors", 1); mcl_print("Please fix the errors and re-run this job ", 2, 2); @@ -660,15 +726,18 @@ function drush_mcl_upload_data($username, $filepath) { * * @return MCL_JOB_UPLOAD */ -function mcl_prepare_uploading_job(MCL_USER $mcl_user, $filepath, $move_input, $working_dir = '', $job_name = '', $param = array()) { +function mcl_prepare_uploading_job(MCL_USER $mcl_user, $filepath, $move_input, $trans, $working_dir = '', $job_name = '', $param = array()) { $mcl_job = NULL; - // Sets job directory to working directory. + // Sets the job directory as working directory. $prop = array(); if ($working_dir) { $prop['working_dir'] = $working_dir; } + // Sets the transaction. + $prop['transaction'] = $trans; + // Sets the job name. $name = 'Uploading-' . basename($filepath); if ($job_name) { @@ -795,8 +864,9 @@ function drush_mcl_generate_class($module, $schema, $dump_file, $table_file) { exit; } - // Checks the namespace option. - $namespace = drush_get_option('namespace'); + // Checks the namespace and extends options. + $namespace = drush_get_option('namespace'); + $extends = drush_get_option('extends'); // Creates a tempolary directory and move the current class files. $tmp_dir = "$working_dir/tmp"; @@ -806,7 +876,7 @@ function drush_mcl_generate_class($module, $schema, $dump_file, $table_file) { $mcl_table_info = new MCL_TABLE_INFO($dump_file, $table_file); // Generats claa files. - $writer = new MCL_TABLE_WRITER($mcl_table_info, $tmp_dir, $namespace); + $writer = new MCL_TABLE_WRITER($mcl_table_info, $tmp_dir, $namespace, $extends); if ($writer->generateClassFiles()) { // Overwrites all the class files with newly generated ones. @@ -832,16 +902,41 @@ function drush_mcl_generate_class($module, $schema, $dump_file, $table_file) { * * @param string $input_file. */ -function drush_mcl_fix_data($input_file = NULL) { +function drush_mcl_fix_data($inc_file, $input_file = NULL) { + + // Checks arguments. + $args = array( + 'inc_file' => $inc_file, + ); + if (!mcl_check_arguments($args)) { + mcl_print("Error : Please check arguments", 1, 3); + exit; + } - $module_path = drupal_get_path('module', 'mcl'); - $filepath = "$module_path/schema/mcl_fix_data.inc"; - if (file_exists($filepath)) { - require_once($filepath); - mcl_fix_data_func($input_file); + // Checks the include file. + $fix_data_dir = drupal_get_path('module', 'mcl') . '/fix_data/'; + $inc_filepath = "$fix_data_dir/$inc_file"; + if (file_exists($inc_filepath)) { + require_once($inc_filepath); + + // Gets the working directory. + $working_dir = dirname($inc_filepath); + + // Checks the input file. + $input_filepath = NULL; + if ($input_file) { + $input_filepath = "$working_dir/$input_file"; + if (!file_exists($input_filepath)) { + print "The input file cannot found : $input_filepath\n\n"; + exit; + } + } + $inc_filename = basename($inc_file); + $func_name = str_replace('.inc', '', $inc_filename); + call_user_func($func_name, $working_dir, $input_filepath); } else { - print "$filepath cannot found\n\n"; + print "The include file cannot found : $inc_filepath\n\n"; } } diff --git a/mcl.info b/mcl.info index 8b91864..fd0026b 100644 --- a/mcl.info +++ b/mcl.info @@ -1,7 +1,8 @@ -name = Mainlab Chado Loader -description = PHP data uploader to chado schema for Mainlab -package = Mainlab -project = MCL -core = 7.x -version = 7.x-1.0 -configure = admin/mainlab_chado_loader +name = Mainlab Chado Loader +description = PHP data uploader to chado schema for Mainlab +package = Mainlab +project = MCL +core = 7.x +version = 7.x-1.0 +configure = admin/mainlab_chado_loader +dependencies[] = file \ No newline at end of file diff --git a/mcl.install b/mcl.install index 84f250c..0dfdd47 100644 --- a/mcl.install +++ b/mcl.install @@ -19,7 +19,7 @@ function mcl_install() { * */ function mcl_uninstall() { - // Remove MCL directory and its sub-directories. + // Remove MCL directories. } /** @@ -34,6 +34,8 @@ function mcl_schema() { mcl_add_table_mcl_job($schema); mcl_add_table_mcl_template($schema); mcl_add_table_mcl_template_type($schema); + mcl_add_table_mcl_data_valid_type($schema); + mcl_add_table_mcl_data_valid($schema); return $schema; } @@ -144,7 +146,7 @@ function mcl_add_table_mcl_template(&$schema) { } /** - * Adds template_type table. + * Adds mcl_template_type table. * * @param $schema */ @@ -167,7 +169,68 @@ function mcl_add_table_mcl_template_type(&$schema) { ), 'primary key' => array('template_type_id'), 'unique keys' => array( - 'ukey_mcl_template_type' => array('type') + 'ukey_mcl_template_type_type' => array('type') + ), + ); +} + +/** + * Adds mcl_data_valid_type table. + * + * @param $schema + */ +function mcl_add_table_mcl_data_valid_type(&$schema) { + $schema['mcl_data_valid_type'] = array( + 'fields' => array( + 'data_valid_type_id' => array( + 'type' => 'serial', + 'not null' => TRUE, + ), + 'type' => array( + 'type' => 'varchar', + 'length' => '255', + 'not null' => TRUE, + ), + 'cv_id' => array( + 'type' => 'int', + ), + ), + 'primary key' => array('data_valid_type_id'), + 'unique keys' => array( + 'ukey_mcl_data_valid_type_type' => array('type') + ), + ); +} + +/** + * Adds mcl_data_valid table. + * + * @param $schema + */ +function mcl_add_table_mcl_data_valid(&$schema) { + $schema['mcl_data_valid'] = array( + 'fields' => array( + 'data_valid_id' => array( + 'type' => 'serial', + 'not null' => TRUE, + ), + 'data_valid_type_id' => array( + 'type' => 'int', + 'not null' => TRUE, + ), + 'name' => array( + 'type' => 'varchar', + 'length' => '255', + 'not null' => TRUE, + ), + 'cvterm_id' => array( + 'type' => 'int', + 'not null' => FALSE, + ), + ), + 'primary key' => array('data_valid_id'), + 'unique keys' => array( + 'ukey_mcl_data_valid_data_valid_type_id_name' => array('data_valid_type_id', 'name') ), ); } @@ -305,6 +368,9 @@ function mcl_populate_table_defaults() { // Populates mcl_template and mcl_template_type tables. mcl_populate_mcl_templates(); + + // Populates mcl_data_type table. + mcl_populate_mcl_data_type(); } /** @@ -347,12 +413,14 @@ function mcl_populate_mcl_templates() { // Default template types. $template_types = array( + 'COLUMN', 'DB', 'CV', 'CVTERM', + 'ORGANISM', + 'CONTACT', 'LIBRARY', 'TRAIT', - 'CONTACT', 'DATASET', 'IMAGE', 'DESCRIPTOR', @@ -396,18 +464,180 @@ function mcl_populate_mcl_templates() { MCL_TEMPLATE::updateTemplates(); } +/** + * Populates mcl_data_valid_type and mcl_data_valid tables. + * + */ +function mcl_populate_mcl_data_valid_type() { + + // Add data valid types. + $data_valid_types = array( + 'contact_type' => 'SITE_CV', + 'descriptor_format' => '', + 'descriptor_type' => '', + 'stock_type' => 'SITE_CV', + 'location_type' => '', + 'trait_category' => 'SITE_TRAIT_ONTOLOGY', + ); + + // Adds contact types. + $data_types['contact_type'] = array( + 'person', + 'institution', + 'organization', + 'lab', + 'database', + 'company', + ); + + // Adds descriptor format types. + $data_types['descriptor_format'] = array( + 'numeric', + 'date', + 'percent', + 'boolean', + 'categorical', + 'text', + 'photo', + 'audio', + ); + + // Adds descriptor types. + $data_types['descriptor_type'] = array( + 'qualitative', + 'quantitative_code', + 'quantitative', + 'code', + 'date', + 'filepath', + 'text', + ); + + // Adds stock types. + $data_types['stock_type'] = array( + 'breeding_research_material', + 'variety', + 'cultivar', + 'population', + 'wild_unimproved', + 'tbd', + 'landrace', + 'germplasm', + 'species' + ); + + // Add location types. + $data_types['location_type'] = array( + 'orchard', + 'seedling block', + 'open field', + 'greenhouse', + ); + + // Adds trait categories. + $data_types['trait_category'] = array( + 'biochemical trait', + 'quality trait', + 'stature or vigor trait', + 'sterility or fertility trait', + 'stress trait', + 'yield trait', + 'plant morphology trait', + 'biological process trait', + 'other miscellaneous trait', + 'plant growth and development trait', + ); + + // Adds data valid types to databases. + foreach ($data_valid_types as $data_valid_type => $cv_name) { + + // Sets the type. + $details = array( + 'type' => $data_valid_type, + ); + + // Gets cv_id. + $cv_id= ''; + if ($cv_name) { + $cv = MCL_CHADO_CV::getCV($cv_name); + $cv_id = $cv->getCvID(); + $details['cv_id'] = $cv_id; + } + + // Adds data valid type. + $mcl_data_valid_type = new PUBLIC_MCL_DATA_VALID_TYPE($details); + if (!$mcl_data_valid_type->insert()) { + print "Failed to add $data_valid_type\n"; + return FALSE; + } + + // Adds data valid. + $data_valid_type_id = $mcl_data_valid_type->getDataValidTypeID(); + foreach ($data_types[$data_valid_type] as $value) { + $details = array( + 'data_valid_type_id' => $data_valid_type_id, + 'name' => $value, + ); + if ($cv_name) { + $cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $value); + if (!$cvterm) { + print "Warning : Skipped : Cannot found cvterm_id of ($cv_name, $value)\n"; + continue; + } + $details['cvterm_id'] = $cvterm->getCvtermID(); + } + $mcl_data_valid = new PUBLIC_MCL_DATA_VALID($details); + if (!$mcl_data_valid->insert()) { + print "Failed to add $value\n"; + return FALSE; + } + } + } + return TRUE; +} + /** * Update function defined below. */ /** - * ..... + * Adds mcl_data_type table and populate it. */ -function mcl_update_7007() { +function mcl_update_7019() { + + // Registers autoloader. + $module_path = drupal_get_path('module', 'mcl'); + require_once "$module_path/includes/class/mcl_class_loader.class.inc"; + $bims_autoloader = new MCL_CLASS_LOADER($module_path); + $bims_autoloader->register(); + $transaction = db_transaction(); try { - mcl_populate_table_defaults(); + if (!db_table_exists('mcl_data_valid_type')) { + $schema = array(); + mcl_add_table_mcl_data_valid_type($schema); + db_create_table('mcl_data_valid_type', $schema['mcl_data_valid_type']); + + $schema = array(); + mcl_add_table_mcl_data_valid($schema); + db_create_table('mcl_data_valid', $schema['mcl_data_valid']); + + // Populate tables. + if (!mcl_populate_mcl_data_valid_type()) { + throw new Exception("Failed to populate data valid type"); + } + } + + // Adds a new template type. + $mcl_template_type = MCL_TEMPLATE_TYPE::byKey(array('type' => 'COLUMN')); + if (!$mcl_template_type) { + $details = array('type' => 'COLUMN', 'rank' => 10); + $mcl_template_type = new MCL_TEMPLATE_TYPE($details); + if (!$mcl_template_type->insert()) { + throw new Exception("Failed to add a template type"); + } + } } - catch (\PDOException $e) { + catch (\Exception $e) { $transaction->rollback(); $error = $e->getMessage(); throw new DrupalUpdateException($error); diff --git a/mcl.module b/mcl.module index 55a75b4..745fd36 100644 --- a/mcl.module +++ b/mcl.module @@ -15,8 +15,8 @@ function mcl_init() { // Registers autoloader. require_once "$module_path/includes/class/mcl_class_loader.class.inc"; - $bims_autoloader = new MCL_CLASS_LOADER($module_path); - $bims_autoloader->register(); + $mcl_autoloader = new MCL_CLASS_LOADER($module_path); + $mcl_autoloader->register(); // Includes .inc file. require_once("$module_path/includes/mcl.inc"); @@ -147,6 +147,17 @@ function mcl_menu() { 'type' => MENU_LOCAL_TASK, 'weight' => $weight++, ); + $items['admin/mcl/data_valid'] = array( + 'title' => 'Data Validation', + 'description' => 'MCL Data Validation', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('mcl_admin_data_valid_form'), + 'access arguments' => array('admin_mcl'), + 'access callback' => 'mcl_access', + 'file' => '/includes/admin/mcl.admin.data_valid.inc', + 'type' => MENU_LOCAL_TASK, + 'weight' => $weight++, + ); $items['admin/mcl/config'] = array( 'title' => 'Configuration', 'description' => 'The configuration for MCL', @@ -176,6 +187,14 @@ function mcl_menu() { 'file' => '/includes/form/mcl.drush.form.inc', 'type' => MENU_CALLBACK, ); + $items['mcl/data_query/%'] = array( + 'page callback' => 'drupal_get_form', + 'page arguments' => array('mcl_data_query_form', 2), + 'access arguments' => array('view_mcl'), + 'access callback' => 'mcl_access', + 'file' => '/includes/form/mcl.data_query.form.inc', + 'type' => MENU_CALLBACK, + ); $items['mcl/upload_data'] = array( 'page callback' => 'drupal_get_form', 'page arguments' => array('mcl_upload_data_form'), @@ -199,6 +218,20 @@ function mcl_menu() { 'access callback' => 'mcl_access', 'type' => MENU_CALLBACK, ); + $items['mcl/delete_data_valid_type/%'] = array( + 'page callback' => 'mcl_delete_data_valid_type', + 'page arguments' => array(2), + 'access arguments' => array('view_mcl'), + 'access callback' => 'mcl_access', + 'type' => MENU_CALLBACK, + ); + $items['mcl/delete_data_valid/%'] = array( + 'page callback' => 'mcl_delete_data_valid', + 'page arguments' => array(2), + 'access arguments' => array('view_mcl'), + 'access callback' => 'mcl_access', + 'type' => MENU_CALLBACK, + ); $items['mcl/template_list'] = array( 'page callback' => 'drupal_get_form', 'page arguments' => array('mcl_template_list_form'), @@ -308,6 +341,32 @@ function mcl_delete_job($job_id) { $commands = array(); $commands[] = ajax_command_invoke(NULL, "reload_page", array('/mcl/upload_data')); print ajax_render($commands); + exit; +} + +/** + * Delete a data validation type. + */ +function mcl_delete_data_valid_type($data_valid_type_id) { + $mcl_data_valid_type = MCL_DATA_VALID_TYPE::byKey(array('data_valid_type_id' => $data_valid_type_id)); + $mcl_data_valid_type->delete(); + $commands = array(); + $commands[] = ajax_command_invoke(NULL, "reload_page", array('/admin/mcl/data_valid')); + print ajax_render($commands); + exit; +} + +/** + * Delete a data validation. + */ +function mcl_delete_data_valid($data_valid_id) { + db_delete('mcl_data_valid') + ->condition('data_valid_id', $data_valid_id) + ->execute(); + $commands = array(); + $commands[] = ajax_command_invoke(NULL, "reload_page", array('/admin/mcl/data_valid')); + print ajax_render($commands); + exit; } /** diff --git a/schema/drupal7.chado.sql b/schema/drupal7.chado.sql new file mode 100644 index 0000000..07fc75b --- /dev/null +++ b/schema/drupal7.chado.sql @@ -0,0 +1,23331 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +-- +-- Name: chado; Type: SCHEMA; Schema: -; Owner: - +-- + +CREATE SCHEMA chado; + + +SET search_path = chado, pg_catalog; + +-- +-- Name: feature_by_fx_type; Type: TYPE; Schema: chado; Owner: - +-- + +CREATE TYPE feature_by_fx_type AS ( + feature_id integer, + depth integer +); + + +-- +-- Name: soi_type; Type: TYPE; Schema: chado; Owner: - +-- + +CREATE TYPE soi_type AS ( + type_id integer, + subject_id integer, + object_id integer +); + + +-- +-- Name: _fill_cvtermpath4node(integer, integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION _fill_cvtermpath4node(integer, integer, integer, integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + origin alias for $1; + child_id alias for $2; + cvid alias for $3; + typeid alias for $4; + depth alias for $5; + cterm cvterm_relationship%ROWTYPE; + exist_c int; +BEGIN + --- RAISE NOTICE 'depth=% root=%', depth,child_id; + --- not check type_id as it may be null and not very meaningful in cvtermpath when pathdistance > 1 + SELECT INTO exist_c count(*) FROM cvtermpath WHERE cv_id = cvid AND object_id = origin AND subject_id = child_id AND pathdistance = depth; + IF (exist_c = 0) THEN + INSERT INTO cvtermpath (object_id, subject_id, cv_id, type_id, pathdistance) VALUES(origin, child_id, cvid, typeid, depth); + END IF; + FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = child_id LOOP + PERFORM _fill_cvtermpath4node(origin, cterm.subject_id, cvid, cterm.type_id, depth+1); + END LOOP; + RETURN 1; +END; +$_$; + + +-- +-- Name: _fill_cvtermpath4node2detect_cycle(integer, integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION _fill_cvtermpath4node2detect_cycle(integer, integer, integer, integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + origin alias for $1; + child_id alias for $2; + cvid alias for $3; + typeid alias for $4; + depth alias for $5; + cterm cvterm_relationship%ROWTYPE; + exist_c int; + ccount int; + ecount int; + rtn int; +BEGIN + EXECUTE 'SELECT * FROM tmpcvtermpath p1, tmpcvtermpath p2 WHERE p1.subject_id=p2.object_id AND p1.object_id=p2.subject_id AND p1.object_id = '|| origin || ' AND p2.subject_id = ' || child_id || 'AND ' || depth || '> 0'; + GET DIAGNOSTICS ccount = ROW_COUNT; + IF (ccount > 0) THEN + --RAISE EXCEPTION 'FOUND CYCLE: node % on cycle path',origin; + RETURN origin; + END IF; + EXECUTE 'SELECT * FROM tmpcvtermpath WHERE cv_id = ' || cvid || ' AND object_id = ' || origin || ' AND subject_id = ' || child_id || ' AND ' || origin || '<>' || child_id; + GET DIAGNOSTICS ecount = ROW_COUNT; + IF (ecount > 0) THEN + --RAISE NOTICE 'FOUND TWICE (node), will check root obj % subj %',origin, child_id; + SELECT INTO rtn _fill_cvtermpath4root2detect_cycle(child_id, cvid); + IF (rtn > 0) THEN + RETURN rtn; + END IF; + END IF; + EXECUTE 'SELECT * FROM tmpcvtermpath WHERE cv_id = ' || cvid || ' AND object_id = ' || origin || ' AND subject_id = ' || child_id || ' AND pathdistance = ' || depth; + GET DIAGNOSTICS exist_c = ROW_COUNT; + IF (exist_c = 0) THEN + EXECUTE 'INSERT INTO tmpcvtermpath (object_id, subject_id, cv_id, type_id, pathdistance) VALUES(' || origin || ', ' || child_id || ', ' || cvid || ', ' || typeid || ', ' || depth || ')'; + END IF; + FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = child_id LOOP + --RAISE NOTICE 'DOING for node, % %', origin, cterm.subject_id; + SELECT INTO rtn _fill_cvtermpath4node2detect_cycle(origin, cterm.subject_id, cvid, cterm.type_id, depth+1); + IF (rtn > 0) THEN + RETURN rtn; + END IF; + END LOOP; + RETURN 0; +END; +$_$; + + +-- +-- Name: _fill_cvtermpath4root(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION _fill_cvtermpath4root(integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + rootid alias for $1; + cvid alias for $2; + ttype int; + cterm cvterm_relationship%ROWTYPE; + child cvterm_relationship%ROWTYPE; +BEGIN + SELECT INTO ttype cvterm_id FROM cvterm WHERE (name = 'isa' OR name = 'is_a'); + PERFORM _fill_cvtermpath4node(rootid, rootid, cvid, ttype, 0); + FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = rootid LOOP + PERFORM _fill_cvtermpath4root(cterm.subject_id, cvid); + -- RAISE NOTICE 'DONE for term, %', cterm.subject_id; + END LOOP; + RETURN 1; +END; +$_$; + + +-- +-- Name: _fill_cvtermpath4root2detect_cycle(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION _fill_cvtermpath4root2detect_cycle(integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + rootid alias for $1; + cvid alias for $2; + ttype int; + ccount int; + cterm cvterm_relationship%ROWTYPE; + child cvterm_relationship%ROWTYPE; + rtn int; +BEGIN + SELECT INTO ttype cvterm_id FROM cvterm WHERE (name = 'isa' OR name = 'is_a'); + SELECT INTO rtn _fill_cvtermpath4node2detect_cycle(rootid, rootid, cvid, ttype, 0); + IF (rtn > 0) THEN + RETURN rtn; + END IF; + FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = rootid LOOP + EXECUTE 'SELECT * FROM tmpcvtermpath p1, tmpcvtermpath p2 WHERE p1.subject_id=p2.object_id AND p1.object_id=p2.subject_id AND p1.object_id=' || rootid || ' AND p1.subject_id=' || cterm.subject_id; + GET DIAGNOSTICS ccount = ROW_COUNT; + IF (ccount > 0) THEN + --RAISE NOTICE 'FOUND TWICE (root), will check root obj % subj %',rootid,cterm.subject_id; + SELECT INTO rtn _fill_cvtermpath4node2detect_cycle(rootid, cterm.subject_id, cvid, ttype, 0); + IF (rtn > 0) THEN + RETURN rtn; + END IF; + ELSE + SELECT INTO rtn _fill_cvtermpath4root2detect_cycle(cterm.subject_id, cvid); + IF (rtn > 0) THEN + RETURN rtn; + END IF; + END IF; + END LOOP; + RETURN 0; +END; +$_$; + + +-- +-- Name: _fill_cvtermpath4soi(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION _fill_cvtermpath4soi(integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + rootid alias for $1; + cvid alias for $2; + ttype int; + cterm soi_type%ROWTYPE; +BEGIN + SELECT INTO ttype cvterm_id FROM cvterm WHERE name = 'isa'; + --RAISE NOTICE 'got ttype %',ttype; + PERFORM _fill_cvtermpath4soinode(rootid, rootid, cvid, ttype, 0); + FOR cterm IN SELECT tmp_type AS type_id, subject_id FROM tmpcvtr WHERE object_id = rootid LOOP + PERFORM _fill_cvtermpath4soi(cterm.subject_id, cvid); + END LOOP; + RETURN 1; +END; +$_$; + + +-- +-- Name: _fill_cvtermpath4soinode(integer, integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION _fill_cvtermpath4soinode(integer, integer, integer, integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + origin alias for $1; + child_id alias for $2; + cvid alias for $3; + typeid alias for $4; + depth alias for $5; + cterm soi_type%ROWTYPE; + exist_c int; +BEGIN + --RAISE NOTICE 'depth=% o=%, root=%, cv=%, t=%', depth,origin,child_id,cvid,typeid; + SELECT INTO exist_c count(*) FROM cvtermpath WHERE cv_id = cvid AND object_id = origin AND subject_id = child_id AND pathdistance = depth; + --- longest path + IF (exist_c > 0) THEN + UPDATE cvtermpath SET pathdistance = depth WHERE cv_id = cvid AND object_id = origin AND subject_id = child_id; + ELSE + INSERT INTO cvtermpath (object_id, subject_id, cv_id, type_id, pathdistance) VALUES(origin, child_id, cvid, typeid, depth); + END IF; + FOR cterm IN SELECT tmp_type AS type_id, subject_id FROM tmpcvtr WHERE object_id = child_id LOOP + PERFORM _fill_cvtermpath4soinode(origin, cterm.subject_id, cvid, cterm.type_id, depth+1); + END LOOP; + RETURN 1; +END; +$_$; + + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: cvtermpath; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cvtermpath ( + cvtermpath_id integer NOT NULL, + type_id integer, + subject_id integer NOT NULL, + object_id integer NOT NULL, + cv_id integer NOT NULL, + pathdistance integer +); + + +-- +-- Name: TABLE cvtermpath; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cvtermpath IS 'The reflexive transitive closure of +the cvterm_relationship relation.'; + + +-- +-- Name: COLUMN cvtermpath.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvtermpath.type_id IS 'The relationship type that +this is a closure over. If null, then this is a closure over ALL +relationship types. If non-null, then this references a relationship +cvterm - note that the closure will apply to both this relationship +AND the OBO_REL:is_a (subclass) relationship.'; + + +-- +-- Name: COLUMN cvtermpath.cv_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvtermpath.cv_id IS 'Closures will mostly be within +one cv. If the closure of a relationship traverses a cv, then this +refers to the cv of the object_id cvterm.'; + + +-- +-- Name: COLUMN cvtermpath.pathdistance; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvtermpath.pathdistance IS 'The number of steps +required to get from the subject cvterm to the object cvterm, counting +from zero (reflexive relationship).'; + + +-- +-- Name: _get_all_object_ids(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION _get_all_object_ids(integer) RETURNS SETOF cvtermpath + LANGUAGE plpgsql + AS $_$ +DECLARE + leaf alias for $1; + cterm cvtermpath%ROWTYPE; + cterm2 cvtermpath%ROWTYPE; +BEGIN + FOR cterm IN SELECT * FROM cvterm_relationship WHERE subject_id = leaf LOOP + RETURN NEXT cterm; + FOR cterm2 IN SELECT * FROM _get_all_object_ids(cterm.object_id) LOOP + RETURN NEXT cterm2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: _get_all_subject_ids(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION _get_all_subject_ids(integer) RETURNS SETOF cvtermpath + LANGUAGE plpgsql + AS $_$ +DECLARE + root alias for $1; + cterm cvtermpath%ROWTYPE; + cterm2 cvtermpath%ROWTYPE; +BEGIN + FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = root LOOP + RETURN NEXT cterm; + FOR cterm2 IN SELECT * FROM _get_all_subject_ids(cterm.subject_id) LOOP + RETURN NEXT cterm2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: boxquery(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION boxquery(integer, integer) RETURNS box + LANGUAGE sql IMMUTABLE + AS $_$SELECT box (create_point($1, $2), create_point($1, $2))$_$; + + +-- +-- Name: boxquery(integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION boxquery(integer, integer, integer) RETURNS box + LANGUAGE sql IMMUTABLE + AS $_$SELECT box (create_point($1, $2), create_point($1, $3))$_$; + + +-- +-- Name: boxrange(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION boxrange(integer, integer) RETURNS box + LANGUAGE sql IMMUTABLE + AS $_$SELECT box (create_point(0, $1), create_point($2,500000000))$_$; + + +-- +-- Name: boxrange(integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION boxrange(integer, integer, integer) RETURNS box + LANGUAGE sql IMMUTABLE + AS $_$SELECT box (create_point($1, $2), create_point($1,$3))$_$; + + +-- +-- Name: bt_sort_genotype(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION bt_sort_genotype(genotype character varying) RETURNS character varying + LANGUAGE plpgsql + AS $$ + DECLARE + arr varchar []; + BEGIN + if genotype != '' then + arr = string_to_array(genotype, '|'); + arr = array(SELECT * FROM unnest(arr) ORDER BY 1); + genotype = array_to_string(arr, '|') || '|'; + end if; + return genotype; + END; +$$; + + +-- +-- Name: complement_residues(text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION complement_residues(text) RETURNS text + LANGUAGE sql + AS $_$SELECT (translate($1, + 'acgtrymkswhbvdnxACGTRYMKSWHBVDNX', + 'tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX'))$_$; + + +-- +-- Name: concat_pair(text, text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION concat_pair(text, text) RETURNS text + LANGUAGE sql + AS $_$SELECT $1 || $2$_$; + + +-- +-- Name: create_point(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION create_point(integer, integer) RETURNS point + LANGUAGE sql + AS $_$SELECT point ($1, $2)$_$; + + +-- +-- Name: create_soi(); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION create_soi() RETURNS integer + LANGUAGE plpgsql + AS $$ +DECLARE + parent soi_type%ROWTYPE; + isa_id cvterm.cvterm_id%TYPE; + soi_term TEXT := 'soi'; + soi_def TEXT := 'ontology of SO feature instantiated in database'; + soi_cvid INTEGER; + soiterm_id INTEGER; + pcount INTEGER; + count INTEGER := 0; + cquery TEXT; +BEGIN + SELECT INTO isa_id cvterm_id FROM cvterm WHERE name = 'isa'; + SELECT INTO soi_cvid cv_id FROM cv WHERE name = soi_term; + IF (soi_cvid > 0) THEN + DELETE FROM cvtermpath WHERE cv_id = soi_cvid; + DELETE FROM cvterm WHERE cv_id = soi_cvid; + ELSE + INSERT INTO cv (name, definition) VALUES(soi_term, soi_def); + END IF; + SELECT INTO soi_cvid cv_id FROM cv WHERE name = soi_term; + INSERT INTO cvterm (name, cv_id) VALUES(soi_term, soi_cvid); + SELECT INTO soiterm_id cvterm_id FROM cvterm WHERE name = soi_term; + CREATE TEMP TABLE tmpcvtr (tmp_type INT, type_id INT, subject_id INT, object_id INT); + CREATE UNIQUE INDEX u_tmpcvtr ON tmpcvtr(subject_id, object_id); + INSERT INTO tmpcvtr (tmp_type, type_id, subject_id, object_id) + SELECT DISTINCT isa_id, soiterm_id, f.type_id, soiterm_id FROM feature f, cvterm t + WHERE f.type_id = t.cvterm_id AND f.type_id > 0; + EXECUTE 'select * from tmpcvtr where type_id = ' || soiterm_id || ';'; + get diagnostics pcount = row_count; + raise notice 'all types in feature %',pcount; +--- do it hard way, delete any child feature type from above (NOT IN clause did not work) + FOR parent IN SELECT DISTINCT 0, t.cvterm_id, 0 FROM feature c, feature_relationship fr, cvterm t + WHERE t.cvterm_id = c.type_id AND c.feature_id = fr.subject_id LOOP + DELETE FROM tmpcvtr WHERE type_id = soiterm_id and object_id = soiterm_id + AND subject_id = parent.subject_id; + END LOOP; + EXECUTE 'select * from tmpcvtr where type_id = ' || soiterm_id || ';'; + get diagnostics pcount = row_count; + raise notice 'all types in feature after delete child %',pcount; + --- create feature type relationship (store in tmpcvtr) + CREATE TEMP TABLE tmproot (cv_id INTEGER not null, cvterm_id INTEGER not null, status INTEGER DEFAULT 0); + cquery := 'SELECT * FROM tmproot tmp WHERE tmp.status = 0;'; + ---temp use tmpcvtr to hold instantiated SO relationship for speed + ---use soterm_id as type_id, will delete from tmpcvtr + ---us tmproot for this as well + INSERT INTO tmproot (cv_id, cvterm_id, status) SELECT DISTINCT soi_cvid, c.subject_id, 0 FROM tmpcvtr c + WHERE c.object_id = soiterm_id; + EXECUTE cquery; + GET DIAGNOSTICS pcount = ROW_COUNT; + WHILE (pcount > 0) LOOP + RAISE NOTICE 'num child temp (to be inserted) in tmpcvtr: %',pcount; + INSERT INTO tmpcvtr (tmp_type, type_id, subject_id, object_id) + SELECT DISTINCT fr.type_id, soiterm_id, c.type_id, p.cvterm_id FROM feature c, feature_relationship fr, + tmproot p, feature pf, cvterm t WHERE c.feature_id = fr.subject_id AND fr.object_id = pf.feature_id + AND p.cvterm_id = pf.type_id AND t.cvterm_id = c.type_id AND p.status = 0; + UPDATE tmproot SET status = 1 WHERE status = 0; + INSERT INTO tmproot (cv_id, cvterm_id, status) + SELECT DISTINCT soi_cvid, c.type_id, 0 FROM feature c, feature_relationship fr, + tmproot tmp, feature p, cvterm t WHERE c.feature_id = fr.subject_id AND fr.object_id = p.feature_id + AND tmp.cvterm_id = p.type_id AND t.cvterm_id = c.type_id AND tmp.status = 1; + UPDATE tmproot SET status = 2 WHERE status = 1; + EXECUTE cquery; + GET DIAGNOSTICS pcount = ROW_COUNT; + END LOOP; + DELETE FROM tmproot; + ---get transitive closure for soi + PERFORM _fill_cvtermpath4soi(soiterm_id, soi_cvid); + DROP TABLE tmpcvtr; + DROP TABLE tmproot; + RETURN 1; +END; +$$; + + +-- +-- Name: feature; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature ( + feature_id integer NOT NULL, + dbxref_id integer, + organism_id integer NOT NULL, + name character varying(255), + uniquename text NOT NULL, + residues text, + seqlen integer, + md5checksum character(32), + type_id integer NOT NULL, + is_analysis boolean DEFAULT false NOT NULL, + is_obsolete boolean DEFAULT false NOT NULL, + timeaccessioned timestamp without time zone DEFAULT now() NOT NULL, + timelastmodified timestamp without time zone DEFAULT now() NOT NULL +); +ALTER TABLE ONLY feature ALTER COLUMN residues SET STORAGE EXTERNAL; + + +-- +-- Name: TABLE feature; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature IS 'A feature is a biological sequence or a +section of a biological sequence, or a collection of such +sections. Examples include genes, exons, transcripts, regulatory +regions, polypeptides, protein domains, chromosome sequences, sequence +variations, cross-genome match regions such as hits and HSPs and so +on; see the Sequence Ontology for more. The combination of +organism_id, uniquename and type_id should be unique.'; + + +-- +-- Name: COLUMN feature.dbxref_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.dbxref_id IS 'An optional primary chado.stable +identifier for this feature. Secondary identifiers and external +dbxrefs go in the table feature_dbxref.'; + + +-- +-- Name: COLUMN feature.organism_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.organism_id IS 'The organism to which this feature +belongs. This column is mandatory.'; + + +-- +-- Name: COLUMN feature.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.name IS 'The optional human-readable common name for +a feature, for display purposes.'; + + +-- +-- Name: COLUMN feature.uniquename; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.uniquename IS 'The unique name for a feature; may +not be necessarily be particularly human-readable, although this is +preferred. This name must be unique for this type of feature within +this organism.'; + + +-- +-- Name: COLUMN feature.residues; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.residues IS 'A sequence of alphabetic characters +representing biological residues (nucleic acids, amino acids). This +column does not need to be manifested for all features; it is optional +for features such as exons where the residues can be derived from the +featureloc. It is recommended that the value for this column be +manifested for features which may may non-contiguous sublocations (e.g. +transcripts), since derivation at query time is non-trivial. For +expressed sequence, the DNA sequence should be used rather than the +RNA sequence. The default storage method for the residues column is +EXTERNAL, which will store it uncompressed to make substring operations +faster.'; + + +-- +-- Name: COLUMN feature.seqlen; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.seqlen IS 'The length of the residue feature. See +column:residues. This column is partially redundant with the residues +column, and also with featureloc. This column is required because the +location may be unknown and the residue sequence may not be +manifested, yet it may be desirable to store and query the length of +the feature. The seqlen should always be manifested where the length +of the sequence is known.'; + + +-- +-- Name: COLUMN feature.md5checksum; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.md5checksum IS 'The 32-character checksum of the sequence, +calculated using the MD5 algorithm. This is practically guaranteed to +be unique for any feature. This column thus acts as a unique +identifier on the mathematical sequence.'; + + +-- +-- Name: COLUMN feature.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.type_id IS 'A required reference to a table:cvterm +giving the feature type. This will typically be a Sequence Ontology +identifier. This column is thus used to subclass the feature table.'; + + +-- +-- Name: COLUMN feature.is_analysis; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.is_analysis IS 'Boolean indicating whether this +feature is annotated or the result of an automated analysis. Analysis +results also use the companalysis module. Note that the dividing line +between analysis and annotation may be fuzzy, this should be determined on +a per-project basis in a consistent manner. One requirement is that +there should only be one non-analysis version of each wild-type gene +feature in a genome, whereas the same gene feature can be predicted +multiple times in different analyses.'; + + +-- +-- Name: COLUMN feature.is_obsolete; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.is_obsolete IS 'Boolean indicating whether this +feature has been obsoleted. Some chado instances may choose to simply +remove the feature altogether, others may choose to keep an obsolete +row in the table.'; + + +-- +-- Name: COLUMN feature.timeaccessioned; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.timeaccessioned IS 'For handling object +accession or modification timestamps (as opposed to database auditing data, +handled elsewhere). The expectation is that these fields would be +available to software interacting with chado.'; + + +-- +-- Name: COLUMN feature.timelastmodified; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature.timelastmodified IS 'For handling object +accession or modification timestamps (as opposed to database auditing data, +handled elsewhere). The expectation is that these fields would be +available to software interacting with chado.'; + + +-- +-- Name: feature_disjoint_from(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION feature_disjoint_from(integer) RETURNS SETOF feature + LANGUAGE sql + AS $_$SELECT feature.* + FROM feature + INNER JOIN featureloc AS x ON (x.feature_id=feature.feature_id) + INNER JOIN featureloc AS y ON (y.feature_id = $1) + WHERE + x.srcfeature_id = y.srcfeature_id AND + ( x.fmax < y.fmin OR x.fmin > y.fmax ) $_$; + + +-- +-- Name: feature_overlaps(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION feature_overlaps(integer) RETURNS SETOF feature + LANGUAGE sql + AS $_$SELECT feature.* + FROM feature + INNER JOIN featureloc AS x ON (x.feature_id=feature.feature_id) + INNER JOIN featureloc AS y ON (y.feature_id = $1) + WHERE + x.srcfeature_id = y.srcfeature_id AND + ( x.fmax >= y.fmin AND x.fmin <= y.fmax ) $_$; + + +-- +-- Name: featureloc; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featureloc ( + featureloc_id integer NOT NULL, + feature_id integer NOT NULL, + srcfeature_id integer, + fmin integer, + is_fmin_partial boolean DEFAULT false NOT NULL, + fmax integer, + is_fmax_partial boolean DEFAULT false NOT NULL, + strand smallint, + phase integer, + residue_info text, + locgroup integer DEFAULT 0 NOT NULL, + rank integer DEFAULT 0 NOT NULL, + CONSTRAINT featureloc_c2 CHECK ((fmin <= fmax)) +); + + +-- +-- Name: TABLE featureloc; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE featureloc IS 'The location of a feature relative to +another feature. Important: interbase coordinates are used. This is +vital as it allows us to represent zero-length features e.g. splice +sites, insertion points without an awkward fuzzy system. Features +typically have exactly ONE location, but this need not be the +case. Some features may not be localized (e.g. a gene that has been +characterized genetically but no sequence or molecular information is +available). Note on multiple locations: Each feature can have 0 or +more locations. Multiple locations do NOT indicate non-contiguous +locations (if a feature such as a transcript has a non-contiguous +location, then the subfeatures such as exons should always be +manifested). Instead, multiple featurelocs for a feature designate +alternate locations or grouped locations; for instance, a feature +designating a blast hit or hsp will have two locations, one on the +query feature, one on the subject feature. Features representing +sequence variation could have alternate locations instantiated on a +feature on the mutant strain. The column:rank is used to +differentiate these different locations. Reflexive locations should +never be stored - this is for -proper- (i.e. non-self) locations only; nothing should be located relative to itself.'; + + +-- +-- Name: COLUMN featureloc.feature_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.feature_id IS 'The feature that is being located. Any feature can have zero or more featurelocs.'; + + +-- +-- Name: COLUMN featureloc.srcfeature_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.srcfeature_id IS 'The source feature which this location is relative to. Every location is relative to another feature (however, this column is nullable, because the srcfeature may not be known). All locations are -proper- that is, nothing should be located relative to itself. No cycles are allowed in the featureloc graph.'; + + +-- +-- Name: COLUMN featureloc.fmin; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.fmin IS 'The leftmost/minimal boundary in the linear range represented by the featureloc. Sometimes (e.g. in Bioperl) this is called -start- although this is confusing because it does not necessarily represent the 5-prime coordinate. Important: This is space-based (interbase) coordinates, counting from zero. To convert this to the leftmost position in a base-oriented system (eg GFF, Bioperl), add 1 to fmin.'; + + +-- +-- Name: COLUMN featureloc.is_fmin_partial; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.is_fmin_partial IS 'This is typically +false, but may be true if the value for column:fmin is inaccurate or +the leftmost part of the range is unknown/unbounded.'; + + +-- +-- Name: COLUMN featureloc.fmax; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.fmax IS 'The rightmost/maximal boundary in the linear range represented by the featureloc. Sometimes (e.g. in bioperl) this is called -end- although this is confusing because it does not necessarily represent the 3-prime coordinate. Important: This is space-based (interbase) coordinates, counting from zero. No conversion is required to go from fmax to the rightmost coordinate in a base-oriented system that counts from 1 (e.g. GFF, Bioperl).'; + + +-- +-- Name: COLUMN featureloc.is_fmax_partial; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.is_fmax_partial IS 'This is typically +false, but may be true if the value for column:fmax is inaccurate or +the rightmost part of the range is unknown/unbounded.'; + + +-- +-- Name: COLUMN featureloc.strand; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.strand IS 'The orientation/directionality of the +location. Should be 0, -1 or +1.'; + + +-- +-- Name: COLUMN featureloc.phase; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.phase IS 'Phase of translation with +respect to srcfeature_id. +Values are 0, 1, 2. It may not be possible to manifest this column for +some features such as exons, because the phase is dependant on the +spliceform (the same exon can appear in multiple spliceforms). This column is mostly useful for predicted exons and CDSs.'; + + +-- +-- Name: COLUMN featureloc.residue_info; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.residue_info IS 'Alternative residues, +when these differ from feature.residues. For instance, a SNP feature +located on a wild and mutant protein would have different alternative residues. +for alignment/similarity features, the alternative residues is used to +represent the alignment string (CIGAR format). Note on variation +features; even if we do not want to instantiate a mutant +chromosome/contig feature, we can still represent a SNP etc with 2 +locations, one (rank 0) on the genome, the other (rank 1) would have +most fields null, except for alternative residues.'; + + +-- +-- Name: COLUMN featureloc.locgroup; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.locgroup IS 'This is used to manifest redundant, +derivable extra locations for a feature. The default locgroup=0 is +used for the DIRECT location of a feature. Important: most Chado users may +never use featurelocs WITH logroup > 0. Transitively derived locations +are indicated with locgroup > 0. For example, the position of an exon on +a BAC and in global chromosome coordinates. This column is used to +differentiate these groupings of locations. The default locgroup 0 +is used for the main or primary location, from which the others can be +derived via coordinate transformations. Another example of redundant +locations is storing ORF coordinates relative to both transcript and +genome. Redundant locations open the possibility of the database +getting into inconsistent states; this schema gives us the flexibility +of both warehouse instantiations with redundant locations (easier for +querying) and management instantiations with no redundant +locations. An example of using both locgroup and rank: imagine a +feature indicating a conserved region between the chromosomes of two +different species. We may want to keep redundant locations on both +contigs and chromosomes. We would thus have 4 locations for the single +conserved region feature - two distinct locgroups (contig level and +chromosome level) and two distinct ranks (for the two species).'; + + +-- +-- Name: COLUMN featureloc.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureloc.rank IS 'Used when a feature has >1 +location, otherwise the default rank 0 is used. Some features (e.g. +blast hits and HSPs) have two locations - one on the query and one on +the subject. Rank is used to differentiate these. Rank=0 is always +used for the query, Rank=1 for the subject. For multiple alignments, +assignment of rank is arbitrary. Rank is also used for +sequence_variant features, such as SNPs. Rank=0 indicates the wildtype +(or baseline) feature, Rank=1 indicates the mutant (or compared) feature.'; + + +-- +-- Name: feature_subalignments(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION feature_subalignments(integer) RETURNS SETOF featureloc + LANGUAGE plpgsql + AS $_$ +DECLARE + return_data featureloc%ROWTYPE; + f_id ALIAS FOR $1; + feature_data feature%rowtype; + featureloc_data featureloc%rowtype; + s text; + fmin integer; + slen integer; +BEGIN + --RAISE NOTICE 'feature_id is %', featureloc_data.feature_id; + SELECT INTO feature_data * FROM feature WHERE feature_id = f_id; + FOR featureloc_data IN SELECT * FROM featureloc WHERE feature_id = f_id LOOP + --RAISE NOTICE 'fmin is %', featureloc_data.fmin; + return_data.feature_id = f_id; + return_data.srcfeature_id = featureloc_data.srcfeature_id; + return_data.is_fmin_partial = featureloc_data.is_fmin_partial; + return_data.is_fmax_partial = featureloc_data.is_fmax_partial; + return_data.strand = featureloc_data.strand; + return_data.phase = featureloc_data.phase; + return_data.residue_info = featureloc_data.residue_info; + return_data.locgroup = featureloc_data.locgroup; + return_data.rank = featureloc_data.rank; + s = feature_data.residues; + fmin = featureloc_data.fmin; + slen = char_length(s); + WHILE char_length(s) LOOP + --RAISE NOTICE 'residues is %', s; + --trim off leading match + s = trim(leading '|ATCGNatcgn' from s); + --if leading match detected + IF slen > char_length(s) THEN + return_data.fmin = fmin; + return_data.fmax = featureloc_data.fmin + (slen - char_length(s)); + --if the string started with a match, return it, + --otherwise, trim the gaps first (ie do not return this iteration) + RETURN NEXT return_data; + END IF; + --trim off leading gap + s = trim(leading '-' from s); + fmin = featureloc_data.fmin + (slen - char_length(s)); + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: featureloc_slice(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION featureloc_slice(integer, integer) RETURNS SETOF featureloc + LANGUAGE sql + AS $_$SELECT * from featureloc where boxquery($1, $2) @ boxrange(fmin,fmax)$_$; + + +-- +-- Name: featureloc_slice(integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION featureloc_slice(integer, integer, integer) RETURNS SETOF featureloc + LANGUAGE sql + AS $_$SELECT * + FROM featureloc + WHERE boxquery($1, $2, $3) && boxrange(srcfeature_id,fmin,fmax)$_$; + + +-- +-- Name: featureloc_slice(character varying, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION featureloc_slice(character varying, integer, integer) RETURNS SETOF featureloc + LANGUAGE sql + AS $_$SELECT featureloc.* + FROM featureloc + INNER JOIN feature AS srcf ON (srcf.feature_id = featureloc.srcfeature_id) + WHERE boxquery($2, $3) @ boxrange(fmin,fmax) + AND srcf.name = $1 $_$; + + +-- +-- Name: featureslice(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION featureslice(integer, integer) RETURNS SETOF featureloc + LANGUAGE sql + AS $_$SELECT * from featureloc where boxquery($1, $2) @ boxrange(fmin,fmax)$_$; + + +-- +-- Name: fill_cvtermpath(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION fill_cvtermpath(integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + cvid alias for $1; + root cvterm%ROWTYPE; +BEGIN + DELETE FROM cvtermpath WHERE cv_id = cvid; + FOR root IN SELECT DISTINCT t.* from cvterm t LEFT JOIN cvterm_relationship r ON (t.cvterm_id = r.subject_id) INNER JOIN cvterm_relationship r2 ON (t.cvterm_id = r2.object_id) WHERE t.cv_id = cvid AND r.subject_id is null LOOP + PERFORM _fill_cvtermpath4root(root.cvterm_id, root.cv_id); + END LOOP; + RETURN 1; +END; +$_$; + + +-- +-- Name: fill_cvtermpath(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION fill_cvtermpath(character varying) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + cvname alias for $1; + cv_id int; + rtn int; +BEGIN + SELECT INTO cv_id cv.cv_id from cv WHERE cv.name = cvname; + SELECT INTO rtn fill_cvtermpath(cv_id); + RETURN rtn; +END; +$_$; + + +-- +-- Name: get_all_object_ids(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_all_object_ids(integer) RETURNS SETOF cvtermpath + LANGUAGE plpgsql + AS $_$ +DECLARE + leaf alias for $1; + cterm cvtermpath%ROWTYPE; + exist_c int; +BEGIN + SELECT INTO exist_c count(*) FROM cvtermpath WHERE object_id = leaf and pathdistance <= 0; + IF (exist_c > 0) THEN + FOR cterm IN SELECT * FROM cvtermpath WHERE subject_id = leaf AND pathdistance > 0 LOOP + RETURN NEXT cterm; + END LOOP; + ELSE + FOR cterm IN SELECT * FROM _get_all_object_ids(leaf) LOOP + RETURN NEXT cterm; + END LOOP; + END IF; + RETURN; +END; +$_$; + + +-- +-- Name: get_all_subject_ids(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_all_subject_ids(integer) RETURNS SETOF cvtermpath + LANGUAGE plpgsql + AS $_$ +DECLARE + root alias for $1; + cterm cvtermpath%ROWTYPE; + exist_c int; +BEGIN + SELECT INTO exist_c count(*) FROM cvtermpath WHERE object_id = root and pathdistance <= 0; + IF (exist_c > 0) THEN + FOR cterm IN SELECT * FROM cvtermpath WHERE object_id = root and pathdistance > 0 LOOP + RETURN NEXT cterm; + END LOOP; + ELSE + FOR cterm IN SELECT * FROM _get_all_subject_ids(root) LOOP + RETURN NEXT cterm; + END LOOP; + END IF; + RETURN; +END; +$_$; + + +-- +-- Name: get_cv_id_for_feature(); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_cv_id_for_feature() RETURNS integer + LANGUAGE sql + AS $$SELECT cv_id FROM cv WHERE name='sequence'$$; + + +-- +-- Name: get_cv_id_for_feature_relationsgip(); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_cv_id_for_feature_relationsgip() RETURNS integer + LANGUAGE sql + AS $$SELECT cv_id FROM cv WHERE name='relationship'$$; + + +-- +-- Name: get_cv_id_for_featureprop(); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_cv_id_for_featureprop() RETURNS integer + LANGUAGE sql + AS $$SELECT cv_id FROM cv WHERE name='feature_property'$$; + + +-- +-- Name: get_cycle_cvterm_id(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_cycle_cvterm_id(integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + cvid alias for $1; + root cvterm%ROWTYPE; + rtn int; +BEGIN + CREATE TEMP TABLE tmpcvtermpath(object_id int, subject_id int, cv_id int, type_id int, pathdistance int); + CREATE INDEX tmp_cvtpath1 ON tmpcvtermpath(object_id, subject_id); + FOR root IN SELECT DISTINCT t.* from cvterm t LEFT JOIN cvterm_relationship r ON (t.cvterm_id = r.subject_id) INNER JOIN cvterm_relationship r2 ON (t.cvterm_id = r2.object_id) WHERE t.cv_id = cvid AND r.subject_id is null LOOP + SELECT INTO rtn _fill_cvtermpath4root2detect_cycle(root.cvterm_id, root.cv_id); + IF (rtn > 0) THEN + DROP TABLE tmpcvtermpath; + RETURN rtn; + END IF; + END LOOP; + DROP TABLE tmpcvtermpath; + RETURN 0; +END; +$_$; + + +-- +-- Name: get_cycle_cvterm_id(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_cycle_cvterm_id(character varying) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + cvname alias for $1; + cv_id int; + rtn int; +BEGIN + SELECT INTO cv_id cv.cv_id from cv WHERE cv.name = cvname; + SELECT INTO rtn get_cycle_cvterm_id(cv_id); + RETURN rtn; +END; +$_$; + + +-- +-- Name: get_cycle_cvterm_id(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_cycle_cvterm_id(integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ +DECLARE + cvid alias for $1; + rootid alias for $2; + rtn int; +BEGIN + CREATE TEMP TABLE tmpcvtermpath(object_id int, subject_id int, cv_id int, type_id int, pathdistance int); + CREATE INDEX tmp_cvtpath1 ON tmpcvtermpath(object_id, subject_id); + SELECT INTO rtn _fill_cvtermpath4root2detect_cycle(rootid, cvid); + IF (rtn > 0) THEN + DROP TABLE tmpcvtermpath; + RETURN rtn; + END IF; + DROP TABLE tmpcvtermpath; + RETURN 0; +END; +$_$; + + +-- +-- Name: get_cycle_cvterm_ids(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_cycle_cvterm_ids(integer) RETURNS SETOF integer + LANGUAGE plpgsql + AS $_$ +DECLARE + cvid alias for $1; + root cvterm%ROWTYPE; + rtn int; +BEGIN + FOR root IN SELECT DISTINCT t.* from cvterm t WHERE cv_id = cvid LOOP + SELECT INTO rtn get_cycle_cvterm_id(cvid,root.cvterm_id); + IF (rtn > 0) THEN + RETURN NEXT rtn; + END IF; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_id(character varying, character varying, character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_id(character varying, character varying, character varying) RETURNS integer + LANGUAGE sql + AS $_$ + SELECT feature_id + FROM feature + WHERE uniquename=$1 + AND type_id=get_feature_type_id($2) + AND organism_id=get_organism_id($3) + $_$; + + +-- +-- Name: get_feature_ids(text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids(text) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + sql alias for $1; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; + myrc3 feature_by_fx_type%ROWTYPE; +BEGIN + FOR myrc IN EXECUTE sql LOOP + RETURN NEXT myrc; + FOR myrc2 IN SELECT * FROM get_up_feature_ids(myrc.feature_id) LOOP + RETURN NEXT myrc2; + END LOOP; + FOR myrc3 IN SELECT * FROM get_sub_feature_ids(myrc.feature_id) LOOP + RETURN NEXT myrc3; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_ids_by_child_count(character varying, character varying, integer, character varying, character); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids_by_child_count(character varying, character varying, integer, character varying, character) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + ptype alias for $1; + ctype alias for $2; + ccount alias for $3; + operator alias for $4; + is_an alias for $5; + query TEXT; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type %ROWTYPE; +BEGIN + query := 'SELECT DISTINCT f.feature_id + FROM feature f INNER join (select count(*) as c, p.feature_id FROM feature p + INNER join cvterm pt ON (p.type_id = pt.cvterm_id) INNER join feature_relationship fr + ON (p.feature_id = fr.object_id) INNER join feature c ON (c.feature_id = fr.subject_id) + INNER join cvterm ct ON (c.type_id = ct.cvterm_id) + WHERE pt.name = ' || quote_literal(ptype) || ' AND ct.name = ' || quote_literal(ctype) + || ' AND p.is_analysis = ' || quote_literal(is_an) || ' group by p.feature_id) as cq + ON (cq.feature_id = f.feature_id) WHERE cq.c ' || operator || ccount || ';'; + ---RAISE NOTICE '%', query; + FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_ids_by_ont(character varying, character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids_by_ont(character varying, character varying) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + aspect alias for $1; + term alias for $2; + query TEXT; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + query := 'SELECT DISTINCT fcvt.feature_id + FROM feature_cvterm fcvt, cv, cvterm t WHERE cv.cv_id = t.cv_id AND + t.cvterm_id = fcvt.cvterm_id AND cv.name = ' || quote_literal(aspect) || + ' AND t.name = ' || quote_literal(term) || ';'; + IF (STRPOS(term, '%') > 0) THEN + query := 'SELECT DISTINCT fcvt.feature_id + FROM feature_cvterm fcvt, cv, cvterm t WHERE cv.cv_id = t.cv_id AND + t.cvterm_id = fcvt.cvterm_id AND cv.name = ' || quote_literal(aspect) || + ' AND t.name like ' || quote_literal(term) || ';'; + END IF; + FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_ids_by_ont_root(character varying, character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids_by_ont_root(character varying, character varying) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + aspect alias for $1; + term alias for $2; + query TEXT; + subquery TEXT; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + subquery := 'SELECT t.cvterm_id FROM cv, cvterm t WHERE cv.cv_id = t.cv_id + AND cv.name = ' || quote_literal(aspect) || ' AND t.name = ' || quote_literal(term) || ';'; + IF (STRPOS(term, '%') > 0) THEN + subquery := 'SELECT t.cvterm_id FROM cv, cvterm t WHERE cv.cv_id = t.cv_id + AND cv.name = ' || quote_literal(aspect) || ' AND t.name like ' || quote_literal(term) || ';'; + END IF; + query := 'SELECT DISTINCT fcvt.feature_id + FROM feature_cvterm fcvt INNER JOIN (SELECT cvterm_id FROM get_it_sub_cvterm_ids(' || quote_literal(subquery) || ')) AS ont ON (fcvt.cvterm_id = ont.cvterm_id);'; + FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_ids_by_property(character varying, character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids_by_property(character varying, character varying) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + p_type alias for $1; + p_val alias for $2; + query TEXT; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + query := 'SELECT DISTINCT fprop.feature_id + FROM featureprop fprop, cvterm t WHERE t.cvterm_id = fprop.type_id AND t.name = ' || + quote_literal(p_type) || ' AND fprop.value = ' || quote_literal(p_val) || ';'; + IF (STRPOS(p_val, '%') > 0) THEN + query := 'SELECT DISTINCT fprop.feature_id + FROM featureprop fprop, cvterm t WHERE t.cvterm_id = fprop.type_id AND t.name = ' || + quote_literal(p_type) || ' AND fprop.value like ' || quote_literal(p_val) || ';'; + END IF; + FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_ids_by_propval(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids_by_propval(character varying) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + p_val alias for $1; + query TEXT; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + query := 'SELECT DISTINCT fprop.feature_id + FROM featureprop fprop WHERE fprop.value = ' || quote_literal(p_val) || ';'; + IF (STRPOS(p_val, '%') > 0) THEN + query := 'SELECT DISTINCT fprop.feature_id + FROM featureprop fprop WHERE fprop.value like ' || quote_literal(p_val) || ';'; + END IF; + FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_ids_by_type(character varying, character); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids_by_type(character varying, character) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + gtype alias for $1; + is_an alias for $2; + query TEXT; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + query := 'SELECT DISTINCT f.feature_id + FROM feature f, cvterm t WHERE t.cvterm_id = f.type_id AND t.name = ' || quote_literal(gtype) || + ' AND f.is_analysis = ' || quote_literal(is_an) || ';'; + IF (STRPOS(gtype, '%') > 0) THEN + query := 'SELECT DISTINCT f.feature_id + FROM feature f, cvterm t WHERE t.cvterm_id = f.type_id AND t.name like ' + || quote_literal(gtype) || ' AND f.is_analysis = ' || quote_literal(is_an) || ';'; + END IF; + FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_ids_by_type_name(character varying, text, character); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids_by_type_name(character varying, text, character) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + gtype alias for $1; + name alias for $2; + is_an alias for $3; + query TEXT; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + query := 'SELECT DISTINCT f.feature_id + FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id) + WHERE t.name = ' || quote_literal(gtype) || ' AND (f.uniquename = ' || quote_literal(name) + || ' OR f.name = ' || quote_literal(name) || ') AND f.is_analysis = ' || quote_literal(is_an) || ';'; + IF (STRPOS(name, '%') > 0) THEN + query := 'SELECT DISTINCT f.feature_id + FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id) + WHERE t.name = ' || quote_literal(gtype) || ' AND (f.uniquename like ' || quote_literal(name) + || ' OR f.name like ' || quote_literal(name) || ') AND f.is_analysis = ' || quote_literal(is_an) || ';'; + END IF; + FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_ids_by_type_src(character varying, text, character); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_ids_by_type_src(character varying, text, character) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + gtype alias for $1; + src alias for $2; + is_an alias for $3; + query TEXT; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + query := 'SELECT DISTINCT f.feature_id + FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id) INNER join featureloc fl + ON (f.feature_id = fl.feature_id) INNER join feature src ON (src.feature_id = fl.srcfeature_id) + WHERE t.name = ' || quote_literal(gtype) || ' AND src.uniquename = ' || quote_literal(src) + || ' AND f.is_analysis = ' || quote_literal(is_an) || ';'; + IF (STRPOS(gtype, '%') > 0) THEN + query := 'SELECT DISTINCT f.feature_id + FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id) INNER join featureloc fl + ON (f.feature_id = fl.feature_id) INNER join feature src ON (src.feature_id = fl.srcfeature_id) + WHERE t.name like ' || quote_literal(gtype) || ' AND src.uniquename = ' || quote_literal(src) + || ' AND f.is_analysis = ' || quote_literal(is_an) || ';'; + END IF; + FOR myrc IN SELECT * FROM get_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_feature_relationship_type_id(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_relationship_type_id(character varying) RETURNS integer + LANGUAGE sql + AS $_$ + SELECT cvterm_id + FROM cv INNER JOIN cvterm USING (cv_id) + WHERE cvterm.name=$1 AND cv.name='relationship' + $_$; + + +-- +-- Name: get_feature_type_id(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_feature_type_id(character varying) RETURNS integer + LANGUAGE sql + AS $_$ + SELECT cvterm_id + FROM cv INNER JOIN cvterm USING (cv_id) + WHERE cvterm.name=$1 AND cv.name='sequence' + $_$; + + +-- +-- Name: get_featureprop_type_id(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_featureprop_type_id(character varying) RETURNS integer + LANGUAGE sql + AS $_$ + SELECT cvterm_id + FROM cv INNER JOIN cvterm USING (cv_id) + WHERE cvterm.name=$1 AND cv.name='feature_property' + $_$; + + +-- +-- Name: get_graph_above(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_graph_above(integer) RETURNS SETOF cvtermpath + LANGUAGE plpgsql + AS $_$ +DECLARE + leaf alias for $1; + cterm cvtermpath%ROWTYPE; + cterm2 cvtermpath%ROWTYPE; +BEGIN + FOR cterm IN SELECT * FROM cvterm_relationship WHERE subject_id = leaf LOOP + RETURN NEXT cterm; + FOR cterm2 IN SELECT * FROM get_all_object_ids(cterm.object_id) LOOP + RETURN NEXT cterm2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_graph_below(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_graph_below(integer) RETURNS SETOF cvtermpath + LANGUAGE plpgsql + AS $_$ +DECLARE + root alias for $1; + cterm cvtermpath%ROWTYPE; + cterm2 cvtermpath%ROWTYPE; +BEGIN + FOR cterm IN SELECT * FROM cvterm_relationship WHERE object_id = root LOOP + RETURN NEXT cterm; + FOR cterm2 IN SELECT * FROM get_all_subject_ids(cterm.subject_id) LOOP + RETURN NEXT cterm2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cvterm ( + cvterm_id integer NOT NULL, + cv_id integer NOT NULL, + name character varying(1024) NOT NULL, + definition text, + dbxref_id integer NOT NULL, + is_obsolete integer DEFAULT 0 NOT NULL, + is_relationshiptype integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cvterm; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cvterm IS 'A term, class, universal or type within an +ontology or controlled vocabulary. This table is also used for +relations and properties. cvterms constitute nodes in the graph +defined by the collection of cvterms and cvterm_relationships.'; + + +-- +-- Name: COLUMN cvterm.cv_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm.cv_id IS 'The cv or ontology or namespace to which +this cvterm belongs.'; + + +-- +-- Name: COLUMN cvterm.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm.name IS 'A concise human-readable name or +label for the cvterm. Uniquely identifies a cvterm within a cv.'; + + +-- +-- Name: COLUMN cvterm.definition; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm.definition IS 'A human-readable text +definition.'; + + +-- +-- Name: COLUMN cvterm.dbxref_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm.dbxref_id IS 'Primary identifier dbxref - The +unique global OBO identifier for this cvterm. Note that a cvterm may +have multiple secondary dbxrefs - see also table: cvterm_dbxref.'; + + +-- +-- Name: COLUMN cvterm.is_obsolete; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm.is_obsolete IS 'Boolean 0=false,1=true; see +GO documentation for details of obsoletion. Note that two terms with +different primary dbxrefs may exist if one is obsolete.'; + + +-- +-- Name: COLUMN cvterm.is_relationshiptype; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm.is_relationshiptype IS 'Boolean +0=false,1=true relations or relationship types (also known as Typedefs +in OBO format, or as properties or slots) form a cv/ontology in +themselves. We use this flag to indicate whether this cvterm is an +actual term/class/universal or a relation. Relations may be drawn from +the OBO Relations ontology, but are not exclusively drawn from there.'; + + +-- +-- Name: get_it_sub_cvterm_ids(text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_it_sub_cvterm_ids(text) RETURNS SETOF cvterm + LANGUAGE plpgsql + AS $_$ +DECLARE + query alias for $1; + cterm cvterm%ROWTYPE; + cterm2 cvterm%ROWTYPE; +BEGIN + FOR cterm IN EXECUTE query LOOP + RETURN NEXT cterm; + FOR cterm2 IN SELECT subject_id as cvterm_id FROM get_all_subject_ids(cterm.cvterm_id) LOOP + RETURN NEXT cterm2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_organism_id(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_organism_id(character varying) RETURNS integer + LANGUAGE sql + AS $_$ +SELECT organism_id + FROM organism + WHERE genus=substring($1,1,position(' ' IN $1)-1) + AND species=substring($1,position(' ' IN $1)+1) + $_$; + + +-- +-- Name: get_organism_id(character varying, character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_organism_id(character varying, character varying) RETURNS integer + LANGUAGE sql + AS $_$ + SELECT organism_id + FROM organism + WHERE genus=$1 + AND species=$2 + $_$; + + +-- +-- Name: get_organism_id_abbrev(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_organism_id_abbrev(character varying) RETURNS integer + LANGUAGE sql + AS $_$ +SELECT organism_id + FROM organism + WHERE substr(genus,1,1)=substring($1,1,1) + AND species=substring($1,position(' ' IN $1)+1) + $_$; + + +-- +-- Name: get_sub_feature_ids(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_sub_feature_ids(integer) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + root alias for $1; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + FOR myrc IN SELECT DISTINCT subject_id AS feature_id FROM feature_relationship WHERE object_id = root LOOP + RETURN NEXT myrc; + FOR myrc2 IN SELECT * FROM get_sub_feature_ids(myrc.feature_id) LOOP + RETURN NEXT myrc2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_sub_feature_ids(text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_sub_feature_ids(text) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + sql alias for $1; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + FOR myrc IN EXECUTE sql LOOP + FOR myrc2 IN SELECT * FROM get_sub_feature_ids(myrc.feature_id) LOOP + RETURN NEXT myrc2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_sub_feature_ids(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_sub_feature_ids(integer, integer) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + root alias for $1; + depth alias for $2; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + FOR myrc IN SELECT DISTINCT subject_id AS feature_id, depth FROM feature_relationship WHERE object_id = root LOOP + RETURN NEXT myrc; + FOR myrc2 IN SELECT * FROM get_sub_feature_ids(myrc.feature_id,depth+1) LOOP + RETURN NEXT myrc2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_sub_feature_ids_by_type_src(character varying, text, character); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_sub_feature_ids_by_type_src(character varying, text, character) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + gtype alias for $1; + src alias for $2; + is_an alias for $3; + query text; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + query := 'SELECT DISTINCT f.feature_id FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id) + INNER join featureloc fl + ON (f.feature_id = fl.feature_id) INNER join feature src ON (src.feature_id = fl.srcfeature_id) + WHERE t.name = ' || quote_literal(gtype) || ' AND src.uniquename = ' || quote_literal(src) + || ' AND f.is_analysis = ' || quote_literal(is_an) || ';'; + IF (STRPOS(gtype, '%') > 0) THEN + query := 'SELECT DISTINCT f.feature_id FROM feature f INNER join cvterm t ON (f.type_id = t.cvterm_id) + INNER join featureloc fl + ON (f.feature_id = fl.feature_id) INNER join feature src ON (src.feature_id = fl.srcfeature_id) + WHERE t.name like ' || quote_literal(gtype) || ' AND src.uniquename = ' || quote_literal(src) + || ' AND f.is_analysis = ' || quote_literal(is_an) || ';'; + END IF; + FOR myrc IN SELECT * FROM get_sub_feature_ids(query) LOOP + RETURN NEXT myrc; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_up_feature_ids(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_up_feature_ids(integer) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + leaf alias for $1; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + FOR myrc IN SELECT DISTINCT object_id AS feature_id FROM feature_relationship WHERE subject_id = leaf LOOP + RETURN NEXT myrc; + FOR myrc2 IN SELECT * FROM get_up_feature_ids(myrc.feature_id) LOOP + RETURN NEXT myrc2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_up_feature_ids(text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_up_feature_ids(text) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + sql alias for $1; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + FOR myrc IN EXECUTE sql LOOP + FOR myrc2 IN SELECT * FROM get_up_feature_ids(myrc.feature_id) LOOP + RETURN NEXT myrc2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: get_up_feature_ids(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION get_up_feature_ids(integer, integer) RETURNS SETOF feature_by_fx_type + LANGUAGE plpgsql + AS $_$ +DECLARE + leaf alias for $1; + depth alias for $2; + myrc feature_by_fx_type%ROWTYPE; + myrc2 feature_by_fx_type%ROWTYPE; +BEGIN + FOR myrc IN SELECT DISTINCT object_id AS feature_id, depth FROM feature_relationship WHERE subject_id = leaf LOOP + RETURN NEXT myrc; + FOR myrc2 IN SELECT * FROM get_up_feature_ids(myrc.feature_id,depth+1) LOOP + RETURN NEXT myrc2; + END LOOP; + END LOOP; + RETURN; +END; +$_$; + + +-- +-- Name: gffattstring(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION gffattstring(integer) RETURNS character varying + LANGUAGE plpgsql + AS $_$DECLARE + return_string varchar; + f_id ALIAS FOR $1; + atts_view gffatts%ROWTYPE; + feature_row feature%ROWTYPE; + name varchar; + uniquename varchar; + parent varchar; + escape_loc int; +BEGIN + --Get name from feature.name + --Get ID from feature.uniquename + SELECT INTO feature_row * FROM feature WHERE feature_id = f_id; + name = feature_row.name; + return_string = 'ID=' || feature_row.uniquename; + IF name IS NOT NULL AND name != '' + THEN + return_string = return_string ||';' || 'Name=' || name; + END IF; + --Get Parent from feature_relationship + SELECT INTO feature_row * FROM feature f, feature_relationship fr + WHERE fr.subject_id = f_id AND fr.object_id = f.feature_id; + IF FOUND + THEN + return_string = return_string||';'||'Parent='||feature_row.uniquename; + END IF; + FOR atts_view IN SELECT * FROM gff3atts WHERE feature_id = f_id LOOP + escape_loc = position(';' in atts_view.attribute); + IF escape_loc > 0 THEN + atts_view.attribute = replace(atts_view.attribute, ';', '%3B'); + END IF; + return_string = return_string || ';' + || atts_view.type || '=' + || atts_view.attribute; + END LOOP; + RETURN return_string; +END; +$_$; + + +-- +-- Name: db; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE db ( + db_id integer NOT NULL, + name character varying(255) NOT NULL, + description character varying(255), + urlprefix character varying(255), + url character varying(255) +); + + +-- +-- Name: TABLE db; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE db IS 'A database authority. Typical databases in +bioinformatics are FlyBase, GO, UniProt, NCBI, MGI, etc. The authority +is generally known by this shortened form, which is unique within the +bioinformatics and biomedical realm. To Do - add support for URIs, +URNs (e.g. LSIDs). We can do this by treating the URL as a URI - +however, some applications may expect this to be resolvable - to be +decided.'; + + +-- +-- Name: dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE dbxref ( + dbxref_id integer NOT NULL, + db_id integer NOT NULL, + accession character varying(255) NOT NULL, + version character varying(255) DEFAULT ''::character varying NOT NULL, + description text +); + + +-- +-- Name: TABLE dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE dbxref IS 'A unique, global, chado. stable identifier. Not necessarily an external reference - can reference data items inside the particular chado instance being used. Typically a row in a table can be uniquely identified with a primary identifier (called dbxref_id); a table may also have secondary identifiers (in a linking table _dbxref). A dbxref is generally written as : or as ::.'; + + +-- +-- Name: COLUMN dbxref.accession; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN dbxref.accession IS 'The local part of the identifier. Guaranteed by the db authority to be unique for that db.'; + + +-- +-- Name: feature_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_cvterm ( + feature_cvterm_id integer NOT NULL, + feature_id integer NOT NULL, + cvterm_id integer NOT NULL, + pub_id integer NOT NULL, + is_not boolean DEFAULT false NOT NULL, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE feature_cvterm; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_cvterm IS 'Associate a term from a cv with a feature, for example, GO annotation.'; + + +-- +-- Name: COLUMN feature_cvterm.pub_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_cvterm.pub_id IS 'Provenance for the annotation. Each annotation should have a single primary chado.tion (which may be of the appropriate type for computational analyses) where more details can be found. Additional provenance dbxrefs can be attached using feature_cvterm_dbxref.'; + + +-- +-- Name: COLUMN feature_cvterm.is_not; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_cvterm.is_not IS 'If this is set to true, then this annotation is interpreted as a NEGATIVE annotation - i.e. the feature does NOT have the specified function, process, component, part, etc. See GO docs for more details.'; + + +-- +-- Name: feature_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_dbxref ( + feature_dbxref_id integer NOT NULL, + feature_id integer NOT NULL, + dbxref_id integer NOT NULL, + is_current boolean DEFAULT true NOT NULL +); + + +-- +-- Name: TABLE feature_dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_dbxref IS 'Links a feature to dbxrefs. This is for secondary identifiers; primary identifiers should use feature.dbxref_id.'; + + +-- +-- Name: COLUMN feature_dbxref.is_current; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_dbxref.is_current IS 'True if this secondary dbxref is the most up to date accession in the corresponding db. Retired accessions should set this field to false'; + + +-- +-- Name: feature_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_pub ( + feature_pub_id integer NOT NULL, + feature_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE feature_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_pub IS 'Provenance. Linking table between features and chado.tions that mention them.'; + + +-- +-- Name: feature_synonym; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_synonym ( + feature_synonym_id integer NOT NULL, + synonym_id integer NOT NULL, + feature_id integer NOT NULL, + pub_id integer NOT NULL, + is_current boolean DEFAULT false NOT NULL, + is_internal boolean DEFAULT false NOT NULL +); + + +-- +-- Name: TABLE feature_synonym; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_synonym IS 'Linking table between feature and synonym.'; + + +-- +-- Name: COLUMN feature_synonym.pub_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_synonym.pub_id IS 'The pub_id link is for relating the usage of a given synonym to the chado.tion in which it was used.'; + + +-- +-- Name: COLUMN feature_synonym.is_current; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_synonym.is_current IS 'The is_current boolean indicates whether the linked synonym is the current -official- symbol for the linked feature.'; + + +-- +-- Name: COLUMN feature_synonym.is_internal; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_synonym.is_internal IS 'Typically a synonym exists so that somebody querying the db with an obsolete name can find the object theyre looking for (under its current name. If the synonym has been used chado.y and deliberately (e.g. in a paper), it may also be listed in reports as a synonym. If the synonym was not used deliberately (e.g. there was a typo which went chado., then the is_internal boolean may be set to -true- so that it is known that the synonym is -internal- and should be queryable but should not be listed in reports as a valid synonym.'; + + +-- +-- Name: featureprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featureprop ( + featureprop_id integer NOT NULL, + feature_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE featureprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE featureprop IS 'A feature can have any number of slot-value property tags attached to it. This is an alternative to hardcoding a list of columns in the relational schema, and is completely extensible.'; + + +-- +-- Name: COLUMN featureprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureprop.type_id IS 'The name of the +property/slot is a cvterm. The meaning of the property is defined in +that cvterm. Certain property types will only apply to certain feature +types (e.g. the anticodon property will only apply to tRNA features) ; +the types here come from the sequence feature property ontology.'; + + +-- +-- Name: COLUMN featureprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureprop.value IS 'The value of the property, represented as text. Numeric values are converted to their text representation. This is less efficient than using native database types, but is easier to query.'; + + +-- +-- Name: COLUMN featureprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featureprop.rank IS 'Property-Value ordering. Any +feature can have multiple values for any particular property type - +these are ordered in a list using rank, counting from zero. For +properties that are single-valued rather than multi-valued, the +default 0 value should be used'; + + +-- +-- Name: pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE pub ( + pub_id integer NOT NULL, + title text, + volumetitle text, + volume character varying(255), + series_name character varying(255), + issue character varying(255), + pyear character varying(255), + pages character varying(255), + miniref character varying(255), + uniquename text NOT NULL, + type_id integer NOT NULL, + is_obsolete boolean DEFAULT false, + publisher character varying(255), + pubplace character varying(255) +); + + +-- +-- Name: TABLE pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE pub IS 'A documented provenance artefact - chado.tions, +documents, personal communication.'; + + +-- +-- Name: COLUMN pub.title; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pub.title IS 'Descriptive general heading.'; + + +-- +-- Name: COLUMN pub.volumetitle; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pub.volumetitle IS 'Title of part if one of a series.'; + + +-- +-- Name: COLUMN pub.series_name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pub.series_name IS 'Full name of (journal) series.'; + + +-- +-- Name: COLUMN pub.pages; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pub.pages IS 'Page number range[s], e.g. 457--459, viii + 664pp, lv--lvii.'; + + +-- +-- Name: COLUMN pub.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pub.type_id IS 'The type of the chado.tion (book, journal, poem, graffiti, etc). Uses pub cv.'; + + +-- +-- Name: synonym; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE synonym ( + synonym_id integer NOT NULL, + name character varying(255) NOT NULL, + type_id integer NOT NULL, + synonym_sgml character varying(255) NOT NULL +); + + +-- +-- Name: TABLE synonym; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE synonym IS 'A synonym for a feature. One feature can have multiple synonyms, and the same synonym can apply to multiple features.'; + + +-- +-- Name: COLUMN synonym.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN synonym.name IS 'The synonym itself. Should be human-readable machine-searchable ascii text.'; + + +-- +-- Name: COLUMN synonym.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN synonym.type_id IS 'Types would be symbol and fullname for now.'; + + +-- +-- Name: COLUMN synonym.synonym_sgml; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN synonym.synonym_sgml IS 'The fully specified synonym, with any non-ascii characters encoded in SGML.'; + + +-- +-- Name: gffatts; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW gffatts AS + SELECT fs.feature_id, + 'Ontology_term'::text AS type, + s.name AS attribute + FROM cvterm s, + feature_cvterm fs + WHERE (fs.cvterm_id = s.cvterm_id) +UNION ALL + SELECT fs.feature_id, + 'Dbxref'::text AS type, + (((d.name)::text || ':'::text) || (s.accession)::text) AS attribute + FROM dbxref s, + feature_dbxref fs, + db d + WHERE ((fs.dbxref_id = s.dbxref_id) AND (s.db_id = d.db_id)) +UNION ALL + SELECT fs.feature_id, + 'Alias'::text AS type, + s.name AS attribute + FROM synonym s, + feature_synonym fs + WHERE (fs.synonym_id = s.synonym_id) +UNION ALL + SELECT fp.feature_id, + cv.name AS type, + fp.value AS attribute + FROM featureprop fp, + cvterm cv + WHERE (fp.type_id = cv.cvterm_id) +UNION ALL + SELECT fs.feature_id, + 'pub'::text AS type, + (((s.series_name)::text || ':'::text) || s.title) AS attribute + FROM pub s, + feature_pub fs + WHERE (fs.pub_id = s.pub_id); + + +-- +-- Name: gfffeatureatts(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION gfffeatureatts(integer) RETURNS SETOF gffatts + LANGUAGE sql + AS $_$ +SELECT feature_id, 'cvterm' AS type, s.name AS attribute +FROM cvterm s, feature_cvterm fs +WHERE fs.feature_id= $1 AND fs.cvterm_id = s.cvterm_id +UNION +SELECT feature_id, 'dbxref' AS type, d.name || ':' || s.accession AS attribute +FROM dbxref s, feature_dbxref fs, db d +WHERE fs.feature_id= $1 AND fs.dbxref_id = s.dbxref_id AND s.db_id = d.db_id +--UNION +--SELECT feature_id, 'expression' AS type, s.description AS attribute +--FROM expression s, feature_expression fs +--WHERE fs.feature_id= $1 AND fs.expression_id = s.expression_id +--UNION +--SELECT fg.feature_id, 'genotype' AS type, g.uniquename||': '||g.description AS attribute +--FROM gcontext g, feature_gcontext fg +--WHERE fg.feature_id= $1 AND g.gcontext_id = fg.gcontext_id +--UNION +--SELECT feature_id, 'genotype' AS type, s.description AS attribute +--FROM genotype s, feature_genotype fs +--WHERE fs.feature_id= $1 AND fs.genotype_id = s.genotype_id +--UNION +--SELECT feature_id, 'phenotype' AS type, s.description AS attribute +--FROM phenotype s, feature_phenotype fs +--WHERE fs.feature_id= $1 AND fs.phenotype_id = s.phenotype_id +UNION +SELECT feature_id, 'synonym' AS type, s.name AS attribute +FROM synonym s, feature_synonym fs +WHERE fs.feature_id= $1 AND fs.synonym_id = s.synonym_id +UNION +SELECT fp.feature_id,cv.name,fp.value +FROM featureprop fp, cvterm cv +WHERE fp.feature_id= $1 AND fp.type_id = cv.cvterm_id +UNION +SELECT feature_id, 'pub' AS type, s.series_name || ':' || s.title AS attribute +FROM pub s, feature_pub fs +WHERE fs.feature_id= $1 AND fs.pub_id = s.pub_id +$_$; + + +-- +-- Name: order_exons(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION order_exons(integer) RETURNS void + LANGUAGE plpgsql + AS $_$ + DECLARE + parent_type ALIAS FOR $1; + exon_id int; + part_of int; + exon_type int; + strand int; + arow RECORD; + order_by varchar; + rowcount int; + exon_count int; + ordered_exons int; + transcript_id int; + transcript_row feature%ROWTYPE; + BEGIN + SELECT INTO part_of cvterm_id FROM cvterm WHERE name='part_of' + AND cv_id IN (SELECT cv_id FROM cv WHERE name='relationship'); + --SELECT INTO exon_type cvterm_id FROM cvterm WHERE name='exon' + -- AND cv_id IN (SELECT cv_id FROM cv WHERE name='sequence'); + --RAISE NOTICE 'part_of %, exon %',part_of,exon_type; + FOR transcript_row IN + SELECT * FROM feature WHERE type_id = parent_type + LOOP + transcript_id = transcript_row.feature_id; + SELECT INTO rowcount count(*) FROM feature_relationship + WHERE object_id = transcript_id + AND rank = 0; + --Dont modify this transcript if there are already numbered exons or + --if there is only one exon + IF rowcount = 1 THEN + --RAISE NOTICE 'skipping transcript %, row count %',transcript_id,rowcount; + CONTINUE; + END IF; + --need to reverse the order if the strand is negative + SELECT INTO strand strand FROM featureloc WHERE feature_id=transcript_id; + IF strand > 0 THEN + order_by = 'fl.fmin'; + ELSE + order_by = 'fl.fmax desc'; + END IF; + exon_count = 0; + FOR arow IN EXECUTE + 'SELECT fr.*, fl.fmin, fl.fmax + FROM feature_relationship fr, featureloc fl + WHERE fr.object_id = '||transcript_id||' + AND fr.subject_id = fl.feature_id + AND fr.type_id = '||part_of||' + ORDER BY '||order_by + LOOP + --number the exons for a given transcript + UPDATE feature_relationship + SET rank = exon_count + WHERE feature_relationship_id = arow.feature_relationship_id; + exon_count = exon_count + 1; + END LOOP; + END LOOP; + END; +$_$; + + +-- +-- Name: phylonode_depth(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION phylonode_depth(integer) RETURNS double precision + LANGUAGE plpgsql + AS $_$DECLARE id ALIAS FOR $1; + DECLARE depth FLOAT := 0; + DECLARE curr_node phylonode%ROWTYPE; + BEGIN + SELECT INTO curr_node * + FROM phylonode + WHERE phylonode_id=id; + depth = depth + curr_node.distance; + IF curr_node.parent_phylonode_id IS NULL + THEN RETURN depth; + ELSE RETURN depth + phylonode_depth(curr_node.parent_phylonode_id); + END IF; + END +$_$; + + +-- +-- Name: phylonode_height(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION phylonode_height(integer) RETURNS double precision + LANGUAGE sql + AS $_$ + SELECT coalesce(max(phylonode_height(phylonode_id) + distance), 0.0) + FROM phylonode + WHERE parent_phylonode_id = $1 +$_$; + + +-- +-- Name: project_featureloc_up(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION project_featureloc_up(integer, integer) RETURNS featureloc + LANGUAGE plpgsql + AS $_$ +DECLARE + in_featureloc_id alias for $1; + up_srcfeature_id alias for $2; + in_featureloc featureloc%ROWTYPE; + up_featureloc featureloc%ROWTYPE; + nu_featureloc featureloc%ROWTYPE; + nu_fmin INT; + nu_fmax INT; + nu_strand INT; +BEGIN + SELECT INTO in_featureloc + featureloc.* + FROM featureloc + WHERE featureloc_id = in_featureloc_id; + SELECT INTO up_featureloc + up_fl.* + FROM featureloc AS in_fl + INNER JOIN featureloc AS up_fl + ON (in_fl.srcfeature_id = up_fl.feature_id) + WHERE + in_fl.featureloc_id = in_featureloc_id AND + up_fl.srcfeature_id = up_srcfeature_id; + IF up_featureloc.strand IS NULL + THEN RETURN NULL; + END IF; + IF up_featureloc.strand < 0 + THEN + nu_fmin = project_point_up(in_featureloc.fmax, + up_featureloc.fmin,up_featureloc.fmax,-1); + nu_fmax = project_point_up(in_featureloc.fmin, + up_featureloc.fmin,up_featureloc.fmax,-1); + nu_strand = -in_featureloc.strand; + ELSE + nu_fmin = project_point_up(in_featureloc.fmin, + up_featureloc.fmin,up_featureloc.fmax,1); + nu_fmax = project_point_up(in_featureloc.fmax, + up_featureloc.fmin,up_featureloc.fmax,1); + nu_strand = in_featureloc.strand; + END IF; + in_featureloc.fmin = nu_fmin; + in_featureloc.fmax = nu_fmax; + in_featureloc.strand = nu_strand; + in_featureloc.srcfeature_id = up_featureloc.srcfeature_id; + RETURN in_featureloc; +END +$_$; + + +-- +-- Name: project_point_down(integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION project_point_down(integer, integer, integer, integer) RETURNS integer + LANGUAGE sql + AS $_$SELECT + CASE WHEN $4<0 + THEN $3-$1 + ELSE $1+$2 + END AS p$_$; + + +-- +-- Name: project_point_g2t(integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION project_point_g2t(integer, integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$ + DECLARE + in_p alias for $1; + srcf_id alias for $2; + t_id alias for $3; + e_floc featureloc%ROWTYPE; + out_p INT; + exon_cvterm_id INT; +BEGIN + SELECT INTO exon_cvterm_id get_feature_type_id('exon'); + SELECT INTO out_p + CASE + WHEN strand<0 THEN fmax-p + ELSE p-fmin + END AS p + FROM featureloc + INNER JOIN feature USING (feature_id) + INNER JOIN feature_relationship ON (feature.feature_id=subject_id) + WHERE + object_id = t_id AND + feature.type_id = exon_cvterm_id AND + featureloc.srcfeature_id = srcf_id AND + in_p >= fmin AND + in_p <= fmax; + RETURN in_featureloc; +END +$_$; + + +-- +-- Name: project_point_up(integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION project_point_up(integer, integer, integer, integer) RETURNS integer + LANGUAGE sql + AS $_$SELECT + CASE WHEN $4<0 + THEN $3-$1 -- rev strand + ELSE $1-$2 -- fwd strand + END AS p$_$; + + +-- +-- Name: reverse_complement(text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION reverse_complement(text) RETURNS text + LANGUAGE sql + AS $_$SELECT reverse_string(complement_residues($1))$_$; + + +-- +-- Name: reverse_string(text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION reverse_string(text) RETURNS text + LANGUAGE plpgsql + AS $_$ + DECLARE + reversed_string TEXT; + incoming ALIAS FOR $1; + BEGIN + reversed_string = ''; + FOR i IN REVERSE char_length(incoming)..1 loop + reversed_string = reversed_string || substring(incoming FROM i FOR 1); + END loop; + RETURN reversed_string; +END$_$; + + +-- +-- Name: share_exons(); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION share_exons() RETURNS void + LANGUAGE plpgsql + AS $$ + DECLARE + BEGIN + CREATE temporary TABLE shared_exons AS + SELECT gene.feature_id as gene_feature_id + , gene.uniquename as gene_uniquename + , transcript1.uniquename as transcript1 + , exon1.feature_id as exon1_feature_id + , exon1.uniquename as exon1_uniquename + , transcript2.uniquename as transcript2 + , exon2.feature_id as exon2_feature_id + , exon2.uniquename as exon2_uniquename + , exon1_loc.fmin + , exon1_loc.fmax + FROM feature gene + JOIN cvterm gene_type ON gene.type_id = gene_type.cvterm_id + JOIN cv gene_type_cv USING (cv_id) + JOIN feature_relationship gene_transcript1 ON gene.feature_id = gene_transcript1.object_id + JOIN feature transcript1 ON gene_transcript1.subject_id = transcript1.feature_id + JOIN cvterm transcript1_type ON transcript1.type_id = transcript1_type.cvterm_id + JOIN cv transcript1_type_cv ON transcript1_type.cv_id = transcript1_type_cv.cv_id + JOIN feature_relationship transcript1_exon1 ON transcript1_exon1.object_id = transcript1.feature_id + JOIN feature exon1 ON transcript1_exon1.subject_id = exon1.feature_id + JOIN cvterm exon1_type ON exon1.type_id = exon1_type.cvterm_id + JOIN cv exon1_type_cv ON exon1_type.cv_id = exon1_type_cv.cv_id + JOIN featureloc exon1_loc ON exon1_loc.feature_id = exon1.feature_id + JOIN feature_relationship gene_transcript2 ON gene.feature_id = gene_transcript2.object_id + JOIN feature transcript2 ON gene_transcript2.subject_id = transcript2.feature_id + JOIN cvterm transcript2_type ON transcript2.type_id = transcript2_type.cvterm_id + JOIN cv transcript2_type_cv ON transcript2_type.cv_id = transcript2_type_cv.cv_id + JOIN feature_relationship transcript2_exon2 ON transcript2_exon2.object_id = transcript2.feature_id + JOIN feature exon2 ON transcript2_exon2.subject_id = exon2.feature_id + JOIN cvterm exon2_type ON exon2.type_id = exon2_type.cvterm_id + JOIN cv exon2_type_cv ON exon2_type.cv_id = exon2_type_cv.cv_id + JOIN featureloc exon2_loc ON exon2_loc.feature_id = exon2.feature_id + WHERE gene_type_cv.name = 'sequence' + AND gene_type.name = 'gene' + AND transcript1_type_cv.name = 'sequence' + AND transcript1_type.name = 'mRNA' + AND transcript2_type_cv.name = 'sequence' + AND transcript2_type.name = 'mRNA' + AND exon1_type_cv.name = 'sequence' + AND exon1_type.name = 'exon' + AND exon2_type_cv.name = 'sequence' + AND exon2_type.name = 'exon' + AND exon1.feature_id < exon2.feature_id + AND exon1_loc.rank = 0 + AND exon2_loc.rank = 0 + AND exon1_loc.fmin = exon2_loc.fmin + AND exon1_loc.fmax = exon2_loc.fmax + ; + /* Choose one of the shared exons to be the canonical representative. + We pick the one with the smallest feature_id. + */ + CREATE temporary TABLE canonical_exon_representatives AS + SELECT gene_feature_id, min(exon1_feature_id) AS canonical_feature_id, fmin + FROM shared_exons + GROUP BY gene_feature_id,fmin + ; + CREATE temporary TABLE exon_replacements AS + SELECT DISTINCT shared_exons.exon2_feature_id AS actual_feature_id + , canonical_exon_representatives.canonical_feature_id + , canonical_exon_representatives.fmin + FROM shared_exons + JOIN canonical_exon_representatives USING (gene_feature_id) + WHERE shared_exons.exon2_feature_id <> canonical_exon_representatives.canonical_feature_id + AND shared_exons.fmin = canonical_exon_representatives.fmin + ; + UPDATE feature_relationship + SET subject_id = ( + SELECT canonical_feature_id + FROM exon_replacements + WHERE feature_relationship.subject_id = exon_replacements.actual_feature_id) + WHERE subject_id IN ( + SELECT actual_feature_id FROM exon_replacements + ); + UPDATE feature_relationship + SET object_id = ( + SELECT canonical_feature_id + FROM exon_replacements + WHERE feature_relationship.subject_id = exon_replacements.actual_feature_id) + WHERE object_id IN ( + SELECT actual_feature_id FROM exon_replacements + ); + UPDATE feature + SET is_obsolete = true + WHERE feature_id IN ( + SELECT actual_feature_id FROM exon_replacements + ); + END; +$$; + + +-- +-- Name: store_analysis(character varying, character varying, character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION store_analysis(character varying, character varying, character varying) RETURNS integer + LANGUAGE plpgsql + AS $_$DECLARE + v_program ALIAS FOR $1; + v_programversion ALIAS FOR $2; + v_sourcename ALIAS FOR $3; + pkval INTEGER; + BEGIN + SELECT INTO pkval analysis_id + FROM analysis + WHERE program=v_program AND + programversion=v_programversion AND + sourcename=v_sourcename; + IF NOT FOUND THEN + INSERT INTO analysis + (program,programversion,sourcename) + VALUES + (v_program,v_programversion,v_sourcename); + RETURN currval('analysis_analysis_id_seq'); + END IF; + RETURN pkval; + END; +$_$; + + +-- +-- Name: store_db(character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION store_db(character varying) RETURNS integer + LANGUAGE plpgsql + AS $_$DECLARE + v_name ALIAS FOR $1; + v_db_id INTEGER; + BEGIN + SELECT INTO v_db_id db_id + FROM db + WHERE name=v_name; + IF NOT FOUND THEN + INSERT INTO db + (name) + VALUES + (v_name); + RETURN currval('db_db_id_seq'); + END IF; + RETURN v_db_id; + END; +$_$; + + +-- +-- Name: store_dbxref(character varying, character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION store_dbxref(character varying, character varying) RETURNS integer + LANGUAGE plpgsql + AS $_$DECLARE + v_dbname ALIAS FOR $1; + v_accession ALIAS FOR $1; + v_db_id INTEGER; + v_dbxref_id INTEGER; + BEGIN + SELECT INTO v_db_id + store_db(v_dbname); + SELECT INTO v_dbxref_id dbxref_id + FROM dbxref + WHERE db_id=v_db_id AND + accession=v_accession; + IF NOT FOUND THEN + INSERT INTO dbxref + (db_id,accession) + VALUES + (v_db_id,v_accession); + RETURN currval('dbxref_dbxref_id_seq'); + END IF; + RETURN v_dbxref_id; + END; +$_$; + + +-- +-- Name: store_feature(integer, integer, integer, integer, integer, integer, character varying, character varying, integer, boolean); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION store_feature(integer, integer, integer, integer, integer, integer, character varying, character varying, integer, boolean) RETURNS integer + LANGUAGE plpgsql + AS $_$DECLARE + v_srcfeature_id ALIAS FOR $1; + v_fmin ALIAS FOR $2; + v_fmax ALIAS FOR $3; + v_strand ALIAS FOR $4; + v_dbxref_id ALIAS FOR $5; + v_organism_id ALIAS FOR $6; + v_name ALIAS FOR $7; + v_uniquename ALIAS FOR $8; + v_type_id ALIAS FOR $9; + v_is_analysis ALIAS FOR $10; + v_feature_id INT; + v_featureloc_id INT; + BEGIN + IF v_dbxref_id IS NULL THEN + SELECT INTO v_feature_id feature_id + FROM feature + WHERE uniquename=v_uniquename AND + organism_id=v_organism_id AND + type_id=v_type_id; + ELSE + SELECT INTO v_feature_id feature_id + FROM feature + WHERE dbxref_id=v_dbxref_id; + END IF; + IF NOT FOUND THEN + INSERT INTO feature + ( dbxref_id , + organism_id , + name , + uniquename , + type_id , + is_analysis ) + VALUES + ( v_dbxref_id , + v_organism_id , + v_name , + v_uniquename , + v_type_id , + v_is_analysis ); + v_feature_id = currval('feature_feature_id_seq'); + ELSE + UPDATE feature SET + dbxref_id = v_dbxref_id , + organism_id = v_organism_id , + name = v_name , + uniquename = v_uniquename , + type_id = v_type_id , + is_analysis = v_is_analysis + WHERE + feature_id=v_feature_id; + END IF; + PERFORM store_featureloc(v_feature_id, + v_srcfeature_id, + v_fmin, + v_fmax, + v_strand, + 0, + 0); + RETURN v_feature_id; + END; +$_$; + + +-- +-- Name: store_feature_synonym(integer, character varying, integer, boolean, boolean, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION store_feature_synonym(integer, character varying, integer, boolean, boolean, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$DECLARE + v_feature_id ALIAS FOR $1; + v_syn ALIAS FOR $2; + v_type_id ALIAS FOR $3; + v_is_current ALIAS FOR $4; + v_is_internal ALIAS FOR $5; + v_pub_id ALIAS FOR $6; + v_synonym_id INT; + v_feature_synonym_id INT; + BEGIN + IF v_feature_id IS NULL THEN RAISE EXCEPTION 'feature_id cannot be null'; + END IF; + SELECT INTO v_synonym_id synonym_id + FROM synonym + WHERE name=v_syn AND + type_id=v_type_id; + IF NOT FOUND THEN + INSERT INTO synonym + ( name, + synonym_sgml, + type_id) + VALUES + ( v_syn, + v_syn, + v_type_id); + v_synonym_id = currval('synonym_synonym_id_seq'); + END IF; + SELECT INTO v_feature_synonym_id feature_synonym_id + FROM feature_synonym + WHERE feature_id=v_feature_id AND + synonym_id=v_synonym_id AND + pub_id=v_pub_id; + IF NOT FOUND THEN + INSERT INTO feature_synonym + ( feature_id, + synonym_id, + pub_id, + is_current, + is_internal) + VALUES + ( v_feature_id, + v_synonym_id, + v_pub_id, + v_is_current, + v_is_internal); + v_feature_synonym_id = currval('feature_synonym_feature_synonym_id_seq'); + ELSE + UPDATE feature_synonym + SET is_current=v_is_current, is_internal=v_is_internal + WHERE feature_synonym_id=v_feature_synonym_id; + END IF; + RETURN v_feature_synonym_id; + END; +$_$; + + +-- +-- Name: store_featureloc(integer, integer, integer, integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION store_featureloc(integer, integer, integer, integer, integer, integer, integer) RETURNS integer + LANGUAGE plpgsql + AS $_$DECLARE + v_feature_id ALIAS FOR $1; + v_srcfeature_id ALIAS FOR $2; + v_fmin ALIAS FOR $3; + v_fmax ALIAS FOR $4; + v_strand ALIAS FOR $5; + v_rank ALIAS FOR $6; + v_locgroup ALIAS FOR $7; + v_featureloc_id INT; + BEGIN + IF v_feature_id IS NULL THEN RAISE EXCEPTION 'feature_id cannot be null'; + END IF; + SELECT INTO v_featureloc_id featureloc_id + FROM featureloc + WHERE feature_id=v_feature_id AND + rank=v_rank AND + locgroup=v_locgroup; + IF NOT FOUND THEN + INSERT INTO featureloc + ( feature_id, + srcfeature_id, + fmin, + fmax, + strand, + rank, + locgroup) + VALUES + ( v_feature_id, + v_srcfeature_id, + v_fmin, + v_fmax, + v_strand, + v_rank, + v_locgroup); + v_featureloc_id = currval('featureloc_featureloc_id_seq'); + ELSE + UPDATE featureloc SET + feature_id = v_feature_id, + srcfeature_id = v_srcfeature_id, + fmin = v_fmin, + fmax = v_fmax, + strand = v_strand, + rank = v_rank, + locgroup = v_locgroup + WHERE + featureloc_id=v_featureloc_id; + END IF; + RETURN v_featureloc_id; + END; +$_$; + + +-- +-- Name: store_organism(character varying, character varying, character varying); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION store_organism(character varying, character varying, character varying) RETURNS integer + LANGUAGE plpgsql + AS $_$DECLARE + v_genus ALIAS FOR $1; + v_species ALIAS FOR $2; + v_common_name ALIAS FOR $3; + v_organism_id INTEGER; + BEGIN + SELECT INTO v_organism_id organism_id + FROM organism + WHERE genus=v_genus AND + species=v_species; + IF NOT FOUND THEN + INSERT INTO organism + (genus,species,common_name) + VALUES + (v_genus,v_species,v_common_name); + RETURN currval('organism_organism_id_seq'); + ELSE + UPDATE organism + SET common_name=v_common_name + WHERE organism_id = v_organism_id; + END IF; + RETURN v_organism_id; + END; +$_$; + + +-- +-- Name: subsequence(integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence(integer, integer, integer, integer) RETURNS text + LANGUAGE sql + AS $_$SELECT + CASE WHEN $4<0 + THEN reverse_complement(substring(srcf.residues,$2+1,($3-$2))) + ELSE substring(residues,$2+1,($3-$2)) + END AS residues + FROM feature AS srcf + WHERE + srcf.feature_id=$1$_$; + + +-- +-- Name: subsequence_by_feature(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence_by_feature(integer) RETURNS text + LANGUAGE sql + AS $_$SELECT subsequence_by_feature($1,0,0)$_$; + + +-- +-- Name: subsequence_by_feature(integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence_by_feature(integer, integer, integer) RETURNS text + LANGUAGE sql + AS $_$SELECT + CASE WHEN strand<0 + THEN reverse_complement(substring(srcf.residues,fmin+1,(fmax-fmin))) + ELSE substring(srcf.residues,fmin+1,(fmax-fmin)) + END AS residues + FROM feature AS srcf + INNER JOIN featureloc ON (srcf.feature_id=featureloc.srcfeature_id) + WHERE + featureloc.feature_id=$1 AND + featureloc.rank=$2 AND + featureloc.locgroup=$3$_$; + + +-- +-- Name: subsequence_by_featureloc(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence_by_featureloc(integer) RETURNS text + LANGUAGE sql + AS $_$SELECT + CASE WHEN strand<0 + THEN reverse_complement(substring(srcf.residues,fmin+1,(fmax-fmin))) + ELSE substring(srcf.residues,fmin+1,(fmax-fmin)) + END AS residues + FROM feature AS srcf + INNER JOIN featureloc ON (srcf.feature_id=featureloc.srcfeature_id) + WHERE + featureloc_id=$1$_$; + + +-- +-- Name: subsequence_by_subfeatures(integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence_by_subfeatures(integer) RETURNS text + LANGUAGE sql + AS $_$ +SELECT subsequence_by_subfeatures($1,get_feature_relationship_type_id('part_of'),0,0) +$_$; + + +-- +-- Name: subsequence_by_subfeatures(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence_by_subfeatures(integer, integer) RETURNS text + LANGUAGE sql + AS $_$SELECT subsequence_by_subfeatures($1,$2,0,0)$_$; + + +-- +-- Name: subsequence_by_subfeatures(integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence_by_subfeatures(integer, integer, integer, integer) RETURNS text + LANGUAGE plpgsql + AS $_$ +DECLARE v_feature_id ALIAS FOR $1; +DECLARE v_rtype_id ALIAS FOR $2; +DECLARE v_rank ALIAS FOR $3; +DECLARE v_locgroup ALIAS FOR $4; +DECLARE subseq TEXT; +DECLARE seqrow RECORD; +BEGIN + subseq = ''; + FOR seqrow IN + SELECT + CASE WHEN strand<0 + THEN reverse_complement(substring(srcf.residues,fmin+1,(fmax-fmin))) + ELSE substring(srcf.residues,fmin+1,(fmax-fmin)) + END AS residues + FROM feature AS srcf + INNER JOIN featureloc ON (srcf.feature_id=featureloc.srcfeature_id) + INNER JOIN feature_relationship AS fr + ON (fr.subject_id=featureloc.feature_id) + WHERE + fr.object_id=v_feature_id AND + fr.type_id=v_rtype_id AND + featureloc.rank=v_rank AND + featureloc.locgroup=v_locgroup + ORDER BY fr.rank + LOOP + subseq = subseq || seqrow.residues; + END LOOP; + RETURN subseq; +END +$_$; + + +-- +-- Name: subsequence_by_typed_subfeatures(integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence_by_typed_subfeatures(integer, integer) RETURNS text + LANGUAGE sql + AS $_$SELECT subsequence_by_typed_subfeatures($1,$2,0,0)$_$; + + +-- +-- Name: subsequence_by_typed_subfeatures(integer, integer, integer, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION subsequence_by_typed_subfeatures(integer, integer, integer, integer) RETURNS text + LANGUAGE plpgsql + AS $_$ +DECLARE v_feature_id ALIAS FOR $1; +DECLARE v_ftype_id ALIAS FOR $2; +DECLARE v_rank ALIAS FOR $3; +DECLARE v_locgroup ALIAS FOR $4; +DECLARE subseq TEXT; +DECLARE seqrow RECORD; +BEGIN + subseq = ''; + FOR seqrow IN + SELECT + CASE WHEN strand<0 + THEN reverse_complement(substring(srcf.residues,fmin+1,(fmax-fmin))) + ELSE substring(srcf.residues,fmin+1,(fmax-fmin)) + END AS residues + FROM feature AS srcf + INNER JOIN featureloc ON (srcf.feature_id=featureloc.srcfeature_id) + INNER JOIN feature AS subf ON (subf.feature_id=featureloc.feature_id) + INNER JOIN feature_relationship AS fr ON (fr.subject_id=subf.feature_id) + WHERE + fr.object_id=v_feature_id AND + subf.type_id=v_ftype_id AND + featureloc.rank=v_rank AND + featureloc.locgroup=v_locgroup + ORDER BY fr.rank + LOOP + subseq = subseq || seqrow.residues; + END LOOP; + RETURN subseq; +END +$_$; + + +-- +-- Name: translate_codon(text, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION translate_codon(text, integer) RETURNS character + LANGUAGE sql + AS $_$SELECT aa FROM genetic_code.gencode_codon_aa WHERE codon=$1 AND gencode_id=$2$_$; + + +-- +-- Name: translate_dna(text); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION translate_dna(text) RETURNS text + LANGUAGE sql + AS $_$SELECT translate_dna($1,1)$_$; + + +-- +-- Name: translate_dna(text, integer); Type: FUNCTION; Schema: chado; Owner: - +-- + +CREATE FUNCTION translate_dna(text, integer) RETURNS text + LANGUAGE plpgsql + AS $_$ + DECLARE + dnaseq ALIAS FOR $1; + gcode ALIAS FOR $2; + translation TEXT; + dnaseqlen INT; + codon CHAR(3); + aa CHAR(1); + i INT; + BEGIN + translation = ''; + dnaseqlen = char_length(dnaseq); + i=1; + WHILE i+1 < dnaseqlen loop + codon = substring(dnaseq,i,3); + aa = translate_codon(codon,gcode); + translation = translation || aa; + i = i+3; + END loop; + RETURN translation; +END$_$; + + +-- +-- Name: concat(text); Type: AGGREGATE; Schema: chado; Owner: - +-- + +CREATE AGGREGATE concat(text) ( + SFUNC = concat_pair, + STYPE = text, + INITCOND = '' +); + + +-- +-- Name: acquisition; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE acquisition ( + acquisition_id integer NOT NULL, + assay_id integer NOT NULL, + protocol_id integer, + channel_id integer, + acquisitiondate timestamp without time zone DEFAULT now(), + name text, + uri text +); + + +-- +-- Name: TABLE acquisition; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE acquisition IS 'This represents the scanning of hybridized material. The output of this process is typically a digital image of an array.'; + + +-- +-- Name: acquisition_acquisition_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE acquisition_acquisition_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: acquisition_acquisition_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE acquisition_acquisition_id_seq OWNED BY acquisition.acquisition_id; + + +-- +-- Name: acquisition_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE acquisition_relationship ( + acquisition_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + type_id integer NOT NULL, + object_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE acquisition_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE acquisition_relationship IS 'Multiple monochrome images may be merged to form a multi-color image. Red-green images of 2-channel hybridizations are an example of this.'; + + +-- +-- Name: acquisition_relationship_acquisition_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE acquisition_relationship_acquisition_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: acquisition_relationship_acquisition_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE acquisition_relationship_acquisition_relationship_id_seq OWNED BY acquisition_relationship.acquisition_relationship_id; + + +-- +-- Name: acquisitionprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE acquisitionprop ( + acquisitionprop_id integer NOT NULL, + acquisition_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE acquisitionprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE acquisitionprop IS 'Parameters associated with image acquisition.'; + + +-- +-- Name: acquisitionprop_acquisitionprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE acquisitionprop_acquisitionprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: acquisitionprop_acquisitionprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE acquisitionprop_acquisitionprop_id_seq OWNED BY acquisitionprop.acquisitionprop_id; + + +-- +-- Name: all_feature_names; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW all_feature_names AS + SELECT feature.feature_id, + ("substring"(feature.uniquename, 0, 255))::character varying(255) AS name, + feature.organism_id + FROM feature +UNION + SELECT feature.feature_id, + feature.name, + feature.organism_id + FROM feature + WHERE (feature.name IS NOT NULL) +UNION + SELECT fs.feature_id, + s.name, + f.organism_id + FROM feature_synonym fs, + synonym s, + feature f + WHERE ((fs.synonym_id = s.synonym_id) AND (fs.feature_id = f.feature_id)) +UNION + SELECT fp.feature_id, + ("substring"(fp.value, 0, 255))::character varying(255) AS name, + f.organism_id + FROM featureprop fp, + feature f + WHERE (f.feature_id = fp.feature_id) +UNION + SELECT fd.feature_id, + d.accession AS name, + f.organism_id + FROM feature_dbxref fd, + dbxref d, + feature f + WHERE ((fd.dbxref_id = d.dbxref_id) AND (fd.feature_id = f.feature_id)); + + +-- +-- Name: analysis; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE analysis ( + analysis_id integer NOT NULL, + name character varying(255), + description text +); + + +-- +-- Name: analysis_analysis_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE analysis_analysis_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: analysis_analysis_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE analysis_analysis_id_seq OWNED BY analysis.analysis_id; + + +-- +-- Name: analysis_organism; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE analysis_organism ( + analysis_id integer NOT NULL, + organism_id integer NOT NULL +); + + +-- +-- Name: analysisfeature; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE analysisfeature ( + analysisfeature_id integer NOT NULL, + feature_id integer NOT NULL, + analysis_id integer NOT NULL, + rawscore double precision, + normscore double precision, + significance double precision, + identity double precision +); + + +-- +-- Name: analysisfeature_analysisfeature_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE analysisfeature_analysisfeature_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: analysisfeature_analysisfeature_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE analysisfeature_analysisfeature_id_seq OWNED BY analysisfeature.analysisfeature_id; + + +-- +-- Name: analysisfeatureprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE analysisfeatureprop ( + analysisfeatureprop_id integer NOT NULL, + analysisfeature_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer NOT NULL +); + + +-- +-- Name: analysisfeatureprop_analysisfeatureprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE analysisfeatureprop_analysisfeatureprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: analysisfeatureprop_analysisfeatureprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE analysisfeatureprop_analysisfeatureprop_id_seq OWNED BY analysisfeatureprop.analysisfeatureprop_id; + + +-- +-- Name: analysisprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE analysisprop ( + analysisprop_id integer NOT NULL, + analysis_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: analysisprop_analysisprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE analysisprop_analysisprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: analysisprop_analysisprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE analysisprop_analysisprop_id_seq OWNED BY analysisprop.analysisprop_id; + + +-- +-- Name: arraydesign; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE arraydesign ( + arraydesign_id integer NOT NULL, + manufacturer_id integer NOT NULL, + platformtype_id integer NOT NULL, + substratetype_id integer, + protocol_id integer, + dbxref_id integer, + name text NOT NULL, + version text, + description text, + array_dimensions text, + element_dimensions text, + num_of_elements integer, + num_array_columns integer, + num_array_rows integer, + num_grid_columns integer, + num_grid_rows integer, + num_sub_columns integer, + num_sub_rows integer +); + + +-- +-- Name: TABLE arraydesign; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE arraydesign IS 'General properties about an array. +An array is a template used to generate physical slides, etc. It +contains layout information, as well as global array properties, such +as material (glass, nylon) and spot dimensions (in rows/columns).'; + + +-- +-- Name: arraydesign_arraydesign_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE arraydesign_arraydesign_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: arraydesign_arraydesign_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE arraydesign_arraydesign_id_seq OWNED BY arraydesign.arraydesign_id; + + +-- +-- Name: arraydesignprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE arraydesignprop ( + arraydesignprop_id integer NOT NULL, + arraydesign_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE arraydesignprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE arraydesignprop IS 'Extra array design properties that are not accounted for in arraydesign.'; + + +-- +-- Name: arraydesignprop_arraydesignprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE arraydesignprop_arraydesignprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: arraydesignprop_arraydesignprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE arraydesignprop_arraydesignprop_id_seq OWNED BY arraydesignprop.arraydesignprop_id; + + +-- +-- Name: assay; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE assay ( + assay_id integer NOT NULL, + arraydesign_id integer NOT NULL, + protocol_id integer, + assaydate timestamp without time zone DEFAULT now(), + arrayidentifier text, + arraybatchidentifier text, + operator_id integer NOT NULL, + dbxref_id integer, + name text, + description text +); + + +-- +-- Name: TABLE assay; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE assay IS 'An assay consists of a physical instance of +an array, combined with the conditions used to create the array +(protocols, technician information). The assay can be thought of as a hybridization.'; + + +-- +-- Name: assay_assay_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE assay_assay_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: assay_assay_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE assay_assay_id_seq OWNED BY assay.assay_id; + + +-- +-- Name: assay_biomaterial; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE assay_biomaterial ( + assay_biomaterial_id integer NOT NULL, + assay_id integer NOT NULL, + biomaterial_id integer NOT NULL, + channel_id integer, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE assay_biomaterial; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE assay_biomaterial IS 'A biomaterial can be hybridized many times (technical replicates), or combined with other biomaterials in a single hybridization (for two-channel arrays).'; + + +-- +-- Name: assay_biomaterial_assay_biomaterial_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE assay_biomaterial_assay_biomaterial_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: assay_biomaterial_assay_biomaterial_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE assay_biomaterial_assay_biomaterial_id_seq OWNED BY assay_biomaterial.assay_biomaterial_id; + + +-- +-- Name: assay_project; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE assay_project ( + assay_project_id integer NOT NULL, + assay_id integer NOT NULL, + project_id integer NOT NULL +); + + +-- +-- Name: TABLE assay_project; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE assay_project IS 'Link assays to projects.'; + + +-- +-- Name: assay_project_assay_project_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE assay_project_assay_project_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: assay_project_assay_project_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE assay_project_assay_project_id_seq OWNED BY assay_project.assay_project_id; + + +-- +-- Name: assayprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE assayprop ( + assayprop_id integer NOT NULL, + assay_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE assayprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE assayprop IS 'Extra assay properties that are not accounted for in assay.'; + + +-- +-- Name: assayprop_assayprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE assayprop_assayprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: assayprop_assayprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE assayprop_assayprop_id_seq OWNED BY assayprop.assayprop_id; + + +-- +-- Name: biomaterial; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE biomaterial ( + biomaterial_id integer NOT NULL, + taxon_id integer, + biosourceprovider_id integer, + dbxref_id integer, + name text, + description text +); + + +-- +-- Name: TABLE biomaterial; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE biomaterial IS 'A biomaterial represents the MAGE concept of BioSource, BioSample, and LabeledExtract. It is essentially some biological material (tissue, cells, serum) that may have been processed. Processed biomaterials should be traceable back to raw biomaterials via the biomaterialrelationship table.'; + + +-- +-- Name: biomaterial_biomaterial_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE biomaterial_biomaterial_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: biomaterial_biomaterial_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE biomaterial_biomaterial_id_seq OWNED BY biomaterial.biomaterial_id; + + +-- +-- Name: biomaterial_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE biomaterial_dbxref ( + biomaterial_dbxref_id integer NOT NULL, + biomaterial_id integer NOT NULL, + dbxref_id integer NOT NULL +); + + +-- +-- Name: biomaterial_dbxref_biomaterial_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE biomaterial_dbxref_biomaterial_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: biomaterial_dbxref_biomaterial_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE biomaterial_dbxref_biomaterial_dbxref_id_seq OWNED BY biomaterial_dbxref.biomaterial_dbxref_id; + + +-- +-- Name: biomaterial_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE biomaterial_relationship ( + biomaterial_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + type_id integer NOT NULL, + object_id integer NOT NULL +); + + +-- +-- Name: TABLE biomaterial_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE biomaterial_relationship IS 'Relate biomaterials to one another. This is a way to track a series of treatments or material splits/merges, for instance.'; + + +-- +-- Name: biomaterial_relationship_biomaterial_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE biomaterial_relationship_biomaterial_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: biomaterial_relationship_biomaterial_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE biomaterial_relationship_biomaterial_relationship_id_seq OWNED BY biomaterial_relationship.biomaterial_relationship_id; + + +-- +-- Name: biomaterial_treatment; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE biomaterial_treatment ( + biomaterial_treatment_id integer NOT NULL, + biomaterial_id integer NOT NULL, + treatment_id integer NOT NULL, + unittype_id integer, + value real, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE biomaterial_treatment; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE biomaterial_treatment IS 'Link biomaterials to treatments. Treatments have an order of operations (rank), and associated measurements (unittype_id, value).'; + + +-- +-- Name: biomaterial_treatment_biomaterial_treatment_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE biomaterial_treatment_biomaterial_treatment_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: biomaterial_treatment_biomaterial_treatment_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE biomaterial_treatment_biomaterial_treatment_id_seq OWNED BY biomaterial_treatment.biomaterial_treatment_id; + + +-- +-- Name: biomaterialprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE biomaterialprop ( + biomaterialprop_id integer NOT NULL, + biomaterial_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE biomaterialprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE biomaterialprop IS 'Extra biomaterial properties that are not accounted for in biomaterial.'; + + +-- +-- Name: biomaterialprop_biomaterialprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE biomaterialprop_biomaterialprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: biomaterialprop_biomaterialprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE biomaterialprop_biomaterialprop_id_seq OWNED BY biomaterialprop.biomaterialprop_id; + + +-- +-- Name: blast_hit_data; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE blast_hit_data ( + analysisfeature_id integer NOT NULL, + analysis_id integer NOT NULL, + feature_id integer NOT NULL, + db_id integer NOT NULL, + hit_num integer NOT NULL, + hit_name character varying(1025), + hit_url text, + hit_description text, + hit_organism character varying(1025), + blast_org_id integer, + hit_accession character varying(255), + hit_best_eval double precision, + hit_best_score double precision, + hit_pid double precision +); + + +-- +-- Name: blast_organisms; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE blast_organisms ( + blast_org_id integer NOT NULL, + blast_org_name character varying(1025) +); + + +-- +-- Name: blast_organisms_blast_org_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE blast_organisms_blast_org_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blast_organisms_blast_org_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE blast_organisms_blast_org_id_seq OWNED BY blast_organisms.blast_org_id; + + +-- +-- Name: cell_line; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line ( + cell_line_id integer NOT NULL, + name character varying(255), + uniquename character varying(255) NOT NULL, + organism_id integer NOT NULL, + timeaccessioned timestamp without time zone DEFAULT now() NOT NULL, + timelastmodified timestamp without time zone DEFAULT now() NOT NULL +); + + +-- +-- Name: cell_line_cell_line_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_cell_line_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_cell_line_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_cell_line_id_seq OWNED BY cell_line.cell_line_id; + + +-- +-- Name: cell_line_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line_cvterm ( + cell_line_cvterm_id integer NOT NULL, + cell_line_id integer NOT NULL, + cvterm_id integer NOT NULL, + pub_id integer NOT NULL, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: cell_line_cvterm_cell_line_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_cvterm_cell_line_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_cvterm_cell_line_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_cvterm_cell_line_cvterm_id_seq OWNED BY cell_line_cvterm.cell_line_cvterm_id; + + +-- +-- Name: cell_line_cvtermprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line_cvtermprop ( + cell_line_cvtermprop_id integer NOT NULL, + cell_line_cvterm_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: cell_line_cvtermprop_cell_line_cvtermprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_cvtermprop_cell_line_cvtermprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_cvtermprop_cell_line_cvtermprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_cvtermprop_cell_line_cvtermprop_id_seq OWNED BY cell_line_cvtermprop.cell_line_cvtermprop_id; + + +-- +-- Name: cell_line_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line_dbxref ( + cell_line_dbxref_id integer NOT NULL, + cell_line_id integer NOT NULL, + dbxref_id integer NOT NULL, + is_current boolean DEFAULT true NOT NULL +); + + +-- +-- Name: cell_line_dbxref_cell_line_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_dbxref_cell_line_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_dbxref_cell_line_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_dbxref_cell_line_dbxref_id_seq OWNED BY cell_line_dbxref.cell_line_dbxref_id; + + +-- +-- Name: cell_line_feature; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line_feature ( + cell_line_feature_id integer NOT NULL, + cell_line_id integer NOT NULL, + feature_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: cell_line_feature_cell_line_feature_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_feature_cell_line_feature_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_feature_cell_line_feature_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_feature_cell_line_feature_id_seq OWNED BY cell_line_feature.cell_line_feature_id; + + +-- +-- Name: cell_line_library; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line_library ( + cell_line_library_id integer NOT NULL, + cell_line_id integer NOT NULL, + library_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: cell_line_library_cell_line_library_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_library_cell_line_library_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_library_cell_line_library_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_library_cell_line_library_id_seq OWNED BY cell_line_library.cell_line_library_id; + + +-- +-- Name: cell_line_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line_pub ( + cell_line_pub_id integer NOT NULL, + cell_line_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: cell_line_pub_cell_line_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_pub_cell_line_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_pub_cell_line_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_pub_cell_line_pub_id_seq OWNED BY cell_line_pub.cell_line_pub_id; + + +-- +-- Name: cell_line_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line_relationship ( + cell_line_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + object_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: cell_line_relationship_cell_line_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_relationship_cell_line_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_relationship_cell_line_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_relationship_cell_line_relationship_id_seq OWNED BY cell_line_relationship.cell_line_relationship_id; + + +-- +-- Name: cell_line_synonym; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_line_synonym ( + cell_line_synonym_id integer NOT NULL, + cell_line_id integer NOT NULL, + synonym_id integer NOT NULL, + pub_id integer NOT NULL, + is_current boolean DEFAULT false NOT NULL, + is_internal boolean DEFAULT false NOT NULL +); + + +-- +-- Name: cell_line_synonym_cell_line_synonym_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_line_synonym_cell_line_synonym_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_line_synonym_cell_line_synonym_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_line_synonym_cell_line_synonym_id_seq OWNED BY cell_line_synonym.cell_line_synonym_id; + + +-- +-- Name: cell_lineprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_lineprop ( + cell_lineprop_id integer NOT NULL, + cell_line_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: cell_lineprop_cell_lineprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_lineprop_cell_lineprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_lineprop_cell_lineprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_lineprop_cell_lineprop_id_seq OWNED BY cell_lineprop.cell_lineprop_id; + + +-- +-- Name: cell_lineprop_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cell_lineprop_pub ( + cell_lineprop_pub_id integer NOT NULL, + cell_lineprop_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: cell_lineprop_pub_cell_lineprop_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cell_lineprop_pub_cell_lineprop_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cell_lineprop_pub_cell_lineprop_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cell_lineprop_pub_cell_lineprop_pub_id_seq OWNED BY cell_lineprop_pub.cell_lineprop_pub_id; + + +-- +-- Name: chado_search_diversity_search; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE chado_search_diversity_search ( + feature_id integer, + marker_uniquename text, + marker_organism_id integer, + genotype_id integer, + genotype text, + allele character varying(255), + project_id integer, + project_name character varying(255), + stock_id integer, + stock_uniquename text, + organism_id integer, + organism character varying(510) +); + + +-- +-- Name: chado_search_gene_search; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE chado_search_gene_search ( + feature_id integer, + name character varying(255), + uniquename text, + feature_type character varying(1025), + organism_id integer, + organism character varying(510), + analysis_id integer, + analysis_name character varying(255), + srcfeature_id integer, + landmark character varying(255), + fmin integer, + fmax integer, + location character varying(510), + genome character varying(255) +); + + +-- +-- Name: chado_search_germplasm_search; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE chado_search_germplasm_search ( + stock_id integer, + name character varying(255), + uniquename text, + organism_id integer, + organism character varying(255), + genome text, + db character varying(255), + accession character varying(255), + urlprefix character varying(255), + alias text +); + + +-- +-- Name: chado_search_haplotype_block_search; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE chado_search_haplotype_block_search ( + hb_feature_id integer, + haplotype_block text, + organism_id integer, + organism character varying(510), + analysis_id integer, + genome character varying(255), + landmark character varying(255), + fmin integer, + fmax integer +); + + +-- +-- Name: chado_search_marker_search; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE chado_search_marker_search ( + marker_feature_id integer, + marker_uniquename text, + marker_name character varying(255), + seq_feature_id integer, + seq_uniquename text, + organism_id integer, + organism character varying(510), + featuremap_id integer, + map_name character varying(255), + mapped_organism_id integer, + mapped_organism character varying(510), + lg_uniquename text, + marker_type text, + start real, + stop real, + landmark_feature_id integer, + landmark character varying(255), + landmark_organism character varying(510), + fmin integer, + fmax integer, + location character varying(510), + alias text, + synonym text +); + + +-- +-- Name: chado_search_sequence_search; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE chado_search_sequence_search ( + feature_id integer, + name character varying(255), + uniquename text, + feature_type character varying(1025), + organism_id integer, + organism character varying(510), + analysis_id integer, + analysis_name character varying(255), + srcfeature_id integer, + landmark character varying(255), + fmin integer, + fmax integer, + location character varying(510) +); + + +-- +-- Name: chadoprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE chadoprop ( + chadoprop_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE chadoprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE chadoprop IS 'This table is different from other prop tables in the database, as it is for storing information about the database itself, like schema version'; + + +-- +-- Name: COLUMN chadoprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN chadoprop.type_id IS 'The name of the property or slot is a cvterm. The meaning of the property is defined in that cvterm.'; + + +-- +-- Name: COLUMN chadoprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN chadoprop.value IS 'The value of the property, represented as text. Numeric values are converted to their text representation.'; + + +-- +-- Name: COLUMN chadoprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN chadoprop.rank IS 'Property-Value ordering. Any + cv can have multiple values for any particular property type - + these are ordered in a list using rank, counting from zero. For + properties that are single-valued rather than multi-valued, the + default 0 value should be used.'; + + +-- +-- Name: chadoprop_chadoprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE chadoprop_chadoprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: chadoprop_chadoprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE chadoprop_chadoprop_id_seq OWNED BY chadoprop.chadoprop_id; + + +-- +-- Name: channel; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE channel ( + channel_id integer NOT NULL, + name text NOT NULL, + definition text NOT NULL +); + + +-- +-- Name: TABLE channel; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE channel IS 'Different array platforms can record signals from one or more channels (cDNA arrays typically use two CCD, but Affymetrix uses only one).'; + + +-- +-- Name: channel_channel_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE channel_channel_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: channel_channel_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE channel_channel_id_seq OWNED BY channel.channel_id; + + +-- +-- Name: common_ancestor_cvterm; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW common_ancestor_cvterm AS + SELECT p1.subject_id AS cvterm1_id, + p2.subject_id AS cvterm2_id, + p1.object_id AS ancestor_cvterm_id, + p1.pathdistance AS pathdistance1, + p2.pathdistance AS pathdistance2, + (p1.pathdistance + p2.pathdistance) AS total_pathdistance + FROM cvtermpath p1, + cvtermpath p2 + WHERE (p1.object_id = p2.object_id); + + +-- +-- Name: VIEW common_ancestor_cvterm; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW common_ancestor_cvterm IS 'The common ancestor of any +two terms is the intersection of both terms ancestors. Two terms can +have multiple common ancestors. Use total_pathdistance to get the +least common ancestor'; + + +-- +-- Name: common_descendant_cvterm; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW common_descendant_cvterm AS + SELECT p1.object_id AS cvterm1_id, + p2.object_id AS cvterm2_id, + p1.subject_id AS ancestor_cvterm_id, + p1.pathdistance AS pathdistance1, + p2.pathdistance AS pathdistance2, + (p1.pathdistance + p2.pathdistance) AS total_pathdistance + FROM cvtermpath p1, + cvtermpath p2 + WHERE (p1.subject_id = p2.subject_id); + + +-- +-- Name: VIEW common_descendant_cvterm; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW common_descendant_cvterm IS 'The common descendant of +any two terms is the intersection of both terms descendants. Two terms +can have multiple common descendants. Use total_pathdistance to get +the least common ancestor'; + + +-- +-- Name: contact; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE contact ( + contact_id integer NOT NULL, + type_id integer, + name character varying(255) NOT NULL, + description character varying(255) +); + + +-- +-- Name: TABLE contact; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE contact IS 'Model persons, institutes, groups, organizations, etc.'; + + +-- +-- Name: COLUMN contact.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN contact.type_id IS 'What type of contact is this? E.g. "person", "lab".'; + + +-- +-- Name: contact_contact_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE contact_contact_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contact_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE contact_contact_id_seq OWNED BY contact.contact_id; + + +-- +-- Name: contact_image; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE contact_image ( + contact_image_id integer NOT NULL, + contact_id integer NOT NULL, + eimage_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: contact_image_contact_image_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE contact_image_contact_image_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contact_image_contact_image_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE contact_image_contact_image_id_seq OWNED BY contact_image.contact_image_id; + + +-- +-- Name: contact_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE contact_relationship ( + contact_relationship_id integer NOT NULL, + type_id integer NOT NULL, + subject_id integer NOT NULL, + object_id integer NOT NULL +); + + +-- +-- Name: TABLE contact_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE contact_relationship IS 'Model relationships between contacts'; + + +-- +-- Name: COLUMN contact_relationship.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN contact_relationship.type_id IS 'Relationship type between subject and object. This is a cvterm, typically from the OBO relationship ontology, although other relationship types are allowed.'; + + +-- +-- Name: COLUMN contact_relationship.subject_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN contact_relationship.subject_id IS 'The subject of the subj-predicate-obj sentence. In a DAG, this corresponds to the child node.'; + + +-- +-- Name: COLUMN contact_relationship.object_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN contact_relationship.object_id IS 'The object of the subj-predicate-obj sentence. In a DAG, this corresponds to the parent node.'; + + +-- +-- Name: contact_relationship_contact_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE contact_relationship_contact_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contact_relationship_contact_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE contact_relationship_contact_relationship_id_seq OWNED BY contact_relationship.contact_relationship_id; + + +-- +-- Name: contactprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE contactprop ( + contactprop_id integer NOT NULL, + contact_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: contactprop_contactprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE contactprop_contactprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contactprop_contactprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE contactprop_contactprop_id_seq OWNED BY contactprop.contactprop_id; + + +-- +-- Name: content_type_chado_analysis_unigene; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE content_type_chado_analysis_unigene ( + vid integer DEFAULT 0 NOT NULL, + nid integer DEFAULT 0 NOT NULL, + CONSTRAINT content_type_chado_analysis_unigene_nid_check CHECK ((nid >= 0)), + CONSTRAINT content_type_chado_analysis_unigene_vid_check CHECK ((vid >= 0)) +); + + +-- +-- Name: control; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE control ( + control_id integer NOT NULL, + type_id integer NOT NULL, + assay_id integer NOT NULL, + tableinfo_id integer NOT NULL, + row_id integer NOT NULL, + name text, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: control_control_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE control_control_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: control_control_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE control_control_id_seq OWNED BY control.control_id; + + +-- +-- Name: cv; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cv ( + cv_id integer NOT NULL, + name character varying(255) NOT NULL, + definition text +); + + +-- +-- Name: TABLE cv; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cv IS 'A controlled vocabulary or ontology. A cv is +composed of cvterms (AKA terms, classes, types, universals - relations +and properties are also stored in cvterm) and the relationships +between them.'; + + +-- +-- Name: COLUMN cv.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cv.name IS 'The name of the ontology. This +corresponds to the obo-format -namespace-. cv names uniquely identify +the cv. In OBO file format, the cv.name is known as the namespace.'; + + +-- +-- Name: COLUMN cv.definition; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cv.definition IS 'A text description of the criteria for +membership of this ontology.'; + + +-- +-- Name: cv_cv_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cv_cv_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cv_cv_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cv_cv_id_seq OWNED BY cv.cv_id; + + +-- +-- Name: cv_cvterm_count; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW cv_cvterm_count AS + SELECT cv.name, + count(*) AS num_terms_excl_obs + FROM (cv + JOIN cvterm USING (cv_id)) + WHERE (cvterm.is_obsolete = 0) + GROUP BY cv.name; + + +-- +-- Name: VIEW cv_cvterm_count; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW cv_cvterm_count IS 'per-cv terms counts (excludes obsoletes)'; + + +-- +-- Name: cv_cvterm_count_with_obs; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW cv_cvterm_count_with_obs AS + SELECT cv.name, + count(*) AS num_terms_incl_obs + FROM (cv + JOIN cvterm USING (cv_id)) + GROUP BY cv.name; + + +-- +-- Name: VIEW cv_cvterm_count_with_obs; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW cv_cvterm_count_with_obs IS 'per-cv terms counts (includes obsoletes)'; + + +-- +-- Name: cvterm_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cvterm_relationship ( + cvterm_relationship_id integer NOT NULL, + type_id integer NOT NULL, + subject_id integer NOT NULL, + object_id integer NOT NULL +); + + +-- +-- Name: TABLE cvterm_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cvterm_relationship IS 'A relationship linking two +cvterms. Each cvterm_relationship constitutes an edge in the graph +defined by the collection of cvterms and cvterm_relationships. The +meaning of the cvterm_relationship depends on the definition of the +cvterm R refered to by type_id. However, in general the definitions +are such that the statement "all SUBJs REL some OBJ" is true. The +cvterm_relationship statement is about the subject, not the +object. For example "insect wing part_of thorax".'; + + +-- +-- Name: COLUMN cvterm_relationship.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm_relationship.type_id IS 'The nature of the +relationship between subject and object. Note that relations are also +housed in the cvterm table, typically from the OBO relationship +ontology, although other relationship types are allowed.'; + + +-- +-- Name: COLUMN cvterm_relationship.subject_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm_relationship.subject_id IS 'The subject of +the subj-predicate-obj sentence. The cvterm_relationship is about the +subject. In a graph, this typically corresponds to the child node.'; + + +-- +-- Name: COLUMN cvterm_relationship.object_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm_relationship.object_id IS 'The object of the +subj-predicate-obj sentence. The cvterm_relationship refers to the +object. In a graph, this typically corresponds to the parent node.'; + + +-- +-- Name: cv_leaf; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW cv_leaf AS + SELECT cvterm.cv_id, + cvterm.cvterm_id + FROM cvterm + WHERE (NOT (cvterm.cvterm_id IN ( SELECT cvterm_relationship.object_id + FROM cvterm_relationship))); + + +-- +-- Name: VIEW cv_leaf; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW cv_leaf IS 'the leaves of a cv are the set of terms +which have no children (terms that are not the object of a +relation). All cvs will have at least 1 leaf'; + + +-- +-- Name: cv_link_count; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW cv_link_count AS + SELECT cv.name AS cv_name, + relation.name AS relation_name, + relation_cv.name AS relation_cv_name, + count(*) AS num_links + FROM ((((cv + JOIN cvterm ON ((cvterm.cv_id = cv.cv_id))) + JOIN cvterm_relationship ON ((cvterm.cvterm_id = cvterm_relationship.subject_id))) + JOIN cvterm relation ON ((cvterm_relationship.type_id = relation.cvterm_id))) + JOIN cv relation_cv ON ((relation.cv_id = relation_cv.cv_id))) + GROUP BY cv.name, relation.name, relation_cv.name; + + +-- +-- Name: VIEW cv_link_count; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW cv_link_count IS 'per-cv summary of number of +links (cvterm_relationships) broken down by +relationship_type. num_links is the total # of links of the specified +type in which the subject_id of the link is in the named cv'; + + +-- +-- Name: cv_path_count; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW cv_path_count AS + SELECT cv.name AS cv_name, + relation.name AS relation_name, + relation_cv.name AS relation_cv_name, + count(*) AS num_paths + FROM ((((cv + JOIN cvterm ON ((cvterm.cv_id = cv.cv_id))) + JOIN cvtermpath ON ((cvterm.cvterm_id = cvtermpath.subject_id))) + JOIN cvterm relation ON ((cvtermpath.type_id = relation.cvterm_id))) + JOIN cv relation_cv ON ((relation.cv_id = relation_cv.cv_id))) + GROUP BY cv.name, relation.name, relation_cv.name; + + +-- +-- Name: VIEW cv_path_count; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW cv_path_count IS 'per-cv summary of number of +paths (cvtermpaths) broken down by relationship_type. num_paths is the +total # of paths of the specified type in which the subject_id of the +path is in the named cv. See also: cv_distinct_relations'; + + +-- +-- Name: cv_root; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW cv_root AS + SELECT cvterm.cv_id, + cvterm.cvterm_id AS root_cvterm_id + FROM cvterm + WHERE ((NOT (cvterm.cvterm_id IN ( SELECT cvterm_relationship.subject_id + FROM cvterm_relationship))) AND (cvterm.is_obsolete = 0)); + + +-- +-- Name: VIEW cv_root; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW cv_root IS 'the roots of a cv are the set of terms +which have no parents (terms that are not the subject of a +relation). Most cvs will have a single root, some may have >1. All +will have at least 1'; + + +-- +-- Name: cv_root_mview; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cv_root_mview ( + name character varying(255) NOT NULL, + cvterm_id integer NOT NULL, + cv_id integer NOT NULL, + cv_name character varying(255) NOT NULL +); + + +-- +-- Name: TABLE cv_root_mview; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cv_root_mview IS 'A list of the root terms for all controlled vocabularies. This is needed for viewing CV trees'; + + +-- +-- Name: cvprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cvprop ( + cvprop_id integer NOT NULL, + cv_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cvprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cvprop IS 'Additional extensible properties can be attached to a cv using this table. A notable example would be the cv version'; + + +-- +-- Name: COLUMN cvprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvprop.type_id IS 'The name of the property or slot is a cvterm. The meaning of the property is defined in that cvterm.'; + + +-- +-- Name: COLUMN cvprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvprop.value IS 'The value of the property, represented as text. Numeric values are converted to their text representation.'; + + +-- +-- Name: COLUMN cvprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvprop.rank IS 'Property-Value ordering. Any + cv can have multiple values for any particular property type - + these are ordered in a list using rank, counting from zero. For + properties that are single-valued rather than multi-valued, the + default 0 value should be used.'; + + +-- +-- Name: cvprop_cvprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cvprop_cvprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cvprop_cvprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cvprop_cvprop_id_seq OWNED BY cvprop.cvprop_id; + + +-- +-- Name: cvterm_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cvterm_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cvterm_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cvterm_cvterm_id_seq OWNED BY cvterm.cvterm_id; + + +-- +-- Name: cvterm_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cvterm_dbxref ( + cvterm_dbxref_id integer NOT NULL, + cvterm_id integer NOT NULL, + dbxref_id integer NOT NULL, + is_for_definition integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cvterm_dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cvterm_dbxref IS 'In addition to the primary +identifier (cvterm.dbxref_id) a cvterm can have zero or more secondary +identifiers/dbxrefs, which may refer to records in external +databases. The exact semantics of cvterm_dbxref are not fixed. For +example: the dbxref could be a pubmed ID that is pertinent to the +cvterm, or it could be an equivalent or similar term in another +ontology. For example, GO cvterms are typically linked to InterPro +IDs, even though the nature of the relationship between them is +largely one of statistical association. The dbxref may be have data +records attached in the same database instance, or it could be a +"hanging" dbxref pointing to some external database. NOTE: If the +desired objective is to link two cvterms together, and the nature of +the relation is known and holds for all instances of the subject +cvterm then consider instead using cvterm_relationship together with a +well-defined relation.'; + + +-- +-- Name: COLUMN cvterm_dbxref.is_for_definition; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvterm_dbxref.is_for_definition IS 'A +cvterm.definition should be supported by one or more references. If +this column is true, the dbxref is not for a term in an external database - +it is a dbxref for provenance information for the definition.'; + + +-- +-- Name: cvterm_dbxref_cvterm_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cvterm_dbxref_cvterm_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cvterm_dbxref_cvterm_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cvterm_dbxref_cvterm_dbxref_id_seq OWNED BY cvterm_dbxref.cvterm_dbxref_id; + + +-- +-- Name: cvterm_relationship_cvterm_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cvterm_relationship_cvterm_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cvterm_relationship_cvterm_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cvterm_relationship_cvterm_relationship_id_seq OWNED BY cvterm_relationship.cvterm_relationship_id; + + +-- +-- Name: cvtermpath_cvtermpath_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cvtermpath_cvtermpath_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cvtermpath_cvtermpath_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cvtermpath_cvtermpath_id_seq OWNED BY cvtermpath.cvtermpath_id; + + +-- +-- Name: cvtermprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cvtermprop ( + cvtermprop_id integer NOT NULL, + cvterm_id integer NOT NULL, + type_id integer NOT NULL, + value text DEFAULT ''::text NOT NULL, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cvtermprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cvtermprop IS 'Additional extensible properties can be attached to a cvterm using this table. Corresponds to -AnnotationProperty- in W3C OWL format.'; + + +-- +-- Name: COLUMN cvtermprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvtermprop.type_id IS 'The name of the property or slot is a cvterm. The meaning of the property is defined in that cvterm.'; + + +-- +-- Name: COLUMN cvtermprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvtermprop.value IS 'The value of the property, represented as text. Numeric values are converted to their text representation.'; + + +-- +-- Name: COLUMN cvtermprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvtermprop.rank IS 'Property-Value ordering. Any +cvterm can have multiple values for any particular property type - +these are ordered in a list using rank, counting from zero. For +properties that are single-valued rather than multi-valued, the +default 0 value should be used.'; + + +-- +-- Name: cvtermprop_cvtermprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cvtermprop_cvtermprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cvtermprop_cvtermprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cvtermprop_cvtermprop_id_seq OWNED BY cvtermprop.cvtermprop_id; + + +-- +-- Name: cvtermsynonym; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE cvtermsynonym ( + cvtermsynonym_id integer NOT NULL, + cvterm_id integer NOT NULL, + synonym character varying(1024) NOT NULL, + type_id integer +); + + +-- +-- Name: TABLE cvtermsynonym; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE cvtermsynonym IS 'A cvterm actually represents a +distinct class or concept. A concept can be refered to by different +phrases or names. In addition to the primary name (cvterm.name) there +can be a number of alternative aliases or synonyms. For example, "T +cell" as a synonym for "T lymphocyte".'; + + +-- +-- Name: COLUMN cvtermsynonym.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN cvtermsynonym.type_id IS 'A synonym can be exact, +narrower, or broader than.'; + + +-- +-- Name: cvtermsynonym_cvtermsynonym_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE cvtermsynonym_cvtermsynonym_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cvtermsynonym_cvtermsynonym_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE cvtermsynonym_cvtermsynonym_id_seq OWNED BY cvtermsynonym.cvtermsynonym_id; + + +-- +-- Name: db_db_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE db_db_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: db_db_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE db_db_id_seq OWNED BY db.db_id; + + +-- +-- Name: db_dbxref_count; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW db_dbxref_count AS + SELECT db.name, + count(*) AS num_dbxrefs + FROM (db + JOIN dbxref USING (db_id)) + GROUP BY db.name; + + +-- +-- Name: VIEW db_dbxref_count; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW db_dbxref_count IS 'per-db dbxref counts'; + + +-- +-- Name: dbxref_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE dbxref_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dbxref_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE dbxref_dbxref_id_seq OWNED BY dbxref.dbxref_id; + + +-- +-- Name: dbxrefprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE dbxrefprop ( + dbxrefprop_id integer NOT NULL, + dbxref_id integer NOT NULL, + type_id integer NOT NULL, + value text DEFAULT ''::text NOT NULL, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE dbxrefprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE dbxrefprop IS 'Metadata about a dbxref. Note that this is not defined in the dbxref module, as it depends on the cvterm table. This table has a structure analagous to cvtermprop.'; + + +-- +-- Name: dbxrefprop_dbxrefprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE dbxrefprop_dbxrefprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dbxrefprop_dbxrefprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE dbxrefprop_dbxrefprop_id_seq OWNED BY dbxrefprop.dbxrefprop_id; + + +-- +-- Name: dfeatureloc; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW dfeatureloc AS + SELECT featureloc.featureloc_id, + featureloc.feature_id, + featureloc.srcfeature_id, + featureloc.fmin AS nbeg, + featureloc.is_fmin_partial AS is_nbeg_partial, + featureloc.fmax AS nend, + featureloc.is_fmax_partial AS is_nend_partial, + featureloc.strand, + featureloc.phase, + featureloc.residue_info, + featureloc.locgroup, + featureloc.rank + FROM featureloc + WHERE ((featureloc.strand < 0) OR (featureloc.phase < 0)) +UNION + SELECT featureloc.featureloc_id, + featureloc.feature_id, + featureloc.srcfeature_id, + featureloc.fmax AS nbeg, + featureloc.is_fmax_partial AS is_nbeg_partial, + featureloc.fmin AS nend, + featureloc.is_fmin_partial AS is_nend_partial, + featureloc.strand, + featureloc.phase, + featureloc.residue_info, + featureloc.locgroup, + featureloc.rank + FROM featureloc + WHERE (((featureloc.strand IS NULL) OR (featureloc.strand >= 0)) OR (featureloc.phase >= 0)); + + +-- +-- Name: eimage; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE eimage ( + eimage_id integer NOT NULL, + eimage_data text, + eimage_type character varying(255) NOT NULL, + image_uri character varying(255) +); + + +-- +-- Name: COLUMN eimage.eimage_data; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN eimage.eimage_data IS 'We expect images in eimage_data (e.g. JPEGs) to be uuencoded.'; + + +-- +-- Name: COLUMN eimage.eimage_type; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN eimage.eimage_type IS 'Describes the type of data in eimage_data.'; + + +-- +-- Name: eimage_eimage_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE eimage_eimage_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: eimage_eimage_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE eimage_eimage_id_seq OWNED BY eimage.eimage_id; + + +-- +-- Name: eimageprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE eimageprop ( + eimageprop_id integer NOT NULL, + eimage_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 +); + + +-- +-- Name: eimageprop_eimageprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE eimageprop_eimageprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: eimageprop_eimageprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE eimageprop_eimageprop_id_seq OWNED BY eimageprop.eimageprop_id; + + +-- +-- Name: element; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE element ( + element_id integer NOT NULL, + feature_id integer, + arraydesign_id integer NOT NULL, + type_id integer, + dbxref_id integer +); + + +-- +-- Name: TABLE element; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE element IS 'Represents a feature of the array. This is typically a region of the array coated or bound to DNA.'; + + +-- +-- Name: element_element_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE element_element_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: element_element_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE element_element_id_seq OWNED BY element.element_id; + + +-- +-- Name: element_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE element_relationship ( + element_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + type_id integer NOT NULL, + object_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE element_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE element_relationship IS 'Sometimes we want to combine measurements from multiple elements to get a composite value. Affymetrix combines many probes to form a probeset measurement, for instance.'; + + +-- +-- Name: element_relationship_element_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE element_relationship_element_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: element_relationship_element_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE element_relationship_element_relationship_id_seq OWNED BY element_relationship.element_relationship_id; + + +-- +-- Name: elementresult; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE elementresult ( + elementresult_id integer NOT NULL, + element_id integer NOT NULL, + quantification_id integer NOT NULL, + signal double precision NOT NULL +); + + +-- +-- Name: TABLE elementresult; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE elementresult IS 'An element on an array produces a measurement when hybridized to a biomaterial (traceable through quantification_id). This is the base data from which tables that actually contain data inherit.'; + + +-- +-- Name: elementresult_elementresult_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE elementresult_elementresult_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: elementresult_elementresult_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE elementresult_elementresult_id_seq OWNED BY elementresult.elementresult_id; + + +-- +-- Name: elementresult_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE elementresult_relationship ( + elementresult_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + type_id integer NOT NULL, + object_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE elementresult_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE elementresult_relationship IS 'Sometimes we want to combine measurements from multiple elements to get a composite value. Affymetrix combines many probes to form a probeset measurement, for instance.'; + + +-- +-- Name: elementresult_relationship_elementresult_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE elementresult_relationship_elementresult_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: elementresult_relationship_elementresult_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE elementresult_relationship_elementresult_relationship_id_seq OWNED BY elementresult_relationship.elementresult_relationship_id; + + +-- +-- Name: environment; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE environment ( + environment_id integer NOT NULL, + uniquename text NOT NULL, + description text +); + + +-- +-- Name: TABLE environment; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE environment IS 'The environmental component of a phenotype description.'; + + +-- +-- Name: environment_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE environment_cvterm ( + environment_cvterm_id integer NOT NULL, + environment_id integer NOT NULL, + cvterm_id integer NOT NULL +); + + +-- +-- Name: environment_cvterm_environment_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE environment_cvterm_environment_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: environment_cvterm_environment_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE environment_cvterm_environment_cvterm_id_seq OWNED BY environment_cvterm.environment_cvterm_id; + + +-- +-- Name: environment_environment_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE environment_environment_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: environment_environment_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE environment_environment_id_seq OWNED BY environment.environment_id; + + +-- +-- Name: expression; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE expression ( + expression_id integer NOT NULL, + uniquename text NOT NULL, + md5checksum character(32), + description text +); + + +-- +-- Name: TABLE expression; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE expression IS 'The expression table is essentially a bridge table.'; + + +-- +-- Name: expression_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE expression_cvterm ( + expression_cvterm_id integer NOT NULL, + expression_id integer NOT NULL, + cvterm_id integer NOT NULL, + rank integer DEFAULT 0 NOT NULL, + cvterm_type_id integer NOT NULL +); + + +-- +-- Name: expression_cvterm_expression_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE expression_cvterm_expression_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: expression_cvterm_expression_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE expression_cvterm_expression_cvterm_id_seq OWNED BY expression_cvterm.expression_cvterm_id; + + +-- +-- Name: expression_cvtermprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE expression_cvtermprop ( + expression_cvtermprop_id integer NOT NULL, + expression_cvterm_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE expression_cvtermprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE expression_cvtermprop IS 'Extensible properties for +expression to cvterm associations. Examples: qualifiers.'; + + +-- +-- Name: COLUMN expression_cvtermprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN expression_cvtermprop.type_id IS 'The name of the +property/slot is a cvterm. The meaning of the property is defined in +that cvterm. For example, cvterms may come from the FlyBase miscellaneous cv.'; + + +-- +-- Name: COLUMN expression_cvtermprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN expression_cvtermprop.value IS 'The value of the +property, represented as text. Numeric values are converted to their +text representation. This is less efficient than using native database +types, but is easier to query.'; + + +-- +-- Name: COLUMN expression_cvtermprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN expression_cvtermprop.rank IS 'Property-Value +ordering. Any expression_cvterm can have multiple values for any particular +property type - these are ordered in a list using rank, counting from +zero. For properties that are single-valued rather than multi-valued, +the default 0 value should be used.'; + + +-- +-- Name: expression_cvtermprop_expression_cvtermprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE expression_cvtermprop_expression_cvtermprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: expression_cvtermprop_expression_cvtermprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE expression_cvtermprop_expression_cvtermprop_id_seq OWNED BY expression_cvtermprop.expression_cvtermprop_id; + + +-- +-- Name: expression_expression_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE expression_expression_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: expression_expression_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE expression_expression_id_seq OWNED BY expression.expression_id; + + +-- +-- Name: expression_image; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE expression_image ( + expression_image_id integer NOT NULL, + expression_id integer NOT NULL, + eimage_id integer NOT NULL +); + + +-- +-- Name: expression_image_expression_image_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE expression_image_expression_image_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: expression_image_expression_image_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE expression_image_expression_image_id_seq OWNED BY expression_image.expression_image_id; + + +-- +-- Name: expression_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE expression_pub ( + expression_pub_id integer NOT NULL, + expression_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: expression_pub_expression_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE expression_pub_expression_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: expression_pub_expression_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE expression_pub_expression_pub_id_seq OWNED BY expression_pub.expression_pub_id; + + +-- +-- Name: expressionprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE expressionprop ( + expressionprop_id integer NOT NULL, + expression_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: expressionprop_expressionprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE expressionprop_expressionprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: expressionprop_expressionprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE expressionprop_expressionprop_id_seq OWNED BY expressionprop.expressionprop_id; + + +-- +-- Name: f_type; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW f_type AS + SELECT f.feature_id, + f.name, + f.dbxref_id, + c.name AS type, + f.residues, + f.seqlen, + f.md5checksum, + f.type_id, + f.timeaccessioned, + f.timelastmodified + FROM feature f, + cvterm c + WHERE (f.type_id = c.cvterm_id); + + +-- +-- Name: f_loc; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW f_loc AS + SELECT f.feature_id, + f.name, + f.dbxref_id, + fl.nbeg, + fl.nend, + fl.strand + FROM dfeatureloc fl, + f_type f + WHERE (f.feature_id = fl.feature_id); + + +-- +-- Name: feature_contact; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_contact ( + feature_contact_id integer NOT NULL, + feature_id integer NOT NULL, + contact_id integer NOT NULL +); + + +-- +-- Name: feature_contact_feature_contact_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_contact_feature_contact_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_contact_feature_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_contact_feature_contact_id_seq OWNED BY feature_contact.feature_contact_id; + + +-- +-- Name: feature_contains; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW feature_contains AS + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id + FROM featureloc x, + featureloc y + WHERE ((x.srcfeature_id = y.srcfeature_id) AND ((y.fmin >= x.fmin) AND (y.fmin <= x.fmax))); + + +-- +-- Name: VIEW feature_contains; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW feature_contains IS 'subject intervals contains (or is +same as) object interval. transitive,reflexive'; + + +-- +-- Name: feature_cvterm_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_cvterm_dbxref ( + feature_cvterm_dbxref_id integer NOT NULL, + feature_cvterm_id integer NOT NULL, + dbxref_id integer NOT NULL +); + + +-- +-- Name: TABLE feature_cvterm_dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_cvterm_dbxref IS 'Additional dbxrefs for an association. Rows in the feature_cvterm table may be backed up by dbxrefs. For example, a feature_cvterm association that was inferred via a protein-protein interaction may be backed by by refering to the dbxref for the alternate protein. Corresponds to the WITH column in a GO gene association file (but can also be used for other analagous associations). See http://www.geneontology.org/doc/GO.annotation.shtml#file for more details.'; + + +-- +-- Name: feature_cvterm_dbxref_feature_cvterm_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_cvterm_dbxref_feature_cvterm_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_cvterm_dbxref_feature_cvterm_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_cvterm_dbxref_feature_cvterm_dbxref_id_seq OWNED BY feature_cvterm_dbxref.feature_cvterm_dbxref_id; + + +-- +-- Name: feature_cvterm_feature_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_cvterm_feature_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_cvterm_feature_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_cvterm_feature_cvterm_id_seq OWNED BY feature_cvterm.feature_cvterm_id; + + +-- +-- Name: feature_cvterm_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_cvterm_pub ( + feature_cvterm_pub_id integer NOT NULL, + feature_cvterm_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE feature_cvterm_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_cvterm_pub IS 'Secondary pubs for an +association. Each feature_cvterm association is supported by a single +primary publication. Additional secondary pubs can be added using this +linking table (in a GO gene association file, these corresponding to +any IDs after the pipe symbol in the publications column.'; + + +-- +-- Name: feature_cvterm_pub_feature_cvterm_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_cvterm_pub_feature_cvterm_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_cvterm_pub_feature_cvterm_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_cvterm_pub_feature_cvterm_pub_id_seq OWNED BY feature_cvterm_pub.feature_cvterm_pub_id; + + +-- +-- Name: feature_cvtermprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_cvtermprop ( + feature_cvtermprop_id integer NOT NULL, + feature_cvterm_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE feature_cvtermprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_cvtermprop IS 'Extensible properties for +feature to cvterm associations. Examples: GO evidence codes; +qualifiers; metadata such as the date on which the entry was curated +and the source of the association. See the featureprop table for +meanings of type_id, value and rank.'; + + +-- +-- Name: COLUMN feature_cvtermprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_cvtermprop.type_id IS 'The name of the +property/slot is a cvterm. The meaning of the property is defined in +that cvterm. cvterms may come from the OBO evidence code cv.'; + + +-- +-- Name: COLUMN feature_cvtermprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_cvtermprop.value IS 'The value of the +property, represented as text. Numeric values are converted to their +text representation. This is less efficient than using native database +types, but is easier to query.'; + + +-- +-- Name: COLUMN feature_cvtermprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_cvtermprop.rank IS 'Property-Value +ordering. Any feature_cvterm can have multiple values for any particular +property type - these are ordered in a list using rank, counting from +zero. For properties that are single-valued rather than multi-valued, +the default 0 value should be used.'; + + +-- +-- Name: feature_cvtermprop_feature_cvtermprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_cvtermprop_feature_cvtermprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_cvtermprop_feature_cvtermprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_cvtermprop_feature_cvtermprop_id_seq OWNED BY feature_cvtermprop.feature_cvtermprop_id; + + +-- +-- Name: feature_dbxref_feature_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_dbxref_feature_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_dbxref_feature_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_dbxref_feature_dbxref_id_seq OWNED BY feature_dbxref.feature_dbxref_id; + + +-- +-- Name: feature_difference; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW feature_difference AS + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id, + x.strand AS srcfeature_id, + x.srcfeature_id AS fmin, + x.fmin AS fmax, + y.fmin AS strand + FROM featureloc x, + featureloc y + WHERE ((x.srcfeature_id = y.srcfeature_id) AND ((x.fmin < y.fmin) AND (x.fmax >= y.fmax))) +UNION + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id, + x.strand AS srcfeature_id, + x.srcfeature_id AS fmin, + y.fmax, + x.fmax AS strand + FROM featureloc x, + featureloc y + WHERE ((x.srcfeature_id = y.srcfeature_id) AND ((x.fmax > y.fmax) AND (x.fmin <= y.fmin))); + + +-- +-- Name: VIEW feature_difference; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW feature_difference IS 'size of gap between two features. must be abutting or disjoint'; + + +-- +-- Name: feature_disjoint; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW feature_disjoint AS + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id + FROM featureloc x, + featureloc y + WHERE ((x.srcfeature_id = y.srcfeature_id) AND ((x.fmax < y.fmin) AND (x.fmin > y.fmax))); + + +-- +-- Name: VIEW feature_disjoint; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW feature_disjoint IS 'featurelocs do not meet. symmetric'; + + +-- +-- Name: feature_distance; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW feature_distance AS + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id, + x.srcfeature_id, + x.strand AS subject_strand, + y.strand AS object_strand, + CASE + WHEN (x.fmax <= y.fmin) THEN (x.fmax - y.fmin) + ELSE (y.fmax - x.fmin) + END AS distance + FROM featureloc x, + featureloc y + WHERE ((x.srcfeature_id = y.srcfeature_id) AND ((x.fmax <= y.fmin) OR (x.fmin >= y.fmax))); + + +-- +-- Name: feature_expression; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_expression ( + feature_expression_id integer NOT NULL, + expression_id integer NOT NULL, + feature_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: feature_expression_feature_expression_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_expression_feature_expression_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_expression_feature_expression_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_expression_feature_expression_id_seq OWNED BY feature_expression.feature_expression_id; + + +-- +-- Name: feature_expressionprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_expressionprop ( + feature_expressionprop_id integer NOT NULL, + feature_expression_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE feature_expressionprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_expressionprop IS 'Extensible properties for +feature_expression (comments, for example). Modeled on feature_cvtermprop.'; + + +-- +-- Name: feature_expressionprop_feature_expressionprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_expressionprop_feature_expressionprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_expressionprop_feature_expressionprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_expressionprop_feature_expressionprop_id_seq OWNED BY feature_expressionprop.feature_expressionprop_id; + + +-- +-- Name: feature_feature_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_feature_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_feature_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_feature_id_seq OWNED BY feature.feature_id; + + +-- +-- Name: feature_genotype; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_genotype ( + feature_genotype_id integer NOT NULL, + feature_id integer NOT NULL, + genotype_id integer NOT NULL, + chromosome_id integer, + rank integer NOT NULL, + cgroup integer NOT NULL, + cvterm_id integer NOT NULL +); + + +-- +-- Name: COLUMN feature_genotype.chromosome_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_genotype.chromosome_id IS 'A feature of SO type "chromosome".'; + + +-- +-- Name: COLUMN feature_genotype.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_genotype.rank IS 'rank can be used for +n-ploid organisms or to preserve order.'; + + +-- +-- Name: COLUMN feature_genotype.cgroup; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_genotype.cgroup IS 'Spatially distinguishable +group. group can be used for distinguishing the chromosomal groups, +for example (RNAi products and so on can be treated as different +groups, as they do not fall on a particular chromosome).'; + + +-- +-- Name: feature_genotype_feature_genotype_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_genotype_feature_genotype_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_genotype_feature_genotype_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_genotype_feature_genotype_id_seq OWNED BY feature_genotype.feature_genotype_id; + + +-- +-- Name: feature_image; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_image ( + feature_image_id integer NOT NULL, + feature_id integer NOT NULL, + eimage_id integer NOT NULL +); + + +-- +-- Name: feature_image_feature_image_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_image_feature_image_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_image_feature_image_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_image_feature_image_id_seq OWNED BY feature_image.feature_image_id; + + +-- +-- Name: feature_intersection; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW feature_intersection AS + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id, + x.srcfeature_id, + x.strand AS subject_strand, + y.strand AS object_strand, + CASE + WHEN (x.fmin < y.fmin) THEN y.fmin + ELSE x.fmin + END AS fmin, + CASE + WHEN (x.fmax > y.fmax) THEN y.fmax + ELSE x.fmax + END AS fmax + FROM featureloc x, + featureloc y + WHERE ((x.srcfeature_id = y.srcfeature_id) AND ((x.fmax >= y.fmin) AND (x.fmin <= y.fmax))); + + +-- +-- Name: VIEW feature_intersection; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW feature_intersection IS 'set-intersection on interval defined by featureloc. featurelocs must meet'; + + +-- +-- Name: feature_meets; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW feature_meets AS + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id + FROM featureloc x, + featureloc y + WHERE ((x.srcfeature_id = y.srcfeature_id) AND ((x.fmax >= y.fmin) AND (x.fmin <= y.fmax))); + + +-- +-- Name: VIEW feature_meets; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW feature_meets IS 'intervals have at least one +interbase point in common (ie overlap OR abut). symmetric,reflexive'; + + +-- +-- Name: feature_meets_on_same_strand; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW feature_meets_on_same_strand AS + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id + FROM featureloc x, + featureloc y + WHERE (((x.srcfeature_id = y.srcfeature_id) AND (x.strand = y.strand)) AND ((x.fmax >= y.fmin) AND (x.fmin <= y.fmax))); + + +-- +-- Name: VIEW feature_meets_on_same_strand; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW feature_meets_on_same_strand IS 'as feature_meets, but +featurelocs must be on the same strand. symmetric,reflexive'; + + +-- +-- Name: feature_nd_geolocation; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_nd_geolocation ( + feature_nd_geolocation_id integer NOT NULL, + feature_id integer NOT NULL, + nd_geolocation_id integer NOT NULL +); + + +-- +-- Name: feature_nd_geolocation_feature_nd_geolocation_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_nd_geolocation_feature_nd_geolocation_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_nd_geolocation_feature_nd_geolocation_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_nd_geolocation_feature_nd_geolocation_id_seq OWNED BY feature_nd_geolocation.feature_nd_geolocation_id; + + +-- +-- Name: feature_phenotype; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_phenotype ( + feature_phenotype_id integer NOT NULL, + feature_id integer NOT NULL, + phenotype_id integer NOT NULL +); + + +-- +-- Name: feature_phenotype_feature_phenotype_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_phenotype_feature_phenotype_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_phenotype_feature_phenotype_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_phenotype_feature_phenotype_id_seq OWNED BY feature_phenotype.feature_phenotype_id; + + +-- +-- Name: feature_project; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_project ( + feature_project_id integer NOT NULL, + feature_id integer NOT NULL, + project_id integer NOT NULL +); + + +-- +-- Name: feature_project_feature_project_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_project_feature_project_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_project_feature_project_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_project_feature_project_id_seq OWNED BY feature_project.feature_project_id; + + +-- +-- Name: feature_pub_feature_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_pub_feature_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_pub_feature_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_pub_feature_pub_id_seq OWNED BY feature_pub.feature_pub_id; + + +-- +-- Name: feature_pubprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_pubprop ( + feature_pubprop_id integer NOT NULL, + feature_pub_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE feature_pubprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_pubprop IS 'Property or attribute of a feature_pub link.'; + + +-- +-- Name: feature_pubprop_feature_pubprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_pubprop_feature_pubprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_pubprop_feature_pubprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_pubprop_feature_pubprop_id_seq OWNED BY feature_pubprop.feature_pubprop_id; + + +-- +-- Name: feature_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_relationship ( + feature_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + object_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE feature_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_relationship IS 'Features can be arranged in +graphs, e.g. "exon part_of transcript part_of gene"; If type is +thought of as a verb, the each arc or edge makes a statement +[Subject Verb Object]. The object can also be thought of as parent +(containing feature), and subject as child (contained feature or +subfeature). We include the relationship rank/order, because even +though most of the time we can order things implicitly by sequence +coordinates, we can not always do this - e.g. transpliced genes. It is also +useful for quickly getting implicit introns.'; + + +-- +-- Name: COLUMN feature_relationship.subject_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_relationship.subject_id IS 'The subject of the subj-predicate-obj sentence. This is typically the subfeature.'; + + +-- +-- Name: COLUMN feature_relationship.object_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_relationship.object_id IS 'The object of the subj-predicate-obj sentence. This is typically the container feature.'; + + +-- +-- Name: COLUMN feature_relationship.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_relationship.type_id IS 'Relationship type between subject and object. This is a cvterm, typically from the OBO relationship ontology, although other relationship types are allowed. The most common relationship type is OBO_REL:part_of. Valid relationship types are constrained by the Sequence Ontology.'; + + +-- +-- Name: COLUMN feature_relationship.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_relationship.value IS 'Additional notes or comments.'; + + +-- +-- Name: COLUMN feature_relationship.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_relationship.rank IS 'The ordering of subject features with respect to the object feature may be important (for example, exon ordering on a transcript - not always derivable if you take trans spliced genes into consideration). Rank is used to order these; starts from zero.'; + + +-- +-- Name: feature_relationship_feature_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_relationship_feature_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_relationship_feature_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_relationship_feature_relationship_id_seq OWNED BY feature_relationship.feature_relationship_id; + + +-- +-- Name: feature_relationship_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_relationship_pub ( + feature_relationship_pub_id integer NOT NULL, + feature_relationship_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE feature_relationship_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_relationship_pub IS 'Provenance. Attach optional evidence to a feature_relationship in the form of a chado.tion.'; + + +-- +-- Name: feature_relationship_pub_feature_relationship_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_relationship_pub_feature_relationship_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_relationship_pub_feature_relationship_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_relationship_pub_feature_relationship_pub_id_seq OWNED BY feature_relationship_pub.feature_relationship_pub_id; + + +-- +-- Name: feature_relationshipprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_relationshipprop ( + feature_relationshipprop_id integer NOT NULL, + feature_relationship_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE feature_relationshipprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_relationshipprop IS 'Extensible properties +for feature_relationships. Analagous structure to featureprop. This +table is largely optional and not used with a high frequency. Typical +scenarios may be if one wishes to attach additional data to a +feature_relationship - for example to say that the +feature_relationship is only true in certain contexts.'; + + +-- +-- Name: COLUMN feature_relationshipprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_relationshipprop.type_id IS 'The name of the +property/slot is a cvterm. The meaning of the property is defined in +that cvterm. Currently there is no standard ontology for +feature_relationship property types.'; + + +-- +-- Name: COLUMN feature_relationshipprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_relationshipprop.value IS 'The value of the +property, represented as text. Numeric values are converted to their +text representation. This is less efficient than using native database +types, but is easier to query.'; + + +-- +-- Name: COLUMN feature_relationshipprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN feature_relationshipprop.rank IS 'Property-Value +ordering. Any feature_relationship can have multiple values for any particular +property type - these are ordered in a list using rank, counting from +zero. For properties that are single-valued rather than multi-valued, +the default 0 value should be used.'; + + +-- +-- Name: feature_relationshipprop_feature_relationshipprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_relationshipprop_feature_relationshipprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_relationshipprop_feature_relationshipprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_relationshipprop_feature_relationshipprop_id_seq OWNED BY feature_relationshipprop.feature_relationshipprop_id; + + +-- +-- Name: feature_relationshipprop_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_relationshipprop_pub ( + feature_relationshipprop_pub_id integer NOT NULL, + feature_relationshipprop_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE feature_relationshipprop_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE feature_relationshipprop_pub IS 'Provenance for feature_relationshipprop.'; + + +-- +-- Name: feature_relationshipprop_pub_feature_relationshipprop_pub_i_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_relationshipprop_pub_feature_relationshipprop_pub_i_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_relationshipprop_pub_feature_relationshipprop_pub_i_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_relationshipprop_pub_feature_relationshipprop_pub_i_seq OWNED BY feature_relationshipprop_pub.feature_relationshipprop_pub_id; + + +-- +-- Name: feature_stock; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE feature_stock ( + feature_stock_id integer NOT NULL, + feature_id integer NOT NULL, + stock_id integer NOT NULL, + type_id integer +); + + +-- +-- Name: feature_stock_feature_stock_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_stock_feature_stock_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_stock_feature_stock_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_stock_feature_stock_id_seq OWNED BY feature_stock.feature_stock_id; + + +-- +-- Name: feature_synonym_feature_synonym_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_synonym_feature_synonym_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: feature_synonym_feature_synonym_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE feature_synonym_feature_synonym_id_seq OWNED BY feature_synonym.feature_synonym_id; + + +-- +-- Name: feature_union; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW feature_union AS + SELECT x.feature_id AS subject_id, + y.feature_id AS object_id, + x.srcfeature_id, + x.strand AS subject_strand, + y.strand AS object_strand, + CASE + WHEN (x.fmin < y.fmin) THEN x.fmin + ELSE y.fmin + END AS fmin, + CASE + WHEN (x.fmax > y.fmax) THEN x.fmax + ELSE y.fmax + END AS fmax + FROM featureloc x, + featureloc y + WHERE ((x.srcfeature_id = y.srcfeature_id) AND ((x.fmax >= y.fmin) AND (x.fmin <= y.fmax))); + + +-- +-- Name: VIEW feature_union; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW feature_union IS 'set-union on interval defined by featureloc. featurelocs must meet'; + + +-- +-- Name: feature_uniquename_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE feature_uniquename_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featureloc_featureloc_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featureloc_featureloc_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featureloc_featureloc_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featureloc_featureloc_id_seq OWNED BY featureloc.featureloc_id; + + +-- +-- Name: featureloc_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featureloc_pub ( + featureloc_pub_id integer NOT NULL, + featureloc_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE featureloc_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE featureloc_pub IS 'Provenance of featureloc. Linking table between featurelocs and chado.tions that mention them.'; + + +-- +-- Name: featureloc_pub_featureloc_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featureloc_pub_featureloc_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featureloc_pub_featureloc_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featureloc_pub_featureloc_pub_id_seq OWNED BY featureloc_pub.featureloc_pub_id; + + +-- +-- Name: featuremap; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featuremap ( + featuremap_id integer NOT NULL, + name character varying(255), + description text, + unittype_id integer +); + + +-- +-- Name: featuremap_contact; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featuremap_contact ( + featuremap_contact_id integer NOT NULL, + featuremap_id integer NOT NULL, + contact_id integer NOT NULL +); + + +-- +-- Name: featuremap_contact_featuremap_contact_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featuremap_contact_featuremap_contact_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featuremap_contact_featuremap_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featuremap_contact_featuremap_contact_id_seq OWNED BY featuremap_contact.featuremap_contact_id; + + +-- +-- Name: featuremap_dbxref_featuremap_dbxref_id; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featuremap_dbxref_featuremap_dbxref_id + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featuremap_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featuremap_dbxref ( + featuremap_dbxref_id integer DEFAULT nextval('featuremap_dbxref_featuremap_dbxref_id'::regclass) NOT NULL, + featuremap_id integer NOT NULL, + dbxref_id integer NOT NULL, + is_current boolean DEFAULT true NOT NULL +); + + +-- +-- Name: featuremap_featuremap_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featuremap_featuremap_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featuremap_featuremap_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featuremap_featuremap_id_seq OWNED BY featuremap.featuremap_id; + + +-- +-- Name: featuremap_organism; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featuremap_organism ( + featuremap_organism_id integer NOT NULL, + featuremap_id integer NOT NULL, + organism_id integer NOT NULL +); + + +-- +-- Name: featuremap_organism_featuremap_organism_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featuremap_organism_featuremap_organism_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featuremap_organism_featuremap_organism_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featuremap_organism_featuremap_organism_id_seq OWNED BY featuremap_organism.featuremap_organism_id; + + +-- +-- Name: featuremap_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featuremap_pub ( + featuremap_pub_id integer NOT NULL, + featuremap_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: featuremap_pub_featuremap_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featuremap_pub_featuremap_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featuremap_pub_featuremap_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featuremap_pub_featuremap_pub_id_seq OWNED BY featuremap_pub.featuremap_pub_id; + + +-- +-- Name: featuremap_stock; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featuremap_stock ( + featuremap_stock_id integer NOT NULL, + featuremap_id integer NOT NULL, + stock_id integer NOT NULL +); + + +-- +-- Name: featuremap_stock_featuremap_stock_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featuremap_stock_featuremap_stock_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featuremap_stock_featuremap_stock_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featuremap_stock_featuremap_stock_id_seq OWNED BY featuremap_stock.featuremap_stock_id; + + +-- +-- Name: featuremapprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featuremapprop ( + featuremapprop_id integer NOT NULL, + featuremap_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: featuremapprop_featuremapprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featuremapprop_featuremapprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featuremapprop_featuremapprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featuremapprop_featuremapprop_id_seq OWNED BY featuremapprop.featuremapprop_id; + + +-- +-- Name: featurepos; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featurepos ( + featurepos_id integer NOT NULL, + featuremap_id integer NOT NULL, + feature_id integer NOT NULL, + map_feature_id integer NOT NULL, + mappos double precision NOT NULL +); + + +-- +-- Name: COLUMN featurepos.map_feature_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featurepos.map_feature_id IS 'map_feature_id +links to the feature (map) upon which the feature is being localized.'; + + +-- +-- Name: featurepos_featurepos_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featurepos_featurepos_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featurepos_featurepos_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featurepos_featurepos_id_seq OWNED BY featurepos.featurepos_id; + + +-- +-- Name: featureposprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featureposprop ( + featureposprop_id integer NOT NULL, + featurepos_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: featureposprop_featureposprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featureposprop_featureposprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featureposprop_featureposprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featureposprop_featureposprop_id_seq OWNED BY featureposprop.featureposprop_id; + + +-- +-- Name: featureprop_featureprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featureprop_featureprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featureprop_featureprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featureprop_featureprop_id_seq OWNED BY featureprop.featureprop_id; + + +-- +-- Name: featureprop_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featureprop_pub ( + featureprop_pub_id integer NOT NULL, + featureprop_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE featureprop_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE featureprop_pub IS 'Provenance. Any featureprop assignment can optionally be supported by a chado.tion.'; + + +-- +-- Name: featureprop_pub_featureprop_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featureprop_pub_featureprop_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featureprop_pub_featureprop_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featureprop_pub_featureprop_pub_id_seq OWNED BY featureprop_pub.featureprop_pub_id; + + +-- +-- Name: featurerange; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE featurerange ( + featurerange_id integer NOT NULL, + featuremap_id integer NOT NULL, + feature_id integer NOT NULL, + leftstartf_id integer NOT NULL, + leftendf_id integer, + rightstartf_id integer, + rightendf_id integer NOT NULL, + rangestr character varying(255) +); + + +-- +-- Name: TABLE featurerange; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE featurerange IS 'In cases where the start and end of a mapped feature is a range, leftendf and rightstartf are populated. leftstartf_id, leftendf_id, rightstartf_id, rightendf_id are the ids of features with respect to which the feature is being mapped. These may be cytological bands.'; + + +-- +-- Name: COLUMN featurerange.featuremap_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN featurerange.featuremap_id IS 'featuremap_id is the id of the feature being mapped.'; + + +-- +-- Name: featurerange_featurerange_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE featurerange_featurerange_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: featurerange_featurerange_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE featurerange_featurerange_id_seq OWNED BY featurerange.featurerange_id; + + +-- +-- Name: featureset_meets; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW featureset_meets AS + SELECT x.object_id AS subject_id, + y.object_id + FROM ((feature_meets r + JOIN feature_relationship x ON ((r.subject_id = x.subject_id))) + JOIN feature_relationship y ON ((r.object_id = y.subject_id))); + + +-- +-- Name: fp_key; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW fp_key AS + SELECT fp.feature_id, + c.name AS pkey, + fp.value + FROM featureprop fp, + cvterm c + WHERE (fp.featureprop_id = c.cvterm_id); + + +-- +-- Name: genotype; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE genotype ( + genotype_id integer NOT NULL, + name text, + uniquename text NOT NULL, + description character varying(255), + type_id integer NOT NULL +); + + +-- +-- Name: TABLE genotype; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE genotype IS 'Genetic context. A genotype is defined by a collection of features, mutations, balancers, deficiencies, haplotype blocks, or engineered constructs.'; + + +-- +-- Name: COLUMN genotype.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN genotype.name IS 'Optional alternative name for a genotype, +for display purposes.'; + + +-- +-- Name: COLUMN genotype.uniquename; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN genotype.uniquename IS 'The unique name for a genotype; +typically derived from the features making up the genotype.'; + + +-- +-- Name: genotype_call; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE genotype_call ( + genotype_call_id integer NOT NULL, + project_id integer NOT NULL, + feature_id integer NOT NULL, + stock_id integer NOT NULL, + genotype_id integer NOT NULL, + meta_data text +); + + +-- +-- Name: genotype_call_genotype_call_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE genotype_call_genotype_call_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: genotype_call_genotype_call_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE genotype_call_genotype_call_id_seq OWNED BY genotype_call.genotype_call_id; + + +-- +-- Name: genotype_genotype_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE genotype_genotype_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: genotype_genotype_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE genotype_genotype_id_seq OWNED BY genotype.genotype_id; + + +-- +-- Name: genotypeprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE genotypeprop ( + genotypeprop_id integer NOT NULL, + genotype_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: genotypeprop_genotypeprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE genotypeprop_genotypeprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: genotypeprop_genotypeprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE genotypeprop_genotypeprop_id_seq OWNED BY genotypeprop.genotypeprop_id; + + +-- +-- Name: gff3atts; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW gff3atts AS + SELECT fs.feature_id, + 'Ontology_term'::text AS type, + CASE + WHEN ((db.name)::text ~~ '%Gene Ontology%'::text) THEN (('GO:'::text || (dbx.accession)::text))::character varying + WHEN ((db.name)::text ~~ 'Sequence Ontology%'::text) THEN (('SO:'::text || (dbx.accession)::text))::character varying + ELSE ((((db.name)::text || ':'::text) || (dbx.accession)::text))::character varying + END AS attribute + FROM cvterm s, + dbxref dbx, + feature_cvterm fs, + db + WHERE (((fs.cvterm_id = s.cvterm_id) AND (s.dbxref_id = dbx.dbxref_id)) AND (db.db_id = dbx.db_id)) +UNION ALL + SELECT fs.feature_id, + 'Dbxref'::text AS type, + (((d.name)::text || ':'::text) || (s.accession)::text) AS attribute + FROM dbxref s, + feature_dbxref fs, + db d + WHERE (((fs.dbxref_id = s.dbxref_id) AND (s.db_id = d.db_id)) AND ((d.name)::text <> 'GFF_source'::text)) +UNION ALL + SELECT f.feature_id, + 'Alias'::text AS type, + s.name AS attribute + FROM synonym s, + feature_synonym fs, + feature f + WHERE ((((fs.synonym_id = s.synonym_id) AND (f.feature_id = fs.feature_id)) AND ((f.name)::text <> (s.name)::text)) AND (f.uniquename <> (s.name)::text)) +UNION ALL + SELECT fp.feature_id, + cv.name AS type, + fp.value AS attribute + FROM featureprop fp, + cvterm cv + WHERE (fp.type_id = cv.cvterm_id) +UNION ALL + SELECT fs.feature_id, + 'pub'::text AS type, + (((s.series_name)::text || ':'::text) || s.title) AS attribute + FROM pub s, + feature_pub fs + WHERE (fs.pub_id = s.pub_id) +UNION ALL + SELECT fr.subject_id AS feature_id, + 'Parent'::text AS type, + parent.uniquename AS attribute + FROM feature_relationship fr, + feature parent + WHERE ((fr.object_id = parent.feature_id) AND (fr.type_id = ( SELECT cvterm.cvterm_id + FROM cvterm + WHERE (((cvterm.name)::text = 'part_of'::text) AND (cvterm.cv_id IN ( SELECT cv.cv_id + FROM cv + WHERE ((cv.name)::text = 'relationship'::text))))))) +UNION ALL + SELECT fr.subject_id AS feature_id, + 'Derives_from'::text AS type, + parent.uniquename AS attribute + FROM feature_relationship fr, + feature parent + WHERE ((fr.object_id = parent.feature_id) AND (fr.type_id = ( SELECT cvterm.cvterm_id + FROM cvterm + WHERE (((cvterm.name)::text = 'derives_from'::text) AND (cvterm.cv_id IN ( SELECT cv.cv_id + FROM cv + WHERE ((cv.name)::text = 'relationship'::text))))))) +UNION ALL + SELECT fl.feature_id, + 'Target'::text AS type, + (((((((target.name)::text || ' '::text) || (fl.fmin + 1)) || ' '::text) || fl.fmax) || ' '::text) || fl.strand) AS attribute + FROM featureloc fl, + feature target + WHERE ((fl.srcfeature_id = target.feature_id) AND (fl.rank <> 0)) +UNION ALL + SELECT feature.feature_id, + 'ID'::text AS type, + feature.uniquename AS attribute + FROM feature + WHERE (NOT (feature.type_id IN ( SELECT cvterm.cvterm_id + FROM cvterm + WHERE ((cvterm.name)::text = 'CDS'::text)))) +UNION ALL + SELECT feature.feature_id, + 'chado_feature_id'::text AS type, + (feature.feature_id)::character varying AS attribute + FROM feature +UNION ALL + SELECT feature.feature_id, + 'Name'::text AS type, + feature.name AS attribute + FROM feature; + + +-- +-- Name: go_count_analysis; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE go_count_analysis ( + cvname character varying(255), + cvterm_id integer, + analysis_id integer, + organism_id integer, + feature_count integer +); + + +-- +-- Name: go_count_organism; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE go_count_organism ( + cvname character varying(255), + cvterm_id integer, + organism_id integer, + feature_count integer +); + + +-- +-- Name: intron_combined_view; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW intron_combined_view AS + SELECT x1.feature_id AS exon1_id, + x2.feature_id AS exon2_id, + CASE + WHEN (l1.strand = (-1)) THEN l2.fmax + ELSE l1.fmax + END AS fmin, + CASE + WHEN (l1.strand = (-1)) THEN l1.fmin + ELSE l2.fmin + END AS fmax, + l1.strand, + l1.srcfeature_id, + r1.rank AS intron_rank, + r1.object_id AS transcript_id + FROM ((((((cvterm + JOIN feature x1 ON ((x1.type_id = cvterm.cvterm_id))) + JOIN feature_relationship r1 ON ((x1.feature_id = r1.subject_id))) + JOIN featureloc l1 ON ((x1.feature_id = l1.feature_id))) + JOIN feature x2 ON ((x2.type_id = cvterm.cvterm_id))) + JOIN feature_relationship r2 ON ((x2.feature_id = r2.subject_id))) + JOIN featureloc l2 ON ((x2.feature_id = l2.feature_id))) + WHERE ((((((((cvterm.name)::text = 'exon'::text) AND ((r2.rank - r1.rank) = 1)) AND (r1.object_id = r2.object_id)) AND (l1.strand = l2.strand)) AND (l1.srcfeature_id = l2.srcfeature_id)) AND (l1.locgroup = 0)) AND (l2.locgroup = 0)); + + +-- +-- Name: intronloc_view; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW intronloc_view AS + SELECT DISTINCT intron_combined_view.exon1_id, + intron_combined_view.exon2_id, + intron_combined_view.fmin, + intron_combined_view.fmax, + intron_combined_view.strand, + intron_combined_view.srcfeature_id + FROM intron_combined_view; + + +-- +-- Name: kegg_by_organism; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE kegg_by_organism ( + analysis_name character varying(255), + analysis_id integer, + organism_id integer +); + + +-- +-- Name: library; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE library ( + library_id integer NOT NULL, + organism_id integer NOT NULL, + name character varying(255), + uniquename text NOT NULL, + type_id integer NOT NULL, + is_obsolete integer DEFAULT 0 NOT NULL, + timeaccessioned timestamp without time zone DEFAULT now() NOT NULL, + timelastmodified timestamp without time zone DEFAULT now() NOT NULL +); + + +-- +-- Name: COLUMN library.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN library.type_id IS 'The type_id foreign key links +to a controlled vocabulary of library types. Examples of this would be: "cDNA_library" or "genomic_library"'; + + +-- +-- Name: library_contact; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE library_contact ( + library_contact_id integer NOT NULL, + library_id integer NOT NULL, + contact_id integer NOT NULL +); + + +-- +-- Name: library_contact_library_contact_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE library_contact_library_contact_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: library_contact_library_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE library_contact_library_contact_id_seq OWNED BY library_contact.library_contact_id; + + +-- +-- Name: library_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE library_cvterm ( + library_cvterm_id integer NOT NULL, + library_id integer NOT NULL, + cvterm_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE library_cvterm; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE library_cvterm IS 'The table library_cvterm links a library to controlled vocabularies which describe the library. For instance, there might be a link to the anatomy cv for "head" or "testes" for a head or testes library.'; + + +-- +-- Name: library_cvterm_library_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE library_cvterm_library_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: library_cvterm_library_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE library_cvterm_library_cvterm_id_seq OWNED BY library_cvterm.library_cvterm_id; + + +-- +-- Name: library_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE library_dbxref ( + library_dbxref_id integer NOT NULL, + library_id integer NOT NULL, + dbxref_id integer NOT NULL, + is_current boolean DEFAULT true NOT NULL +); + + +-- +-- Name: library_dbxref_library_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE library_dbxref_library_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: library_dbxref_library_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE library_dbxref_library_dbxref_id_seq OWNED BY library_dbxref.library_dbxref_id; + + +-- +-- Name: library_feature; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE library_feature ( + library_feature_id integer NOT NULL, + library_id integer NOT NULL, + feature_id integer NOT NULL +); + + +-- +-- Name: TABLE library_feature; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE library_feature IS 'library_feature links a library to the clones which are contained in the library. Examples of such linked features might be "cDNA_clone" or "genomic_clone".'; + + +-- +-- Name: library_feature_library_feature_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE library_feature_library_feature_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: library_feature_library_feature_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE library_feature_library_feature_id_seq OWNED BY library_feature.library_feature_id; + + +-- +-- Name: library_library_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE library_library_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: library_library_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE library_library_id_seq OWNED BY library.library_id; + + +-- +-- Name: library_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE library_pub ( + library_pub_id integer NOT NULL, + library_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: library_pub_library_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE library_pub_library_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: library_pub_library_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE library_pub_library_pub_id_seq OWNED BY library_pub.library_pub_id; + + +-- +-- Name: library_stock; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE library_stock ( + library_stock_id integer NOT NULL, + library_id integer NOT NULL, + stock_id integer NOT NULL +); + + +-- +-- Name: library_stock_library_stock_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE library_stock_library_stock_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: library_stock_library_stock_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE library_stock_library_stock_id_seq OWNED BY library_stock.library_stock_id; + + +-- +-- Name: library_synonym; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE library_synonym ( + library_synonym_id integer NOT NULL, + synonym_id integer NOT NULL, + library_id integer NOT NULL, + pub_id integer NOT NULL, + is_current boolean DEFAULT true NOT NULL, + is_internal boolean DEFAULT false NOT NULL +); + + +-- +-- Name: COLUMN library_synonym.pub_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN library_synonym.pub_id IS 'The pub_id link is for +relating the usage of a given synonym to the publication in which it was used.'; + + +-- +-- Name: COLUMN library_synonym.is_current; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN library_synonym.is_current IS 'The is_current bit indicates whether the linked synonym is the current -official- symbol for the linked library.'; + + +-- +-- Name: COLUMN library_synonym.is_internal; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN library_synonym.is_internal IS 'Typically a synonym +exists so that somebody querying the database with an obsolete name +can find the object they are looking for under its current name. If +the synonym has been used publicly and deliberately (e.g. in a paper), it my also be listed in reports as a synonym. If the synonym was not used deliberately (e.g., there was a typo which went public), then the is_internal bit may be set to "true" so that it is known that the synonym is "internal" and should be queryable but should not be listed in reports as a valid synonym.'; + + +-- +-- Name: library_synonym_library_synonym_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE library_synonym_library_synonym_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: library_synonym_library_synonym_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE library_synonym_library_synonym_id_seq OWNED BY library_synonym.library_synonym_id; + + +-- +-- Name: libraryprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE libraryprop ( + libraryprop_id integer NOT NULL, + library_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: libraryprop_libraryprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE libraryprop_libraryprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: libraryprop_libraryprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE libraryprop_libraryprop_id_seq OWNED BY libraryprop.libraryprop_id; + + +-- +-- Name: libraryprop_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE libraryprop_pub ( + libraryprop_pub_id integer NOT NULL, + libraryprop_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: libraryprop_pub_libraryprop_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE libraryprop_pub_libraryprop_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: libraryprop_pub_libraryprop_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE libraryprop_pub_libraryprop_pub_id_seq OWNED BY libraryprop_pub.libraryprop_pub_id; + + +-- +-- Name: magedocumentation; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE magedocumentation ( + magedocumentation_id integer NOT NULL, + mageml_id integer NOT NULL, + tableinfo_id integer NOT NULL, + row_id integer NOT NULL, + mageidentifier text NOT NULL +); + + +-- +-- Name: magedocumentation_magedocumentation_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE magedocumentation_magedocumentation_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: magedocumentation_magedocumentation_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE magedocumentation_magedocumentation_id_seq OWNED BY magedocumentation.magedocumentation_id; + + +-- +-- Name: mageml; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE mageml ( + mageml_id integer NOT NULL, + mage_package text NOT NULL, + mage_ml text NOT NULL +); + + +-- +-- Name: TABLE mageml; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE mageml IS 'This table is for storing extra bits of MAGEml in a denormalized form. More normalization would require many more tables.'; + + +-- +-- Name: mageml_mageml_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE mageml_mageml_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mageml_mageml_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE mageml_mageml_id_seq OWNED BY mageml.mageml_id; + + +-- +-- Name: materialized_view; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE materialized_view ( + materialized_view_id integer NOT NULL, + last_update timestamp without time zone, + refresh_time integer, + name character varying(64), + mv_schema character varying(64), + mv_table character varying(128), + mv_specs text, + indexed text, + query text, + special_index text +); + + +-- +-- Name: materialized_view_materialized_view_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE materialized_view_materialized_view_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: materialized_view_materialized_view_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE materialized_view_materialized_view_id_seq OWNED BY materialized_view.materialized_view_id; + + +-- +-- Name: nd_experiment; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment ( + nd_experiment_id integer NOT NULL, + nd_geolocation_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: nd_experiment_contact; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_contact ( + nd_experiment_contact_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + contact_id integer NOT NULL +); + + +-- +-- Name: nd_experiment_contact_nd_experiment_contact_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_contact_nd_experiment_contact_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_contact_nd_experiment_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_contact_nd_experiment_contact_id_seq OWNED BY nd_experiment_contact.nd_experiment_contact_id; + + +-- +-- Name: nd_experiment_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_dbxref ( + nd_experiment_dbxref_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + dbxref_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_experiment_dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_experiment_dbxref IS 'Cross-reference experiment to accessions, images, etc'; + + +-- +-- Name: nd_experiment_dbxref_nd_experiment_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_dbxref_nd_experiment_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_dbxref_nd_experiment_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_dbxref_nd_experiment_dbxref_id_seq OWNED BY nd_experiment_dbxref.nd_experiment_dbxref_id; + + +-- +-- Name: nd_experiment_genotype; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_genotype ( + nd_experiment_genotype_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + genotype_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_experiment_genotype; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_experiment_genotype IS 'Linking table: experiments to the genotypes they produce. There is a one-to-one relationship between an experiment and a genotype since each genotype record should point to one experiment. Add a new experiment_id for each genotype record.'; + + +-- +-- Name: nd_experiment_genotype_nd_experiment_genotype_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_genotype_nd_experiment_genotype_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_genotype_nd_experiment_genotype_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_genotype_nd_experiment_genotype_id_seq OWNED BY nd_experiment_genotype.nd_experiment_genotype_id; + + +-- +-- Name: nd_experiment_nd_experiment_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_nd_experiment_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_nd_experiment_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_nd_experiment_id_seq OWNED BY nd_experiment.nd_experiment_id; + + +-- +-- Name: nd_experiment_phenotype; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_phenotype ( + nd_experiment_phenotype_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + phenotype_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_experiment_phenotype; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_experiment_phenotype IS 'Linking table: experiments to the phenotypes they produce. There is a one-to-one relationship between an experiment and a phenotype since each phenotype record should point to one experiment. Add a new experiment_id for each phenotype record.'; + + +-- +-- Name: nd_experiment_phenotype_nd_experiment_phenotype_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_phenotype_nd_experiment_phenotype_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_phenotype_nd_experiment_phenotype_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_phenotype_nd_experiment_phenotype_id_seq OWNED BY nd_experiment_phenotype.nd_experiment_phenotype_id; + + +-- +-- Name: nd_experiment_project; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_project ( + nd_experiment_project_id integer NOT NULL, + project_id integer NOT NULL, + nd_experiment_id integer NOT NULL +); + + +-- +-- Name: nd_experiment_project_nd_experiment_project_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_project_nd_experiment_project_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_project_nd_experiment_project_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_project_nd_experiment_project_id_seq OWNED BY nd_experiment_project.nd_experiment_project_id; + + +-- +-- Name: nd_experiment_protocol; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_protocol ( + nd_experiment_protocol_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + nd_protocol_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_experiment_protocol; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_experiment_protocol IS 'Linking table: experiments to the protocols they involve.'; + + +-- +-- Name: nd_experiment_protocol_nd_experiment_protocol_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_protocol_nd_experiment_protocol_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_protocol_nd_experiment_protocol_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_protocol_nd_experiment_protocol_id_seq OWNED BY nd_experiment_protocol.nd_experiment_protocol_id; + + +-- +-- Name: nd_experiment_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_pub ( + nd_experiment_pub_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_experiment_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_experiment_pub IS 'Linking nd_experiment(s) to chado.tion(s)'; + + +-- +-- Name: nd_experiment_pub_nd_experiment_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_pub_nd_experiment_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_pub_nd_experiment_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_pub_nd_experiment_pub_id_seq OWNED BY nd_experiment_pub.nd_experiment_pub_id; + + +-- +-- Name: nd_experiment_stock; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_stock ( + nd_experiment_stock_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + stock_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_experiment_stock; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_experiment_stock IS 'Part of a stock or a clone of a stock that is used in an experiment'; + + +-- +-- Name: COLUMN nd_experiment_stock.stock_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_experiment_stock.stock_id IS 'stock used in the extraction or the corresponding stock for the clone'; + + +-- +-- Name: nd_experiment_stock_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_stock_dbxref ( + nd_experiment_stock_dbxref_id integer NOT NULL, + nd_experiment_stock_id integer NOT NULL, + dbxref_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_experiment_stock_dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_experiment_stock_dbxref IS 'Cross-reference experiment_stock to accessions, images, etc'; + + +-- +-- Name: nd_experiment_stock_dbxref_nd_experiment_stock_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_stock_dbxref_nd_experiment_stock_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_stock_dbxref_nd_experiment_stock_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_stock_dbxref_nd_experiment_stock_dbxref_id_seq OWNED BY nd_experiment_stock_dbxref.nd_experiment_stock_dbxref_id; + + +-- +-- Name: nd_experiment_stock_nd_experiment_stock_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_stock_nd_experiment_stock_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_stock_nd_experiment_stock_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_stock_nd_experiment_stock_id_seq OWNED BY nd_experiment_stock.nd_experiment_stock_id; + + +-- +-- Name: nd_experiment_stockprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experiment_stockprop ( + nd_experiment_stockprop_id integer NOT NULL, + nd_experiment_stock_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE nd_experiment_stockprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_experiment_stockprop IS 'Property/value associations for experiment_stocks. This table can store the properties such as treatment'; + + +-- +-- Name: COLUMN nd_experiment_stockprop.nd_experiment_stock_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_experiment_stockprop.nd_experiment_stock_id IS 'The experiment_stock to which the property applies.'; + + +-- +-- Name: COLUMN nd_experiment_stockprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_experiment_stockprop.type_id IS 'The name of the property as a reference to a controlled vocabulary term.'; + + +-- +-- Name: COLUMN nd_experiment_stockprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_experiment_stockprop.value IS 'The value of the property.'; + + +-- +-- Name: COLUMN nd_experiment_stockprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_experiment_stockprop.rank IS 'The rank of the property value, if the property has an array of values.'; + + +-- +-- Name: nd_experiment_stockprop_nd_experiment_stockprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experiment_stockprop_nd_experiment_stockprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experiment_stockprop_nd_experiment_stockprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experiment_stockprop_nd_experiment_stockprop_id_seq OWNED BY nd_experiment_stockprop.nd_experiment_stockprop_id; + + +-- +-- Name: nd_experimentprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_experimentprop ( + nd_experimentprop_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: nd_experimentprop_nd_experimentprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_experimentprop_nd_experimentprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_experimentprop_nd_experimentprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_experimentprop_nd_experimentprop_id_seq OWNED BY nd_experimentprop.nd_experimentprop_id; + + +-- +-- Name: nd_geolocation; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_geolocation ( + nd_geolocation_id integer NOT NULL, + description character varying(255), + latitude real, + longitude real, + geodetic_datum character varying(32), + altitude real +); + + +-- +-- Name: TABLE nd_geolocation; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_geolocation IS 'The geo-referencable location of the stock. NOTE: This entity is subject to change as a more general and possibly more OpenGIS-compliant geolocation module may be introduced into Chado.'; + + +-- +-- Name: COLUMN nd_geolocation.description; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_geolocation.description IS 'A textual representation of the location, if this is the original georeference. Optional if the original georeference is available in lat/long coordinates.'; + + +-- +-- Name: COLUMN nd_geolocation.latitude; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_geolocation.latitude IS 'The decimal latitude coordinate of the georeference, using positive and negative sign to indicate N and S, respectively.'; + + +-- +-- Name: COLUMN nd_geolocation.longitude; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_geolocation.longitude IS 'The decimal longitude coordinate of the georeference, using positive and negative sign to indicate E and W, respectively.'; + + +-- +-- Name: COLUMN nd_geolocation.geodetic_datum; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_geolocation.geodetic_datum IS 'The geodetic system on which the geo-reference coordinates are based. For geo-references measured between 1984 and 2010, this will typically be WGS84.'; + + +-- +-- Name: COLUMN nd_geolocation.altitude; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_geolocation.altitude IS 'The altitude (elevation) of the location in meters. If the altitude is only known as a range, this is the average, and altitude_dev will hold half of the width of the range.'; + + +-- +-- Name: nd_geolocation_nd_geolocation_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_geolocation_nd_geolocation_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_geolocation_nd_geolocation_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_geolocation_nd_geolocation_id_seq OWNED BY nd_geolocation.nd_geolocation_id; + + +-- +-- Name: nd_geolocationprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_geolocationprop ( + nd_geolocationprop_id integer NOT NULL, + nd_geolocation_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE nd_geolocationprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_geolocationprop IS 'Property/value associations for geolocations. This table can store the properties such as location and environment'; + + +-- +-- Name: COLUMN nd_geolocationprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_geolocationprop.type_id IS 'The name of the property as a reference to a controlled vocabulary term.'; + + +-- +-- Name: COLUMN nd_geolocationprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_geolocationprop.value IS 'The value of the property.'; + + +-- +-- Name: COLUMN nd_geolocationprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_geolocationprop.rank IS 'The rank of the property value, if the property has an array of values.'; + + +-- +-- Name: nd_geolocationprop_nd_geolocationprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_geolocationprop_nd_geolocationprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_geolocationprop_nd_geolocationprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_geolocationprop_nd_geolocationprop_id_seq OWNED BY nd_geolocationprop.nd_geolocationprop_id; + + +-- +-- Name: nd_protocol; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_protocol ( + nd_protocol_id integer NOT NULL, + name character varying(255) NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_protocol; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_protocol IS 'A protocol can be anything that is done as part of the experiment.'; + + +-- +-- Name: COLUMN nd_protocol.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_protocol.name IS 'The protocol name.'; + + +-- +-- Name: nd_protocol_nd_protocol_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_protocol_nd_protocol_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_protocol_nd_protocol_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_protocol_nd_protocol_id_seq OWNED BY nd_protocol.nd_protocol_id; + + +-- +-- Name: nd_protocol_reagent; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_protocol_reagent ( + nd_protocol_reagent_id integer NOT NULL, + nd_protocol_id integer NOT NULL, + reagent_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: nd_protocol_reagent_nd_protocol_reagent_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_protocol_reagent_nd_protocol_reagent_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_protocol_reagent_nd_protocol_reagent_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_protocol_reagent_nd_protocol_reagent_id_seq OWNED BY nd_protocol_reagent.nd_protocol_reagent_id; + + +-- +-- Name: nd_protocolprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_protocolprop ( + nd_protocolprop_id integer NOT NULL, + nd_protocol_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE nd_protocolprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_protocolprop IS 'Property/value associations for protocol.'; + + +-- +-- Name: COLUMN nd_protocolprop.nd_protocol_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_protocolprop.nd_protocol_id IS 'The protocol to which the property applies.'; + + +-- +-- Name: COLUMN nd_protocolprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_protocolprop.type_id IS 'The name of the property as a reference to a controlled vocabulary term.'; + + +-- +-- Name: COLUMN nd_protocolprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_protocolprop.value IS 'The value of the property.'; + + +-- +-- Name: COLUMN nd_protocolprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_protocolprop.rank IS 'The rank of the property value, if the property has an array of values.'; + + +-- +-- Name: nd_protocolprop_nd_protocolprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_protocolprop_nd_protocolprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_protocolprop_nd_protocolprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_protocolprop_nd_protocolprop_id_seq OWNED BY nd_protocolprop.nd_protocolprop_id; + + +-- +-- Name: nd_reagent; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_reagent ( + nd_reagent_id integer NOT NULL, + name character varying(80) NOT NULL, + type_id integer NOT NULL, + feature_id integer +); + + +-- +-- Name: TABLE nd_reagent; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_reagent IS 'A reagent such as a primer, an enzyme, an adapter oligo, a linker oligo. Reagents are used in genotyping experiments, or in any other kind of experiment.'; + + +-- +-- Name: COLUMN nd_reagent.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_reagent.name IS 'The name of the reagent. The name should be unique for a given type.'; + + +-- +-- Name: COLUMN nd_reagent.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_reagent.type_id IS 'The type of the reagent, for example linker oligomer, or forward primer.'; + + +-- +-- Name: COLUMN nd_reagent.feature_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_reagent.feature_id IS 'If the reagent is a primer, the feature that it corresponds to. More generally, the corresponding feature for any reagent that has a sequence that maps to another sequence.'; + + +-- +-- Name: nd_reagent_nd_reagent_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_reagent_nd_reagent_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_reagent_nd_reagent_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_reagent_nd_reagent_id_seq OWNED BY nd_reagent.nd_reagent_id; + + +-- +-- Name: nd_reagent_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_reagent_relationship ( + nd_reagent_relationship_id integer NOT NULL, + subject_reagent_id integer NOT NULL, + object_reagent_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: TABLE nd_reagent_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE nd_reagent_relationship IS 'Relationships between reagents. Some reagents form a group. i.e., they are used all together or not at all. Examples are adapter/linker/enzyme experiment reagents.'; + + +-- +-- Name: COLUMN nd_reagent_relationship.subject_reagent_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_reagent_relationship.subject_reagent_id IS 'The subject reagent in the relationship. In parent/child terminology, the subject is the child. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object.'; + + +-- +-- Name: COLUMN nd_reagent_relationship.object_reagent_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_reagent_relationship.object_reagent_id IS 'The object reagent in the relationship. In parent/child terminology, the object is the parent. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object.'; + + +-- +-- Name: COLUMN nd_reagent_relationship.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN nd_reagent_relationship.type_id IS 'The type (or predicate) of the relationship. For example, in "linkerA 3prime-overhang-linker enzymeA" linkerA is the subject, 3prime-overhand-linker is the type, and enzymeA is the object.'; + + +-- +-- Name: nd_reagent_relationship_nd_reagent_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_reagent_relationship_nd_reagent_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_reagent_relationship_nd_reagent_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_reagent_relationship_nd_reagent_relationship_id_seq OWNED BY nd_reagent_relationship.nd_reagent_relationship_id; + + +-- +-- Name: nd_reagentprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE nd_reagentprop ( + nd_reagentprop_id integer NOT NULL, + nd_reagent_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: nd_reagentprop_nd_reagentprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE nd_reagentprop_nd_reagentprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nd_reagentprop_nd_reagentprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE nd_reagentprop_nd_reagentprop_id_seq OWNED BY nd_reagentprop.nd_reagentprop_id; + + +-- +-- Name: organism; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism ( + organism_id integer NOT NULL, + abbreviation character varying(255), + genus character varying(255) NOT NULL, + species character varying(255) NOT NULL, + common_name character varying(255), + comment text +); + + +-- +-- Name: TABLE organism; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE organism IS 'The organismal taxonomic +classification. Note that phylogenies are represented using the +phylogeny module, and taxonomies can be represented using the cvterm +module or the phylogeny module.'; + + +-- +-- Name: COLUMN organism.species; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN organism.species IS 'A type of organism is always +uniquely identified by genus and species. When mapping from the NCBI +taxonomy names.dmp file, this column must be used where it +is present, as the common_name column is not always unique (e.g. environmental +samples). If a particular strain or subspecies is to be represented, +this is appended onto the species name. Follows standard NCBI taxonomy +pattern.'; + + +-- +-- Name: organism_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism_dbxref ( + organism_dbxref_id integer NOT NULL, + organism_id integer NOT NULL, + dbxref_id integer NOT NULL +); + + +-- +-- Name: organism_dbxref_organism_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE organism_dbxref_organism_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: organism_dbxref_organism_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE organism_dbxref_organism_dbxref_id_seq OWNED BY organism_dbxref.organism_dbxref_id; + + +-- +-- Name: organism_feature_count; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism_feature_count ( + organism_id integer, + genus character varying(255), + species character varying(255), + common_name character varying(255), + num_features integer, + cvterm_id integer, + feature_type character varying(255) +); + + +-- +-- Name: organism_for_search; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism_for_search ( + organism_id integer, + organism_name text NOT NULL +); + + +-- +-- Name: organism_image; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism_image ( + organism_image_id integer NOT NULL, + organism_id integer NOT NULL, + eimage_id integer NOT NULL +); + + +-- +-- Name: organism_image_organism_image_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE organism_image_organism_image_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: organism_image_organism_image_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE organism_image_organism_image_id_seq OWNED BY organism_image.organism_image_id; + + +-- +-- Name: organism_organism_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE organism_organism_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: organism_organism_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE organism_organism_id_seq OWNED BY organism.organism_id; + + +-- +-- Name: organism_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism_pub ( + organism_pub_id integer NOT NULL, + organism_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: organism_pub_organism_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE organism_pub_organism_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: organism_pub_organism_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE organism_pub_organism_pub_id_seq OWNED BY organism_pub.organism_pub_id; + + +-- +-- Name: organism_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism_relationship ( + organism_relationship_id integer NOT NULL, + subject_organism_id integer NOT NULL, + object_organism_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: organism_relationship_organism_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE organism_relationship_organism_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: organism_relationship_organism_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE organism_relationship_organism_relationship_id_seq OWNED BY organism_relationship.organism_relationship_id; + + +-- +-- Name: organism_stock_count; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism_stock_count ( + organism_id integer NOT NULL, + genus character varying(255) NOT NULL, + species character varying(255) NOT NULL, + common_name character varying(255), + num_stocks integer NOT NULL, + cvterm_id integer NOT NULL, + stock_type character varying(255) NOT NULL +); + + +-- +-- Name: TABLE organism_stock_count; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE organism_stock_count IS 'Stores the type and number of stocks per organism'; + + +-- +-- Name: organism_unigene_mview; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organism_unigene_mview ( + analysis_id integer, + organism_id integer +); + + +-- +-- Name: organismprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE organismprop ( + organismprop_id integer NOT NULL, + organism_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE organismprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE organismprop IS 'Tag-value properties - follows standard chado model.'; + + +-- +-- Name: organismprop_organismprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE organismprop_organismprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: organismprop_organismprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE organismprop_organismprop_id_seq OWNED BY organismprop.organismprop_id; + + +-- +-- Name: phendesc; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phendesc ( + phendesc_id integer NOT NULL, + genotype_id integer NOT NULL, + environment_id integer NOT NULL, + description text NOT NULL, + type_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE phendesc; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phendesc IS 'A summary of a _set_ of phenotypic statements for any one gcontext made in any one chado.tion.'; + + +-- +-- Name: phendesc_phendesc_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phendesc_phendesc_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phendesc_phendesc_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phendesc_phendesc_id_seq OWNED BY phendesc.phendesc_id; + + +-- +-- Name: phenotype; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phenotype ( + phenotype_id integer NOT NULL, + uniquename text NOT NULL, + observable_id integer, + attr_id integer, + value text, + cvalue_id integer, + assay_id integer, + name text +); + + +-- +-- Name: TABLE phenotype; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phenotype IS 'A phenotypic statement, or a single +atomic phenotypic observation, is a controlled sentence describing +observable effects of non-wild type function. E.g. Obs=eye, attribute=color, cvalue=red.'; + + +-- +-- Name: COLUMN phenotype.observable_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phenotype.observable_id IS 'The entity: e.g. anatomy_part, biological_process.'; + + +-- +-- Name: COLUMN phenotype.attr_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phenotype.attr_id IS 'Phenotypic attribute (quality, property, attribute, character) - drawn from PATO.'; + + +-- +-- Name: COLUMN phenotype.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phenotype.value IS 'Value of attribute - unconstrained free text. Used only if cvalue_id is not appropriate.'; + + +-- +-- Name: COLUMN phenotype.cvalue_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phenotype.cvalue_id IS 'Phenotype attribute value (state).'; + + +-- +-- Name: COLUMN phenotype.assay_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phenotype.assay_id IS 'Evidence type.'; + + +-- +-- Name: phenotype_comparison; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phenotype_comparison ( + phenotype_comparison_id integer NOT NULL, + genotype1_id integer NOT NULL, + environment1_id integer NOT NULL, + genotype2_id integer NOT NULL, + environment2_id integer NOT NULL, + phenotype1_id integer NOT NULL, + phenotype2_id integer, + pub_id integer NOT NULL, + organism_id integer NOT NULL +); + + +-- +-- Name: TABLE phenotype_comparison; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phenotype_comparison IS 'Comparison of phenotypes e.g., genotype1/environment1/phenotype1 "non-suppressible" with respect to genotype2/environment2/phenotype2.'; + + +-- +-- Name: phenotype_comparison_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phenotype_comparison_cvterm ( + phenotype_comparison_cvterm_id integer NOT NULL, + phenotype_comparison_id integer NOT NULL, + cvterm_id integer NOT NULL, + pub_id integer NOT NULL, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: phenotype_comparison_cvterm_phenotype_comparison_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phenotype_comparison_cvterm_phenotype_comparison_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phenotype_comparison_cvterm_phenotype_comparison_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phenotype_comparison_cvterm_phenotype_comparison_cvterm_id_seq OWNED BY phenotype_comparison_cvterm.phenotype_comparison_cvterm_id; + + +-- +-- Name: phenotype_comparison_phenotype_comparison_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phenotype_comparison_phenotype_comparison_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phenotype_comparison_phenotype_comparison_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phenotype_comparison_phenotype_comparison_id_seq OWNED BY phenotype_comparison.phenotype_comparison_id; + + +-- +-- Name: phenotype_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phenotype_cvterm ( + phenotype_cvterm_id integer NOT NULL, + phenotype_id integer NOT NULL, + cvterm_id integer NOT NULL, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: phenotype_cvterm_phenotype_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phenotype_cvterm_phenotype_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phenotype_cvterm_phenotype_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phenotype_cvterm_phenotype_cvterm_id_seq OWNED BY phenotype_cvterm.phenotype_cvterm_id; + + +-- +-- Name: phenotype_phenotype_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phenotype_phenotype_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phenotype_phenotype_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phenotype_phenotype_id_seq OWNED BY phenotype.phenotype_id; + + +-- +-- Name: phenstatement; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phenstatement ( + phenstatement_id integer NOT NULL, + genotype_id integer NOT NULL, + environment_id integer NOT NULL, + phenotype_id integer NOT NULL, + type_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE phenstatement; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phenstatement IS 'Phenotypes are things like "larval lethal". Phenstatements are things like "dpp-1 is recessive larval lethal". So essentially phenstatement is a linking table expressing the relationship between genotype, environment, and phenotype.'; + + +-- +-- Name: phenstatement_phenstatement_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phenstatement_phenstatement_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phenstatement_phenstatement_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phenstatement_phenstatement_id_seq OWNED BY phenstatement.phenstatement_id; + + +-- +-- Name: phenstatementprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phenstatementprop ( + phenstatementprop_id integer NOT NULL, + phenstatement_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: phenstatementprop_phenstatementprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phenstatementprop_phenstatementprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phenstatementprop_phenstatementprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phenstatementprop_phenstatementprop_id_seq OWNED BY phenstatementprop.phenstatementprop_id; + + +-- +-- Name: phylonode; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phylonode ( + phylonode_id integer NOT NULL, + phylotree_id integer NOT NULL, + parent_phylonode_id integer, + left_idx integer NOT NULL, + right_idx integer NOT NULL, + type_id integer, + feature_id integer, + label character varying(255), + distance double precision +); + + +-- +-- Name: TABLE phylonode; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phylonode IS 'This is the most pervasive + element in the phylogeny module, cataloging the "phylonodes" of + tree graphs. Edges are implied by the parent_phylonode_id + reflexive closure. For all nodes in a nested set implementation the left and right index will be *between* the parents left and right indexes.'; + + +-- +-- Name: COLUMN phylonode.parent_phylonode_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phylonode.parent_phylonode_id IS 'Root phylonode can have null parent_phylonode_id value.'; + + +-- +-- Name: COLUMN phylonode.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phylonode.type_id IS 'Type: e.g. root, interior, leaf.'; + + +-- +-- Name: COLUMN phylonode.feature_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phylonode.feature_id IS 'Phylonodes can have optional features attached to them e.g. a protein or nucleotide sequence usually attached to a leaf of the phylotree for non-leaf nodes, the feature may be a feature that is an instance of SO:match; this feature is the alignment of all leaf features beneath it.'; + + +-- +-- Name: phylonode_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phylonode_dbxref ( + phylonode_dbxref_id integer NOT NULL, + phylonode_id integer NOT NULL, + dbxref_id integer NOT NULL +); + + +-- +-- Name: TABLE phylonode_dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phylonode_dbxref IS 'For example, for orthology, paralogy group identifiers; could also be used for NCBI taxonomy; for sequences, refer to phylonode_feature, feature associated dbxrefs.'; + + +-- +-- Name: phylonode_dbxref_phylonode_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phylonode_dbxref_phylonode_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phylonode_dbxref_phylonode_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phylonode_dbxref_phylonode_dbxref_id_seq OWNED BY phylonode_dbxref.phylonode_dbxref_id; + + +-- +-- Name: phylonode_organism; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phylonode_organism ( + phylonode_organism_id integer NOT NULL, + phylonode_id integer NOT NULL, + organism_id integer NOT NULL +); + + +-- +-- Name: TABLE phylonode_organism; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phylonode_organism IS 'This linking table should only be used for nodes in taxonomy trees; it provides a mapping between the node and an organism. One node can have zero or one organisms, one organism can have zero or more nodes (although typically it should only have one in the standard NCBI taxonomy tree).'; + + +-- +-- Name: COLUMN phylonode_organism.phylonode_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phylonode_organism.phylonode_id IS 'One phylonode cannot refer to >1 organism.'; + + +-- +-- Name: phylonode_organism_phylonode_organism_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phylonode_organism_phylonode_organism_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phylonode_organism_phylonode_organism_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phylonode_organism_phylonode_organism_id_seq OWNED BY phylonode_organism.phylonode_organism_id; + + +-- +-- Name: phylonode_phylonode_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phylonode_phylonode_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phylonode_phylonode_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phylonode_phylonode_id_seq OWNED BY phylonode.phylonode_id; + + +-- +-- Name: phylonode_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phylonode_pub ( + phylonode_pub_id integer NOT NULL, + phylonode_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: phylonode_pub_phylonode_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phylonode_pub_phylonode_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phylonode_pub_phylonode_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phylonode_pub_phylonode_pub_id_seq OWNED BY phylonode_pub.phylonode_pub_id; + + +-- +-- Name: phylonode_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phylonode_relationship ( + phylonode_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + object_id integer NOT NULL, + type_id integer NOT NULL, + rank integer, + phylotree_id integer NOT NULL +); + + +-- +-- Name: TABLE phylonode_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phylonode_relationship IS 'This is for +relationships that are not strictly hierarchical; for example, +horizontal gene transfer. Most phylogenetic trees are strictly +hierarchical, nevertheless it is here for completeness.'; + + +-- +-- Name: phylonode_relationship_phylonode_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phylonode_relationship_phylonode_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phylonode_relationship_phylonode_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phylonode_relationship_phylonode_relationship_id_seq OWNED BY phylonode_relationship.phylonode_relationship_id; + + +-- +-- Name: phylonodeprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phylonodeprop ( + phylonodeprop_id integer NOT NULL, + phylonode_id integer NOT NULL, + type_id integer NOT NULL, + value text DEFAULT ''::text NOT NULL, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: COLUMN phylonodeprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phylonodeprop.type_id IS 'type_id could designate phylonode hierarchy relationships, for example: species taxonomy (kingdom, order, family, genus, species), "ortholog/paralog", "fold/superfold", etc.'; + + +-- +-- Name: phylonodeprop_phylonodeprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phylonodeprop_phylonodeprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phylonodeprop_phylonodeprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phylonodeprop_phylonodeprop_id_seq OWNED BY phylonodeprop.phylonodeprop_id; + + +-- +-- Name: phylotree; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phylotree ( + phylotree_id integer NOT NULL, + dbxref_id integer NOT NULL, + name character varying(255), + type_id integer, + analysis_id integer, + comment text +); + + +-- +-- Name: TABLE phylotree; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phylotree IS 'Global anchor for phylogenetic tree.'; + + +-- +-- Name: COLUMN phylotree.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN phylotree.type_id IS 'Type: protein, nucleotide, taxonomy, for example. The type should be any SO type, or "taxonomy".'; + + +-- +-- Name: phylotree_phylotree_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phylotree_phylotree_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phylotree_phylotree_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phylotree_phylotree_id_seq OWNED BY phylotree.phylotree_id; + + +-- +-- Name: phylotree_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE phylotree_pub ( + phylotree_pub_id integer NOT NULL, + phylotree_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE phylotree_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE phylotree_pub IS 'Tracks citations global to the tree e.g. multiple sequence alignment supporting tree construction.'; + + +-- +-- Name: phylotree_pub_phylotree_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE phylotree_pub_phylotree_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: phylotree_pub_phylotree_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE phylotree_pub_phylotree_pub_id_seq OWNED BY phylotree_pub.phylotree_pub_id; + + +-- +-- Name: project; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE project ( + project_id integer NOT NULL, + name character varying(255) NOT NULL, + description character varying(255) NOT NULL +); + + +-- +-- Name: project_contact; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE project_contact ( + project_contact_id integer NOT NULL, + project_id integer NOT NULL, + contact_id integer NOT NULL +); + + +-- +-- Name: TABLE project_contact; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE project_contact IS 'Linking project(s) to contact(s)'; + + +-- +-- Name: project_contact_project_contact_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE project_contact_project_contact_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: project_contact_project_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE project_contact_project_contact_id_seq OWNED BY project_contact.project_contact_id; + + +-- +-- Name: project_project_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE project_project_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: project_project_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE project_project_id_seq OWNED BY project.project_id; + + +-- +-- Name: project_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE project_pub ( + project_pub_id integer NOT NULL, + project_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE project_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE project_pub IS 'Linking project(s) to chado.tion(s)'; + + +-- +-- Name: project_pub_project_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE project_pub_project_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: project_pub_project_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE project_pub_project_pub_id_seq OWNED BY project_pub.project_pub_id; + + +-- +-- Name: project_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE project_relationship ( + project_relationship_id integer NOT NULL, + subject_project_id integer NOT NULL, + object_project_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: TABLE project_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE project_relationship IS 'A project can be composed of several smaller scale projects'; + + +-- +-- Name: COLUMN project_relationship.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN project_relationship.type_id IS 'The type of relationship being stated, such as "is part of".'; + + +-- +-- Name: project_relationship_project_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE project_relationship_project_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: project_relationship_project_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE project_relationship_project_relationship_id_seq OWNED BY project_relationship.project_relationship_id; + + +-- +-- Name: projectprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE projectprop ( + projectprop_id integer NOT NULL, + project_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: projectprop_projectprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE projectprop_projectprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: projectprop_projectprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE projectprop_projectprop_id_seq OWNED BY projectprop.projectprop_id; + + +-- +-- Name: protocol; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE protocol ( + protocol_id integer NOT NULL, + type_id integer NOT NULL, + pub_id integer, + dbxref_id integer, + name text NOT NULL, + uri text, + protocoldescription text, + hardwaredescription text, + softwaredescription text +); + + +-- +-- Name: TABLE protocol; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE protocol IS 'Procedural notes on how data was prepared and processed.'; + + +-- +-- Name: protocol_protocol_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE protocol_protocol_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: protocol_protocol_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE protocol_protocol_id_seq OWNED BY protocol.protocol_id; + + +-- +-- Name: protocolparam; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE protocolparam ( + protocolparam_id integer NOT NULL, + protocol_id integer NOT NULL, + name text NOT NULL, + datatype_id integer, + unittype_id integer, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE protocolparam; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE protocolparam IS 'Parameters related to a +protocol. For example, if the protocol is a soak, this might include attributes of bath temperature and duration.'; + + +-- +-- Name: protocolparam_protocolparam_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE protocolparam_protocolparam_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: protocolparam_protocolparam_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE protocolparam_protocolparam_id_seq OWNED BY protocolparam.protocolparam_id; + + +-- +-- Name: pub_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE pub_dbxref ( + pub_dbxref_id integer NOT NULL, + pub_id integer NOT NULL, + dbxref_id integer NOT NULL, + is_current boolean DEFAULT true NOT NULL +); + + +-- +-- Name: TABLE pub_dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE pub_dbxref IS 'Handle links to repositories, +e.g. Pubmed, Biosis, zoorec, OCLC, Medline, ISSN, coden...'; + + +-- +-- Name: pub_dbxref_pub_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE pub_dbxref_pub_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pub_dbxref_pub_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE pub_dbxref_pub_dbxref_id_seq OWNED BY pub_dbxref.pub_dbxref_id; + + +-- +-- Name: pub_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE pub_pub_id_seq + START WITH 4901 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pub_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE pub_pub_id_seq OWNED BY pub.pub_id; + + +-- +-- Name: pub_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE pub_relationship ( + pub_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + object_id integer NOT NULL, + type_id integer NOT NULL +); + + +-- +-- Name: TABLE pub_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE pub_relationship IS 'Handle relationships between +publications, e.g. when one publication makes others obsolete, when one +publication contains errata with respect to other publication(s), or +when one publication also appears in another pub.'; + + +-- +-- Name: pub_relationship_pub_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE pub_relationship_pub_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pub_relationship_pub_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE pub_relationship_pub_relationship_id_seq OWNED BY pub_relationship.pub_relationship_id; + + +-- +-- Name: pubauthor; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE pubauthor ( + pubauthor_id integer NOT NULL, + pub_id integer NOT NULL, + rank integer NOT NULL, + editor boolean DEFAULT false, + surname character varying(100) NOT NULL, + givennames character varying(100), + suffix character varying(100) +); + + +-- +-- Name: TABLE pubauthor; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE pubauthor IS 'An author for a chado.tion. Note the denormalisation (hence lack of _ in table name) - this is deliberate as it is in general too hard to assign IDs to authors.'; + + +-- +-- Name: COLUMN pubauthor.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pubauthor.rank IS 'Order of author in author list for this pub - order is important.'; + + +-- +-- Name: COLUMN pubauthor.editor; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pubauthor.editor IS 'Indicates whether the author is an editor for linked chado.tion. Note: this is a boolean field but does not follow the normal chado convention for naming booleans.'; + + +-- +-- Name: COLUMN pubauthor.givennames; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pubauthor.givennames IS 'First name, initials'; + + +-- +-- Name: COLUMN pubauthor.suffix; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN pubauthor.suffix IS 'Jr., Sr., etc'; + + +-- +-- Name: pubauthor_contact; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE pubauthor_contact ( + pubauthor_contact_id integer NOT NULL, + contact_id integer NOT NULL, + pubauthor_id integer NOT NULL +); + + +-- +-- Name: pubauthor_contact_pubauthor_contact_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE pubauthor_contact_pubauthor_contact_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pubauthor_contact_pubauthor_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE pubauthor_contact_pubauthor_contact_id_seq OWNED BY pubauthor_contact.pubauthor_contact_id; + + +-- +-- Name: pubauthor_pubauthor_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE pubauthor_pubauthor_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pubauthor_pubauthor_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE pubauthor_pubauthor_id_seq OWNED BY pubauthor.pubauthor_id; + + +-- +-- Name: pubprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE pubprop ( + pubprop_id integer NOT NULL, + pub_id integer NOT NULL, + type_id integer NOT NULL, + value text NOT NULL, + rank integer +); + + +-- +-- Name: TABLE pubprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE pubprop IS 'Property-value pairs for a pub. Follows standard chado pattern.'; + + +-- +-- Name: pubprop_pubprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE pubprop_pubprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pubprop_pubprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE pubprop_pubprop_id_seq OWNED BY pubprop.pubprop_id; + + +-- +-- Name: qtl_search; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE qtl_search ( + qtl_nid integer, + qtl text NOT NULL, + org_nid integer, + organism character varying(510) NOT NULL, + symbol text, + trait character varying(255), + category character varying(1024), + category_filter text, + map_nid integer, + map character varying(255), + col_marker_nid integer, + col_marker_uniquename text, + neighbor_marker_nid integer, + neighbor_marker_uniquename text, + study_project_id integer, + study character varying(255), + pop_nid integer, + population text, + lod text, + r2 text, + ad_ratio text, + ref_pub_id integer, + reference text, + aliases text, + type character varying(100) NOT NULL +); + + +-- +-- Name: quantification; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE quantification ( + quantification_id integer NOT NULL, + acquisition_id integer NOT NULL, + operator_id integer, + protocol_id integer, + analysis_id integer NOT NULL, + quantificationdate timestamp without time zone DEFAULT now(), + name text, + uri text +); + + +-- +-- Name: TABLE quantification; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE quantification IS 'Quantification is the transformation of an image acquisition to numeric data. This typically involves statistical procedures.'; + + +-- +-- Name: quantification_quantification_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE quantification_quantification_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: quantification_quantification_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE quantification_quantification_id_seq OWNED BY quantification.quantification_id; + + +-- +-- Name: quantification_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE quantification_relationship ( + quantification_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + type_id integer NOT NULL, + object_id integer NOT NULL +); + + +-- +-- Name: TABLE quantification_relationship; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE quantification_relationship IS 'There may be multiple rounds of quantification, this allows us to keep an audit trail of what values went where.'; + + +-- +-- Name: quantification_relationship_quantification_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE quantification_relationship_quantification_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: quantification_relationship_quantification_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE quantification_relationship_quantification_relationship_id_seq OWNED BY quantification_relationship.quantification_relationship_id; + + +-- +-- Name: quantificationprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE quantificationprop ( + quantificationprop_id integer NOT NULL, + quantification_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE quantificationprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE quantificationprop IS 'Extra quantification properties that are not accounted for in quantification.'; + + +-- +-- Name: quantificationprop_quantificationprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE quantificationprop_quantificationprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: quantificationprop_quantificationprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE quantificationprop_quantificationprop_id_seq OWNED BY quantificationprop.quantificationprop_id; + + +-- +-- Name: search_by_gene; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE search_by_gene ( + feature_id integer, + analysis_id integer, + analysis_name character varying(255), + organism_id integer, + feature_name character varying(255), + feature_type_id integer, + landmark character varying(255), + fmin integer, + fmax integer, + strand smallint, + feature_type character varying(1025), + feature_nid integer, + analysis_nid integer +); + + +-- +-- Name: search_by_go; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE search_by_go ( + feature_id integer, + type_id integer, + feature_type character varying(1025), + organism_id integer, + feature_name character varying(255), + analysis_id integer, + analysis_name character varying(255), + source_analysis_id integer, + source_name character varying(255), + source_analysis_nid integer, + landmark character varying(255), + fmin integer, + fmax integer, + strand smallint, + go_cvterm_id integer, + go_name character varying(1025), + go_accession character varying(255), + feature_nid integer, + analysis_nid integer +); + + +-- +-- Name: search_by_homology; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE search_by_homology ( + feature_id integer, + type_id integer, + feature_type character varying(1025), + analysis_id integer, + analysis_name character varying(255), + source_analysis_id integer, + source_name character varying(255), + organism_id integer, + feature_name character varying(255), + landmark character varying(255), + fmin integer, + fmax integer, + strand smallint, + feature_nid integer, + analysis_nid integer, + source_analysis_nid integer +); + + +-- +-- Name: search_by_interpro; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE search_by_interpro ( + feature_id integer, + type_id integer, + feature_type character varying(1024), + analysis_id integer, + analysis_name character varying(255), + source_analysis_id integer, + source_name character varying(255), + organism_id integer, + feature_name character varying(255), + feature_type_id integer, + landmark character varying(255), + fmin integer, + fmax integer, + strand smallint, + accession character varying(255), + term_name character varying(1024), + feature_nid integer, + analysis_nid integer, + source_analysis_nid integer +); + + +-- +-- Name: search_by_kegg; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE search_by_kegg ( + feature_id integer, + type_id integer, + feature_type character varying(1025), + organism_id integer, + feature_name character varying(255), + analysis_id integer, + analysis_name character varying(255), + source_analysis_id integer, + source_name character varying(255), + source_analysis_nid integer, + landmark character varying(255), + fmin integer, + fmax integer, + strand smallint, + accession character varying(255), + kegg_term text, + feature_nid integer, + analysis_nid integer +); + + +-- +-- Name: search_by_map; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE search_by_map ( + featuremap_id integer NOT NULL, + featuremap_name character varying(256), + featuremap_nid integer, + organism character varying(512), + organism_id integer, + organism_nid integer, + pop_stock_id integer, + maternal_stock_id integer, + maternal_stock_uniquename character varying(255), + maternal_stock_nid integer, + paternal_stock_id integer, + paternal_stock_uniquename character varying(255), + paternal_stock_nid integer, + genome text, + pop_size text, + pop_type text, + num_of_lg integer, + num_of_loci integer +); + + +-- +-- Name: searchable_features; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE searchable_features ( + feature_id integer NOT NULL, + organism_id integer NOT NULL, + type_id integer NOT NULL, + feature_type character varying(1025) NOT NULL, + source_analysis_id integer NOT NULL, + source_name character varying(255) NOT NULL, + feature_name character varying(255) NOT NULL, + landmark character varying(255), + fmin integer, + fmax integer, + strand integer +); + + +-- +-- Name: species_summary; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE species_summary ( + organism_id integer NOT NULL, + species character varying(510) NOT NULL, + common_name character varying(255), + grin character varying(255), + haploid_chromosome_number text, + ploidy text, + geographic_origin text, + num_germplasm text, + num_sequences text, + num_libraries text, + organism_nid integer +); + + +-- +-- Name: stats_paths_to_root; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW stats_paths_to_root AS + SELECT cvtermpath.subject_id AS cvterm_id, + count(DISTINCT cvtermpath.cvtermpath_id) AS total_paths, + avg(cvtermpath.pathdistance) AS avg_distance, + min(cvtermpath.pathdistance) AS min_distance, + max(cvtermpath.pathdistance) AS max_distance + FROM (cvtermpath + JOIN cv_root ON ((cvtermpath.object_id = cv_root.root_cvterm_id))) + GROUP BY cvtermpath.subject_id; + + +-- +-- Name: VIEW stats_paths_to_root; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW stats_paths_to_root IS 'per-cvterm statistics on its +placement in the DAG relative to the root. There may be multiple paths +from any term to the root. This gives the total number of paths, and +the average minimum and maximum distances. Here distance is defined by +cvtermpath.pathdistance'; + + +-- +-- Name: stock; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock ( + stock_id integer NOT NULL, + dbxref_id integer, + organism_id integer, + name character varying(255), + uniquename text NOT NULL, + description text, + type_id integer NOT NULL, + is_obsolete boolean DEFAULT false NOT NULL +); + + +-- +-- Name: TABLE stock; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock IS 'Any stock can be globally identified by the +combination of organism, uniquename and stock type. A stock is the physical entities, either living or preserved, held by collections. Stocks belong to a collection; they have IDs, type, organism, description and may have a genotype.'; + + +-- +-- Name: COLUMN stock.dbxref_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock.dbxref_id IS 'The dbxref_id is an optional primary stable identifier for this stock. Secondary indentifiers and external dbxrefs go in table: stock_dbxref.'; + + +-- +-- Name: COLUMN stock.organism_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock.organism_id IS 'The organism_id is the organism to which the stock belongs. This column is mandatory.'; + + +-- +-- Name: COLUMN stock.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock.name IS 'The name is a human-readable local name for a stock.'; + + +-- +-- Name: COLUMN stock.description; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock.description IS 'The description is the genetic description provided in the stock list.'; + + +-- +-- Name: COLUMN stock.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock.type_id IS 'The type_id foreign key links to a controlled vocabulary of stock types. The would include living stock, genomic DNA, preserved specimen. Secondary cvterms for stocks would go in stock_cvterm.'; + + +-- +-- Name: stock_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_cvterm ( + stock_cvterm_id integer NOT NULL, + stock_id integer NOT NULL, + cvterm_id integer NOT NULL, + pub_id integer NOT NULL, + is_not boolean DEFAULT false NOT NULL, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE stock_cvterm; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock_cvterm IS 'stock_cvterm links a stock to cvterms. This is for secondary cvterms; primary cvterms should use stock.type_id.'; + + +-- +-- Name: stock_cvterm_stock_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_cvterm_stock_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_cvterm_stock_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_cvterm_stock_cvterm_id_seq OWNED BY stock_cvterm.stock_cvterm_id; + + +-- +-- Name: stock_cvtermprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_cvtermprop ( + stock_cvtermprop_id integer NOT NULL, + stock_cvterm_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE stock_cvtermprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock_cvtermprop IS 'Extensible properties for + stock to cvterm associations. Examples: GO evidence codes; + qualifiers; metadata such as the date on which the entry was curated + and the source of the association. See the stockprop table for + meanings of type_id, value and rank.'; + + +-- +-- Name: COLUMN stock_cvtermprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_cvtermprop.type_id IS 'The name of the + property/slot is a cvterm. The meaning of the property is defined in + that cvterm. cvterms may come from the OBO evidence code cv.'; + + +-- +-- Name: COLUMN stock_cvtermprop.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_cvtermprop.value IS 'The value of the + property, represented as text. Numeric values are converted to their + text representation. This is less efficient than using native database + types, but is easier to query.'; + + +-- +-- Name: COLUMN stock_cvtermprop.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_cvtermprop.rank IS 'Property-Value + ordering. Any stock_cvterm can have multiple values for any particular + property type - these are ordered in a list using rank, counting from + zero. For properties that are single-valued rather than multi-valued, + the default 0 value should be used.'; + + +-- +-- Name: stock_cvtermprop_stock_cvtermprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_cvtermprop_stock_cvtermprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_cvtermprop_stock_cvtermprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_cvtermprop_stock_cvtermprop_id_seq OWNED BY stock_cvtermprop.stock_cvtermprop_id; + + +-- +-- Name: stock_dbxref; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_dbxref ( + stock_dbxref_id integer NOT NULL, + stock_id integer NOT NULL, + dbxref_id integer NOT NULL, + is_current boolean DEFAULT true NOT NULL +); + + +-- +-- Name: TABLE stock_dbxref; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock_dbxref IS 'stock_dbxref links a stock to dbxrefs. This is for secondary identifiers; primary identifiers should use stock.dbxref_id.'; + + +-- +-- Name: COLUMN stock_dbxref.is_current; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_dbxref.is_current IS 'The is_current boolean indicates whether the linked dbxref is the current -official- dbxref for the linked stock.'; + + +-- +-- Name: stock_dbxref_stock_dbxref_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_dbxref_stock_dbxref_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_dbxref_stock_dbxref_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_dbxref_stock_dbxref_id_seq OWNED BY stock_dbxref.stock_dbxref_id; + + +-- +-- Name: stock_dbxrefprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_dbxrefprop ( + stock_dbxrefprop_id integer NOT NULL, + stock_dbxref_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE stock_dbxrefprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock_dbxrefprop IS 'A stock_dbxref can have any number of + slot-value property tags attached to it. This is useful for storing properties related to dbxref annotations of stocks, such as evidence codes, and references, and metadata, such as create/modify dates. This is an alternative to + hardcoding a list of columns in the relational schema, and is + completely extensible. There is a unique constraint, stock_dbxrefprop_c1, for + the combination of stock_dbxref_id, rank, and type_id. Multivalued property-value pairs must be differentiated by rank.'; + + +-- +-- Name: stock_dbxrefprop_stock_dbxrefprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_dbxrefprop_stock_dbxrefprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_dbxrefprop_stock_dbxrefprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_dbxrefprop_stock_dbxrefprop_id_seq OWNED BY stock_dbxrefprop.stock_dbxrefprop_id; + + +-- +-- Name: stock_genotype; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_genotype ( + stock_genotype_id integer NOT NULL, + stock_id integer NOT NULL, + genotype_id integer NOT NULL +); + + +-- +-- Name: TABLE stock_genotype; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock_genotype IS 'Simple table linking a stock to +a genotype. Features with genotypes can be linked to stocks thru feature_genotype -> genotype -> stock_genotype -> stock.'; + + +-- +-- Name: stock_genotype_stock_genotype_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_genotype_stock_genotype_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_genotype_stock_genotype_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_genotype_stock_genotype_id_seq OWNED BY stock_genotype.stock_genotype_id; + + +-- +-- Name: stock_image; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_image ( + stock_image_id integer NOT NULL, + stock_id integer NOT NULL, + eimage_id integer NOT NULL +); + + +-- +-- Name: stock_image_stock_image_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_image_stock_image_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_image_stock_image_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_image_stock_image_id_seq OWNED BY stock_image.stock_image_id; + + +-- +-- Name: stock_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_pub ( + stock_pub_id integer NOT NULL, + stock_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE stock_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock_pub IS 'Provenance. Linking table between stocks and, for example, a stocklist computer file.'; + + +-- +-- Name: stock_pub_stock_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_pub_stock_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_pub_stock_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_pub_stock_pub_id_seq OWNED BY stock_pub.stock_pub_id; + + +-- +-- Name: stock_relationship; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_relationship ( + stock_relationship_id integer NOT NULL, + subject_id integer NOT NULL, + object_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: COLUMN stock_relationship.subject_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_relationship.subject_id IS 'stock_relationship.subject_id is the subject of the subj-predicate-obj sentence. This is typically the substock.'; + + +-- +-- Name: COLUMN stock_relationship.object_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_relationship.object_id IS 'stock_relationship.object_id is the object of the subj-predicate-obj sentence. This is typically the container stock.'; + + +-- +-- Name: COLUMN stock_relationship.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_relationship.type_id IS 'stock_relationship.type_id is relationship type between subject and object. This is a cvterm, typically from the OBO relationship ontology, although other relationship types are allowed.'; + + +-- +-- Name: COLUMN stock_relationship.value; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_relationship.value IS 'stock_relationship.value is for additional notes or comments.'; + + +-- +-- Name: COLUMN stock_relationship.rank; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stock_relationship.rank IS 'stock_relationship.rank is the ordering of subject stocks with respect to the object stock may be important where rank is used to order these; starts from zero.'; + + +-- +-- Name: stock_relationship_cvterm; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_relationship_cvterm ( + stock_relationship_cvterm_id integer NOT NULL, + stock_relationship_id integer NOT NULL, + cvterm_id integer NOT NULL, + pub_id integer +); + + +-- +-- Name: TABLE stock_relationship_cvterm; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock_relationship_cvterm IS 'For germplasm maintenance and pedigree data, stock_relationship. type_id will record cvterms such as "is a female parent of", "a parent for mutation", "is a group_id of", "is a source_id of", etc The cvterms for higher categories such as "generative", "derivative" or "maintenance" can be stored in table stock_relationship_cvterm'; + + +-- +-- Name: stock_relationship_cvterm_stock_relationship_cvterm_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_relationship_cvterm_stock_relationship_cvterm_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_relationship_cvterm_stock_relationship_cvterm_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_relationship_cvterm_stock_relationship_cvterm_id_seq OWNED BY stock_relationship_cvterm.stock_relationship_cvterm_id; + + +-- +-- Name: stock_relationship_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stock_relationship_pub ( + stock_relationship_pub_id integer NOT NULL, + stock_relationship_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE stock_relationship_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stock_relationship_pub IS 'Provenance. Attach optional evidence to a stock_relationship in the form of a chado.tion.'; + + +-- +-- Name: stock_relationship_pub_stock_relationship_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_relationship_pub_stock_relationship_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_relationship_pub_stock_relationship_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_relationship_pub_stock_relationship_pub_id_seq OWNED BY stock_relationship_pub.stock_relationship_pub_id; + + +-- +-- Name: stock_relationship_stock_relationship_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_relationship_stock_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_relationship_stock_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_relationship_stock_relationship_id_seq OWNED BY stock_relationship.stock_relationship_id; + + +-- +-- Name: stock_stock_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stock_stock_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stock_stock_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stock_stock_id_seq OWNED BY stock.stock_id; + + +-- +-- Name: stockcollection; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stockcollection ( + stockcollection_id integer NOT NULL, + type_id integer NOT NULL, + contact_id integer, + name character varying(255), + uniquename text NOT NULL +); + + +-- +-- Name: TABLE stockcollection; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stockcollection IS 'The lab or stock center distributing the stocks in their collection.'; + + +-- +-- Name: COLUMN stockcollection.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stockcollection.type_id IS 'type_id is the collection type cv.'; + + +-- +-- Name: COLUMN stockcollection.contact_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stockcollection.contact_id IS 'contact_id links to the contact information for the collection.'; + + +-- +-- Name: COLUMN stockcollection.name; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stockcollection.name IS 'name is the collection.'; + + +-- +-- Name: COLUMN stockcollection.uniquename; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stockcollection.uniquename IS 'uniqename is the value of the collection cv.'; + + +-- +-- Name: stockcollection_stock; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stockcollection_stock ( + stockcollection_stock_id integer NOT NULL, + stockcollection_id integer NOT NULL, + stock_id integer NOT NULL +); + + +-- +-- Name: TABLE stockcollection_stock; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stockcollection_stock IS 'stockcollection_stock links +a stock collection to the stocks which are contained in the collection.'; + + +-- +-- Name: stockcollection_stock_stockcollection_stock_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stockcollection_stock_stockcollection_stock_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stockcollection_stock_stockcollection_stock_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stockcollection_stock_stockcollection_stock_id_seq OWNED BY stockcollection_stock.stockcollection_stock_id; + + +-- +-- Name: stockcollection_stockcollection_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stockcollection_stockcollection_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stockcollection_stockcollection_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stockcollection_stockcollection_id_seq OWNED BY stockcollection.stockcollection_id; + + +-- +-- Name: stockcollectionprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stockcollectionprop ( + stockcollectionprop_id integer NOT NULL, + stockcollection_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE stockcollectionprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stockcollectionprop IS 'The table stockcollectionprop +contains the value of the stock collection such as website/email URLs; +the value of the stock collection order URLs.'; + + +-- +-- Name: COLUMN stockcollectionprop.type_id; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON COLUMN stockcollectionprop.type_id IS 'The cv for the type_id is "stockcollection property type".'; + + +-- +-- Name: stockcollectionprop_stockcollectionprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stockcollectionprop_stockcollectionprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stockcollectionprop_stockcollectionprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stockcollectionprop_stockcollectionprop_id_seq OWNED BY stockcollectionprop.stockcollectionprop_id; + + +-- +-- Name: stockprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stockprop ( + stockprop_id integer NOT NULL, + stock_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE stockprop; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stockprop IS 'A stock can have any number of +slot-value property tags attached to it. This is an alternative to +hardcoding a list of columns in the relational schema, and is +completely extensible. There is a unique constraint, stockprop_c1, for +the combination of stock_id, rank, and type_id. Multivalued property-value pairs must be differentiated by rank.'; + + +-- +-- Name: stockprop_pub; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE stockprop_pub ( + stockprop_pub_id integer NOT NULL, + stockprop_id integer NOT NULL, + pub_id integer NOT NULL +); + + +-- +-- Name: TABLE stockprop_pub; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE stockprop_pub IS 'Provenance. Any stockprop assignment can optionally be supported by a chado.tion.'; + + +-- +-- Name: stockprop_pub_stockprop_pub_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stockprop_pub_stockprop_pub_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stockprop_pub_stockprop_pub_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stockprop_pub_stockprop_pub_id_seq OWNED BY stockprop_pub.stockprop_pub_id; + + +-- +-- Name: stockprop_stockprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE stockprop_stockprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: stockprop_stockprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE stockprop_stockprop_id_seq OWNED BY stockprop.stockprop_id; + + +-- +-- Name: study; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE study ( + study_id integer NOT NULL, + contact_id integer NOT NULL, + pub_id integer, + dbxref_id integer, + name text NOT NULL, + description text +); + + +-- +-- Name: study_assay; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE study_assay ( + study_assay_id integer NOT NULL, + study_id integer NOT NULL, + assay_id integer NOT NULL +); + + +-- +-- Name: study_assay_study_assay_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE study_assay_study_assay_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_assay_study_assay_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE study_assay_study_assay_id_seq OWNED BY study_assay.study_assay_id; + + +-- +-- Name: study_study_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE study_study_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_study_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE study_study_id_seq OWNED BY study.study_id; + + +-- +-- Name: studydesign; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE studydesign ( + studydesign_id integer NOT NULL, + study_id integer NOT NULL, + description text +); + + +-- +-- Name: studydesign_studydesign_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE studydesign_studydesign_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: studydesign_studydesign_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE studydesign_studydesign_id_seq OWNED BY studydesign.studydesign_id; + + +-- +-- Name: studydesignprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE studydesignprop ( + studydesignprop_id integer NOT NULL, + studydesign_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: studydesignprop_studydesignprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE studydesignprop_studydesignprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: studydesignprop_studydesignprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE studydesignprop_studydesignprop_id_seq OWNED BY studydesignprop.studydesignprop_id; + + +-- +-- Name: studyfactor; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE studyfactor ( + studyfactor_id integer NOT NULL, + studydesign_id integer NOT NULL, + type_id integer, + name text NOT NULL, + description text +); + + +-- +-- Name: studyfactor_studyfactor_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE studyfactor_studyfactor_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: studyfactor_studyfactor_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE studyfactor_studyfactor_id_seq OWNED BY studyfactor.studyfactor_id; + + +-- +-- Name: studyfactorvalue; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE studyfactorvalue ( + studyfactorvalue_id integer NOT NULL, + studyfactor_id integer NOT NULL, + assay_id integer NOT NULL, + factorvalue text, + name text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: studyfactorvalue_studyfactorvalue_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE studyfactorvalue_studyfactorvalue_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: studyfactorvalue_studyfactorvalue_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE studyfactorvalue_studyfactorvalue_id_seq OWNED BY studyfactorvalue.studyfactorvalue_id; + + +-- +-- Name: studyprop; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE studyprop ( + studyprop_id integer NOT NULL, + study_id integer NOT NULL, + type_id integer NOT NULL, + value text, + rank integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: studyprop_feature; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE studyprop_feature ( + studyprop_feature_id integer NOT NULL, + studyprop_id integer NOT NULL, + feature_id integer NOT NULL, + type_id integer +); + + +-- +-- Name: studyprop_feature_studyprop_feature_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE studyprop_feature_studyprop_feature_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: studyprop_feature_studyprop_feature_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE studyprop_feature_studyprop_feature_id_seq OWNED BY studyprop_feature.studyprop_feature_id; + + +-- +-- Name: studyprop_studyprop_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE studyprop_studyprop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: studyprop_studyprop_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE studyprop_studyprop_id_seq OWNED BY studyprop.studyprop_id; + + +-- +-- Name: synonym_synonym_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE synonym_synonym_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: synonym_synonym_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE synonym_synonym_id_seq OWNED BY synonym.synonym_id; + + +-- +-- Name: tableinfo; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE tableinfo ( + tableinfo_id integer NOT NULL, + name character varying(30) NOT NULL, + primary_key_column character varying(30), + is_view integer DEFAULT 0 NOT NULL, + view_on_table_id integer, + superclass_table_id integer, + is_updateable integer DEFAULT 1 NOT NULL, + modification_date date DEFAULT now() NOT NULL +); + + +-- +-- Name: tableinfo_tableinfo_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE tableinfo_tableinfo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: tableinfo_tableinfo_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE tableinfo_tableinfo_id_seq OWNED BY tableinfo.tableinfo_id; + + +-- +-- Name: test1; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE test1 ( + id integer NOT NULL, + uniquename character varying, + a character varying, + r character varying, + z character varying +); + + +-- +-- Name: test2; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE test2 ( + id integer NOT NULL, + uniquename character varying, + a character varying, + b character varying, + p character varying +); + + +-- +-- Name: test3; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE test3 ( + id integer NOT NULL, + uniquename character varying, + a character varying, + c character varying +); + + +-- +-- Name: treatment; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE treatment ( + treatment_id integer NOT NULL, + rank integer DEFAULT 0 NOT NULL, + biomaterial_id integer NOT NULL, + type_id integer NOT NULL, + protocol_id integer, + name text +); + + +-- +-- Name: TABLE treatment; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON TABLE treatment IS 'A biomaterial may undergo multiple +treatments. Examples of treatments: apoxia, fluorophore and biotin labeling.'; + + +-- +-- Name: treatment_treatment_id_seq; Type: SEQUENCE; Schema: chado; Owner: - +-- + +CREATE SEQUENCE treatment_treatment_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: treatment_treatment_id_seq; Type: SEQUENCE OWNED BY; Schema: chado; Owner: - +-- + +ALTER SEQUENCE treatment_treatment_id_seq OWNED BY treatment.treatment_id; + + +-- +-- Name: tripal_gff_temp; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE tripal_gff_temp ( + feature_id integer NOT NULL, + organism_id integer NOT NULL, + uniquename text NOT NULL, + type_name character varying(1024) NOT NULL +); + + +-- +-- Name: tripal_gffcds_temp; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE tripal_gffcds_temp ( + feature_id integer NOT NULL, + parent_id integer NOT NULL, + phase integer NOT NULL, + strand integer NOT NULL, + fmin integer NOT NULL, + fmax integer NOT NULL +); + + +-- +-- Name: tripal_gffprotein_temp; Type: TABLE; Schema: chado; Owner: -; Tablespace: +-- + +CREATE TABLE tripal_gffprotein_temp ( + feature_id integer NOT NULL, + parent_id integer NOT NULL, + fmin integer NOT NULL, + fmax integer NOT NULL +); + + +-- +-- Name: type_feature_count; Type: VIEW; Schema: chado; Owner: - +-- + +CREATE VIEW type_feature_count AS + SELECT t.name AS type, + count(*) AS num_features + FROM (cvterm t + JOIN feature ON ((feature.type_id = t.cvterm_id))) + GROUP BY t.name; + + +-- +-- Name: VIEW type_feature_count; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON VIEW type_feature_count IS 'per-feature-type feature counts'; + + +-- +-- Name: acquisition_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisition ALTER COLUMN acquisition_id SET DEFAULT nextval('acquisition_acquisition_id_seq'::regclass); + + +-- +-- Name: acquisition_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisition_relationship ALTER COLUMN acquisition_relationship_id SET DEFAULT nextval('acquisition_relationship_acquisition_relationship_id_seq'::regclass); + + +-- +-- Name: acquisitionprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisitionprop ALTER COLUMN acquisitionprop_id SET DEFAULT nextval('acquisitionprop_acquisitionprop_id_seq'::regclass); + + +-- +-- Name: analysis_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysis ALTER COLUMN analysis_id SET DEFAULT nextval('analysis_analysis_id_seq'::regclass); + + +-- +-- Name: analysisfeature_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysisfeature ALTER COLUMN analysisfeature_id SET DEFAULT nextval('analysisfeature_analysisfeature_id_seq'::regclass); + + +-- +-- Name: analysisfeatureprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysisfeatureprop ALTER COLUMN analysisfeatureprop_id SET DEFAULT nextval('analysisfeatureprop_analysisfeatureprop_id_seq'::regclass); + + +-- +-- Name: analysisprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysisprop ALTER COLUMN analysisprop_id SET DEFAULT nextval('analysisprop_analysisprop_id_seq'::regclass); + + +-- +-- Name: arraydesign_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesign ALTER COLUMN arraydesign_id SET DEFAULT nextval('arraydesign_arraydesign_id_seq'::regclass); + + +-- +-- Name: arraydesignprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesignprop ALTER COLUMN arraydesignprop_id SET DEFAULT nextval('arraydesignprop_arraydesignprop_id_seq'::regclass); + + +-- +-- Name: assay_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay ALTER COLUMN assay_id SET DEFAULT nextval('assay_assay_id_seq'::regclass); + + +-- +-- Name: assay_biomaterial_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay_biomaterial ALTER COLUMN assay_biomaterial_id SET DEFAULT nextval('assay_biomaterial_assay_biomaterial_id_seq'::regclass); + + +-- +-- Name: assay_project_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay_project ALTER COLUMN assay_project_id SET DEFAULT nextval('assay_project_assay_project_id_seq'::regclass); + + +-- +-- Name: assayprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assayprop ALTER COLUMN assayprop_id SET DEFAULT nextval('assayprop_assayprop_id_seq'::regclass); + + +-- +-- Name: biomaterial_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial ALTER COLUMN biomaterial_id SET DEFAULT nextval('biomaterial_biomaterial_id_seq'::regclass); + + +-- +-- Name: biomaterial_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_dbxref ALTER COLUMN biomaterial_dbxref_id SET DEFAULT nextval('biomaterial_dbxref_biomaterial_dbxref_id_seq'::regclass); + + +-- +-- Name: biomaterial_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_relationship ALTER COLUMN biomaterial_relationship_id SET DEFAULT nextval('biomaterial_relationship_biomaterial_relationship_id_seq'::regclass); + + +-- +-- Name: biomaterial_treatment_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_treatment ALTER COLUMN biomaterial_treatment_id SET DEFAULT nextval('biomaterial_treatment_biomaterial_treatment_id_seq'::regclass); + + +-- +-- Name: biomaterialprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterialprop ALTER COLUMN biomaterialprop_id SET DEFAULT nextval('biomaterialprop_biomaterialprop_id_seq'::regclass); + + +-- +-- Name: blast_org_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY blast_organisms ALTER COLUMN blast_org_id SET DEFAULT nextval('blast_organisms_blast_org_id_seq'::regclass); + + +-- +-- Name: cell_line_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line ALTER COLUMN cell_line_id SET DEFAULT nextval('cell_line_cell_line_id_seq'::regclass); + + +-- +-- Name: cell_line_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_cvterm ALTER COLUMN cell_line_cvterm_id SET DEFAULT nextval('cell_line_cvterm_cell_line_cvterm_id_seq'::regclass); + + +-- +-- Name: cell_line_cvtermprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_cvtermprop ALTER COLUMN cell_line_cvtermprop_id SET DEFAULT nextval('cell_line_cvtermprop_cell_line_cvtermprop_id_seq'::regclass); + + +-- +-- Name: cell_line_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_dbxref ALTER COLUMN cell_line_dbxref_id SET DEFAULT nextval('cell_line_dbxref_cell_line_dbxref_id_seq'::regclass); + + +-- +-- Name: cell_line_feature_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_feature ALTER COLUMN cell_line_feature_id SET DEFAULT nextval('cell_line_feature_cell_line_feature_id_seq'::regclass); + + +-- +-- Name: cell_line_library_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_library ALTER COLUMN cell_line_library_id SET DEFAULT nextval('cell_line_library_cell_line_library_id_seq'::regclass); + + +-- +-- Name: cell_line_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_pub ALTER COLUMN cell_line_pub_id SET DEFAULT nextval('cell_line_pub_cell_line_pub_id_seq'::regclass); + + +-- +-- Name: cell_line_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_relationship ALTER COLUMN cell_line_relationship_id SET DEFAULT nextval('cell_line_relationship_cell_line_relationship_id_seq'::regclass); + + +-- +-- Name: cell_line_synonym_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_synonym ALTER COLUMN cell_line_synonym_id SET DEFAULT nextval('cell_line_synonym_cell_line_synonym_id_seq'::regclass); + + +-- +-- Name: cell_lineprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_lineprop ALTER COLUMN cell_lineprop_id SET DEFAULT nextval('cell_lineprop_cell_lineprop_id_seq'::regclass); + + +-- +-- Name: cell_lineprop_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_lineprop_pub ALTER COLUMN cell_lineprop_pub_id SET DEFAULT nextval('cell_lineprop_pub_cell_lineprop_pub_id_seq'::regclass); + + +-- +-- Name: chadoprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY chadoprop ALTER COLUMN chadoprop_id SET DEFAULT nextval('chadoprop_chadoprop_id_seq'::regclass); + + +-- +-- Name: channel_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY channel ALTER COLUMN channel_id SET DEFAULT nextval('channel_channel_id_seq'::regclass); + + +-- +-- Name: contact_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact ALTER COLUMN contact_id SET DEFAULT nextval('contact_contact_id_seq'::regclass); + + +-- +-- Name: contact_image_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact_image ALTER COLUMN contact_image_id SET DEFAULT nextval('contact_image_contact_image_id_seq'::regclass); + + +-- +-- Name: contact_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact_relationship ALTER COLUMN contact_relationship_id SET DEFAULT nextval('contact_relationship_contact_relationship_id_seq'::regclass); + + +-- +-- Name: contactprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contactprop ALTER COLUMN contactprop_id SET DEFAULT nextval('contactprop_contactprop_id_seq'::regclass); + + +-- +-- Name: control_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY control ALTER COLUMN control_id SET DEFAULT nextval('control_control_id_seq'::regclass); + + +-- +-- Name: cv_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cv ALTER COLUMN cv_id SET DEFAULT nextval('cv_cv_id_seq'::regclass); + + +-- +-- Name: cvprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvprop ALTER COLUMN cvprop_id SET DEFAULT nextval('cvprop_cvprop_id_seq'::regclass); + + +-- +-- Name: cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm ALTER COLUMN cvterm_id SET DEFAULT nextval('cvterm_cvterm_id_seq'::regclass); + + +-- +-- Name: cvterm_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm_dbxref ALTER COLUMN cvterm_dbxref_id SET DEFAULT nextval('cvterm_dbxref_cvterm_dbxref_id_seq'::regclass); + + +-- +-- Name: cvterm_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm_relationship ALTER COLUMN cvterm_relationship_id SET DEFAULT nextval('cvterm_relationship_cvterm_relationship_id_seq'::regclass); + + +-- +-- Name: cvtermpath_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermpath ALTER COLUMN cvtermpath_id SET DEFAULT nextval('cvtermpath_cvtermpath_id_seq'::regclass); + + +-- +-- Name: cvtermprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermprop ALTER COLUMN cvtermprop_id SET DEFAULT nextval('cvtermprop_cvtermprop_id_seq'::regclass); + + +-- +-- Name: cvtermsynonym_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermsynonym ALTER COLUMN cvtermsynonym_id SET DEFAULT nextval('cvtermsynonym_cvtermsynonym_id_seq'::regclass); + + +-- +-- Name: db_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY db ALTER COLUMN db_id SET DEFAULT nextval('db_db_id_seq'::regclass); + + +-- +-- Name: dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY dbxref ALTER COLUMN dbxref_id SET DEFAULT nextval('dbxref_dbxref_id_seq'::regclass); + + +-- +-- Name: dbxrefprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY dbxrefprop ALTER COLUMN dbxrefprop_id SET DEFAULT nextval('dbxrefprop_dbxrefprop_id_seq'::regclass); + + +-- +-- Name: eimage_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY eimage ALTER COLUMN eimage_id SET DEFAULT nextval('eimage_eimage_id_seq'::regclass); + + +-- +-- Name: eimageprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY eimageprop ALTER COLUMN eimageprop_id SET DEFAULT nextval('eimageprop_eimageprop_id_seq'::regclass); + + +-- +-- Name: element_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element ALTER COLUMN element_id SET DEFAULT nextval('element_element_id_seq'::regclass); + + +-- +-- Name: element_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element_relationship ALTER COLUMN element_relationship_id SET DEFAULT nextval('element_relationship_element_relationship_id_seq'::regclass); + + +-- +-- Name: elementresult_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY elementresult ALTER COLUMN elementresult_id SET DEFAULT nextval('elementresult_elementresult_id_seq'::regclass); + + +-- +-- Name: elementresult_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY elementresult_relationship ALTER COLUMN elementresult_relationship_id SET DEFAULT nextval('elementresult_relationship_elementresult_relationship_id_seq'::regclass); + + +-- +-- Name: environment_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY environment ALTER COLUMN environment_id SET DEFAULT nextval('environment_environment_id_seq'::regclass); + + +-- +-- Name: environment_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY environment_cvterm ALTER COLUMN environment_cvterm_id SET DEFAULT nextval('environment_cvterm_environment_cvterm_id_seq'::regclass); + + +-- +-- Name: expression_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression ALTER COLUMN expression_id SET DEFAULT nextval('expression_expression_id_seq'::regclass); + + +-- +-- Name: expression_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_cvterm ALTER COLUMN expression_cvterm_id SET DEFAULT nextval('expression_cvterm_expression_cvterm_id_seq'::regclass); + + +-- +-- Name: expression_cvtermprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_cvtermprop ALTER COLUMN expression_cvtermprop_id SET DEFAULT nextval('expression_cvtermprop_expression_cvtermprop_id_seq'::regclass); + + +-- +-- Name: expression_image_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_image ALTER COLUMN expression_image_id SET DEFAULT nextval('expression_image_expression_image_id_seq'::regclass); + + +-- +-- Name: expression_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_pub ALTER COLUMN expression_pub_id SET DEFAULT nextval('expression_pub_expression_pub_id_seq'::regclass); + + +-- +-- Name: expressionprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expressionprop ALTER COLUMN expressionprop_id SET DEFAULT nextval('expressionprop_expressionprop_id_seq'::regclass); + + +-- +-- Name: feature_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature ALTER COLUMN feature_id SET DEFAULT nextval('feature_feature_id_seq'::regclass); + + +-- +-- Name: feature_contact_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_contact ALTER COLUMN feature_contact_id SET DEFAULT nextval('feature_contact_feature_contact_id_seq'::regclass); + + +-- +-- Name: feature_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm ALTER COLUMN feature_cvterm_id SET DEFAULT nextval('feature_cvterm_feature_cvterm_id_seq'::regclass); + + +-- +-- Name: feature_cvterm_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm_dbxref ALTER COLUMN feature_cvterm_dbxref_id SET DEFAULT nextval('feature_cvterm_dbxref_feature_cvterm_dbxref_id_seq'::regclass); + + +-- +-- Name: feature_cvterm_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm_pub ALTER COLUMN feature_cvterm_pub_id SET DEFAULT nextval('feature_cvterm_pub_feature_cvterm_pub_id_seq'::regclass); + + +-- +-- Name: feature_cvtermprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvtermprop ALTER COLUMN feature_cvtermprop_id SET DEFAULT nextval('feature_cvtermprop_feature_cvtermprop_id_seq'::regclass); + + +-- +-- Name: feature_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_dbxref ALTER COLUMN feature_dbxref_id SET DEFAULT nextval('feature_dbxref_feature_dbxref_id_seq'::regclass); + + +-- +-- Name: feature_expression_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_expression ALTER COLUMN feature_expression_id SET DEFAULT nextval('feature_expression_feature_expression_id_seq'::regclass); + + +-- +-- Name: feature_expressionprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_expressionprop ALTER COLUMN feature_expressionprop_id SET DEFAULT nextval('feature_expressionprop_feature_expressionprop_id_seq'::regclass); + + +-- +-- Name: feature_genotype_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_genotype ALTER COLUMN feature_genotype_id SET DEFAULT nextval('feature_genotype_feature_genotype_id_seq'::regclass); + + +-- +-- Name: feature_image_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_image ALTER COLUMN feature_image_id SET DEFAULT nextval('feature_image_feature_image_id_seq'::regclass); + + +-- +-- Name: feature_nd_geolocation_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_nd_geolocation ALTER COLUMN feature_nd_geolocation_id SET DEFAULT nextval('feature_nd_geolocation_feature_nd_geolocation_id_seq'::regclass); + + +-- +-- Name: feature_phenotype_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_phenotype ALTER COLUMN feature_phenotype_id SET DEFAULT nextval('feature_phenotype_feature_phenotype_id_seq'::regclass); + + +-- +-- Name: feature_project_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_project ALTER COLUMN feature_project_id SET DEFAULT nextval('feature_project_feature_project_id_seq'::regclass); + + +-- +-- Name: feature_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_pub ALTER COLUMN feature_pub_id SET DEFAULT nextval('feature_pub_feature_pub_id_seq'::regclass); + + +-- +-- Name: feature_pubprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_pubprop ALTER COLUMN feature_pubprop_id SET DEFAULT nextval('feature_pubprop_feature_pubprop_id_seq'::regclass); + + +-- +-- Name: feature_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationship ALTER COLUMN feature_relationship_id SET DEFAULT nextval('feature_relationship_feature_relationship_id_seq'::regclass); + + +-- +-- Name: feature_relationship_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationship_pub ALTER COLUMN feature_relationship_pub_id SET DEFAULT nextval('feature_relationship_pub_feature_relationship_pub_id_seq'::regclass); + + +-- +-- Name: feature_relationshipprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationshipprop ALTER COLUMN feature_relationshipprop_id SET DEFAULT nextval('feature_relationshipprop_feature_relationshipprop_id_seq'::regclass); + + +-- +-- Name: feature_relationshipprop_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationshipprop_pub ALTER COLUMN feature_relationshipprop_pub_id SET DEFAULT nextval('feature_relationshipprop_pub_feature_relationshipprop_pub_i_seq'::regclass); + + +-- +-- Name: feature_stock_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_stock ALTER COLUMN feature_stock_id SET DEFAULT nextval('feature_stock_feature_stock_id_seq'::regclass); + + +-- +-- Name: feature_synonym_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_synonym ALTER COLUMN feature_synonym_id SET DEFAULT nextval('feature_synonym_feature_synonym_id_seq'::regclass); + + +-- +-- Name: featureloc_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureloc ALTER COLUMN featureloc_id SET DEFAULT nextval('featureloc_featureloc_id_seq'::regclass); + + +-- +-- Name: featureloc_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureloc_pub ALTER COLUMN featureloc_pub_id SET DEFAULT nextval('featureloc_pub_featureloc_pub_id_seq'::regclass); + + +-- +-- Name: featuremap_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap ALTER COLUMN featuremap_id SET DEFAULT nextval('featuremap_featuremap_id_seq'::regclass); + + +-- +-- Name: featuremap_contact_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_contact ALTER COLUMN featuremap_contact_id SET DEFAULT nextval('featuremap_contact_featuremap_contact_id_seq'::regclass); + + +-- +-- Name: featuremap_organism_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_organism ALTER COLUMN featuremap_organism_id SET DEFAULT nextval('featuremap_organism_featuremap_organism_id_seq'::regclass); + + +-- +-- Name: featuremap_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_pub ALTER COLUMN featuremap_pub_id SET DEFAULT nextval('featuremap_pub_featuremap_pub_id_seq'::regclass); + + +-- +-- Name: featuremap_stock_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_stock ALTER COLUMN featuremap_stock_id SET DEFAULT nextval('featuremap_stock_featuremap_stock_id_seq'::regclass); + + +-- +-- Name: featuremapprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremapprop ALTER COLUMN featuremapprop_id SET DEFAULT nextval('featuremapprop_featuremapprop_id_seq'::regclass); + + +-- +-- Name: featurepos_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurepos ALTER COLUMN featurepos_id SET DEFAULT nextval('featurepos_featurepos_id_seq'::regclass); + + +-- +-- Name: featureposprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureposprop ALTER COLUMN featureposprop_id SET DEFAULT nextval('featureposprop_featureposprop_id_seq'::regclass); + + +-- +-- Name: featureprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureprop ALTER COLUMN featureprop_id SET DEFAULT nextval('featureprop_featureprop_id_seq'::regclass); + + +-- +-- Name: featureprop_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureprop_pub ALTER COLUMN featureprop_pub_id SET DEFAULT nextval('featureprop_pub_featureprop_pub_id_seq'::regclass); + + +-- +-- Name: featurerange_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurerange ALTER COLUMN featurerange_id SET DEFAULT nextval('featurerange_featurerange_id_seq'::regclass); + + +-- +-- Name: genotype_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotype ALTER COLUMN genotype_id SET DEFAULT nextval('genotype_genotype_id_seq'::regclass); + + +-- +-- Name: genotype_call_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotype_call ALTER COLUMN genotype_call_id SET DEFAULT nextval('genotype_call_genotype_call_id_seq'::regclass); + + +-- +-- Name: genotypeprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotypeprop ALTER COLUMN genotypeprop_id SET DEFAULT nextval('genotypeprop_genotypeprop_id_seq'::regclass); + + +-- +-- Name: library_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library ALTER COLUMN library_id SET DEFAULT nextval('library_library_id_seq'::regclass); + + +-- +-- Name: library_contact_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_contact ALTER COLUMN library_contact_id SET DEFAULT nextval('library_contact_library_contact_id_seq'::regclass); + + +-- +-- Name: library_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_cvterm ALTER COLUMN library_cvterm_id SET DEFAULT nextval('library_cvterm_library_cvterm_id_seq'::regclass); + + +-- +-- Name: library_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_dbxref ALTER COLUMN library_dbxref_id SET DEFAULT nextval('library_dbxref_library_dbxref_id_seq'::regclass); + + +-- +-- Name: library_feature_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_feature ALTER COLUMN library_feature_id SET DEFAULT nextval('library_feature_library_feature_id_seq'::regclass); + + +-- +-- Name: library_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_pub ALTER COLUMN library_pub_id SET DEFAULT nextval('library_pub_library_pub_id_seq'::regclass); + + +-- +-- Name: library_stock_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_stock ALTER COLUMN library_stock_id SET DEFAULT nextval('library_stock_library_stock_id_seq'::regclass); + + +-- +-- Name: library_synonym_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_synonym ALTER COLUMN library_synonym_id SET DEFAULT nextval('library_synonym_library_synonym_id_seq'::regclass); + + +-- +-- Name: libraryprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY libraryprop ALTER COLUMN libraryprop_id SET DEFAULT nextval('libraryprop_libraryprop_id_seq'::regclass); + + +-- +-- Name: libraryprop_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY libraryprop_pub ALTER COLUMN libraryprop_pub_id SET DEFAULT nextval('libraryprop_pub_libraryprop_pub_id_seq'::regclass); + + +-- +-- Name: magedocumentation_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY magedocumentation ALTER COLUMN magedocumentation_id SET DEFAULT nextval('magedocumentation_magedocumentation_id_seq'::regclass); + + +-- +-- Name: mageml_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY mageml ALTER COLUMN mageml_id SET DEFAULT nextval('mageml_mageml_id_seq'::regclass); + + +-- +-- Name: materialized_view_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY materialized_view ALTER COLUMN materialized_view_id SET DEFAULT nextval('materialized_view_materialized_view_id_seq'::regclass); + + +-- +-- Name: nd_experiment_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment ALTER COLUMN nd_experiment_id SET DEFAULT nextval('nd_experiment_nd_experiment_id_seq'::regclass); + + +-- +-- Name: nd_experiment_contact_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_contact ALTER COLUMN nd_experiment_contact_id SET DEFAULT nextval('nd_experiment_contact_nd_experiment_contact_id_seq'::regclass); + + +-- +-- Name: nd_experiment_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_dbxref ALTER COLUMN nd_experiment_dbxref_id SET DEFAULT nextval('nd_experiment_dbxref_nd_experiment_dbxref_id_seq'::regclass); + + +-- +-- Name: nd_experiment_genotype_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_genotype ALTER COLUMN nd_experiment_genotype_id SET DEFAULT nextval('nd_experiment_genotype_nd_experiment_genotype_id_seq'::regclass); + + +-- +-- Name: nd_experiment_phenotype_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_phenotype ALTER COLUMN nd_experiment_phenotype_id SET DEFAULT nextval('nd_experiment_phenotype_nd_experiment_phenotype_id_seq'::regclass); + + +-- +-- Name: nd_experiment_project_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_project ALTER COLUMN nd_experiment_project_id SET DEFAULT nextval('nd_experiment_project_nd_experiment_project_id_seq'::regclass); + + +-- +-- Name: nd_experiment_protocol_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_protocol ALTER COLUMN nd_experiment_protocol_id SET DEFAULT nextval('nd_experiment_protocol_nd_experiment_protocol_id_seq'::regclass); + + +-- +-- Name: nd_experiment_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_pub ALTER COLUMN nd_experiment_pub_id SET DEFAULT nextval('nd_experiment_pub_nd_experiment_pub_id_seq'::regclass); + + +-- +-- Name: nd_experiment_stock_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stock ALTER COLUMN nd_experiment_stock_id SET DEFAULT nextval('nd_experiment_stock_nd_experiment_stock_id_seq'::regclass); + + +-- +-- Name: nd_experiment_stock_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stock_dbxref ALTER COLUMN nd_experiment_stock_dbxref_id SET DEFAULT nextval('nd_experiment_stock_dbxref_nd_experiment_stock_dbxref_id_seq'::regclass); + + +-- +-- Name: nd_experiment_stockprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stockprop ALTER COLUMN nd_experiment_stockprop_id SET DEFAULT nextval('nd_experiment_stockprop_nd_experiment_stockprop_id_seq'::regclass); + + +-- +-- Name: nd_experimentprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experimentprop ALTER COLUMN nd_experimentprop_id SET DEFAULT nextval('nd_experimentprop_nd_experimentprop_id_seq'::regclass); + + +-- +-- Name: nd_geolocation_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_geolocation ALTER COLUMN nd_geolocation_id SET DEFAULT nextval('nd_geolocation_nd_geolocation_id_seq'::regclass); + + +-- +-- Name: nd_geolocationprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_geolocationprop ALTER COLUMN nd_geolocationprop_id SET DEFAULT nextval('nd_geolocationprop_nd_geolocationprop_id_seq'::regclass); + + +-- +-- Name: nd_protocol_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocol ALTER COLUMN nd_protocol_id SET DEFAULT nextval('nd_protocol_nd_protocol_id_seq'::regclass); + + +-- +-- Name: nd_protocol_reagent_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocol_reagent ALTER COLUMN nd_protocol_reagent_id SET DEFAULT nextval('nd_protocol_reagent_nd_protocol_reagent_id_seq'::regclass); + + +-- +-- Name: nd_protocolprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocolprop ALTER COLUMN nd_protocolprop_id SET DEFAULT nextval('nd_protocolprop_nd_protocolprop_id_seq'::regclass); + + +-- +-- Name: nd_reagent_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagent ALTER COLUMN nd_reagent_id SET DEFAULT nextval('nd_reagent_nd_reagent_id_seq'::regclass); + + +-- +-- Name: nd_reagent_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagent_relationship ALTER COLUMN nd_reagent_relationship_id SET DEFAULT nextval('nd_reagent_relationship_nd_reagent_relationship_id_seq'::regclass); + + +-- +-- Name: nd_reagentprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagentprop ALTER COLUMN nd_reagentprop_id SET DEFAULT nextval('nd_reagentprop_nd_reagentprop_id_seq'::regclass); + + +-- +-- Name: organism_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism ALTER COLUMN organism_id SET DEFAULT nextval('organism_organism_id_seq'::regclass); + + +-- +-- Name: organism_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_dbxref ALTER COLUMN organism_dbxref_id SET DEFAULT nextval('organism_dbxref_organism_dbxref_id_seq'::regclass); + + +-- +-- Name: organism_image_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_image ALTER COLUMN organism_image_id SET DEFAULT nextval('organism_image_organism_image_id_seq'::regclass); + + +-- +-- Name: organism_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_pub ALTER COLUMN organism_pub_id SET DEFAULT nextval('organism_pub_organism_pub_id_seq'::regclass); + + +-- +-- Name: organism_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_relationship ALTER COLUMN organism_relationship_id SET DEFAULT nextval('organism_relationship_organism_relationship_id_seq'::regclass); + + +-- +-- Name: organismprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organismprop ALTER COLUMN organismprop_id SET DEFAULT nextval('organismprop_organismprop_id_seq'::regclass); + + +-- +-- Name: phendesc_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phendesc ALTER COLUMN phendesc_id SET DEFAULT nextval('phendesc_phendesc_id_seq'::regclass); + + +-- +-- Name: phenotype_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype ALTER COLUMN phenotype_id SET DEFAULT nextval('phenotype_phenotype_id_seq'::regclass); + + +-- +-- Name: phenotype_comparison_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison ALTER COLUMN phenotype_comparison_id SET DEFAULT nextval('phenotype_comparison_phenotype_comparison_id_seq'::regclass); + + +-- +-- Name: phenotype_comparison_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison_cvterm ALTER COLUMN phenotype_comparison_cvterm_id SET DEFAULT nextval('phenotype_comparison_cvterm_phenotype_comparison_cvterm_id_seq'::regclass); + + +-- +-- Name: phenotype_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_cvterm ALTER COLUMN phenotype_cvterm_id SET DEFAULT nextval('phenotype_cvterm_phenotype_cvterm_id_seq'::regclass); + + +-- +-- Name: phenstatement_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatement ALTER COLUMN phenstatement_id SET DEFAULT nextval('phenstatement_phenstatement_id_seq'::regclass); + + +-- +-- Name: phenstatementprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatementprop ALTER COLUMN phenstatementprop_id SET DEFAULT nextval('phenstatementprop_phenstatementprop_id_seq'::regclass); + + +-- +-- Name: phylonode_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode ALTER COLUMN phylonode_id SET DEFAULT nextval('phylonode_phylonode_id_seq'::regclass); + + +-- +-- Name: phylonode_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_dbxref ALTER COLUMN phylonode_dbxref_id SET DEFAULT nextval('phylonode_dbxref_phylonode_dbxref_id_seq'::regclass); + + +-- +-- Name: phylonode_organism_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_organism ALTER COLUMN phylonode_organism_id SET DEFAULT nextval('phylonode_organism_phylonode_organism_id_seq'::regclass); + + +-- +-- Name: phylonode_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_pub ALTER COLUMN phylonode_pub_id SET DEFAULT nextval('phylonode_pub_phylonode_pub_id_seq'::regclass); + + +-- +-- Name: phylonode_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_relationship ALTER COLUMN phylonode_relationship_id SET DEFAULT nextval('phylonode_relationship_phylonode_relationship_id_seq'::regclass); + + +-- +-- Name: phylonodeprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonodeprop ALTER COLUMN phylonodeprop_id SET DEFAULT nextval('phylonodeprop_phylonodeprop_id_seq'::regclass); + + +-- +-- Name: phylotree_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylotree ALTER COLUMN phylotree_id SET DEFAULT nextval('phylotree_phylotree_id_seq'::regclass); + + +-- +-- Name: phylotree_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylotree_pub ALTER COLUMN phylotree_pub_id SET DEFAULT nextval('phylotree_pub_phylotree_pub_id_seq'::regclass); + + +-- +-- Name: project_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project ALTER COLUMN project_id SET DEFAULT nextval('project_project_id_seq'::regclass); + + +-- +-- Name: project_contact_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_contact ALTER COLUMN project_contact_id SET DEFAULT nextval('project_contact_project_contact_id_seq'::regclass); + + +-- +-- Name: project_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_pub ALTER COLUMN project_pub_id SET DEFAULT nextval('project_pub_project_pub_id_seq'::regclass); + + +-- +-- Name: project_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_relationship ALTER COLUMN project_relationship_id SET DEFAULT nextval('project_relationship_project_relationship_id_seq'::regclass); + + +-- +-- Name: projectprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY projectprop ALTER COLUMN projectprop_id SET DEFAULT nextval('projectprop_projectprop_id_seq'::regclass); + + +-- +-- Name: protocol_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY protocol ALTER COLUMN protocol_id SET DEFAULT nextval('protocol_protocol_id_seq'::regclass); + + +-- +-- Name: protocolparam_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY protocolparam ALTER COLUMN protocolparam_id SET DEFAULT nextval('protocolparam_protocolparam_id_seq'::regclass); + + +-- +-- Name: pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub ALTER COLUMN pub_id SET DEFAULT nextval('pub_pub_id_seq'::regclass); + + +-- +-- Name: pub_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub_dbxref ALTER COLUMN pub_dbxref_id SET DEFAULT nextval('pub_dbxref_pub_dbxref_id_seq'::regclass); + + +-- +-- Name: pub_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub_relationship ALTER COLUMN pub_relationship_id SET DEFAULT nextval('pub_relationship_pub_relationship_id_seq'::regclass); + + +-- +-- Name: pubauthor_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pubauthor ALTER COLUMN pubauthor_id SET DEFAULT nextval('pubauthor_pubauthor_id_seq'::regclass); + + +-- +-- Name: pubauthor_contact_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pubauthor_contact ALTER COLUMN pubauthor_contact_id SET DEFAULT nextval('pubauthor_contact_pubauthor_contact_id_seq'::regclass); + + +-- +-- Name: pubprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pubprop ALTER COLUMN pubprop_id SET DEFAULT nextval('pubprop_pubprop_id_seq'::regclass); + + +-- +-- Name: quantification_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantification ALTER COLUMN quantification_id SET DEFAULT nextval('quantification_quantification_id_seq'::regclass); + + +-- +-- Name: quantification_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantification_relationship ALTER COLUMN quantification_relationship_id SET DEFAULT nextval('quantification_relationship_quantification_relationship_id_seq'::regclass); + + +-- +-- Name: quantificationprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantificationprop ALTER COLUMN quantificationprop_id SET DEFAULT nextval('quantificationprop_quantificationprop_id_seq'::regclass); + + +-- +-- Name: stock_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock ALTER COLUMN stock_id SET DEFAULT nextval('stock_stock_id_seq'::regclass); + + +-- +-- Name: stock_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_cvterm ALTER COLUMN stock_cvterm_id SET DEFAULT nextval('stock_cvterm_stock_cvterm_id_seq'::regclass); + + +-- +-- Name: stock_cvtermprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_cvtermprop ALTER COLUMN stock_cvtermprop_id SET DEFAULT nextval('stock_cvtermprop_stock_cvtermprop_id_seq'::regclass); + + +-- +-- Name: stock_dbxref_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_dbxref ALTER COLUMN stock_dbxref_id SET DEFAULT nextval('stock_dbxref_stock_dbxref_id_seq'::regclass); + + +-- +-- Name: stock_dbxrefprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_dbxrefprop ALTER COLUMN stock_dbxrefprop_id SET DEFAULT nextval('stock_dbxrefprop_stock_dbxrefprop_id_seq'::regclass); + + +-- +-- Name: stock_genotype_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_genotype ALTER COLUMN stock_genotype_id SET DEFAULT nextval('stock_genotype_stock_genotype_id_seq'::regclass); + + +-- +-- Name: stock_image_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_image ALTER COLUMN stock_image_id SET DEFAULT nextval('stock_image_stock_image_id_seq'::regclass); + + +-- +-- Name: stock_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_pub ALTER COLUMN stock_pub_id SET DEFAULT nextval('stock_pub_stock_pub_id_seq'::regclass); + + +-- +-- Name: stock_relationship_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship ALTER COLUMN stock_relationship_id SET DEFAULT nextval('stock_relationship_stock_relationship_id_seq'::regclass); + + +-- +-- Name: stock_relationship_cvterm_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship_cvterm ALTER COLUMN stock_relationship_cvterm_id SET DEFAULT nextval('stock_relationship_cvterm_stock_relationship_cvterm_id_seq'::regclass); + + +-- +-- Name: stock_relationship_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship_pub ALTER COLUMN stock_relationship_pub_id SET DEFAULT nextval('stock_relationship_pub_stock_relationship_pub_id_seq'::regclass); + + +-- +-- Name: stockcollection_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollection ALTER COLUMN stockcollection_id SET DEFAULT nextval('stockcollection_stockcollection_id_seq'::regclass); + + +-- +-- Name: stockcollection_stock_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollection_stock ALTER COLUMN stockcollection_stock_id SET DEFAULT nextval('stockcollection_stock_stockcollection_stock_id_seq'::regclass); + + +-- +-- Name: stockcollectionprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollectionprop ALTER COLUMN stockcollectionprop_id SET DEFAULT nextval('stockcollectionprop_stockcollectionprop_id_seq'::regclass); + + +-- +-- Name: stockprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockprop ALTER COLUMN stockprop_id SET DEFAULT nextval('stockprop_stockprop_id_seq'::regclass); + + +-- +-- Name: stockprop_pub_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockprop_pub ALTER COLUMN stockprop_pub_id SET DEFAULT nextval('stockprop_pub_stockprop_pub_id_seq'::regclass); + + +-- +-- Name: study_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY study ALTER COLUMN study_id SET DEFAULT nextval('study_study_id_seq'::regclass); + + +-- +-- Name: study_assay_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY study_assay ALTER COLUMN study_assay_id SET DEFAULT nextval('study_assay_study_assay_id_seq'::regclass); + + +-- +-- Name: studydesign_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studydesign ALTER COLUMN studydesign_id SET DEFAULT nextval('studydesign_studydesign_id_seq'::regclass); + + +-- +-- Name: studydesignprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studydesignprop ALTER COLUMN studydesignprop_id SET DEFAULT nextval('studydesignprop_studydesignprop_id_seq'::regclass); + + +-- +-- Name: studyfactor_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyfactor ALTER COLUMN studyfactor_id SET DEFAULT nextval('studyfactor_studyfactor_id_seq'::regclass); + + +-- +-- Name: studyfactorvalue_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyfactorvalue ALTER COLUMN studyfactorvalue_id SET DEFAULT nextval('studyfactorvalue_studyfactorvalue_id_seq'::regclass); + + +-- +-- Name: studyprop_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyprop ALTER COLUMN studyprop_id SET DEFAULT nextval('studyprop_studyprop_id_seq'::regclass); + + +-- +-- Name: studyprop_feature_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyprop_feature ALTER COLUMN studyprop_feature_id SET DEFAULT nextval('studyprop_feature_studyprop_feature_id_seq'::regclass); + + +-- +-- Name: synonym_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY synonym ALTER COLUMN synonym_id SET DEFAULT nextval('synonym_synonym_id_seq'::regclass); + + +-- +-- Name: tableinfo_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY tableinfo ALTER COLUMN tableinfo_id SET DEFAULT nextval('tableinfo_tableinfo_id_seq'::regclass); + + +-- +-- Name: treatment_id; Type: DEFAULT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY treatment ALTER COLUMN treatment_id SET DEFAULT nextval('treatment_treatment_id_seq'::regclass); + + +-- +-- Name: acquisition_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY acquisition + ADD CONSTRAINT acquisition_c1 UNIQUE (name); + + +-- +-- Name: acquisition_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY acquisition + ADD CONSTRAINT acquisition_pkey PRIMARY KEY (acquisition_id); + + +-- +-- Name: acquisition_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY acquisition_relationship + ADD CONSTRAINT acquisition_relationship_c1 UNIQUE (subject_id, object_id, type_id, rank); + + +-- +-- Name: acquisition_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY acquisition_relationship + ADD CONSTRAINT acquisition_relationship_pkey PRIMARY KEY (acquisition_relationship_id); + + +-- +-- Name: acquisitionprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY acquisitionprop + ADD CONSTRAINT acquisitionprop_c1 UNIQUE (acquisition_id, type_id, rank); + + +-- +-- Name: acquisitionprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY acquisitionprop + ADD CONSTRAINT acquisitionprop_pkey PRIMARY KEY (acquisitionprop_id); + + +-- +-- Name: analysis_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY analysis + ADD CONSTRAINT analysis_pkey PRIMARY KEY (analysis_id); + + +-- +-- Name: analysisfeature_feature_id_analysis_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY analysisfeature + ADD CONSTRAINT analysisfeature_feature_id_analysis_id_key UNIQUE (feature_id, analysis_id); + + +-- +-- Name: analysisfeature_id_type_id_rank; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY analysisfeatureprop + ADD CONSTRAINT analysisfeature_id_type_id_rank UNIQUE (analysisfeature_id, type_id, rank); + + +-- +-- Name: analysisfeature_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY analysisfeature + ADD CONSTRAINT analysisfeature_pkey PRIMARY KEY (analysisfeature_id); + + +-- +-- Name: analysisfeatureprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY analysisfeatureprop + ADD CONSTRAINT analysisfeatureprop_pkey PRIMARY KEY (analysisfeatureprop_id); + + +-- +-- Name: analysisprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY analysisprop + ADD CONSTRAINT analysisprop_c1 UNIQUE (analysis_id, type_id, rank); + + +-- +-- Name: analysisprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY analysisprop + ADD CONSTRAINT analysisprop_pkey PRIMARY KEY (analysisprop_id); + + +-- +-- Name: arraydesign_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY arraydesign + ADD CONSTRAINT arraydesign_c1 UNIQUE (name); + + +-- +-- Name: arraydesign_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY arraydesign + ADD CONSTRAINT arraydesign_pkey PRIMARY KEY (arraydesign_id); + + +-- +-- Name: arraydesignprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY arraydesignprop + ADD CONSTRAINT arraydesignprop_c1 UNIQUE (arraydesign_id, type_id, rank); + + +-- +-- Name: arraydesignprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY arraydesignprop + ADD CONSTRAINT arraydesignprop_pkey PRIMARY KEY (arraydesignprop_id); + + +-- +-- Name: assay_biomaterial_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY assay_biomaterial + ADD CONSTRAINT assay_biomaterial_c1 UNIQUE (assay_id, biomaterial_id, channel_id, rank); + + +-- +-- Name: assay_biomaterial_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY assay_biomaterial + ADD CONSTRAINT assay_biomaterial_pkey PRIMARY KEY (assay_biomaterial_id); + + +-- +-- Name: assay_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY assay + ADD CONSTRAINT assay_c1 UNIQUE (name); + + +-- +-- Name: assay_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY assay + ADD CONSTRAINT assay_pkey PRIMARY KEY (assay_id); + + +-- +-- Name: assay_project_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY assay_project + ADD CONSTRAINT assay_project_c1 UNIQUE (assay_id, project_id); + + +-- +-- Name: assay_project_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY assay_project + ADD CONSTRAINT assay_project_pkey PRIMARY KEY (assay_project_id); + + +-- +-- Name: assayprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY assayprop + ADD CONSTRAINT assayprop_c1 UNIQUE (assay_id, type_id, rank); + + +-- +-- Name: assayprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY assayprop + ADD CONSTRAINT assayprop_pkey PRIMARY KEY (assayprop_id); + + +-- +-- Name: biomaterial_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterial + ADD CONSTRAINT biomaterial_c1 UNIQUE (name); + + +-- +-- Name: biomaterial_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterial_dbxref + ADD CONSTRAINT biomaterial_dbxref_c1 UNIQUE (biomaterial_id, dbxref_id); + + +-- +-- Name: biomaterial_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterial_dbxref + ADD CONSTRAINT biomaterial_dbxref_pkey PRIMARY KEY (biomaterial_dbxref_id); + + +-- +-- Name: biomaterial_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterial + ADD CONSTRAINT biomaterial_pkey PRIMARY KEY (biomaterial_id); + + +-- +-- Name: biomaterial_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterial_relationship + ADD CONSTRAINT biomaterial_relationship_c1 UNIQUE (subject_id, object_id, type_id); + + +-- +-- Name: biomaterial_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterial_relationship + ADD CONSTRAINT biomaterial_relationship_pkey PRIMARY KEY (biomaterial_relationship_id); + + +-- +-- Name: biomaterial_treatment_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterial_treatment + ADD CONSTRAINT biomaterial_treatment_c1 UNIQUE (biomaterial_id, treatment_id); + + +-- +-- Name: biomaterial_treatment_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterial_treatment + ADD CONSTRAINT biomaterial_treatment_pkey PRIMARY KEY (biomaterial_treatment_id); + + +-- +-- Name: biomaterialprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterialprop + ADD CONSTRAINT biomaterialprop_c1 UNIQUE (biomaterial_id, type_id, rank); + + +-- +-- Name: biomaterialprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY biomaterialprop + ADD CONSTRAINT biomaterialprop_pkey PRIMARY KEY (biomaterialprop_id); + + +-- +-- Name: blast_organisms_blast_org_name_uq_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blast_organisms + ADD CONSTRAINT blast_organisms_blast_org_name_uq_key UNIQUE (blast_org_name); + + +-- +-- Name: blast_organisms_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blast_organisms + ADD CONSTRAINT blast_organisms_pkey PRIMARY KEY (blast_org_id); + + +-- +-- Name: cell_line_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line + ADD CONSTRAINT cell_line_c1 UNIQUE (uniquename, organism_id); + + +-- +-- Name: cell_line_cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_cvterm + ADD CONSTRAINT cell_line_cvterm_c1 UNIQUE (cell_line_id, cvterm_id, pub_id, rank); + + +-- +-- Name: cell_line_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_cvterm + ADD CONSTRAINT cell_line_cvterm_pkey PRIMARY KEY (cell_line_cvterm_id); + + +-- +-- Name: cell_line_cvtermprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_cvtermprop + ADD CONSTRAINT cell_line_cvtermprop_c1 UNIQUE (cell_line_cvterm_id, type_id, rank); + + +-- +-- Name: cell_line_cvtermprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_cvtermprop + ADD CONSTRAINT cell_line_cvtermprop_pkey PRIMARY KEY (cell_line_cvtermprop_id); + + +-- +-- Name: cell_line_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_dbxref + ADD CONSTRAINT cell_line_dbxref_c1 UNIQUE (cell_line_id, dbxref_id); + + +-- +-- Name: cell_line_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_dbxref + ADD CONSTRAINT cell_line_dbxref_pkey PRIMARY KEY (cell_line_dbxref_id); + + +-- +-- Name: cell_line_feature_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_feature + ADD CONSTRAINT cell_line_feature_c1 UNIQUE (cell_line_id, feature_id, pub_id); + + +-- +-- Name: cell_line_feature_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_feature + ADD CONSTRAINT cell_line_feature_pkey PRIMARY KEY (cell_line_feature_id); + + +-- +-- Name: cell_line_library_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_library + ADD CONSTRAINT cell_line_library_c1 UNIQUE (cell_line_id, library_id, pub_id); + + +-- +-- Name: cell_line_library_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_library + ADD CONSTRAINT cell_line_library_pkey PRIMARY KEY (cell_line_library_id); + + +-- +-- Name: cell_line_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line + ADD CONSTRAINT cell_line_pkey PRIMARY KEY (cell_line_id); + + +-- +-- Name: cell_line_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_pub + ADD CONSTRAINT cell_line_pub_c1 UNIQUE (cell_line_id, pub_id); + + +-- +-- Name: cell_line_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_pub + ADD CONSTRAINT cell_line_pub_pkey PRIMARY KEY (cell_line_pub_id); + + +-- +-- Name: cell_line_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_relationship + ADD CONSTRAINT cell_line_relationship_c1 UNIQUE (subject_id, object_id, type_id); + + +-- +-- Name: cell_line_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_relationship + ADD CONSTRAINT cell_line_relationship_pkey PRIMARY KEY (cell_line_relationship_id); + + +-- +-- Name: cell_line_synonym_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_synonym + ADD CONSTRAINT cell_line_synonym_c1 UNIQUE (synonym_id, cell_line_id, pub_id); + + +-- +-- Name: cell_line_synonym_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_line_synonym + ADD CONSTRAINT cell_line_synonym_pkey PRIMARY KEY (cell_line_synonym_id); + + +-- +-- Name: cell_lineprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_lineprop + ADD CONSTRAINT cell_lineprop_c1 UNIQUE (cell_line_id, type_id, rank); + + +-- +-- Name: cell_lineprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_lineprop + ADD CONSTRAINT cell_lineprop_pkey PRIMARY KEY (cell_lineprop_id); + + +-- +-- Name: cell_lineprop_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_lineprop_pub + ADD CONSTRAINT cell_lineprop_pub_c1 UNIQUE (cell_lineprop_id, pub_id); + + +-- +-- Name: cell_lineprop_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cell_lineprop_pub + ADD CONSTRAINT cell_lineprop_pub_pkey PRIMARY KEY (cell_lineprop_pub_id); + + +-- +-- Name: chadoprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY chadoprop + ADD CONSTRAINT chadoprop_c1 UNIQUE (type_id, rank); + + +-- +-- Name: chadoprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY chadoprop + ADD CONSTRAINT chadoprop_pkey PRIMARY KEY (chadoprop_id); + + +-- +-- Name: channel_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY channel + ADD CONSTRAINT channel_c1 UNIQUE (name); + + +-- +-- Name: channel_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY channel + ADD CONSTRAINT channel_pkey PRIMARY KEY (channel_id); + + +-- +-- Name: contact_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact + ADD CONSTRAINT contact_c1 UNIQUE (name); + + +-- +-- Name: contact_image_contact_id_eimage_id_type_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact_image + ADD CONSTRAINT contact_image_contact_id_eimage_id_type_id_key UNIQUE (contact_id, eimage_id, type_id); + + +-- +-- Name: contact_image_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact_image + ADD CONSTRAINT contact_image_pkey PRIMARY KEY (contact_image_id); + + +-- +-- Name: contact_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact + ADD CONSTRAINT contact_pkey PRIMARY KEY (contact_id); + + +-- +-- Name: contact_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact_relationship + ADD CONSTRAINT contact_relationship_c1 UNIQUE (subject_id, object_id, type_id); + + +-- +-- Name: contact_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact_relationship + ADD CONSTRAINT contact_relationship_pkey PRIMARY KEY (contact_relationship_id); + + +-- +-- Name: contactprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contactprop + ADD CONSTRAINT contactprop_c1 UNIQUE (contact_id, type_id, rank); + + +-- +-- Name: contactprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contactprop + ADD CONSTRAINT contactprop_pkey PRIMARY KEY (contactprop_id); + + +-- +-- Name: content_type_chado_analysis_unigene_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY content_type_chado_analysis_unigene + ADD CONSTRAINT content_type_chado_analysis_unigene_pkey PRIMARY KEY (vid); + + +-- +-- Name: control_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY control + ADD CONSTRAINT control_pkey PRIMARY KEY (control_id); + + +-- +-- Name: cvprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvprop + ADD CONSTRAINT cvprop_c1 UNIQUE (cv_id, type_id, rank); + + +-- +-- Name: cvprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvprop + ADD CONSTRAINT cvprop_pkey PRIMARY KEY (cvprop_id); + + +-- +-- Name: cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvterm + ADD CONSTRAINT cvterm_c1 UNIQUE (name, cv_id, is_obsolete); + + +-- +-- Name: cvterm_c2; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvterm + ADD CONSTRAINT cvterm_c2 UNIQUE (dbxref_id); + + +-- +-- Name: cvterm_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvterm_dbxref + ADD CONSTRAINT cvterm_dbxref_c1 UNIQUE (cvterm_id, dbxref_id); + + +-- +-- Name: cvterm_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvterm_dbxref + ADD CONSTRAINT cvterm_dbxref_pkey PRIMARY KEY (cvterm_dbxref_id); + + +-- +-- Name: cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvterm + ADD CONSTRAINT cvterm_pkey PRIMARY KEY (cvterm_id); + + +-- +-- Name: cvterm_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvterm_relationship + ADD CONSTRAINT cvterm_relationship_c1 UNIQUE (subject_id, object_id, type_id); + + +-- +-- Name: cvterm_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvterm_relationship + ADD CONSTRAINT cvterm_relationship_pkey PRIMARY KEY (cvterm_relationship_id); + + +-- +-- Name: cvtermpath_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvtermpath + ADD CONSTRAINT cvtermpath_c1 UNIQUE (subject_id, object_id, type_id, pathdistance); + + +-- +-- Name: cvtermpath_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvtermpath + ADD CONSTRAINT cvtermpath_pkey PRIMARY KEY (cvtermpath_id); + + +-- +-- Name: cvtermprop_cvterm_id_type_id_value_rank_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvtermprop + ADD CONSTRAINT cvtermprop_cvterm_id_type_id_value_rank_key UNIQUE (cvterm_id, type_id, value, rank); + + +-- +-- Name: cvtermprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvtermprop + ADD CONSTRAINT cvtermprop_pkey PRIMARY KEY (cvtermprop_id); + + +-- +-- Name: cvtermsynonym_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvtermsynonym + ADD CONSTRAINT cvtermsynonym_c1 UNIQUE (cvterm_id, synonym); + + +-- +-- Name: cvtermsynonym_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cvtermsynonym + ADD CONSTRAINT cvtermsynonym_pkey PRIMARY KEY (cvtermsynonym_id); + + +-- +-- Name: db_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY db + ADD CONSTRAINT db_c1 UNIQUE (name); + + +-- +-- Name: db_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY db + ADD CONSTRAINT db_pkey PRIMARY KEY (db_id); + + +-- +-- Name: dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dbxref + ADD CONSTRAINT dbxref_c1 UNIQUE (db_id, accession, version); + + +-- +-- Name: dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dbxref + ADD CONSTRAINT dbxref_pkey PRIMARY KEY (dbxref_id); + + +-- +-- Name: dbxrefprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dbxrefprop + ADD CONSTRAINT dbxrefprop_c1 UNIQUE (dbxref_id, type_id, rank); + + +-- +-- Name: dbxrefprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY dbxrefprop + ADD CONSTRAINT dbxrefprop_pkey PRIMARY KEY (dbxrefprop_id); + + +-- +-- Name: eimage_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY eimage + ADD CONSTRAINT eimage_pkey PRIMARY KEY (eimage_id); + + +-- +-- Name: eimageprop_eimage_id_type_id_rank_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY eimageprop + ADD CONSTRAINT eimageprop_eimage_id_type_id_rank_key UNIQUE (eimage_id, type_id, rank); + + +-- +-- Name: eimageprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY eimageprop + ADD CONSTRAINT eimageprop_pkey PRIMARY KEY (eimageprop_id); + + +-- +-- Name: element_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY element + ADD CONSTRAINT element_c1 UNIQUE (feature_id, arraydesign_id); + + +-- +-- Name: element_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY element + ADD CONSTRAINT element_pkey PRIMARY KEY (element_id); + + +-- +-- Name: element_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY element_relationship + ADD CONSTRAINT element_relationship_c1 UNIQUE (subject_id, object_id, type_id, rank); + + +-- +-- Name: element_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY element_relationship + ADD CONSTRAINT element_relationship_pkey PRIMARY KEY (element_relationship_id); + + +-- +-- Name: elementresult_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY elementresult + ADD CONSTRAINT elementresult_c1 UNIQUE (element_id, quantification_id); + + +-- +-- Name: elementresult_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY elementresult + ADD CONSTRAINT elementresult_pkey PRIMARY KEY (elementresult_id); + + +-- +-- Name: elementresult_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY elementresult_relationship + ADD CONSTRAINT elementresult_relationship_c1 UNIQUE (subject_id, object_id, type_id, rank); + + +-- +-- Name: elementresult_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY elementresult_relationship + ADD CONSTRAINT elementresult_relationship_pkey PRIMARY KEY (elementresult_relationship_id); + + +-- +-- Name: environment_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY environment + ADD CONSTRAINT environment_c1 UNIQUE (uniquename); + + +-- +-- Name: environment_cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY environment_cvterm + ADD CONSTRAINT environment_cvterm_c1 UNIQUE (environment_id, cvterm_id); + + +-- +-- Name: environment_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY environment_cvterm + ADD CONSTRAINT environment_cvterm_pkey PRIMARY KEY (environment_cvterm_id); + + +-- +-- Name: environment_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY environment + ADD CONSTRAINT environment_pkey PRIMARY KEY (environment_id); + + +-- +-- Name: expression_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression + ADD CONSTRAINT expression_c1 UNIQUE (uniquename); + + +-- +-- Name: expression_cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression_cvterm + ADD CONSTRAINT expression_cvterm_c1 UNIQUE (expression_id, cvterm_id, cvterm_type_id); + + +-- +-- Name: expression_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression_cvterm + ADD CONSTRAINT expression_cvterm_pkey PRIMARY KEY (expression_cvterm_id); + + +-- +-- Name: expression_cvtermprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression_cvtermprop + ADD CONSTRAINT expression_cvtermprop_c1 UNIQUE (expression_cvterm_id, type_id, rank); + + +-- +-- Name: expression_cvtermprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression_cvtermprop + ADD CONSTRAINT expression_cvtermprop_pkey PRIMARY KEY (expression_cvtermprop_id); + + +-- +-- Name: expression_image_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression_image + ADD CONSTRAINT expression_image_c1 UNIQUE (expression_id, eimage_id); + + +-- +-- Name: expression_image_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression_image + ADD CONSTRAINT expression_image_pkey PRIMARY KEY (expression_image_id); + + +-- +-- Name: expression_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression + ADD CONSTRAINT expression_pkey PRIMARY KEY (expression_id); + + +-- +-- Name: expression_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression_pub + ADD CONSTRAINT expression_pub_c1 UNIQUE (expression_id, pub_id); + + +-- +-- Name: expression_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expression_pub + ADD CONSTRAINT expression_pub_pkey PRIMARY KEY (expression_pub_id); + + +-- +-- Name: expressionprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expressionprop + ADD CONSTRAINT expressionprop_c1 UNIQUE (expression_id, type_id, rank); + + +-- +-- Name: expressionprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY expressionprop + ADD CONSTRAINT expressionprop_pkey PRIMARY KEY (expressionprop_id); + + +-- +-- Name: feature_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature + ADD CONSTRAINT feature_c1 UNIQUE (organism_id, uniquename, type_id); + + +-- +-- Name: feature_contact_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_contact + ADD CONSTRAINT feature_contact_c1 UNIQUE (feature_id, contact_id); + + +-- +-- Name: feature_contact_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_contact + ADD CONSTRAINT feature_contact_pkey PRIMARY KEY (feature_contact_id); + + +-- +-- Name: feature_cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_cvterm + ADD CONSTRAINT feature_cvterm_c1 UNIQUE (feature_id, cvterm_id, pub_id, rank); + + +-- +-- Name: feature_cvterm_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_cvterm_dbxref + ADD CONSTRAINT feature_cvterm_dbxref_c1 UNIQUE (feature_cvterm_id, dbxref_id); + + +-- +-- Name: feature_cvterm_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_cvterm_dbxref + ADD CONSTRAINT feature_cvterm_dbxref_pkey PRIMARY KEY (feature_cvterm_dbxref_id); + + +-- +-- Name: feature_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_cvterm + ADD CONSTRAINT feature_cvterm_pkey PRIMARY KEY (feature_cvterm_id); + + +-- +-- Name: feature_cvterm_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_cvterm_pub + ADD CONSTRAINT feature_cvterm_pub_c1 UNIQUE (feature_cvterm_id, pub_id); + + +-- +-- Name: feature_cvterm_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_cvterm_pub + ADD CONSTRAINT feature_cvterm_pub_pkey PRIMARY KEY (feature_cvterm_pub_id); + + +-- +-- Name: feature_cvtermprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_cvtermprop + ADD CONSTRAINT feature_cvtermprop_c1 UNIQUE (feature_cvterm_id, type_id, rank); + + +-- +-- Name: feature_cvtermprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_cvtermprop + ADD CONSTRAINT feature_cvtermprop_pkey PRIMARY KEY (feature_cvtermprop_id); + + +-- +-- Name: feature_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_dbxref + ADD CONSTRAINT feature_dbxref_c1 UNIQUE (feature_id, dbxref_id); + + +-- +-- Name: feature_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_dbxref + ADD CONSTRAINT feature_dbxref_pkey PRIMARY KEY (feature_dbxref_id); + + +-- +-- Name: feature_expression_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_expression + ADD CONSTRAINT feature_expression_c1 UNIQUE (expression_id, feature_id, pub_id); + + +-- +-- Name: feature_expression_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_expression + ADD CONSTRAINT feature_expression_pkey PRIMARY KEY (feature_expression_id); + + +-- +-- Name: feature_expressionprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_expressionprop + ADD CONSTRAINT feature_expressionprop_c1 UNIQUE (feature_expression_id, type_id, rank); + + +-- +-- Name: feature_expressionprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_expressionprop + ADD CONSTRAINT feature_expressionprop_pkey PRIMARY KEY (feature_expressionprop_id); + + +-- +-- Name: feature_genotype_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_genotype + ADD CONSTRAINT feature_genotype_c1 UNIQUE (feature_id, genotype_id, cvterm_id, chromosome_id, rank, cgroup); + + +-- +-- Name: feature_genotype_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_genotype + ADD CONSTRAINT feature_genotype_pkey PRIMARY KEY (feature_genotype_id); + + +-- +-- Name: feature_image_feature_id_eimage_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_image + ADD CONSTRAINT feature_image_feature_id_eimage_id_key UNIQUE (feature_id, eimage_id); + + +-- +-- Name: feature_image_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_image + ADD CONSTRAINT feature_image_pkey PRIMARY KEY (feature_image_id); + + +-- +-- Name: feature_nd_geolocation_feature_id_nd_geolocation_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_nd_geolocation + ADD CONSTRAINT feature_nd_geolocation_feature_id_nd_geolocation_id_key UNIQUE (feature_id, nd_geolocation_id); + + +-- +-- Name: feature_nd_geolocation_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_nd_geolocation + ADD CONSTRAINT feature_nd_geolocation_pkey PRIMARY KEY (feature_nd_geolocation_id); + + +-- +-- Name: feature_phenotype_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_phenotype + ADD CONSTRAINT feature_phenotype_c1 UNIQUE (feature_id, phenotype_id); + + +-- +-- Name: feature_phenotype_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_phenotype + ADD CONSTRAINT feature_phenotype_pkey PRIMARY KEY (feature_phenotype_id); + + +-- +-- Name: feature_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature + ADD CONSTRAINT feature_pkey PRIMARY KEY (feature_id); + + +-- +-- Name: feature_project_feature_id_project_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_project + ADD CONSTRAINT feature_project_feature_id_project_id_key UNIQUE (feature_id, project_id); + + +-- +-- Name: feature_project_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_project + ADD CONSTRAINT feature_project_pkey PRIMARY KEY (feature_project_id); + + +-- +-- Name: feature_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_pub + ADD CONSTRAINT feature_pub_c1 UNIQUE (feature_id, pub_id); + + +-- +-- Name: feature_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_pub + ADD CONSTRAINT feature_pub_pkey PRIMARY KEY (feature_pub_id); + + +-- +-- Name: feature_pubprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_pubprop + ADD CONSTRAINT feature_pubprop_c1 UNIQUE (feature_pub_id, type_id, rank); + + +-- +-- Name: feature_pubprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_pubprop + ADD CONSTRAINT feature_pubprop_pkey PRIMARY KEY (feature_pubprop_id); + + +-- +-- Name: feature_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_relationship + ADD CONSTRAINT feature_relationship_c1 UNIQUE (subject_id, object_id, type_id, rank); + + +-- +-- Name: feature_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_relationship + ADD CONSTRAINT feature_relationship_pkey PRIMARY KEY (feature_relationship_id); + + +-- +-- Name: feature_relationship_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_relationship_pub + ADD CONSTRAINT feature_relationship_pub_c1 UNIQUE (feature_relationship_id, pub_id); + + +-- +-- Name: feature_relationship_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_relationship_pub + ADD CONSTRAINT feature_relationship_pub_pkey PRIMARY KEY (feature_relationship_pub_id); + + +-- +-- Name: feature_relationshipprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_relationshipprop + ADD CONSTRAINT feature_relationshipprop_c1 UNIQUE (feature_relationship_id, type_id, rank); + + +-- +-- Name: feature_relationshipprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_relationshipprop + ADD CONSTRAINT feature_relationshipprop_pkey PRIMARY KEY (feature_relationshipprop_id); + + +-- +-- Name: feature_relationshipprop_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_relationshipprop_pub + ADD CONSTRAINT feature_relationshipprop_pub_c1 UNIQUE (feature_relationshipprop_id, pub_id); + + +-- +-- Name: feature_relationshipprop_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_relationshipprop_pub + ADD CONSTRAINT feature_relationshipprop_pub_pkey PRIMARY KEY (feature_relationshipprop_pub_id); + + +-- +-- Name: feature_stock_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_stock + ADD CONSTRAINT feature_stock_pkey PRIMARY KEY (feature_stock_id); + + +-- +-- Name: feature_synonym_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_synonym + ADD CONSTRAINT feature_synonym_c1 UNIQUE (synonym_id, feature_id, pub_id); + + +-- +-- Name: feature_synonym_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY feature_synonym + ADD CONSTRAINT feature_synonym_pkey PRIMARY KEY (feature_synonym_id); + + +-- +-- Name: featureloc_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureloc + ADD CONSTRAINT featureloc_c1 UNIQUE (feature_id, locgroup, rank); + + +-- +-- Name: featureloc_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureloc + ADD CONSTRAINT featureloc_pkey PRIMARY KEY (featureloc_id); + + +-- +-- Name: featureloc_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureloc_pub + ADD CONSTRAINT featureloc_pub_c1 UNIQUE (featureloc_id, pub_id); + + +-- +-- Name: featureloc_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureloc_pub + ADD CONSTRAINT featureloc_pub_pkey PRIMARY KEY (featureloc_pub_id); + + +-- +-- Name: featuremap_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap + ADD CONSTRAINT featuremap_c1 UNIQUE (name); + + +-- +-- Name: featuremap_contact_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_contact + ADD CONSTRAINT featuremap_contact_c1 UNIQUE (featuremap_id, contact_id); + + +-- +-- Name: featuremap_contact_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_contact + ADD CONSTRAINT featuremap_contact_pkey PRIMARY KEY (featuremap_contact_id); + + +-- +-- Name: featuremap_dbxref_featuremap_dbxref_c1_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_dbxref + ADD CONSTRAINT featuremap_dbxref_featuremap_dbxref_c1_key UNIQUE (featuremap_id, dbxref_id); + + +-- +-- Name: featuremap_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_dbxref + ADD CONSTRAINT featuremap_dbxref_pkey PRIMARY KEY (featuremap_dbxref_id); + + +-- +-- Name: featuremap_organism_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_organism + ADD CONSTRAINT featuremap_organism_c1 UNIQUE (featuremap_id, organism_id); + + +-- +-- Name: featuremap_organism_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_organism + ADD CONSTRAINT featuremap_organism_pkey PRIMARY KEY (featuremap_organism_id); + + +-- +-- Name: featuremap_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap + ADD CONSTRAINT featuremap_pkey PRIMARY KEY (featuremap_id); + + +-- +-- Name: featuremap_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_pub + ADD CONSTRAINT featuremap_pub_pkey PRIMARY KEY (featuremap_pub_id); + + +-- +-- Name: featuremap_stock_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_stock + ADD CONSTRAINT featuremap_stock_c1 UNIQUE (featuremap_id, stock_id); + + +-- +-- Name: featuremap_stock_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremap_stock + ADD CONSTRAINT featuremap_stock_pkey PRIMARY KEY (featuremap_stock_id); + + +-- +-- Name: featuremapprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremapprop + ADD CONSTRAINT featuremapprop_c1 UNIQUE (featuremap_id, type_id, rank); + + +-- +-- Name: featuremapprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featuremapprop + ADD CONSTRAINT featuremapprop_pkey PRIMARY KEY (featuremapprop_id); + + +-- +-- Name: featurepos_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featurepos + ADD CONSTRAINT featurepos_pkey PRIMARY KEY (featurepos_id); + + +-- +-- Name: featureposprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureposprop + ADD CONSTRAINT featureposprop_pkey PRIMARY KEY (featureposprop_id); + + +-- +-- Name: featureprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureprop + ADD CONSTRAINT featureprop_c1 UNIQUE (feature_id, type_id, rank); + + +-- +-- Name: featureprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureprop + ADD CONSTRAINT featureprop_pkey PRIMARY KEY (featureprop_id); + + +-- +-- Name: featureprop_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureprop_pub + ADD CONSTRAINT featureprop_pub_c1 UNIQUE (featureprop_id, pub_id); + + +-- +-- Name: featureprop_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featureprop_pub + ADD CONSTRAINT featureprop_pub_pkey PRIMARY KEY (featureprop_pub_id); + + +-- +-- Name: featurerange_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY featurerange + ADD CONSTRAINT featurerange_pkey PRIMARY KEY (featurerange_id); + + +-- +-- Name: genotype_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY genotype + ADD CONSTRAINT genotype_c1 UNIQUE (uniquename); + + +-- +-- Name: genotype_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY genotype + ADD CONSTRAINT genotype_pkey PRIMARY KEY (genotype_id); + + +-- +-- Name: genotypeprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY genotypeprop + ADD CONSTRAINT genotypeprop_c1 UNIQUE (genotype_id, type_id, rank); + + +-- +-- Name: genotypeprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY genotypeprop + ADD CONSTRAINT genotypeprop_pkey PRIMARY KEY (genotypeprop_id); + + +-- +-- Name: library_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library + ADD CONSTRAINT library_c1 UNIQUE (organism_id, uniquename, type_id); + + +-- +-- Name: library_contact_library_contact_c1_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_contact + ADD CONSTRAINT library_contact_library_contact_c1_key UNIQUE (library_id, contact_id); + + +-- +-- Name: library_contact_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_contact + ADD CONSTRAINT library_contact_pkey PRIMARY KEY (library_contact_id); + + +-- +-- Name: library_cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_cvterm + ADD CONSTRAINT library_cvterm_c1 UNIQUE (library_id, cvterm_id, pub_id); + + +-- +-- Name: library_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_cvterm + ADD CONSTRAINT library_cvterm_pkey PRIMARY KEY (library_cvterm_id); + + +-- +-- Name: library_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_dbxref + ADD CONSTRAINT library_dbxref_c1 UNIQUE (library_id, dbxref_id); + + +-- +-- Name: library_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_dbxref + ADD CONSTRAINT library_dbxref_pkey PRIMARY KEY (library_dbxref_id); + + +-- +-- Name: library_feature_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_feature + ADD CONSTRAINT library_feature_c1 UNIQUE (library_id, feature_id); + + +-- +-- Name: library_feature_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_feature + ADD CONSTRAINT library_feature_pkey PRIMARY KEY (library_feature_id); + + +-- +-- Name: library_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library + ADD CONSTRAINT library_pkey PRIMARY KEY (library_id); + + +-- +-- Name: library_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_pub + ADD CONSTRAINT library_pub_c1 UNIQUE (library_id, pub_id); + + +-- +-- Name: library_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_pub + ADD CONSTRAINT library_pub_pkey PRIMARY KEY (library_pub_id); + + +-- +-- Name: library_stock_library_stock_c1_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_stock + ADD CONSTRAINT library_stock_library_stock_c1_key UNIQUE (library_id, stock_id); + + +-- +-- Name: library_stock_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_stock + ADD CONSTRAINT library_stock_pkey PRIMARY KEY (library_stock_id); + + +-- +-- Name: library_synonym_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_synonym + ADD CONSTRAINT library_synonym_c1 UNIQUE (synonym_id, library_id, pub_id); + + +-- +-- Name: library_synonym_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY library_synonym + ADD CONSTRAINT library_synonym_pkey PRIMARY KEY (library_synonym_id); + + +-- +-- Name: libraryprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY libraryprop + ADD CONSTRAINT libraryprop_c1 UNIQUE (library_id, type_id, rank); + + +-- +-- Name: libraryprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY libraryprop + ADD CONSTRAINT libraryprop_pkey PRIMARY KEY (libraryprop_id); + + +-- +-- Name: libraryprop_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY libraryprop_pub + ADD CONSTRAINT libraryprop_pub_c1 UNIQUE (libraryprop_id, pub_id); + + +-- +-- Name: libraryprop_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY libraryprop_pub + ADD CONSTRAINT libraryprop_pub_pkey PRIMARY KEY (libraryprop_pub_id); + + +-- +-- Name: magedocumentation_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY magedocumentation + ADD CONSTRAINT magedocumentation_pkey PRIMARY KEY (magedocumentation_id); + + +-- +-- Name: mageml_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mageml + ADD CONSTRAINT mageml_pkey PRIMARY KEY (mageml_id); + + +-- +-- Name: materialized_view_name_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY materialized_view + ADD CONSTRAINT materialized_view_name_key UNIQUE (name); + + +-- +-- Name: nd_experiment_contact_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_contact + ADD CONSTRAINT nd_experiment_contact_pkey PRIMARY KEY (nd_experiment_contact_id); + + +-- +-- Name: nd_experiment_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_dbxref + ADD CONSTRAINT nd_experiment_dbxref_pkey PRIMARY KEY (nd_experiment_dbxref_id); + + +-- +-- Name: nd_experiment_genotype_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_genotype + ADD CONSTRAINT nd_experiment_genotype_c1 UNIQUE (nd_experiment_id, genotype_id); + + +-- +-- Name: nd_experiment_genotype_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_genotype + ADD CONSTRAINT nd_experiment_genotype_pkey PRIMARY KEY (nd_experiment_genotype_id); + + +-- +-- Name: nd_experiment_phenotype_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_phenotype + ADD CONSTRAINT nd_experiment_phenotype_c1 UNIQUE (nd_experiment_id, phenotype_id); + + +-- +-- Name: nd_experiment_phenotype_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_phenotype + ADD CONSTRAINT nd_experiment_phenotype_pkey PRIMARY KEY (nd_experiment_phenotype_id); + + +-- +-- Name: nd_experiment_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment + ADD CONSTRAINT nd_experiment_pkey PRIMARY KEY (nd_experiment_id); + + +-- +-- Name: nd_experiment_project_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_project + ADD CONSTRAINT nd_experiment_project_pkey PRIMARY KEY (nd_experiment_project_id); + + +-- +-- Name: nd_experiment_protocol_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_protocol + ADD CONSTRAINT nd_experiment_protocol_pkey PRIMARY KEY (nd_experiment_protocol_id); + + +-- +-- Name: nd_experiment_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_pub + ADD CONSTRAINT nd_experiment_pub_c1 UNIQUE (nd_experiment_id, pub_id); + + +-- +-- Name: nd_experiment_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_pub + ADD CONSTRAINT nd_experiment_pub_pkey PRIMARY KEY (nd_experiment_pub_id); + + +-- +-- Name: nd_experiment_stock_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_stock_dbxref + ADD CONSTRAINT nd_experiment_stock_dbxref_pkey PRIMARY KEY (nd_experiment_stock_dbxref_id); + + +-- +-- Name: nd_experiment_stock_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_stock + ADD CONSTRAINT nd_experiment_stock_pkey PRIMARY KEY (nd_experiment_stock_id); + + +-- +-- Name: nd_experiment_stockprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_stockprop + ADD CONSTRAINT nd_experiment_stockprop_c1 UNIQUE (nd_experiment_stock_id, type_id, rank); + + +-- +-- Name: nd_experiment_stockprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experiment_stockprop + ADD CONSTRAINT nd_experiment_stockprop_pkey PRIMARY KEY (nd_experiment_stockprop_id); + + +-- +-- Name: nd_experimentprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experimentprop + ADD CONSTRAINT nd_experimentprop_c1 UNIQUE (nd_experiment_id, type_id, rank); + + +-- +-- Name: nd_experimentprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_experimentprop + ADD CONSTRAINT nd_experimentprop_pkey PRIMARY KEY (nd_experimentprop_id); + + +-- +-- Name: nd_geolocation_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_geolocation + ADD CONSTRAINT nd_geolocation_pkey PRIMARY KEY (nd_geolocation_id); + + +-- +-- Name: nd_geolocationprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_geolocationprop + ADD CONSTRAINT nd_geolocationprop_c1 UNIQUE (nd_geolocation_id, type_id, rank); + + +-- +-- Name: nd_geolocationprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_geolocationprop + ADD CONSTRAINT nd_geolocationprop_pkey PRIMARY KEY (nd_geolocationprop_id); + + +-- +-- Name: nd_protocol_name_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_protocol + ADD CONSTRAINT nd_protocol_name_key UNIQUE (name); + + +-- +-- Name: nd_protocol_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_protocol + ADD CONSTRAINT nd_protocol_pkey PRIMARY KEY (nd_protocol_id); + + +-- +-- Name: nd_protocol_reagent_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_protocol_reagent + ADD CONSTRAINT nd_protocol_reagent_pkey PRIMARY KEY (nd_protocol_reagent_id); + + +-- +-- Name: nd_protocolprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_protocolprop + ADD CONSTRAINT nd_protocolprop_c1 UNIQUE (nd_protocol_id, type_id, rank); + + +-- +-- Name: nd_protocolprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_protocolprop + ADD CONSTRAINT nd_protocolprop_pkey PRIMARY KEY (nd_protocolprop_id); + + +-- +-- Name: nd_reagent_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_reagent + ADD CONSTRAINT nd_reagent_pkey PRIMARY KEY (nd_reagent_id); + + +-- +-- Name: nd_reagent_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_reagent_relationship + ADD CONSTRAINT nd_reagent_relationship_pkey PRIMARY KEY (nd_reagent_relationship_id); + + +-- +-- Name: nd_reagentprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_reagentprop + ADD CONSTRAINT nd_reagentprop_c1 UNIQUE (nd_reagent_id, type_id, rank); + + +-- +-- Name: nd_reagentprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY nd_reagentprop + ADD CONSTRAINT nd_reagentprop_pkey PRIMARY KEY (nd_reagentprop_id); + + +-- +-- Name: organism_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism + ADD CONSTRAINT organism_c1 UNIQUE (genus, species); + + +-- +-- Name: organism_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism_dbxref + ADD CONSTRAINT organism_dbxref_c1 UNIQUE (organism_id, dbxref_id); + + +-- +-- Name: organism_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism_dbxref + ADD CONSTRAINT organism_dbxref_pkey PRIMARY KEY (organism_dbxref_id); + + +-- +-- Name: organism_image_organism_id_eimage_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism_image + ADD CONSTRAINT organism_image_organism_id_eimage_id_key UNIQUE (organism_id, eimage_id); + + +-- +-- Name: organism_image_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism_image + ADD CONSTRAINT organism_image_pkey PRIMARY KEY (organism_image_id); + + +-- +-- Name: organism_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism + ADD CONSTRAINT organism_pkey PRIMARY KEY (organism_id); + + +-- +-- Name: organism_pub_organism_id_pub_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism_pub + ADD CONSTRAINT organism_pub_organism_id_pub_id_key UNIQUE (organism_id, pub_id); + + +-- +-- Name: organism_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism_pub + ADD CONSTRAINT organism_pub_pkey PRIMARY KEY (organism_pub_id); + + +-- +-- Name: organism_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organism_relationship + ADD CONSTRAINT organism_relationship_pkey PRIMARY KEY (organism_relationship_id); + + +-- +-- Name: organismprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organismprop + ADD CONSTRAINT organismprop_c1 UNIQUE (organism_id, type_id, rank); + + +-- +-- Name: organismprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY organismprop + ADD CONSTRAINT organismprop_pkey PRIMARY KEY (organismprop_id); + + +-- +-- Name: phendesc_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phendesc + ADD CONSTRAINT phendesc_c1 UNIQUE (genotype_id, environment_id, type_id, pub_id); + + +-- +-- Name: phendesc_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phendesc + ADD CONSTRAINT phendesc_pkey PRIMARY KEY (phendesc_id); + + +-- +-- Name: phenotype_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenotype + ADD CONSTRAINT phenotype_c1 UNIQUE (uniquename); + + +-- +-- Name: phenotype_comparison_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_c1 UNIQUE (genotype1_id, environment1_id, genotype2_id, environment2_id, phenotype1_id, pub_id); + + +-- +-- Name: phenotype_comparison_cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenotype_comparison_cvterm + ADD CONSTRAINT phenotype_comparison_cvterm_c1 UNIQUE (phenotype_comparison_id, cvterm_id); + + +-- +-- Name: phenotype_comparison_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenotype_comparison_cvterm + ADD CONSTRAINT phenotype_comparison_cvterm_pkey PRIMARY KEY (phenotype_comparison_cvterm_id); + + +-- +-- Name: phenotype_comparison_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_pkey PRIMARY KEY (phenotype_comparison_id); + + +-- +-- Name: phenotype_cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenotype_cvterm + ADD CONSTRAINT phenotype_cvterm_c1 UNIQUE (phenotype_id, cvterm_id, rank); + + +-- +-- Name: phenotype_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenotype_cvterm + ADD CONSTRAINT phenotype_cvterm_pkey PRIMARY KEY (phenotype_cvterm_id); + + +-- +-- Name: phenotype_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenotype + ADD CONSTRAINT phenotype_pkey PRIMARY KEY (phenotype_id); + + +-- +-- Name: phenstatement_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenstatement + ADD CONSTRAINT phenstatement_c1 UNIQUE (genotype_id, phenotype_id, environment_id, type_id, pub_id); + + +-- +-- Name: phenstatement_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenstatement + ADD CONSTRAINT phenstatement_pkey PRIMARY KEY (phenstatement_id); + + +-- +-- Name: phenstatementprop_phenstatement_id_type_id_rank_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenstatementprop + ADD CONSTRAINT phenstatementprop_phenstatement_id_type_id_rank_key UNIQUE (phenstatement_id, type_id, rank); + + +-- +-- Name: phenstatementprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phenstatementprop + ADD CONSTRAINT phenstatementprop_pkey PRIMARY KEY (phenstatementprop_id); + + +-- +-- Name: phylonode_dbxref_phylonode_id_dbxref_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode_dbxref + ADD CONSTRAINT phylonode_dbxref_phylonode_id_dbxref_id_key UNIQUE (phylonode_id, dbxref_id); + + +-- +-- Name: phylonode_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode_dbxref + ADD CONSTRAINT phylonode_dbxref_pkey PRIMARY KEY (phylonode_dbxref_id); + + +-- +-- Name: phylonode_organism_phylonode_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode_organism + ADD CONSTRAINT phylonode_organism_phylonode_id_key UNIQUE (phylonode_id); + + +-- +-- Name: phylonode_organism_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode_organism + ADD CONSTRAINT phylonode_organism_pkey PRIMARY KEY (phylonode_organism_id); + + +-- +-- Name: phylonode_phylotree_id_left_idx_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode + ADD CONSTRAINT phylonode_phylotree_id_left_idx_key UNIQUE (phylotree_id, left_idx); + + +-- +-- Name: phylonode_phylotree_id_right_idx_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode + ADD CONSTRAINT phylonode_phylotree_id_right_idx_key UNIQUE (phylotree_id, right_idx); + + +-- +-- Name: phylonode_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode + ADD CONSTRAINT phylonode_pkey PRIMARY KEY (phylonode_id); + + +-- +-- Name: phylonode_pub_phylonode_id_pub_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode_pub + ADD CONSTRAINT phylonode_pub_phylonode_id_pub_id_key UNIQUE (phylonode_id, pub_id); + + +-- +-- Name: phylonode_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode_pub + ADD CONSTRAINT phylonode_pub_pkey PRIMARY KEY (phylonode_pub_id); + + +-- +-- Name: phylonode_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode_relationship + ADD CONSTRAINT phylonode_relationship_pkey PRIMARY KEY (phylonode_relationship_id); + + +-- +-- Name: phylonode_relationship_subject_id_object_id_type_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonode_relationship + ADD CONSTRAINT phylonode_relationship_subject_id_object_id_type_id_key UNIQUE (subject_id, object_id, type_id); + + +-- +-- Name: phylonodeprop_phylonode_id_type_id_value_rank_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonodeprop + ADD CONSTRAINT phylonodeprop_phylonode_id_type_id_value_rank_key UNIQUE (phylonode_id, type_id, value, rank); + + +-- +-- Name: phylonodeprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylonodeprop + ADD CONSTRAINT phylonodeprop_pkey PRIMARY KEY (phylonodeprop_id); + + +-- +-- Name: phylotree_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylotree + ADD CONSTRAINT phylotree_pkey PRIMARY KEY (phylotree_id); + + +-- +-- Name: phylotree_pub_phylotree_id_pub_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylotree_pub + ADD CONSTRAINT phylotree_pub_phylotree_id_pub_id_key UNIQUE (phylotree_id, pub_id); + + +-- +-- Name: phylotree_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY phylotree_pub + ADD CONSTRAINT phylotree_pub_pkey PRIMARY KEY (phylotree_pub_id); + + +-- +-- Name: project_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project + ADD CONSTRAINT project_c1 UNIQUE (name); + + +-- +-- Name: project_contact_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project_contact + ADD CONSTRAINT project_contact_c1 UNIQUE (project_id, contact_id); + + +-- +-- Name: project_contact_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project_contact + ADD CONSTRAINT project_contact_pkey PRIMARY KEY (project_contact_id); + + +-- +-- Name: project_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project + ADD CONSTRAINT project_pkey PRIMARY KEY (project_id); + + +-- +-- Name: project_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project_pub + ADD CONSTRAINT project_pub_c1 UNIQUE (project_id, pub_id); + + +-- +-- Name: project_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project_pub + ADD CONSTRAINT project_pub_pkey PRIMARY KEY (project_pub_id); + + +-- +-- Name: project_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project_relationship + ADD CONSTRAINT project_relationship_c1 UNIQUE (subject_project_id, object_project_id, type_id); + + +-- +-- Name: project_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY project_relationship + ADD CONSTRAINT project_relationship_pkey PRIMARY KEY (project_relationship_id); + + +-- +-- Name: projectprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY projectprop + ADD CONSTRAINT projectprop_c1 UNIQUE (project_id, type_id, rank); + + +-- +-- Name: projectprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY projectprop + ADD CONSTRAINT projectprop_pkey PRIMARY KEY (projectprop_id); + + +-- +-- Name: protocol_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY protocol + ADD CONSTRAINT protocol_c1 UNIQUE (name); + + +-- +-- Name: protocol_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY protocol + ADD CONSTRAINT protocol_pkey PRIMARY KEY (protocol_id); + + +-- +-- Name: protocolparam_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY protocolparam + ADD CONSTRAINT protocolparam_pkey PRIMARY KEY (protocolparam_id); + + +-- +-- Name: pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pub + ADD CONSTRAINT pub_c1 UNIQUE (uniquename); + + +-- +-- Name: pub_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pub_dbxref + ADD CONSTRAINT pub_dbxref_c1 UNIQUE (pub_id, dbxref_id); + + +-- +-- Name: pub_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pub_dbxref + ADD CONSTRAINT pub_dbxref_pkey PRIMARY KEY (pub_dbxref_id); + + +-- +-- Name: pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pub + ADD CONSTRAINT pub_pkey PRIMARY KEY (pub_id); + + +-- +-- Name: pub_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pub_relationship + ADD CONSTRAINT pub_relationship_c1 UNIQUE (subject_id, object_id, type_id); + + +-- +-- Name: pub_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pub_relationship + ADD CONSTRAINT pub_relationship_pkey PRIMARY KEY (pub_relationship_id); + + +-- +-- Name: pubauthor_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pubauthor + ADD CONSTRAINT pubauthor_c1 UNIQUE (pub_id, rank); + + +-- +-- Name: pubauthor_contact_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pubauthor_contact + ADD CONSTRAINT pubauthor_contact_pkey PRIMARY KEY (pubauthor_contact_id); + + +-- +-- Name: pubauthor_contact_pubauthor_contact_c1_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pubauthor_contact + ADD CONSTRAINT pubauthor_contact_pubauthor_contact_c1_key UNIQUE (contact_id, pubauthor_id); + + +-- +-- Name: pubauthor_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pubauthor + ADD CONSTRAINT pubauthor_pkey PRIMARY KEY (pubauthor_id); + + +-- +-- Name: pubprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pubprop + ADD CONSTRAINT pubprop_c1 UNIQUE (pub_id, type_id, rank); + + +-- +-- Name: pubprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY pubprop + ADD CONSTRAINT pubprop_pkey PRIMARY KEY (pubprop_id); + + +-- +-- Name: quantification_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY quantification + ADD CONSTRAINT quantification_c1 UNIQUE (name, analysis_id); + + +-- +-- Name: quantification_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY quantification + ADD CONSTRAINT quantification_pkey PRIMARY KEY (quantification_id); + + +-- +-- Name: quantification_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY quantification_relationship + ADD CONSTRAINT quantification_relationship_c1 UNIQUE (subject_id, object_id, type_id); + + +-- +-- Name: quantification_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY quantification_relationship + ADD CONSTRAINT quantification_relationship_pkey PRIMARY KEY (quantification_relationship_id); + + +-- +-- Name: quantificationprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY quantificationprop + ADD CONSTRAINT quantificationprop_c1 UNIQUE (quantification_id, type_id, rank); + + +-- +-- Name: quantificationprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY quantificationprop + ADD CONSTRAINT quantificationprop_pkey PRIMARY KEY (quantificationprop_id); + + +-- +-- Name: stock_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock + ADD CONSTRAINT stock_c1 UNIQUE (organism_id, uniquename, type_id); + + +-- +-- Name: stock_cvterm_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_cvterm + ADD CONSTRAINT stock_cvterm_c1 UNIQUE (stock_id, cvterm_id, pub_id, rank); + + +-- +-- Name: stock_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_cvterm + ADD CONSTRAINT stock_cvterm_pkey PRIMARY KEY (stock_cvterm_id); + + +-- +-- Name: stock_cvtermprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_cvtermprop + ADD CONSTRAINT stock_cvtermprop_c1 UNIQUE (stock_cvterm_id, type_id, rank); + + +-- +-- Name: stock_cvtermprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_cvtermprop + ADD CONSTRAINT stock_cvtermprop_pkey PRIMARY KEY (stock_cvtermprop_id); + + +-- +-- Name: stock_dbxref_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_dbxref + ADD CONSTRAINT stock_dbxref_c1 UNIQUE (stock_id, dbxref_id); + + +-- +-- Name: stock_dbxref_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_dbxref + ADD CONSTRAINT stock_dbxref_pkey PRIMARY KEY (stock_dbxref_id); + + +-- +-- Name: stock_dbxrefprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_dbxrefprop + ADD CONSTRAINT stock_dbxrefprop_c1 UNIQUE (stock_dbxref_id, type_id, rank); + + +-- +-- Name: stock_dbxrefprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_dbxrefprop + ADD CONSTRAINT stock_dbxrefprop_pkey PRIMARY KEY (stock_dbxrefprop_id); + + +-- +-- Name: stock_genotype_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_genotype + ADD CONSTRAINT stock_genotype_c1 UNIQUE (stock_id, genotype_id); + + +-- +-- Name: stock_genotype_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_genotype + ADD CONSTRAINT stock_genotype_pkey PRIMARY KEY (stock_genotype_id); + + +-- +-- Name: stock_image_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_image + ADD CONSTRAINT stock_image_pkey PRIMARY KEY (stock_image_id); + + +-- +-- Name: stock_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock + ADD CONSTRAINT stock_pkey PRIMARY KEY (stock_id); + + +-- +-- Name: stock_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_pub + ADD CONSTRAINT stock_pub_c1 UNIQUE (stock_id, pub_id); + + +-- +-- Name: stock_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_pub + ADD CONSTRAINT stock_pub_pkey PRIMARY KEY (stock_pub_id); + + +-- +-- Name: stock_relationship_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_relationship + ADD CONSTRAINT stock_relationship_c1 UNIQUE (subject_id, object_id, type_id, rank); + + +-- +-- Name: stock_relationship_cvterm_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_relationship_cvterm + ADD CONSTRAINT stock_relationship_cvterm_pkey PRIMARY KEY (stock_relationship_cvterm_id); + + +-- +-- Name: stock_relationship_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_relationship + ADD CONSTRAINT stock_relationship_pkey PRIMARY KEY (stock_relationship_id); + + +-- +-- Name: stock_relationship_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_relationship_pub + ADD CONSTRAINT stock_relationship_pub_c1 UNIQUE (stock_relationship_id, pub_id); + + +-- +-- Name: stock_relationship_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stock_relationship_pub + ADD CONSTRAINT stock_relationship_pub_pkey PRIMARY KEY (stock_relationship_pub_id); + + +-- +-- Name: stockcollection_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockcollection + ADD CONSTRAINT stockcollection_c1 UNIQUE (uniquename, type_id); + + +-- +-- Name: stockcollection_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockcollection + ADD CONSTRAINT stockcollection_pkey PRIMARY KEY (stockcollection_id); + + +-- +-- Name: stockcollection_stock_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockcollection_stock + ADD CONSTRAINT stockcollection_stock_c1 UNIQUE (stockcollection_id, stock_id); + + +-- +-- Name: stockcollection_stock_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockcollection_stock + ADD CONSTRAINT stockcollection_stock_pkey PRIMARY KEY (stockcollection_stock_id); + + +-- +-- Name: stockcollectionprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockcollectionprop + ADD CONSTRAINT stockcollectionprop_c1 UNIQUE (stockcollection_id, type_id, rank); + + +-- +-- Name: stockcollectionprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockcollectionprop + ADD CONSTRAINT stockcollectionprop_pkey PRIMARY KEY (stockcollectionprop_id); + + +-- +-- Name: stockprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockprop + ADD CONSTRAINT stockprop_c1 UNIQUE (stock_id, type_id, rank); + + +-- +-- Name: stockprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockprop + ADD CONSTRAINT stockprop_pkey PRIMARY KEY (stockprop_id); + + +-- +-- Name: stockprop_pub_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockprop_pub + ADD CONSTRAINT stockprop_pub_c1 UNIQUE (stockprop_id, pub_id); + + +-- +-- Name: stockprop_pub_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY stockprop_pub + ADD CONSTRAINT stockprop_pub_pkey PRIMARY KEY (stockprop_pub_id); + + +-- +-- Name: study_assay_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY study_assay + ADD CONSTRAINT study_assay_c1 UNIQUE (study_id, assay_id); + + +-- +-- Name: study_assay_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY study_assay + ADD CONSTRAINT study_assay_pkey PRIMARY KEY (study_assay_id); + + +-- +-- Name: study_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY study + ADD CONSTRAINT study_c1 UNIQUE (name); + + +-- +-- Name: study_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY study + ADD CONSTRAINT study_pkey PRIMARY KEY (study_id); + + +-- +-- Name: studydesign_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studydesign + ADD CONSTRAINT studydesign_pkey PRIMARY KEY (studydesign_id); + + +-- +-- Name: studydesignprop_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studydesignprop + ADD CONSTRAINT studydesignprop_c1 UNIQUE (studydesign_id, type_id, rank); + + +-- +-- Name: studydesignprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studydesignprop + ADD CONSTRAINT studydesignprop_pkey PRIMARY KEY (studydesignprop_id); + + +-- +-- Name: studyfactor_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studyfactor + ADD CONSTRAINT studyfactor_pkey PRIMARY KEY (studyfactor_id); + + +-- +-- Name: studyfactorvalue_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studyfactorvalue + ADD CONSTRAINT studyfactorvalue_pkey PRIMARY KEY (studyfactorvalue_id); + + +-- +-- Name: studyprop_feature_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studyprop_feature + ADD CONSTRAINT studyprop_feature_pkey PRIMARY KEY (studyprop_feature_id); + + +-- +-- Name: studyprop_feature_studyprop_id_feature_id_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studyprop_feature + ADD CONSTRAINT studyprop_feature_studyprop_id_feature_id_key UNIQUE (studyprop_id, feature_id); + + +-- +-- Name: studyprop_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studyprop + ADD CONSTRAINT studyprop_pkey PRIMARY KEY (studyprop_id); + + +-- +-- Name: studyprop_study_id_type_id_rank_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY studyprop + ADD CONSTRAINT studyprop_study_id_type_id_rank_key UNIQUE (study_id, type_id, rank); + + +-- +-- Name: synonym_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY synonym + ADD CONSTRAINT synonym_c1 UNIQUE (name, type_id); + + +-- +-- Name: synonym_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY synonym + ADD CONSTRAINT synonym_pkey PRIMARY KEY (synonym_id); + + +-- +-- Name: tableinfo_c1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tableinfo + ADD CONSTRAINT tableinfo_c1 UNIQUE (name); + + +-- +-- Name: tableinfo_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tableinfo + ADD CONSTRAINT tableinfo_pkey PRIMARY KEY (tableinfo_id); + + +-- +-- Name: test2_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY test2 + ADD CONSTRAINT test2_pkey PRIMARY KEY (id); + + +-- +-- Name: test_join_1_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY test3 + ADD CONSTRAINT test_join_1_pkey PRIMARY KEY (id); + + +-- +-- Name: test_join_1_pkey1; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY test1 + ADD CONSTRAINT test_join_1_pkey1 PRIMARY KEY (id); + + +-- +-- Name: treatment_pkey; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY treatment + ADD CONSTRAINT treatment_pkey PRIMARY KEY (treatment_id); + + +-- +-- Name: tripal_gff_temp_tripal_gff_temp_uq0_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tripal_gff_temp + ADD CONSTRAINT tripal_gff_temp_tripal_gff_temp_uq0_key UNIQUE (feature_id); + + +-- +-- Name: tripal_gff_temp_tripal_gff_temp_uq1_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tripal_gff_temp + ADD CONSTRAINT tripal_gff_temp_tripal_gff_temp_uq1_key UNIQUE (uniquename, organism_id, type_name); + + +-- +-- Name: tripal_gffprotein_temp_tripal_gff_temp_uq0_key; Type: CONSTRAINT; Schema: chado; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY tripal_gffprotein_temp + ADD CONSTRAINT tripal_gffprotein_temp_tripal_gff_temp_uq0_key UNIQUE (feature_id); + + +-- +-- Name: acquisition_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX acquisition_idx1 ON acquisition USING btree (assay_id); + + +-- +-- Name: acquisition_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX acquisition_idx2 ON acquisition USING btree (protocol_id); + + +-- +-- Name: acquisition_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX acquisition_idx3 ON acquisition USING btree (channel_id); + + +-- +-- Name: acquisition_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX acquisition_relationship_idx1 ON acquisition_relationship USING btree (subject_id); + + +-- +-- Name: acquisition_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX acquisition_relationship_idx2 ON acquisition_relationship USING btree (type_id); + + +-- +-- Name: acquisition_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX acquisition_relationship_idx3 ON acquisition_relationship USING btree (object_id); + + +-- +-- Name: acquisitionprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX acquisitionprop_idx1 ON acquisitionprop USING btree (acquisition_id); + + +-- +-- Name: acquisitionprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX acquisitionprop_idx2 ON acquisitionprop USING btree (type_id); + + +-- +-- Name: analysis_organism_networkmod_qtl_indx0_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX analysis_organism_networkmod_qtl_indx0_idx ON analysis_organism USING btree (analysis_id); + + +-- +-- Name: analysis_organism_networkmod_qtl_indx1_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX analysis_organism_networkmod_qtl_indx1_idx ON analysis_organism USING btree (organism_id); + + +-- +-- Name: analysisfeatureprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX analysisfeatureprop_idx1 ON analysisfeatureprop USING btree (analysisfeature_id); + + +-- +-- Name: analysisfeatureprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX analysisfeatureprop_idx2 ON analysisfeatureprop USING btree (type_id); + + +-- +-- Name: analysisprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX analysisprop_idx1 ON analysisprop USING btree (analysis_id); + + +-- +-- Name: analysisprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX analysisprop_idx2 ON analysisprop USING btree (type_id); + + +-- +-- Name: arraydesign_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX arraydesign_idx1 ON arraydesign USING btree (manufacturer_id); + + +-- +-- Name: arraydesign_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX arraydesign_idx2 ON arraydesign USING btree (platformtype_id); + + +-- +-- Name: arraydesign_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX arraydesign_idx3 ON arraydesign USING btree (substratetype_id); + + +-- +-- Name: arraydesign_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX arraydesign_idx4 ON arraydesign USING btree (protocol_id); + + +-- +-- Name: arraydesign_idx5; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX arraydesign_idx5 ON arraydesign USING btree (dbxref_id); + + +-- +-- Name: arraydesignprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX arraydesignprop_idx1 ON arraydesignprop USING btree (arraydesign_id); + + +-- +-- Name: arraydesignprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX arraydesignprop_idx2 ON arraydesignprop USING btree (type_id); + + +-- +-- Name: assay_biomaterial_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_biomaterial_idx1 ON assay_biomaterial USING btree (assay_id); + + +-- +-- Name: assay_biomaterial_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_biomaterial_idx2 ON assay_biomaterial USING btree (biomaterial_id); + + +-- +-- Name: assay_biomaterial_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_biomaterial_idx3 ON assay_biomaterial USING btree (channel_id); + + +-- +-- Name: assay_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_idx1 ON assay USING btree (arraydesign_id); + + +-- +-- Name: assay_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_idx2 ON assay USING btree (protocol_id); + + +-- +-- Name: assay_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_idx3 ON assay USING btree (operator_id); + + +-- +-- Name: assay_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_idx4 ON assay USING btree (dbxref_id); + + +-- +-- Name: assay_project_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_project_idx1 ON assay_project USING btree (assay_id); + + +-- +-- Name: assay_project_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assay_project_idx2 ON assay_project USING btree (project_id); + + +-- +-- Name: assayprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assayprop_idx1 ON assayprop USING btree (assay_id); + + +-- +-- Name: assayprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX assayprop_idx2 ON assayprop USING btree (type_id); + + +-- +-- Name: binloc_boxrange; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX binloc_boxrange ON featureloc USING gist (boxrange(fmin, fmax)); + + +-- +-- Name: binloc_boxrange_src; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX binloc_boxrange_src ON featureloc USING gist (boxrange(srcfeature_id, fmin, fmax)); + + +-- +-- Name: biomaterial_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_dbxref_idx1 ON biomaterial_dbxref USING btree (biomaterial_id); + + +-- +-- Name: biomaterial_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_dbxref_idx2 ON biomaterial_dbxref USING btree (dbxref_id); + + +-- +-- Name: biomaterial_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_idx1 ON biomaterial USING btree (taxon_id); + + +-- +-- Name: biomaterial_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_idx2 ON biomaterial USING btree (biosourceprovider_id); + + +-- +-- Name: biomaterial_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_idx3 ON biomaterial USING btree (dbxref_id); + + +-- +-- Name: biomaterial_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_relationship_idx1 ON biomaterial_relationship USING btree (subject_id); + + +-- +-- Name: biomaterial_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_relationship_idx2 ON biomaterial_relationship USING btree (object_id); + + +-- +-- Name: biomaterial_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_relationship_idx3 ON biomaterial_relationship USING btree (type_id); + + +-- +-- Name: biomaterial_treatment_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_treatment_idx1 ON biomaterial_treatment USING btree (biomaterial_id); + + +-- +-- Name: biomaterial_treatment_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_treatment_idx2 ON biomaterial_treatment USING btree (treatment_id); + + +-- +-- Name: biomaterial_treatment_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterial_treatment_idx3 ON biomaterial_treatment USING btree (unittype_id); + + +-- +-- Name: biomaterialprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterialprop_idx1 ON biomaterialprop USING btree (biomaterial_id); + + +-- +-- Name: biomaterialprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX biomaterialprop_idx2 ON biomaterialprop USING btree (type_id); + + +-- +-- Name: blast_hit_data_analysis_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_analysis_id_idx ON blast_hit_data USING btree (analysis_id); + + +-- +-- Name: blast_hit_data_analysisfeature_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_analysisfeature_id_idx ON blast_hit_data USING btree (analysisfeature_id); + + +-- +-- Name: blast_hit_data_blast_org_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_blast_org_id_idx ON blast_hit_data USING btree (blast_org_id); + + +-- +-- Name: blast_hit_data_db_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_db_id_idx ON blast_hit_data USING btree (db_id); + + +-- +-- Name: blast_hit_data_feature_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_feature_id_idx ON blast_hit_data USING btree (feature_id); + + +-- +-- Name: blast_hit_data_hit_accession_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_hit_accession_idx ON blast_hit_data USING btree (hit_accession); + + +-- +-- Name: blast_hit_data_hit_best_eval_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_hit_best_eval_idx ON blast_hit_data USING btree (hit_best_eval); + + +-- +-- Name: blast_hit_data_hit_name_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_hit_name_idx ON blast_hit_data USING btree (hit_organism); + + +-- +-- Name: blast_hit_data_hit_organism_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_hit_data_hit_organism_idx ON blast_hit_data USING btree (hit_organism); + + +-- +-- Name: blast_organisms_blast_org_name_idx_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX blast_organisms_blast_org_name_idx_idx ON blast_organisms USING btree (blast_org_name); + + +-- +-- Name: contact_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX contact_relationship_idx1 ON contact_relationship USING btree (type_id); + + +-- +-- Name: contact_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX contact_relationship_idx2 ON contact_relationship USING btree (subject_id); + + +-- +-- Name: contact_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX contact_relationship_idx3 ON contact_relationship USING btree (object_id); + + +-- +-- Name: contactprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX contactprop_idx1 ON contactprop USING btree (contact_id); + + +-- +-- Name: contactprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX contactprop_idx2 ON contactprop USING btree (type_id); + + +-- +-- Name: content_type_chado_analysis_unigene_nid_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX content_type_chado_analysis_unigene_nid_idx ON content_type_chado_analysis_unigene USING btree (nid); + + +-- +-- Name: control_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX control_idx1 ON control USING btree (type_id); + + +-- +-- Name: control_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX control_idx2 ON control USING btree (assay_id); + + +-- +-- Name: control_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX control_idx3 ON control USING btree (tableinfo_id); + + +-- +-- Name: control_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX control_idx4 ON control USING btree (row_id); + + +-- +-- Name: cv_root_mview_cv_root_mview_indx1_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cv_root_mview_cv_root_mview_indx1_idx ON cv_root_mview USING btree (cvterm_id); + + +-- +-- Name: cv_root_mview_cv_root_mview_indx2_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cv_root_mview_cv_root_mview_indx2_idx ON cv_root_mview USING btree (cv_id); + + +-- +-- Name: INDEX cvterm_c1; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON INDEX cvterm_c1 IS 'A name can mean different things in +different contexts; for example "chromosome" in SO and GO. A name +should be unique within an ontology or cv. A name may exist twice in a +cv, in both obsolete and non-obsolete forms - these will be for +different cvterms with different OBO identifiers; so GO documentation +for more details on obsoletion. Note that occasionally multiple +obsolete terms with the same name will exist in the same cv. If this +is a possibility for the ontology under consideration (e.g. GO) then the +ID should be appended to the name to ensure uniqueness.'; + + +-- +-- Name: INDEX cvterm_c2; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON INDEX cvterm_c2 IS 'The OBO identifier is globally unique.'; + + +-- +-- Name: cvterm_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvterm_dbxref_idx1 ON cvterm_dbxref USING btree (cvterm_id); + + +-- +-- Name: cvterm_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvterm_dbxref_idx2 ON cvterm_dbxref USING btree (dbxref_id); + + +-- +-- Name: cvterm_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvterm_idx1 ON cvterm USING btree (cv_id); + + +-- +-- Name: cvterm_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvterm_idx2 ON cvterm USING btree (name); + + +-- +-- Name: cvterm_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvterm_idx3 ON cvterm USING btree (dbxref_id); + + +-- +-- Name: cvterm_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvterm_relationship_idx1 ON cvterm_relationship USING btree (type_id); + + +-- +-- Name: cvterm_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvterm_relationship_idx2 ON cvterm_relationship USING btree (subject_id); + + +-- +-- Name: cvterm_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvterm_relationship_idx3 ON cvterm_relationship USING btree (object_id); + + +-- +-- Name: cvtermpath_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvtermpath_idx1 ON cvtermpath USING btree (type_id); + + +-- +-- Name: cvtermpath_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvtermpath_idx2 ON cvtermpath USING btree (subject_id); + + +-- +-- Name: cvtermpath_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvtermpath_idx3 ON cvtermpath USING btree (object_id); + + +-- +-- Name: cvtermpath_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvtermpath_idx4 ON cvtermpath USING btree (cv_id); + + +-- +-- Name: cvtermprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvtermprop_idx1 ON cvtermprop USING btree (cvterm_id); + + +-- +-- Name: cvtermprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvtermprop_idx2 ON cvtermprop USING btree (type_id); + + +-- +-- Name: cvtermsynonym_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX cvtermsynonym_idx1 ON cvtermsynonym USING btree (cvterm_id); + + +-- +-- Name: dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX dbxref_idx1 ON dbxref USING btree (db_id); + + +-- +-- Name: dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX dbxref_idx2 ON dbxref USING btree (accession); + + +-- +-- Name: dbxref_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX dbxref_idx3 ON dbxref USING btree (version); + + +-- +-- Name: dbxrefprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX dbxrefprop_idx1 ON dbxrefprop USING btree (dbxref_id); + + +-- +-- Name: dbxrefprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX dbxrefprop_idx2 ON dbxrefprop USING btree (type_id); + + +-- +-- Name: element_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX element_idx1 ON element USING btree (feature_id); + + +-- +-- Name: element_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX element_idx2 ON element USING btree (arraydesign_id); + + +-- +-- Name: element_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX element_idx3 ON element USING btree (type_id); + + +-- +-- Name: element_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX element_idx4 ON element USING btree (dbxref_id); + + +-- +-- Name: element_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX element_relationship_idx1 ON element_relationship USING btree (subject_id); + + +-- +-- Name: element_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX element_relationship_idx2 ON element_relationship USING btree (type_id); + + +-- +-- Name: element_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX element_relationship_idx3 ON element_relationship USING btree (object_id); + + +-- +-- Name: element_relationship_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX element_relationship_idx4 ON element_relationship USING btree (value); + + +-- +-- Name: elementresult_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX elementresult_idx1 ON elementresult USING btree (element_id); + + +-- +-- Name: elementresult_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX elementresult_idx2 ON elementresult USING btree (quantification_id); + + +-- +-- Name: elementresult_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX elementresult_idx3 ON elementresult USING btree (signal); + + +-- +-- Name: elementresult_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX elementresult_relationship_idx1 ON elementresult_relationship USING btree (subject_id); + + +-- +-- Name: elementresult_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX elementresult_relationship_idx2 ON elementresult_relationship USING btree (type_id); + + +-- +-- Name: elementresult_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX elementresult_relationship_idx3 ON elementresult_relationship USING btree (object_id); + + +-- +-- Name: elementresult_relationship_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX elementresult_relationship_idx4 ON elementresult_relationship USING btree (value); + + +-- +-- Name: environment_cvterm_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX environment_cvterm_idx1 ON environment_cvterm USING btree (environment_id); + + +-- +-- Name: environment_cvterm_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX environment_cvterm_idx2 ON environment_cvterm USING btree (cvterm_id); + + +-- +-- Name: environment_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX environment_idx1 ON environment USING btree (uniquename); + + +-- +-- Name: expression_cvterm_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_cvterm_idx1 ON expression_cvterm USING btree (expression_id); + + +-- +-- Name: expression_cvterm_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_cvterm_idx2 ON expression_cvterm USING btree (cvterm_id); + + +-- +-- Name: expression_cvterm_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_cvterm_idx3 ON expression_cvterm USING btree (cvterm_type_id); + + +-- +-- Name: expression_cvtermprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_cvtermprop_idx1 ON expression_cvtermprop USING btree (expression_cvterm_id); + + +-- +-- Name: expression_cvtermprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_cvtermprop_idx2 ON expression_cvtermprop USING btree (type_id); + + +-- +-- Name: expression_image_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_image_idx1 ON expression_image USING btree (expression_id); + + +-- +-- Name: expression_image_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_image_idx2 ON expression_image USING btree (eimage_id); + + +-- +-- Name: expression_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_pub_idx1 ON expression_pub USING btree (expression_id); + + +-- +-- Name: expression_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expression_pub_idx2 ON expression_pub USING btree (pub_id); + + +-- +-- Name: expressionprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expressionprop_idx1 ON expressionprop USING btree (expression_id); + + +-- +-- Name: expressionprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX expressionprop_idx2 ON expressionprop USING btree (type_id); + + +-- +-- Name: feature_contact_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_contact_idx1 ON feature_contact USING btree (feature_id); + + +-- +-- Name: feature_contact_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_contact_idx2 ON feature_contact USING btree (contact_id); + + +-- +-- Name: feature_cvterm_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvterm_dbxref_idx1 ON feature_cvterm_dbxref USING btree (feature_cvterm_id); + + +-- +-- Name: feature_cvterm_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvterm_dbxref_idx2 ON feature_cvterm_dbxref USING btree (dbxref_id); + + +-- +-- Name: feature_cvterm_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvterm_idx1 ON feature_cvterm USING btree (feature_id); + + +-- +-- Name: feature_cvterm_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvterm_idx2 ON feature_cvterm USING btree (cvterm_id); + + +-- +-- Name: feature_cvterm_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvterm_idx3 ON feature_cvterm USING btree (pub_id); + + +-- +-- Name: feature_cvterm_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvterm_pub_idx1 ON feature_cvterm_pub USING btree (feature_cvterm_id); + + +-- +-- Name: feature_cvterm_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvterm_pub_idx2 ON feature_cvterm_pub USING btree (pub_id); + + +-- +-- Name: feature_cvtermprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvtermprop_idx1 ON feature_cvtermprop USING btree (feature_cvterm_id); + + +-- +-- Name: feature_cvtermprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_cvtermprop_idx2 ON feature_cvtermprop USING btree (type_id); + + +-- +-- Name: feature_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_dbxref_idx1 ON feature_dbxref USING btree (feature_id); + + +-- +-- Name: feature_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_dbxref_idx2 ON feature_dbxref USING btree (dbxref_id); + + +-- +-- Name: feature_expression_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_expression_idx1 ON feature_expression USING btree (expression_id); + + +-- +-- Name: feature_expression_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_expression_idx2 ON feature_expression USING btree (feature_id); + + +-- +-- Name: feature_expression_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_expression_idx3 ON feature_expression USING btree (pub_id); + + +-- +-- Name: feature_expressionprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_expressionprop_idx1 ON feature_expressionprop USING btree (feature_expression_id); + + +-- +-- Name: feature_expressionprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_expressionprop_idx2 ON feature_expressionprop USING btree (type_id); + + +-- +-- Name: feature_genotype_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_genotype_idx1 ON feature_genotype USING btree (feature_id); + + +-- +-- Name: feature_genotype_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_genotype_idx2 ON feature_genotype USING btree (genotype_id); + + +-- +-- Name: feature_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_idx1 ON feature USING btree (dbxref_id); + + +-- +-- Name: feature_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_idx2 ON feature USING btree (organism_id); + + +-- +-- Name: feature_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_idx3 ON feature USING btree (type_id); + + +-- +-- Name: feature_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_idx4 ON feature USING btree (uniquename); + + +-- +-- Name: feature_idx5; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_idx5 ON feature USING btree (lower((name)::text)); + + +-- +-- Name: feature_name_ind1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_name_ind1 ON feature USING btree (name); + + +-- +-- Name: feature_phenotype_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_phenotype_idx1 ON feature_phenotype USING btree (feature_id); + + +-- +-- Name: feature_phenotype_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_phenotype_idx2 ON feature_phenotype USING btree (phenotype_id); + + +-- +-- Name: feature_project_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_project_idx1 ON feature_project USING btree (feature_id); + + +-- +-- Name: feature_project_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_project_idx2 ON feature_project USING btree (project_id); + + +-- +-- Name: feature_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_pub_idx1 ON feature_pub USING btree (feature_id); + + +-- +-- Name: feature_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_pub_idx2 ON feature_pub USING btree (pub_id); + + +-- +-- Name: feature_pubprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_pubprop_idx1 ON feature_pubprop USING btree (feature_pub_id); + + +-- +-- Name: feature_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationship_idx1 ON feature_relationship USING btree (subject_id); + + +-- +-- Name: feature_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationship_idx2 ON feature_relationship USING btree (object_id); + + +-- +-- Name: feature_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationship_idx3 ON feature_relationship USING btree (type_id); + + +-- +-- Name: feature_relationship_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationship_pub_idx1 ON feature_relationship_pub USING btree (feature_relationship_id); + + +-- +-- Name: feature_relationship_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationship_pub_idx2 ON feature_relationship_pub USING btree (pub_id); + + +-- +-- Name: feature_relationshipprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationshipprop_idx1 ON feature_relationshipprop USING btree (feature_relationship_id); + + +-- +-- Name: feature_relationshipprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationshipprop_idx2 ON feature_relationshipprop USING btree (type_id); + + +-- +-- Name: feature_relationshipprop_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationshipprop_pub_idx1 ON feature_relationshipprop_pub USING btree (feature_relationshipprop_id); + + +-- +-- Name: feature_relationshipprop_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_relationshipprop_pub_idx2 ON feature_relationshipprop_pub USING btree (pub_id); + + +-- +-- Name: feature_stock_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_stock_idx1 ON feature_stock USING btree (feature_id); + + +-- +-- Name: feature_stock_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_stock_idx2 ON feature_stock USING btree (stock_id); + + +-- +-- Name: feature_synonym_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_synonym_idx1 ON feature_synonym USING btree (synonym_id); + + +-- +-- Name: feature_synonym_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_synonym_idx2 ON feature_synonym USING btree (feature_id); + + +-- +-- Name: feature_synonym_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX feature_synonym_idx3 ON feature_synonym USING btree (pub_id); + + +-- +-- Name: featureloc_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureloc_idx1 ON featureloc USING btree (feature_id); + + +-- +-- Name: featureloc_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureloc_idx2 ON featureloc USING btree (srcfeature_id); + + +-- +-- Name: featureloc_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureloc_idx3 ON featureloc USING btree (srcfeature_id, fmin, fmax); + + +-- +-- Name: featureloc_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureloc_pub_idx1 ON featureloc_pub USING btree (featureloc_id); + + +-- +-- Name: featureloc_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureloc_pub_idx2 ON featureloc_pub USING btree (pub_id); + + +-- +-- Name: featuremap_contact_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremap_contact_idx1 ON featuremap_contact USING btree (featuremap_id); + + +-- +-- Name: featuremap_contact_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremap_contact_idx2 ON featuremap_contact USING btree (contact_id); + + +-- +-- Name: featuremap_organism_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremap_organism_idx1 ON featuremap_organism USING btree (featuremap_id); + + +-- +-- Name: featuremap_organism_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremap_organism_idx2 ON featuremap_organism USING btree (organism_id); + + +-- +-- Name: featuremap_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremap_pub_idx1 ON featuremap_pub USING btree (featuremap_id); + + +-- +-- Name: featuremap_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremap_pub_idx2 ON featuremap_pub USING btree (pub_id); + + +-- +-- Name: featuremap_stock_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremap_stock_idx1 ON featuremap_stock USING btree (featuremap_id); + + +-- +-- Name: featuremap_stock_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremap_stock_idx2 ON featuremap_stock USING btree (stock_id); + + +-- +-- Name: featuremapprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremapprop_idx1 ON featuremapprop USING btree (featuremap_id); + + +-- +-- Name: featuremapprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featuremapprop_idx2 ON featuremapprop USING btree (type_id); + + +-- +-- Name: featurepos_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurepos_idx1 ON featurepos USING btree (featuremap_id); + + +-- +-- Name: featurepos_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurepos_idx2 ON featurepos USING btree (feature_id); + + +-- +-- Name: featurepos_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurepos_idx3 ON featurepos USING btree (map_feature_id); + + +-- +-- Name: featureposprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureposprop_idx1 ON featureposprop USING btree (featurepos_id); + + +-- +-- Name: featureposprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureposprop_idx2 ON featureposprop USING btree (type_id); + + +-- +-- Name: INDEX featureprop_c1; Type: COMMENT; Schema: chado; Owner: - +-- + +COMMENT ON INDEX featureprop_c1 IS 'For any one feature, multivalued +property-value pairs must be differentiated by rank.'; + + +-- +-- Name: featureprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureprop_idx1 ON featureprop USING btree (feature_id); + + +-- +-- Name: featureprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureprop_idx2 ON featureprop USING btree (type_id); + + +-- +-- Name: featureprop_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureprop_pub_idx1 ON featureprop_pub USING btree (featureprop_id); + + +-- +-- Name: featureprop_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featureprop_pub_idx2 ON featureprop_pub USING btree (pub_id); + + +-- +-- Name: featurerange_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurerange_idx1 ON featurerange USING btree (featuremap_id); + + +-- +-- Name: featurerange_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurerange_idx2 ON featurerange USING btree (feature_id); + + +-- +-- Name: featurerange_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurerange_idx3 ON featurerange USING btree (leftstartf_id); + + +-- +-- Name: featurerange_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurerange_idx4 ON featurerange USING btree (leftendf_id); + + +-- +-- Name: featurerange_idx5; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurerange_idx5 ON featurerange USING btree (rightstartf_id); + + +-- +-- Name: featurerange_idx6; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX featurerange_idx6 ON featurerange USING btree (rightendf_id); + + +-- +-- Name: genotype_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX genotype_idx1 ON genotype USING btree (uniquename); + + +-- +-- Name: genotype_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX genotype_idx2 ON genotype USING btree (name); + + +-- +-- Name: genotypeprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX genotypeprop_idx1 ON genotypeprop USING btree (genotype_id); + + +-- +-- Name: genotypeprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX genotypeprop_idx2 ON genotypeprop USING btree (type_id); + + +-- +-- Name: idx_go_count_analysis_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_go_count_analysis_analysis_id ON go_count_analysis USING btree (analysis_id); + + +-- +-- Name: idx_go_count_analysis_cvterm_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_go_count_analysis_cvterm_id ON go_count_analysis USING btree (cvterm_id); + + +-- +-- Name: idx_go_count_analysis_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_go_count_analysis_organism_id ON go_count_analysis USING btree (organism_id); + + +-- +-- Name: idx_go_count_organism_cvterm_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_go_count_organism_cvterm_id ON go_count_organism USING btree (cvterm_id); + + +-- +-- Name: idx_go_count_organism_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_go_count_organism_organism_id ON go_count_organism USING btree (organism_id); + + +-- +-- Name: idx_kegg_by_organism_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_kegg_by_organism_analysis_id ON kegg_by_organism USING btree (analysis_id); + + +-- +-- Name: idx_kegg_by_organism_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_kegg_by_organism_organism_id ON kegg_by_organism USING btree (organism_id); + + +-- +-- Name: idx_organism_feature_count_cvterm_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_organism_feature_count_cvterm_id ON organism_feature_count USING btree (cvterm_id); + + +-- +-- Name: idx_organism_feature_count_feature_type; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_organism_feature_count_feature_type ON organism_feature_count USING btree (feature_type); + + +-- +-- Name: idx_organism_feature_count_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_organism_feature_count_organism_id ON organism_feature_count USING btree (organism_id); + + +-- +-- Name: idx_organism_unigene_mview_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_organism_unigene_mview_analysis_id ON organism_unigene_mview USING btree (analysis_id); + + +-- +-- Name: idx_organism_unigene_mview_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_organism_unigene_mview_organism_id ON organism_unigene_mview USING btree (organism_id); + + +-- +-- Name: idx_search_by_gene_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_gene_analysis_id ON search_by_gene USING btree (analysis_id); + + +-- +-- Name: idx_search_by_gene_analysis_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_gene_analysis_name ON search_by_gene USING btree (analysis_name); + + +-- +-- Name: idx_search_by_gene_feature_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_gene_feature_id ON search_by_gene USING btree (feature_id); + + +-- +-- Name: idx_search_by_gene_feature_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_gene_feature_name ON search_by_gene USING btree (feature_name); + + +-- +-- Name: idx_search_by_gene_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_gene_organism_id ON search_by_gene USING btree (organism_id); + + +-- +-- Name: idx_search_by_go_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_analysis_id ON search_by_go USING btree (analysis_id); + + +-- +-- Name: idx_search_by_go_analysis_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_analysis_name ON search_by_go USING btree (analysis_name); + + +-- +-- Name: idx_search_by_go_analysis_nid; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_analysis_nid ON search_by_go USING btree (analysis_nid); + + +-- +-- Name: idx_search_by_go_feature_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_feature_id ON search_by_go USING btree (feature_id); + + +-- +-- Name: idx_search_by_go_feature_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_feature_name ON search_by_go USING btree (feature_name); + + +-- +-- Name: idx_search_by_go_feature_nid; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_feature_nid ON search_by_go USING btree (feature_nid); + + +-- +-- Name: idx_search_by_go_feature_type; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_feature_type ON search_by_go USING btree (feature_type); + + +-- +-- Name: idx_search_by_go_fmax; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_fmax ON search_by_go USING btree (fmax); + + +-- +-- Name: idx_search_by_go_fmin; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_fmin ON search_by_go USING btree (fmin); + + +-- +-- Name: idx_search_by_go_go_accession; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_go_accession ON search_by_go USING btree (go_accession); + + +-- +-- Name: idx_search_by_go_go_cvterm_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_go_cvterm_id ON search_by_go USING btree (go_cvterm_id); + + +-- +-- Name: idx_search_by_go_go_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_go_name ON search_by_go USING btree (go_name); + + +-- +-- Name: idx_search_by_go_landmark; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_landmark ON search_by_go USING btree (landmark); + + +-- +-- Name: idx_search_by_go_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_organism_id ON search_by_go USING btree (organism_id); + + +-- +-- Name: idx_search_by_go_source_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_source_analysis_id ON search_by_go USING btree (source_analysis_id); + + +-- +-- Name: idx_search_by_go_source_analysis_nid; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_source_analysis_nid ON search_by_go USING btree (source_analysis_nid); + + +-- +-- Name: idx_search_by_go_source_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_source_name ON search_by_go USING btree (source_name); + + +-- +-- Name: idx_search_by_go_strand; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_strand ON search_by_go USING btree (strand); + + +-- +-- Name: idx_search_by_go_type_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_go_type_id ON search_by_go USING btree (type_id); + + +-- +-- Name: idx_search_by_homology_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_homology_analysis_id ON search_by_homology USING btree (analysis_id); + + +-- +-- Name: idx_search_by_homology_feature_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_homology_feature_id ON search_by_homology USING btree (feature_id); + + +-- +-- Name: idx_search_by_homology_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_homology_organism_id ON search_by_homology USING btree (organism_id); + + +-- +-- Name: idx_search_by_interpro_accession; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_accession ON search_by_interpro USING btree (accession); + + +-- +-- Name: idx_search_by_interpro_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_analysis_id ON search_by_interpro USING btree (analysis_id); + + +-- +-- Name: idx_search_by_interpro_analysis_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_analysis_name ON search_by_interpro USING btree (analysis_name); + + +-- +-- Name: idx_search_by_interpro_analysis_nid; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_analysis_nid ON search_by_interpro USING btree (analysis_nid); + + +-- +-- Name: idx_search_by_interpro_feature_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_feature_id ON search_by_interpro USING btree (feature_id); + + +-- +-- Name: idx_search_by_interpro_feature_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_feature_name ON search_by_interpro USING btree (feature_name); + + +-- +-- Name: idx_search_by_interpro_feature_nid; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_feature_nid ON search_by_interpro USING btree (feature_nid); + + +-- +-- Name: idx_search_by_interpro_feature_type; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_feature_type ON search_by_interpro USING btree (feature_type); + + +-- +-- Name: idx_search_by_interpro_feature_type_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_feature_type_id ON search_by_interpro USING btree (feature_type_id); + + +-- +-- Name: idx_search_by_interpro_fmax; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_fmax ON search_by_interpro USING btree (fmax); + + +-- +-- Name: idx_search_by_interpro_fmin; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_fmin ON search_by_interpro USING btree (fmin); + + +-- +-- Name: idx_search_by_interpro_landmark; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_landmark ON search_by_interpro USING btree (landmark); + + +-- +-- Name: idx_search_by_interpro_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_organism_id ON search_by_interpro USING btree (organism_id); + + +-- +-- Name: idx_search_by_interpro_source_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_source_analysis_id ON search_by_interpro USING btree (source_analysis_id); + + +-- +-- Name: idx_search_by_interpro_source_analysis_nid; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_source_analysis_nid ON search_by_interpro USING btree (source_analysis_nid); + + +-- +-- Name: idx_search_by_interpro_source_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_source_name ON search_by_interpro USING btree (source_name); + + +-- +-- Name: idx_search_by_interpro_strand; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_strand ON search_by_interpro USING btree (strand); + + +-- +-- Name: idx_search_by_interpro_term_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_term_name ON search_by_interpro USING btree (term_name); + + +-- +-- Name: idx_search_by_interpro_type_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_interpro_type_id ON search_by_interpro USING btree (type_id); + + +-- +-- Name: idx_search_by_kegg_accession; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_accession ON search_by_kegg USING btree (accession); + + +-- +-- Name: idx_search_by_kegg_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_analysis_id ON search_by_kegg USING btree (analysis_id); + + +-- +-- Name: idx_search_by_kegg_feature_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_feature_id ON search_by_kegg USING btree (feature_id); + + +-- +-- Name: idx_search_by_kegg_feature_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_feature_name ON search_by_kegg USING btree (feature_name); + + +-- +-- Name: idx_search_by_kegg_feature_type; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_feature_type ON search_by_kegg USING btree (feature_type); + + +-- +-- Name: idx_search_by_kegg_kegg_term; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_kegg_term ON search_by_kegg USING btree (kegg_term); + + +-- +-- Name: idx_search_by_kegg_organism_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_organism_id ON search_by_kegg USING btree (organism_id); + + +-- +-- Name: idx_search_by_kegg_source_analysis_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_source_analysis_id ON search_by_kegg USING btree (source_analysis_id); + + +-- +-- Name: idx_search_by_kegg_source_name; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_source_name ON search_by_kegg USING btree (source_name); + + +-- +-- Name: idx_search_by_kegg_type_id; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX idx_search_by_kegg_type_id ON search_by_kegg USING btree (type_id); + + +-- +-- Name: library_cvterm_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_cvterm_idx1 ON library_cvterm USING btree (library_id); + + +-- +-- Name: library_cvterm_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_cvterm_idx2 ON library_cvterm USING btree (cvterm_id); + + +-- +-- Name: library_cvterm_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_cvterm_idx3 ON library_cvterm USING btree (pub_id); + + +-- +-- Name: library_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_dbxref_idx1 ON library_dbxref USING btree (library_id); + + +-- +-- Name: library_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_dbxref_idx2 ON library_dbxref USING btree (dbxref_id); + + +-- +-- Name: library_feature_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_feature_idx1 ON library_feature USING btree (library_id); + + +-- +-- Name: library_feature_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_feature_idx2 ON library_feature USING btree (feature_id); + + +-- +-- Name: library_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_idx1 ON library USING btree (organism_id); + + +-- +-- Name: library_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_idx2 ON library USING btree (type_id); + + +-- +-- Name: library_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_idx3 ON library USING btree (uniquename); + + +-- +-- Name: library_name_ind1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_name_ind1 ON library USING btree (name); + + +-- +-- Name: library_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_pub_idx1 ON library_pub USING btree (library_id); + + +-- +-- Name: library_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_pub_idx2 ON library_pub USING btree (pub_id); + + +-- +-- Name: library_synonym_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_synonym_idx1 ON library_synonym USING btree (synonym_id); + + +-- +-- Name: library_synonym_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_synonym_idx2 ON library_synonym USING btree (library_id); + + +-- +-- Name: library_synonym_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX library_synonym_idx3 ON library_synonym USING btree (pub_id); + + +-- +-- Name: libraryprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX libraryprop_idx1 ON libraryprop USING btree (library_id); + + +-- +-- Name: libraryprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX libraryprop_idx2 ON libraryprop USING btree (type_id); + + +-- +-- Name: libraryprop_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX libraryprop_pub_idx1 ON libraryprop_pub USING btree (libraryprop_id); + + +-- +-- Name: libraryprop_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX libraryprop_pub_idx2 ON libraryprop_pub USING btree (pub_id); + + +-- +-- Name: magedocumentation_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX magedocumentation_idx1 ON magedocumentation USING btree (mageml_id); + + +-- +-- Name: magedocumentation_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX magedocumentation_idx2 ON magedocumentation USING btree (tableinfo_id); + + +-- +-- Name: magedocumentation_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX magedocumentation_idx3 ON magedocumentation USING btree (row_id); + + +-- +-- Name: nd_experiment_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX nd_experiment_pub_idx1 ON nd_experiment_pub USING btree (nd_experiment_id); + + +-- +-- Name: nd_experiment_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX nd_experiment_pub_idx2 ON nd_experiment_pub USING btree (pub_id); + + +-- +-- Name: organism_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX organism_dbxref_idx1 ON organism_dbxref USING btree (organism_id); + + +-- +-- Name: organism_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX organism_dbxref_idx2 ON organism_dbxref USING btree (dbxref_id); + + +-- +-- Name: organism_for_search_organism_for_search_indx0_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX organism_for_search_organism_for_search_indx0_idx ON organism_for_search USING btree (organism_name); + + +-- +-- Name: organism_stock_count_organism_stock_count_idx1_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX organism_stock_count_organism_stock_count_idx1_idx ON organism_stock_count USING btree (organism_id); + + +-- +-- Name: organism_stock_count_organism_stock_count_idx2_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX organism_stock_count_organism_stock_count_idx2_idx ON organism_stock_count USING btree (cvterm_id); + + +-- +-- Name: organism_stock_count_organism_stock_count_idx3_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX organism_stock_count_organism_stock_count_idx3_idx ON organism_stock_count USING btree (stock_type); + + +-- +-- Name: organismprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX organismprop_idx1 ON organismprop USING btree (organism_id); + + +-- +-- Name: organismprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX organismprop_idx2 ON organismprop USING btree (type_id); + + +-- +-- Name: phendesc_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phendesc_idx1 ON phendesc USING btree (genotype_id); + + +-- +-- Name: phendesc_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phendesc_idx2 ON phendesc USING btree (environment_id); + + +-- +-- Name: phendesc_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phendesc_idx3 ON phendesc USING btree (pub_id); + + +-- +-- Name: phenotype_comparison_cvterm_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_comparison_cvterm_idx1 ON phenotype_comparison_cvterm USING btree (phenotype_comparison_id); + + +-- +-- Name: phenotype_comparison_cvterm_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_comparison_cvterm_idx2 ON phenotype_comparison_cvterm USING btree (cvterm_id); + + +-- +-- Name: phenotype_comparison_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_comparison_idx1 ON phenotype_comparison USING btree (genotype1_id); + + +-- +-- Name: phenotype_comparison_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_comparison_idx2 ON phenotype_comparison USING btree (genotype2_id); + + +-- +-- Name: phenotype_comparison_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_comparison_idx4 ON phenotype_comparison USING btree (pub_id); + + +-- +-- Name: phenotype_cvterm_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_cvterm_idx1 ON phenotype_cvterm USING btree (phenotype_id); + + +-- +-- Name: phenotype_cvterm_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_cvterm_idx2 ON phenotype_cvterm USING btree (cvterm_id); + + +-- +-- Name: phenotype_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_idx1 ON phenotype USING btree (cvalue_id); + + +-- +-- Name: phenotype_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_idx2 ON phenotype USING btree (observable_id); + + +-- +-- Name: phenotype_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenotype_idx3 ON phenotype USING btree (attr_id); + + +-- +-- Name: phenstatement_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenstatement_idx1 ON phenstatement USING btree (genotype_id); + + +-- +-- Name: phenstatement_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phenstatement_idx2 ON phenstatement USING btree (phenotype_id); + + +-- +-- Name: phylonode_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_dbxref_idx1 ON phylonode_dbxref USING btree (phylonode_id); + + +-- +-- Name: phylonode_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_dbxref_idx2 ON phylonode_dbxref USING btree (dbxref_id); + + +-- +-- Name: phylonode_organism_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_organism_idx1 ON phylonode_organism USING btree (phylonode_id); + + +-- +-- Name: phylonode_organism_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_organism_idx2 ON phylonode_organism USING btree (organism_id); + + +-- +-- Name: phylonode_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_pub_idx1 ON phylonode_pub USING btree (phylonode_id); + + +-- +-- Name: phylonode_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_pub_idx2 ON phylonode_pub USING btree (pub_id); + + +-- +-- Name: phylonode_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_relationship_idx1 ON phylonode_relationship USING btree (subject_id); + + +-- +-- Name: phylonode_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_relationship_idx2 ON phylonode_relationship USING btree (object_id); + + +-- +-- Name: phylonode_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonode_relationship_idx3 ON phylonode_relationship USING btree (type_id); + + +-- +-- Name: phylonodeprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonodeprop_idx1 ON phylonodeprop USING btree (phylonode_id); + + +-- +-- Name: phylonodeprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylonodeprop_idx2 ON phylonodeprop USING btree (type_id); + + +-- +-- Name: phylotree_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylotree_idx1 ON phylotree USING btree (phylotree_id); + + +-- +-- Name: phylotree_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylotree_pub_idx1 ON phylotree_pub USING btree (phylotree_id); + + +-- +-- Name: phylotree_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX phylotree_pub_idx2 ON phylotree_pub USING btree (pub_id); + + +-- +-- Name: project_contact_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX project_contact_idx1 ON project_contact USING btree (project_id); + + +-- +-- Name: project_contact_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX project_contact_idx2 ON project_contact USING btree (contact_id); + + +-- +-- Name: project_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX project_pub_idx1 ON project_pub USING btree (project_id); + + +-- +-- Name: project_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX project_pub_idx2 ON project_pub USING btree (pub_id); + + +-- +-- Name: protocol_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX protocol_idx1 ON protocol USING btree (type_id); + + +-- +-- Name: protocol_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX protocol_idx2 ON protocol USING btree (pub_id); + + +-- +-- Name: protocol_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX protocol_idx3 ON protocol USING btree (dbxref_id); + + +-- +-- Name: protocolparam_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX protocolparam_idx1 ON protocolparam USING btree (protocol_id); + + +-- +-- Name: protocolparam_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX protocolparam_idx2 ON protocolparam USING btree (datatype_id); + + +-- +-- Name: protocolparam_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX protocolparam_idx3 ON protocolparam USING btree (unittype_id); + + +-- +-- Name: pub_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pub_dbxref_idx1 ON pub_dbxref USING btree (pub_id); + + +-- +-- Name: pub_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pub_dbxref_idx2 ON pub_dbxref USING btree (dbxref_id); + + +-- +-- Name: pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pub_idx1 ON pub USING btree (type_id); + + +-- +-- Name: pub_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pub_relationship_idx1 ON pub_relationship USING btree (subject_id); + + +-- +-- Name: pub_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pub_relationship_idx2 ON pub_relationship USING btree (object_id); + + +-- +-- Name: pub_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pub_relationship_idx3 ON pub_relationship USING btree (type_id); + + +-- +-- Name: pubauthor_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pubauthor_idx2 ON pubauthor USING btree (pub_id); + + +-- +-- Name: pubprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pubprop_idx1 ON pubprop USING btree (pub_id); + + +-- +-- Name: pubprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX pubprop_idx2 ON pubprop USING btree (type_id); + + +-- +-- Name: qtl_search_qtl_search_indx0_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX qtl_search_qtl_search_indx0_idx ON qtl_search USING btree (organism); + + +-- +-- Name: qtl_search_qtl_search_indx1_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX qtl_search_qtl_search_indx1_idx ON qtl_search USING btree (qtl); + + +-- +-- Name: qtl_search_qtl_search_indx2_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX qtl_search_qtl_search_indx2_idx ON qtl_search USING btree (symbol); + + +-- +-- Name: qtl_search_qtl_search_indx3_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX qtl_search_qtl_search_indx3_idx ON qtl_search USING btree (trait); + + +-- +-- Name: quantification_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantification_idx1 ON quantification USING btree (acquisition_id); + + +-- +-- Name: quantification_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantification_idx2 ON quantification USING btree (operator_id); + + +-- +-- Name: quantification_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantification_idx3 ON quantification USING btree (protocol_id); + + +-- +-- Name: quantification_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantification_idx4 ON quantification USING btree (analysis_id); + + +-- +-- Name: quantification_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantification_relationship_idx1 ON quantification_relationship USING btree (subject_id); + + +-- +-- Name: quantification_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantification_relationship_idx2 ON quantification_relationship USING btree (type_id); + + +-- +-- Name: quantification_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantification_relationship_idx3 ON quantification_relationship USING btree (object_id); + + +-- +-- Name: quantificationprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantificationprop_idx1 ON quantificationprop USING btree (quantification_id); + + +-- +-- Name: quantificationprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX quantificationprop_idx2 ON quantificationprop USING btree (type_id); + + +-- +-- Name: search_by_map_search_by_map_idx12_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx12_idx ON search_by_map USING btree (genome); + + +-- +-- Name: search_by_map_search_by_map_idx13_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx13_idx ON search_by_map USING btree (pop_size); + + +-- +-- Name: search_by_map_search_by_map_idx14_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx14_idx ON search_by_map USING btree (pop_type); + + +-- +-- Name: search_by_map_search_by_map_idx15_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx15_idx ON search_by_map USING btree (num_of_lg); + + +-- +-- Name: search_by_map_search_by_map_idx16_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx16_idx ON search_by_map USING btree (num_of_loci); + + +-- +-- Name: search_by_map_search_by_map_idx1_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx1_idx ON search_by_map USING btree (featuremap_id); + + +-- +-- Name: search_by_map_search_by_map_idx2_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx2_idx ON search_by_map USING btree (organism_id); + + +-- +-- Name: search_by_map_search_by_map_idx3_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx3_idx ON search_by_map USING btree (pop_stock_id); + + +-- +-- Name: search_by_map_search_by_map_idx4_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx4_idx ON search_by_map USING btree (maternal_stock_id); + + +-- +-- Name: search_by_map_search_by_map_idx5_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx5_idx ON search_by_map USING btree (maternal_stock_uniquename); + + +-- +-- Name: search_by_map_search_by_map_idx6_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx6_idx ON search_by_map USING btree (maternal_stock_nid); + + +-- +-- Name: search_by_map_search_by_map_idx7_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx7_idx ON search_by_map USING btree (paternal_stock_id); + + +-- +-- Name: search_by_map_search_by_map_idx8_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx8_idx ON search_by_map USING btree (paternal_stock_uniquename); + + +-- +-- Name: search_by_map_search_by_map_idx9_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX search_by_map_search_by_map_idx9_idx ON search_by_map USING btree (paternal_stock_nid); + + +-- +-- Name: searchable_features_feature_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX searchable_features_feature_id_idx ON searchable_features USING btree (feature_id); + + +-- +-- Name: searchable_features_feature_name_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX searchable_features_feature_name_idx ON searchable_features USING btree (feature_name); + + +-- +-- Name: searchable_features_feature_type_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX searchable_features_feature_type_idx ON searchable_features USING btree (feature_type); + + +-- +-- Name: searchable_features_organism_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX searchable_features_organism_id_idx ON searchable_features USING btree (organism_id); + + +-- +-- Name: searchable_features_source_analysis_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX searchable_features_source_analysis_id_idx ON searchable_features USING btree (source_analysis_id); + + +-- +-- Name: searchable_features_source_name_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX searchable_features_source_name_idx ON searchable_features USING btree (source_name); + + +-- +-- Name: searchable_features_type_id_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX searchable_features_type_id_idx ON searchable_features USING btree (type_id); + + +-- +-- Name: species_summary_species_summary_idx0_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX species_summary_species_summary_idx0_idx ON species_summary USING btree (organism_id); + + +-- +-- Name: stock_cvterm_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_cvterm_idx1 ON stock_cvterm USING btree (stock_id); + + +-- +-- Name: stock_cvterm_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_cvterm_idx2 ON stock_cvterm USING btree (cvterm_id); + + +-- +-- Name: stock_cvterm_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_cvterm_idx3 ON stock_cvterm USING btree (pub_id); + + +-- +-- Name: stock_cvtermprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_cvtermprop_idx1 ON stock_cvtermprop USING btree (stock_cvterm_id); + + +-- +-- Name: stock_cvtermprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_cvtermprop_idx2 ON stock_cvtermprop USING btree (type_id); + + +-- +-- Name: stock_dbxref_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_dbxref_idx1 ON stock_dbxref USING btree (stock_id); + + +-- +-- Name: stock_dbxref_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_dbxref_idx2 ON stock_dbxref USING btree (dbxref_id); + + +-- +-- Name: stock_dbxrefprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_dbxrefprop_idx1 ON stock_dbxrefprop USING btree (stock_dbxref_id); + + +-- +-- Name: stock_dbxrefprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_dbxrefprop_idx2 ON stock_dbxrefprop USING btree (type_id); + + +-- +-- Name: stock_genotype_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_genotype_idx1 ON stock_genotype USING btree (stock_id); + + +-- +-- Name: stock_genotype_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_genotype_idx2 ON stock_genotype USING btree (genotype_id); + + +-- +-- Name: stock_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_idx1 ON stock USING btree (dbxref_id); + + +-- +-- Name: stock_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_idx2 ON stock USING btree (organism_id); + + +-- +-- Name: stock_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_idx3 ON stock USING btree (type_id); + + +-- +-- Name: stock_idx4; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_idx4 ON stock USING btree (uniquename); + + +-- +-- Name: stock_image_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_image_idx1 ON stock_image USING btree (stock_id); + + +-- +-- Name: stock_image_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_image_idx2 ON stock_image USING btree (eimage_id); + + +-- +-- Name: stock_name_ind1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_name_ind1 ON stock USING btree (name); + + +-- +-- Name: stock_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_pub_idx1 ON stock_pub USING btree (stock_id); + + +-- +-- Name: stock_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_pub_idx2 ON stock_pub USING btree (pub_id); + + +-- +-- Name: stock_relationship_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_relationship_idx1 ON stock_relationship USING btree (subject_id); + + +-- +-- Name: stock_relationship_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_relationship_idx2 ON stock_relationship USING btree (object_id); + + +-- +-- Name: stock_relationship_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_relationship_idx3 ON stock_relationship USING btree (type_id); + + +-- +-- Name: stock_relationship_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_relationship_pub_idx1 ON stock_relationship_pub USING btree (stock_relationship_id); + + +-- +-- Name: stock_relationship_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stock_relationship_pub_idx2 ON stock_relationship_pub USING btree (pub_id); + + +-- +-- Name: stockcollection_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockcollection_idx1 ON stockcollection USING btree (contact_id); + + +-- +-- Name: stockcollection_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockcollection_idx2 ON stockcollection USING btree (type_id); + + +-- +-- Name: stockcollection_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockcollection_idx3 ON stockcollection USING btree (uniquename); + + +-- +-- Name: stockcollection_name_ind1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockcollection_name_ind1 ON stockcollection USING btree (name); + + +-- +-- Name: stockcollection_stock_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockcollection_stock_idx1 ON stockcollection_stock USING btree (stockcollection_id); + + +-- +-- Name: stockcollection_stock_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockcollection_stock_idx2 ON stockcollection_stock USING btree (stock_id); + + +-- +-- Name: stockcollectionprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockcollectionprop_idx1 ON stockcollectionprop USING btree (stockcollection_id); + + +-- +-- Name: stockcollectionprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockcollectionprop_idx2 ON stockcollectionprop USING btree (type_id); + + +-- +-- Name: stockprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockprop_idx1 ON stockprop USING btree (stock_id); + + +-- +-- Name: stockprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockprop_idx2 ON stockprop USING btree (type_id); + + +-- +-- Name: stockprop_pub_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockprop_pub_idx1 ON stockprop_pub USING btree (stockprop_id); + + +-- +-- Name: stockprop_pub_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX stockprop_pub_idx2 ON stockprop_pub USING btree (pub_id); + + +-- +-- Name: study_assay_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX study_assay_idx1 ON study_assay USING btree (study_id); + + +-- +-- Name: study_assay_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX study_assay_idx2 ON study_assay USING btree (assay_id); + + +-- +-- Name: study_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX study_idx1 ON study USING btree (contact_id); + + +-- +-- Name: study_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX study_idx2 ON study USING btree (pub_id); + + +-- +-- Name: study_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX study_idx3 ON study USING btree (dbxref_id); + + +-- +-- Name: studydesign_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studydesign_idx1 ON studydesign USING btree (study_id); + + +-- +-- Name: studydesignprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studydesignprop_idx1 ON studydesignprop USING btree (studydesign_id); + + +-- +-- Name: studydesignprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studydesignprop_idx2 ON studydesignprop USING btree (type_id); + + +-- +-- Name: studyfactor_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studyfactor_idx1 ON studyfactor USING btree (studydesign_id); + + +-- +-- Name: studyfactor_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studyfactor_idx2 ON studyfactor USING btree (type_id); + + +-- +-- Name: studyfactorvalue_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studyfactorvalue_idx1 ON studyfactorvalue USING btree (studyfactor_id); + + +-- +-- Name: studyfactorvalue_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studyfactorvalue_idx2 ON studyfactorvalue USING btree (assay_id); + + +-- +-- Name: studyprop_feature_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studyprop_feature_idx1 ON studyprop_feature USING btree (studyprop_id); + + +-- +-- Name: studyprop_feature_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studyprop_feature_idx2 ON studyprop_feature USING btree (feature_id); + + +-- +-- Name: studyprop_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studyprop_idx1 ON studyprop USING btree (study_id); + + +-- +-- Name: studyprop_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX studyprop_idx2 ON studyprop USING btree (type_id); + + +-- +-- Name: synonym_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX synonym_idx1 ON synonym USING btree (type_id); + + +-- +-- Name: synonym_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX synonym_idx2 ON synonym USING btree (lower((synonym_sgml)::text)); + + +-- +-- Name: treatment_idx1; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX treatment_idx1 ON treatment USING btree (biomaterial_id); + + +-- +-- Name: treatment_idx2; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX treatment_idx2 ON treatment USING btree (type_id); + + +-- +-- Name: treatment_idx3; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX treatment_idx3 ON treatment USING btree (protocol_id); + + +-- +-- Name: tripal_gff_temp_tripal_gff_temp_idx1_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX tripal_gff_temp_tripal_gff_temp_idx1_idx ON tripal_gff_temp USING btree (uniquename); + + +-- +-- Name: tripal_gffcds_temp_tripal_gff_temp_idx0_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX tripal_gffcds_temp_tripal_gff_temp_idx0_idx ON tripal_gffcds_temp USING btree (parent_id); + + +-- +-- Name: tripal_gffprotein_temp_tripal_gff_temp_idx0_idx; Type: INDEX; Schema: chado; Owner: -; Tablespace: +-- + +CREATE INDEX tripal_gffprotein_temp_tripal_gff_temp_idx0_idx ON tripal_gffprotein_temp USING btree (parent_id); + + +-- +-- Name: acquisition_assay_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisition + ADD CONSTRAINT acquisition_assay_id_fkey FOREIGN KEY (assay_id) REFERENCES assay(assay_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: acquisition_channel_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisition + ADD CONSTRAINT acquisition_channel_id_fkey FOREIGN KEY (channel_id) REFERENCES channel(channel_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: acquisition_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisition + ADD CONSTRAINT acquisition_protocol_id_fkey FOREIGN KEY (protocol_id) REFERENCES protocol(protocol_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: acquisition_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisition_relationship + ADD CONSTRAINT acquisition_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES acquisition(acquisition_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: acquisition_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisition_relationship + ADD CONSTRAINT acquisition_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES acquisition(acquisition_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: acquisition_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisition_relationship + ADD CONSTRAINT acquisition_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: acquisitionprop_acquisition_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisitionprop + ADD CONSTRAINT acquisitionprop_acquisition_id_fkey FOREIGN KEY (acquisition_id) REFERENCES acquisition(acquisition_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: acquisitionprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY acquisitionprop + ADD CONSTRAINT acquisitionprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: analysis_organism_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysis_organism + ADD CONSTRAINT analysis_organism_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: analysisfeature_analysis_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysisfeature + ADD CONSTRAINT analysisfeature_analysis_id_fkey FOREIGN KEY (analysis_id) REFERENCES analysis(analysis_id) ON DELETE CASCADE; + + +-- +-- Name: analysisfeature_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysisfeature + ADD CONSTRAINT analysisfeature_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: analysisfeatureprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysisfeatureprop + ADD CONSTRAINT analysisfeatureprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: analysisprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY analysisprop + ADD CONSTRAINT analysisprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: arraydesign_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesign + ADD CONSTRAINT arraydesign_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: arraydesign_manufacturer_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesign + ADD CONSTRAINT arraydesign_manufacturer_id_fkey FOREIGN KEY (manufacturer_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: arraydesign_platformtype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesign + ADD CONSTRAINT arraydesign_platformtype_id_fkey FOREIGN KEY (platformtype_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: arraydesign_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesign + ADD CONSTRAINT arraydesign_protocol_id_fkey FOREIGN KEY (protocol_id) REFERENCES protocol(protocol_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: arraydesign_substratetype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesign + ADD CONSTRAINT arraydesign_substratetype_id_fkey FOREIGN KEY (substratetype_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: arraydesignprop_arraydesign_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesignprop + ADD CONSTRAINT arraydesignprop_arraydesign_id_fkey FOREIGN KEY (arraydesign_id) REFERENCES arraydesign(arraydesign_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: arraydesignprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY arraydesignprop + ADD CONSTRAINT arraydesignprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_arraydesign_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay + ADD CONSTRAINT assay_arraydesign_id_fkey FOREIGN KEY (arraydesign_id) REFERENCES arraydesign(arraydesign_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_biomaterial_assay_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay_biomaterial + ADD CONSTRAINT assay_biomaterial_assay_id_fkey FOREIGN KEY (assay_id) REFERENCES assay(assay_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_biomaterial_biomaterial_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay_biomaterial + ADD CONSTRAINT assay_biomaterial_biomaterial_id_fkey FOREIGN KEY (biomaterial_id) REFERENCES biomaterial(biomaterial_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_biomaterial_channel_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay_biomaterial + ADD CONSTRAINT assay_biomaterial_channel_id_fkey FOREIGN KEY (channel_id) REFERENCES channel(channel_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay + ADD CONSTRAINT assay_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_operator_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay + ADD CONSTRAINT assay_operator_id_fkey FOREIGN KEY (operator_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_project_assay_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay_project + ADD CONSTRAINT assay_project_assay_id_fkey FOREIGN KEY (assay_id) REFERENCES assay(assay_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_project_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay_project + ADD CONSTRAINT assay_project_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assay_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assay + ADD CONSTRAINT assay_protocol_id_fkey FOREIGN KEY (protocol_id) REFERENCES protocol(protocol_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assayprop_assay_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assayprop + ADD CONSTRAINT assayprop_assay_id_fkey FOREIGN KEY (assay_id) REFERENCES assay(assay_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: assayprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY assayprop + ADD CONSTRAINT assayprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_biosourceprovider_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial + ADD CONSTRAINT biomaterial_biosourceprovider_id_fkey FOREIGN KEY (biosourceprovider_id) REFERENCES contact(contact_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_dbxref_biomaterial_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_dbxref + ADD CONSTRAINT biomaterial_dbxref_biomaterial_id_fkey FOREIGN KEY (biomaterial_id) REFERENCES biomaterial(biomaterial_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_dbxref + ADD CONSTRAINT biomaterial_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial + ADD CONSTRAINT biomaterial_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_relationship + ADD CONSTRAINT biomaterial_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES biomaterial(biomaterial_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_relationship + ADD CONSTRAINT biomaterial_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES biomaterial(biomaterial_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_relationship + ADD CONSTRAINT biomaterial_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_taxon_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial + ADD CONSTRAINT biomaterial_taxon_id_fkey FOREIGN KEY (taxon_id) REFERENCES organism(organism_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_treatment_biomaterial_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_treatment + ADD CONSTRAINT biomaterial_treatment_biomaterial_id_fkey FOREIGN KEY (biomaterial_id) REFERENCES biomaterial(biomaterial_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_treatment_treatment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_treatment + ADD CONSTRAINT biomaterial_treatment_treatment_id_fkey FOREIGN KEY (treatment_id) REFERENCES treatment(treatment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterial_treatment_unittype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterial_treatment + ADD CONSTRAINT biomaterial_treatment_unittype_id_fkey FOREIGN KEY (unittype_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterialprop_biomaterial_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterialprop + ADD CONSTRAINT biomaterialprop_biomaterial_id_fkey FOREIGN KEY (biomaterial_id) REFERENCES biomaterial(biomaterial_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: biomaterialprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY biomaterialprop + ADD CONSTRAINT biomaterialprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: blast_hit_data_blast_org_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY blast_hit_data + ADD CONSTRAINT blast_hit_data_blast_org_id_fkey FOREIGN KEY (blast_org_id) REFERENCES blast_organisms(blast_org_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: blast_hit_data_db_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY blast_hit_data + ADD CONSTRAINT blast_hit_data_db_id_fkey FOREIGN KEY (db_id) REFERENCES db(db_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: blast_hit_data_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY blast_hit_data + ADD CONSTRAINT blast_hit_data_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_cvterm_cell_line_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_cvterm + ADD CONSTRAINT cell_line_cvterm_cell_line_id_fkey FOREIGN KEY (cell_line_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_cvterm + ADD CONSTRAINT cell_line_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_cvterm_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_cvterm + ADD CONSTRAINT cell_line_cvterm_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_cvtermprop_cell_line_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_cvtermprop + ADD CONSTRAINT cell_line_cvtermprop_cell_line_cvterm_id_fkey FOREIGN KEY (cell_line_cvterm_id) REFERENCES cell_line_cvterm(cell_line_cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_cvtermprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_cvtermprop + ADD CONSTRAINT cell_line_cvtermprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_dbxref_cell_line_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_dbxref + ADD CONSTRAINT cell_line_dbxref_cell_line_id_fkey FOREIGN KEY (cell_line_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_dbxref + ADD CONSTRAINT cell_line_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_feature_cell_line_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_feature + ADD CONSTRAINT cell_line_feature_cell_line_id_fkey FOREIGN KEY (cell_line_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_feature_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_feature + ADD CONSTRAINT cell_line_feature_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_feature_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_feature + ADD CONSTRAINT cell_line_feature_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_library_cell_line_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_library + ADD CONSTRAINT cell_line_library_cell_line_id_fkey FOREIGN KEY (cell_line_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_library_library_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_library + ADD CONSTRAINT cell_line_library_library_id_fkey FOREIGN KEY (library_id) REFERENCES library(library_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_library_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_library + ADD CONSTRAINT cell_line_library_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line + ADD CONSTRAINT cell_line_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_pub_cell_line_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_pub + ADD CONSTRAINT cell_line_pub_cell_line_id_fkey FOREIGN KEY (cell_line_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_pub + ADD CONSTRAINT cell_line_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_relationship + ADD CONSTRAINT cell_line_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_relationship + ADD CONSTRAINT cell_line_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_relationship + ADD CONSTRAINT cell_line_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_synonym_cell_line_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_synonym + ADD CONSTRAINT cell_line_synonym_cell_line_id_fkey FOREIGN KEY (cell_line_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_synonym_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_synonym + ADD CONSTRAINT cell_line_synonym_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line_synonym_synonym_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_line_synonym + ADD CONSTRAINT cell_line_synonym_synonym_id_fkey FOREIGN KEY (synonym_id) REFERENCES synonym(synonym_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_lineprop_cell_line_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_lineprop + ADD CONSTRAINT cell_lineprop_cell_line_id_fkey FOREIGN KEY (cell_line_id) REFERENCES cell_line(cell_line_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_lineprop_pub_cell_lineprop_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_lineprop_pub + ADD CONSTRAINT cell_lineprop_pub_cell_lineprop_id_fkey FOREIGN KEY (cell_lineprop_id) REFERENCES cell_lineprop(cell_lineprop_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_lineprop_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_lineprop_pub + ADD CONSTRAINT cell_lineprop_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_lineprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cell_lineprop + ADD CONSTRAINT cell_lineprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: chadoprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY chadoprop + ADD CONSTRAINT chadoprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: contact_image_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact_image + ADD CONSTRAINT contact_image_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id); + + +-- +-- Name: contact_image_eimage_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact_image + ADD CONSTRAINT contact_image_eimage_id_fkey FOREIGN KEY (eimage_id) REFERENCES eimage(eimage_id); + + +-- +-- Name: contact_image_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact_image + ADD CONSTRAINT contact_image_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id); + + +-- +-- Name: contact_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact_relationship + ADD CONSTRAINT contact_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: contact_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact_relationship + ADD CONSTRAINT contact_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: contact_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact_relationship + ADD CONSTRAINT contact_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: contact_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contact + ADD CONSTRAINT contact_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id); + + +-- +-- Name: contactprop_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contactprop + ADD CONSTRAINT contactprop_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: contactprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY contactprop + ADD CONSTRAINT contactprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: control_assay_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY control + ADD CONSTRAINT control_assay_id_fkey FOREIGN KEY (assay_id) REFERENCES assay(assay_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: control_tableinfo_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY control + ADD CONSTRAINT control_tableinfo_id_fkey FOREIGN KEY (tableinfo_id) REFERENCES tableinfo(tableinfo_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: control_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY control + ADD CONSTRAINT control_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvprop + ADD CONSTRAINT cvprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvterm_dbxref_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm_dbxref + ADD CONSTRAINT cvterm_dbxref_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvterm_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm_dbxref + ADD CONSTRAINT cvterm_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvterm_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm + ADD CONSTRAINT cvterm_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvterm_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm_relationship + ADD CONSTRAINT cvterm_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvterm_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm_relationship + ADD CONSTRAINT cvterm_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvterm_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvterm_relationship + ADD CONSTRAINT cvterm_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvtermpath_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermpath + ADD CONSTRAINT cvtermpath_object_id_fkey FOREIGN KEY (object_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvtermpath_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermpath + ADD CONSTRAINT cvtermpath_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvtermpath_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermpath + ADD CONSTRAINT cvtermpath_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvtermprop_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermprop + ADD CONSTRAINT cvtermprop_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: cvtermprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermprop + ADD CONSTRAINT cvtermprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: cvtermsynonym_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermsynonym + ADD CONSTRAINT cvtermsynonym_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cvtermsynonym_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY cvtermsynonym + ADD CONSTRAINT cvtermsynonym_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: dbxrefprop_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY dbxrefprop + ADD CONSTRAINT dbxrefprop_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: dbxrefprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY dbxrefprop + ADD CONSTRAINT dbxrefprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: eimageprop_eimage_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY eimageprop + ADD CONSTRAINT eimageprop_eimage_id_fkey FOREIGN KEY (eimage_id) REFERENCES eimage(eimage_id) ON DELETE CASCADE; + + +-- +-- Name: eimageprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY eimageprop + ADD CONSTRAINT eimageprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: element_arraydesign_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element + ADD CONSTRAINT element_arraydesign_id_fkey FOREIGN KEY (arraydesign_id) REFERENCES arraydesign(arraydesign_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: element_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element + ADD CONSTRAINT element_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: element_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element + ADD CONSTRAINT element_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: element_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element_relationship + ADD CONSTRAINT element_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES element(element_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: element_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element_relationship + ADD CONSTRAINT element_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES element(element_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: element_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element_relationship + ADD CONSTRAINT element_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: element_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY element + ADD CONSTRAINT element_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: elementresult_element_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY elementresult + ADD CONSTRAINT elementresult_element_id_fkey FOREIGN KEY (element_id) REFERENCES element(element_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: elementresult_quantification_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY elementresult + ADD CONSTRAINT elementresult_quantification_id_fkey FOREIGN KEY (quantification_id) REFERENCES quantification(quantification_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: elementresult_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY elementresult_relationship + ADD CONSTRAINT elementresult_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES elementresult(elementresult_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: elementresult_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY elementresult_relationship + ADD CONSTRAINT elementresult_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES elementresult(elementresult_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: elementresult_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY elementresult_relationship + ADD CONSTRAINT elementresult_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: environment_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY environment_cvterm + ADD CONSTRAINT environment_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: environment_cvterm_environment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY environment_cvterm + ADD CONSTRAINT environment_cvterm_environment_id_fkey FOREIGN KEY (environment_id) REFERENCES environment(environment_id) ON DELETE CASCADE; + + +-- +-- Name: expression_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_cvterm + ADD CONSTRAINT expression_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expression_cvterm_cvterm_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_cvterm + ADD CONSTRAINT expression_cvterm_cvterm_type_id_fkey FOREIGN KEY (cvterm_type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expression_cvterm_expression_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_cvterm + ADD CONSTRAINT expression_cvterm_expression_id_fkey FOREIGN KEY (expression_id) REFERENCES expression(expression_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expression_cvtermprop_expression_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_cvtermprop + ADD CONSTRAINT expression_cvtermprop_expression_cvterm_id_fkey FOREIGN KEY (expression_cvterm_id) REFERENCES expression_cvterm(expression_cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expression_cvtermprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_cvtermprop + ADD CONSTRAINT expression_cvtermprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expression_image_eimage_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_image + ADD CONSTRAINT expression_image_eimage_id_fkey FOREIGN KEY (eimage_id) REFERENCES eimage(eimage_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expression_image_expression_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_image + ADD CONSTRAINT expression_image_expression_id_fkey FOREIGN KEY (expression_id) REFERENCES expression(expression_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expression_pub_expression_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_pub + ADD CONSTRAINT expression_pub_expression_id_fkey FOREIGN KEY (expression_id) REFERENCES expression(expression_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expression_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expression_pub + ADD CONSTRAINT expression_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expressionprop_expression_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expressionprop + ADD CONSTRAINT expressionprop_expression_id_fkey FOREIGN KEY (expression_id) REFERENCES expression(expression_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: expressionprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY expressionprop + ADD CONSTRAINT expressionprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_contact_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_contact + ADD CONSTRAINT feature_contact_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE; + + +-- +-- Name: feature_contact_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_contact + ADD CONSTRAINT feature_contact_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: feature_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm + ADD CONSTRAINT feature_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_cvterm_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm_dbxref + ADD CONSTRAINT feature_cvterm_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_cvterm_dbxref_feature_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm_dbxref + ADD CONSTRAINT feature_cvterm_dbxref_feature_cvterm_id_fkey FOREIGN KEY (feature_cvterm_id) REFERENCES feature_cvterm(feature_cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: feature_cvterm_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm + ADD CONSTRAINT feature_cvterm_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_cvterm_pub_feature_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm_pub + ADD CONSTRAINT feature_cvterm_pub_feature_cvterm_id_fkey FOREIGN KEY (feature_cvterm_id) REFERENCES feature_cvterm(feature_cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: feature_cvterm_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm + ADD CONSTRAINT feature_cvterm_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_cvterm_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvterm_pub + ADD CONSTRAINT feature_cvterm_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_cvtermprop_feature_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvtermprop + ADD CONSTRAINT feature_cvtermprop_feature_cvterm_id_fkey FOREIGN KEY (feature_cvterm_id) REFERENCES feature_cvterm(feature_cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: feature_cvtermprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_cvtermprop + ADD CONSTRAINT feature_cvtermprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_dbxref + ADD CONSTRAINT feature_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_dbxref_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_dbxref + ADD CONSTRAINT feature_dbxref_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature + ADD CONSTRAINT feature_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_expression_expression_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_expression + ADD CONSTRAINT feature_expression_expression_id_fkey FOREIGN KEY (expression_id) REFERENCES expression(expression_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_expression_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_expression + ADD CONSTRAINT feature_expression_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_expression_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_expression + ADD CONSTRAINT feature_expression_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_expressionprop_feature_expression_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_expressionprop + ADD CONSTRAINT feature_expressionprop_feature_expression_id_fkey FOREIGN KEY (feature_expression_id) REFERENCES feature_expression(feature_expression_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_expressionprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_expressionprop + ADD CONSTRAINT feature_expressionprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_genotype_chromosome_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_genotype + ADD CONSTRAINT feature_genotype_chromosome_id_fkey FOREIGN KEY (chromosome_id) REFERENCES feature(feature_id) ON DELETE SET NULL; + + +-- +-- Name: feature_genotype_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_genotype + ADD CONSTRAINT feature_genotype_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: feature_genotype_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_genotype + ADD CONSTRAINT feature_genotype_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: feature_genotype_genotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_genotype + ADD CONSTRAINT feature_genotype_genotype_id_fkey FOREIGN KEY (genotype_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE; + + +-- +-- Name: feature_image_eimage_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_image + ADD CONSTRAINT feature_image_eimage_id_fkey FOREIGN KEY (eimage_id) REFERENCES eimage(eimage_id) ON DELETE CASCADE; + + +-- +-- Name: feature_image_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_image + ADD CONSTRAINT feature_image_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: feature_nd_geolocation_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_nd_geolocation + ADD CONSTRAINT feature_nd_geolocation_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: feature_nd_geolocation_nd_geolocation_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_nd_geolocation + ADD CONSTRAINT feature_nd_geolocation_nd_geolocation_id_fkey FOREIGN KEY (nd_geolocation_id) REFERENCES nd_geolocation(nd_geolocation_id) ON DELETE CASCADE; + + +-- +-- Name: feature_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature + ADD CONSTRAINT feature_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_phenotype_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_phenotype + ADD CONSTRAINT feature_phenotype_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: feature_phenotype_phenotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_phenotype + ADD CONSTRAINT feature_phenotype_phenotype_id_fkey FOREIGN KEY (phenotype_id) REFERENCES phenotype(phenotype_id) ON DELETE CASCADE; + + +-- +-- Name: feature_project_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_project + ADD CONSTRAINT feature_project_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: feature_project_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_project + ADD CONSTRAINT feature_project_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON DELETE CASCADE; + + +-- +-- Name: feature_pub_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_pub + ADD CONSTRAINT feature_pub_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_pub + ADD CONSTRAINT feature_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_pubprop_feature_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_pubprop + ADD CONSTRAINT feature_pubprop_feature_pub_id_fkey FOREIGN KEY (feature_pub_id) REFERENCES feature_pub(feature_pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_pubprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_pubprop + ADD CONSTRAINT feature_pubprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationship + ADD CONSTRAINT feature_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_relationship_pub_feature_relationship_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationship_pub + ADD CONSTRAINT feature_relationship_pub_feature_relationship_id_fkey FOREIGN KEY (feature_relationship_id) REFERENCES feature_relationship(feature_relationship_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_relationship_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationship_pub + ADD CONSTRAINT feature_relationship_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationship + ADD CONSTRAINT feature_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationship + ADD CONSTRAINT feature_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_relationshipprop_feature_relationship_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationshipprop + ADD CONSTRAINT feature_relationshipprop_feature_relationship_id_fkey FOREIGN KEY (feature_relationship_id) REFERENCES feature_relationship(feature_relationship_id) ON DELETE CASCADE; + + +-- +-- Name: feature_relationshipprop_pub_feature_relationshipprop_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationshipprop_pub + ADD CONSTRAINT feature_relationshipprop_pub_feature_relationshipprop_id_fkey FOREIGN KEY (feature_relationshipprop_id) REFERENCES feature_relationshipprop(feature_relationshipprop_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_relationshipprop_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationshipprop_pub + ADD CONSTRAINT feature_relationshipprop_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_relationshipprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_relationshipprop + ADD CONSTRAINT feature_relationshipprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_stock_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_stock + ADD CONSTRAINT feature_stock_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: feature_stock_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_stock + ADD CONSTRAINT feature_stock_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE; + + +-- +-- Name: feature_stock_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_stock + ADD CONSTRAINT feature_stock_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: feature_synonym_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_synonym + ADD CONSTRAINT feature_synonym_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_synonym_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_synonym + ADD CONSTRAINT feature_synonym_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_synonym_synonym_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature_synonym + ADD CONSTRAINT feature_synonym_synonym_id_fkey FOREIGN KEY (synonym_id) REFERENCES synonym(synonym_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: feature_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY feature + ADD CONSTRAINT feature_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureloc_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureloc + ADD CONSTRAINT featureloc_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureloc_pub_featureloc_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureloc_pub + ADD CONSTRAINT featureloc_pub_featureloc_id_fkey FOREIGN KEY (featureloc_id) REFERENCES featureloc(featureloc_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureloc_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureloc_pub + ADD CONSTRAINT featureloc_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureloc_srcfeature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureloc + ADD CONSTRAINT featureloc_srcfeature_id_fkey FOREIGN KEY (srcfeature_id) REFERENCES feature(feature_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featuremap_contact_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_contact + ADD CONSTRAINT featuremap_contact_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE; + + +-- +-- Name: featuremap_contact_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_contact + ADD CONSTRAINT featuremap_contact_feature_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE; + + +-- +-- Name: featuremap_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_dbxref + ADD CONSTRAINT featuremap_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featuremap_dbxref_featuremap_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_dbxref + ADD CONSTRAINT featuremap_dbxref_featuremap_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featuremap_organism_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_organism + ADD CONSTRAINT featuremap_organism_feature_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE; + + +-- +-- Name: featuremap_organism_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_organism + ADD CONSTRAINT featuremap_organism_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE; + + +-- +-- Name: featuremap_pub_featuremap_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_pub + ADD CONSTRAINT featuremap_pub_featuremap_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featuremap_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_pub + ADD CONSTRAINT featuremap_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featuremap_stock_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_stock + ADD CONSTRAINT featuremap_stock_feature_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE; + + +-- +-- Name: featuremap_stock_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap_stock + ADD CONSTRAINT featuremap_stock_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE; + + +-- +-- Name: featuremap_unittype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremap + ADD CONSTRAINT featuremap_unittype_id_fkey FOREIGN KEY (unittype_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featuremapprop_featuremap_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremapprop + ADD CONSTRAINT featuremapprop_featuremap_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featuremapprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featuremapprop + ADD CONSTRAINT featuremapprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurepos_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurepos + ADD CONSTRAINT featurepos_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurepos_featuremap_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurepos + ADD CONSTRAINT featurepos_featuremap_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurepos_map_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurepos + ADD CONSTRAINT featurepos_map_feature_id_fkey FOREIGN KEY (map_feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureposprop_featurepos_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureposprop + ADD CONSTRAINT featureposprop_featurepos_id_fkey FOREIGN KEY (featurepos_id) REFERENCES featurepos(featurepos_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureposprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureposprop + ADD CONSTRAINT featureposprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureprop_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureprop + ADD CONSTRAINT featureprop_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureprop_pub_featureprop_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureprop_pub + ADD CONSTRAINT featureprop_pub_featureprop_id_fkey FOREIGN KEY (featureprop_id) REFERENCES featureprop(featureprop_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureprop_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureprop_pub + ADD CONSTRAINT featureprop_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featureprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featureprop + ADD CONSTRAINT featureprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurerange_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurerange + ADD CONSTRAINT featurerange_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurerange_featuremap_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurerange + ADD CONSTRAINT featurerange_featuremap_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurerange_leftendf_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurerange + ADD CONSTRAINT featurerange_leftendf_id_fkey FOREIGN KEY (leftendf_id) REFERENCES feature(feature_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurerange_leftstartf_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurerange + ADD CONSTRAINT featurerange_leftstartf_id_fkey FOREIGN KEY (leftstartf_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurerange_rightendf_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurerange + ADD CONSTRAINT featurerange_rightendf_id_fkey FOREIGN KEY (rightendf_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: featurerange_rightstartf_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY featurerange + ADD CONSTRAINT featurerange_rightstartf_id_fkey FOREIGN KEY (rightstartf_id) REFERENCES feature(feature_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: genotype_call_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotype_call + ADD CONSTRAINT genotype_call_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: genotype_call_genotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotype_call + ADD CONSTRAINT genotype_call_genotype_id_fkey FOREIGN KEY (genotype_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE; + + +-- +-- Name: genotype_call_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotype_call + ADD CONSTRAINT genotype_call_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON DELETE CASCADE; + + +-- +-- Name: genotype_call_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotype_call + ADD CONSTRAINT genotype_call_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE; + + +-- +-- Name: genotype_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotype + ADD CONSTRAINT genotype_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: genotypeprop_genotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotypeprop + ADD CONSTRAINT genotypeprop_genotype_id_fkey FOREIGN KEY (genotype_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: genotypeprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY genotypeprop + ADD CONSTRAINT genotypeprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_cvterm + ADD CONSTRAINT library_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id); + + +-- +-- Name: library_cvterm_library_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_cvterm + ADD CONSTRAINT library_cvterm_library_id_fkey FOREIGN KEY (library_id) REFERENCES library(library_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_cvterm_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_cvterm + ADD CONSTRAINT library_cvterm_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id); + + +-- +-- Name: library_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_dbxref + ADD CONSTRAINT library_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_dbxref_library_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_dbxref + ADD CONSTRAINT library_dbxref_library_id_fkey FOREIGN KEY (library_id) REFERENCES library(library_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_feature_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_feature + ADD CONSTRAINT library_feature_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_feature_library_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_feature + ADD CONSTRAINT library_feature_library_id_fkey FOREIGN KEY (library_id) REFERENCES library(library_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library + ADD CONSTRAINT library_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id); + + +-- +-- Name: library_pub_library_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_pub + ADD CONSTRAINT library_pub_library_id_fkey FOREIGN KEY (library_id) REFERENCES library(library_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_pub + ADD CONSTRAINT library_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_synonym_library_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_synonym + ADD CONSTRAINT library_synonym_library_id_fkey FOREIGN KEY (library_id) REFERENCES library(library_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_synonym_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_synonym + ADD CONSTRAINT library_synonym_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_synonym_synonym_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library_synonym + ADD CONSTRAINT library_synonym_synonym_id_fkey FOREIGN KEY (synonym_id) REFERENCES synonym(synonym_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: library_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY library + ADD CONSTRAINT library_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id); + + +-- +-- Name: libraryprop_library_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY libraryprop + ADD CONSTRAINT libraryprop_library_id_fkey FOREIGN KEY (library_id) REFERENCES library(library_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: libraryprop_pub_libraryprop_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY libraryprop_pub + ADD CONSTRAINT libraryprop_pub_libraryprop_id_fkey FOREIGN KEY (libraryprop_id) REFERENCES libraryprop(libraryprop_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: libraryprop_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY libraryprop_pub + ADD CONSTRAINT libraryprop_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: libraryprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY libraryprop + ADD CONSTRAINT libraryprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id); + + +-- +-- Name: magedocumentation_mageml_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY magedocumentation + ADD CONSTRAINT magedocumentation_mageml_id_fkey FOREIGN KEY (mageml_id) REFERENCES mageml(mageml_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: magedocumentation_tableinfo_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY magedocumentation + ADD CONSTRAINT magedocumentation_tableinfo_id_fkey FOREIGN KEY (tableinfo_id) REFERENCES tableinfo(tableinfo_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_contact_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_contact + ADD CONSTRAINT nd_experiment_contact_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_contact_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_contact + ADD CONSTRAINT nd_experiment_contact_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_dbxref + ADD CONSTRAINT nd_experiment_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_dbxref_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_dbxref + ADD CONSTRAINT nd_experiment_dbxref_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_genotype_genotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_genotype + ADD CONSTRAINT nd_experiment_genotype_genotype_id_fkey FOREIGN KEY (genotype_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_genotype_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_genotype + ADD CONSTRAINT nd_experiment_genotype_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_nd_geolocation_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment + ADD CONSTRAINT nd_experiment_nd_geolocation_id_fkey FOREIGN KEY (nd_geolocation_id) REFERENCES nd_geolocation(nd_geolocation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_phenotype_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_phenotype + ADD CONSTRAINT nd_experiment_phenotype_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_phenotype_phenotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_phenotype + ADD CONSTRAINT nd_experiment_phenotype_phenotype_id_fkey FOREIGN KEY (phenotype_id) REFERENCES phenotype(phenotype_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_project_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_project + ADD CONSTRAINT nd_experiment_project_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_project_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_project + ADD CONSTRAINT nd_experiment_project_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_protocol_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_protocol + ADD CONSTRAINT nd_experiment_protocol_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_protocol_nd_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_protocol + ADD CONSTRAINT nd_experiment_protocol_nd_protocol_id_fkey FOREIGN KEY (nd_protocol_id) REFERENCES nd_protocol(nd_protocol_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_pub_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_pub + ADD CONSTRAINT nd_experiment_pub_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_pub + ADD CONSTRAINT nd_experiment_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_stock_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stock_dbxref + ADD CONSTRAINT nd_experiment_stock_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_stock_dbxref_nd_experiment_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stock_dbxref + ADD CONSTRAINT nd_experiment_stock_dbxref_nd_experiment_stock_id_fkey FOREIGN KEY (nd_experiment_stock_id) REFERENCES nd_experiment_stock(nd_experiment_stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_stock_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stock + ADD CONSTRAINT nd_experiment_stock_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_stock_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stock + ADD CONSTRAINT nd_experiment_stock_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_stock_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stock + ADD CONSTRAINT nd_experiment_stock_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_stockprop_nd_experiment_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stockprop + ADD CONSTRAINT nd_experiment_stockprop_nd_experiment_stock_id_fkey FOREIGN KEY (nd_experiment_stock_id) REFERENCES nd_experiment_stock(nd_experiment_stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_stockprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment_stockprop + ADD CONSTRAINT nd_experiment_stockprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experiment_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experiment + ADD CONSTRAINT nd_experiment_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experimentprop_nd_experiment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experimentprop + ADD CONSTRAINT nd_experimentprop_nd_experiment_id_fkey FOREIGN KEY (nd_experiment_id) REFERENCES nd_experiment(nd_experiment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_experimentprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_experimentprop + ADD CONSTRAINT nd_experimentprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_geolocationprop_nd_geolocation_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_geolocationprop + ADD CONSTRAINT nd_geolocationprop_nd_geolocation_id_fkey FOREIGN KEY (nd_geolocation_id) REFERENCES nd_geolocation(nd_geolocation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_geolocationprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_geolocationprop + ADD CONSTRAINT nd_geolocationprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_protocol_reagent_nd_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocol_reagent + ADD CONSTRAINT nd_protocol_reagent_nd_protocol_id_fkey FOREIGN KEY (nd_protocol_id) REFERENCES nd_protocol(nd_protocol_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_protocol_reagent_reagent_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocol_reagent + ADD CONSTRAINT nd_protocol_reagent_reagent_id_fkey FOREIGN KEY (reagent_id) REFERENCES nd_reagent(nd_reagent_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_protocol_reagent_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocol_reagent + ADD CONSTRAINT nd_protocol_reagent_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_protocol_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocol + ADD CONSTRAINT nd_protocol_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_protocolprop_nd_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocolprop + ADD CONSTRAINT nd_protocolprop_nd_protocol_id_fkey FOREIGN KEY (nd_protocol_id) REFERENCES nd_protocol(nd_protocol_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_protocolprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_protocolprop + ADD CONSTRAINT nd_protocolprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_reagent_relationship_object_reagent_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagent_relationship + ADD CONSTRAINT nd_reagent_relationship_object_reagent_id_fkey FOREIGN KEY (object_reagent_id) REFERENCES nd_reagent(nd_reagent_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_reagent_relationship_subject_reagent_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagent_relationship + ADD CONSTRAINT nd_reagent_relationship_subject_reagent_id_fkey FOREIGN KEY (subject_reagent_id) REFERENCES nd_reagent(nd_reagent_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_reagent_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagent_relationship + ADD CONSTRAINT nd_reagent_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_reagent_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagent + ADD CONSTRAINT nd_reagent_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_reagentprop_nd_reagent_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagentprop + ADD CONSTRAINT nd_reagentprop_nd_reagent_id_fkey FOREIGN KEY (nd_reagent_id) REFERENCES nd_reagent(nd_reagent_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: nd_reagentprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY nd_reagentprop + ADD CONSTRAINT nd_reagentprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: organism_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_dbxref + ADD CONSTRAINT organism_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: organism_dbxref_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_dbxref + ADD CONSTRAINT organism_dbxref_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: organism_for_search_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_for_search + ADD CONSTRAINT organism_for_search_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: organism_image_eimage_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_image + ADD CONSTRAINT organism_image_eimage_id_fkey FOREIGN KEY (eimage_id) REFERENCES eimage(eimage_id) ON DELETE CASCADE; + + +-- +-- Name: organism_image_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_image + ADD CONSTRAINT organism_image_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE; + + +-- +-- Name: organism_pub_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_pub + ADD CONSTRAINT organism_pub_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE; + + +-- +-- Name: organism_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_pub + ADD CONSTRAINT organism_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE; + + +-- +-- Name: organism_relationship_object_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_relationship + ADD CONSTRAINT organism_relationship_object_organism_id_fkey FOREIGN KEY (object_organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE; + + +-- +-- Name: organism_relationship_subject_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_relationship + ADD CONSTRAINT organism_relationship_subject_organism_id_fkey FOREIGN KEY (subject_organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE; + + +-- +-- Name: organism_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organism_relationship + ADD CONSTRAINT organism_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: organismprop_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organismprop + ADD CONSTRAINT organismprop_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: organismprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY organismprop + ADD CONSTRAINT organismprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: phendesc_environment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phendesc + ADD CONSTRAINT phendesc_environment_id_fkey FOREIGN KEY (environment_id) REFERENCES environment(environment_id) ON DELETE CASCADE; + + +-- +-- Name: phendesc_genotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phendesc + ADD CONSTRAINT phendesc_genotype_id_fkey FOREIGN KEY (genotype_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE; + + +-- +-- Name: phendesc_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phendesc + ADD CONSTRAINT phendesc_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE; + + +-- +-- Name: phendesc_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phendesc + ADD CONSTRAINT phendesc_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_assay_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype + ADD CONSTRAINT phenotype_assay_id_fkey FOREIGN KEY (assay_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL; + + +-- +-- Name: phenotype_attr_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype + ADD CONSTRAINT phenotype_attr_id_fkey FOREIGN KEY (attr_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL; + + +-- +-- Name: phenotype_comparison_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison_cvterm + ADD CONSTRAINT phenotype_comparison_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_cvterm_phenotype_comparison_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison_cvterm + ADD CONSTRAINT phenotype_comparison_cvterm_phenotype_comparison_id_fkey FOREIGN KEY (phenotype_comparison_id) REFERENCES phenotype_comparison(phenotype_comparison_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_cvterm_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison_cvterm + ADD CONSTRAINT phenotype_comparison_cvterm_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_environment1_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_environment1_id_fkey FOREIGN KEY (environment1_id) REFERENCES environment(environment_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_environment2_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_environment2_id_fkey FOREIGN KEY (environment2_id) REFERENCES environment(environment_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_genotype1_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_genotype1_id_fkey FOREIGN KEY (genotype1_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_genotype2_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_genotype2_id_fkey FOREIGN KEY (genotype2_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_phenotype1_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_phenotype1_id_fkey FOREIGN KEY (phenotype1_id) REFERENCES phenotype(phenotype_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_phenotype2_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_phenotype2_id_fkey FOREIGN KEY (phenotype2_id) REFERENCES phenotype(phenotype_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_comparison_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_comparison + ADD CONSTRAINT phenotype_comparison_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_cvalue_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype + ADD CONSTRAINT phenotype_cvalue_id_fkey FOREIGN KEY (cvalue_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL; + + +-- +-- Name: phenotype_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_cvterm + ADD CONSTRAINT phenotype_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_cvterm_phenotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype_cvterm + ADD CONSTRAINT phenotype_cvterm_phenotype_id_fkey FOREIGN KEY (phenotype_id) REFERENCES phenotype(phenotype_id) ON DELETE CASCADE; + + +-- +-- Name: phenotype_observable_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenotype + ADD CONSTRAINT phenotype_observable_id_fkey FOREIGN KEY (observable_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phenstatement_environment_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatement + ADD CONSTRAINT phenstatement_environment_id_fkey FOREIGN KEY (environment_id) REFERENCES environment(environment_id) ON DELETE CASCADE; + + +-- +-- Name: phenstatement_genotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatement + ADD CONSTRAINT phenstatement_genotype_id_fkey FOREIGN KEY (genotype_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE; + + +-- +-- Name: phenstatement_phenotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatement + ADD CONSTRAINT phenstatement_phenotype_id_fkey FOREIGN KEY (phenotype_id) REFERENCES phenotype(phenotype_id) ON DELETE CASCADE; + + +-- +-- Name: phenstatement_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatement + ADD CONSTRAINT phenstatement_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE; + + +-- +-- Name: phenstatement_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatement + ADD CONSTRAINT phenstatement_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phenstatementprop_phenstatement_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatementprop + ADD CONSTRAINT phenstatementprop_phenstatement_id_fkey FOREIGN KEY (phenstatement_id) REFERENCES phenstatement(phenstatement_id) ON DELETE CASCADE; + + +-- +-- Name: phenstatementprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phenstatementprop + ADD CONSTRAINT phenstatementprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_dbxref + ADD CONSTRAINT phylonode_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_dbxref_phylonode_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_dbxref + ADD CONSTRAINT phylonode_dbxref_phylonode_id_fkey FOREIGN KEY (phylonode_id) REFERENCES phylonode(phylonode_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode + ADD CONSTRAINT phylonode_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_organism_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_organism + ADD CONSTRAINT phylonode_organism_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_organism_phylonode_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_organism + ADD CONSTRAINT phylonode_organism_phylonode_id_fkey FOREIGN KEY (phylonode_id) REFERENCES phylonode(phylonode_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_parent_phylonode_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode + ADD CONSTRAINT phylonode_parent_phylonode_id_fkey FOREIGN KEY (parent_phylonode_id) REFERENCES phylonode(phylonode_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_phylotree_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode + ADD CONSTRAINT phylonode_phylotree_id_fkey FOREIGN KEY (phylotree_id) REFERENCES phylotree(phylotree_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_pub_phylonode_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_pub + ADD CONSTRAINT phylonode_pub_phylonode_id_fkey FOREIGN KEY (phylonode_id) REFERENCES phylonode(phylonode_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_pub + ADD CONSTRAINT phylonode_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_relationship + ADD CONSTRAINT phylonode_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES phylonode(phylonode_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_relationship_phylotree_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_relationship + ADD CONSTRAINT phylonode_relationship_phylotree_id_fkey FOREIGN KEY (phylotree_id) REFERENCES phylotree(phylotree_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_relationship + ADD CONSTRAINT phylonode_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES phylonode(phylonode_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode_relationship + ADD CONSTRAINT phylonode_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phylonode_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonode + ADD CONSTRAINT phylonode_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phylonodeprop_phylonode_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonodeprop + ADD CONSTRAINT phylonodeprop_phylonode_id_fkey FOREIGN KEY (phylonode_id) REFERENCES phylonode(phylonode_id) ON DELETE CASCADE; + + +-- +-- Name: phylonodeprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylonodeprop + ADD CONSTRAINT phylonodeprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: phylotree_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylotree + ADD CONSTRAINT phylotree_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE; + + +-- +-- Name: phylotree_pub_phylotree_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylotree_pub + ADD CONSTRAINT phylotree_pub_phylotree_id_fkey FOREIGN KEY (phylotree_id) REFERENCES phylotree(phylotree_id) ON DELETE CASCADE; + + +-- +-- Name: phylotree_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylotree_pub + ADD CONSTRAINT phylotree_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE; + + +-- +-- Name: phylotree_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY phylotree + ADD CONSTRAINT phylotree_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: project_contact_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_contact + ADD CONSTRAINT project_contact_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: project_contact_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_contact + ADD CONSTRAINT project_contact_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: project_pub_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_pub + ADD CONSTRAINT project_pub_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: project_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_pub + ADD CONSTRAINT project_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: project_relationship_object_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_relationship + ADD CONSTRAINT project_relationship_object_project_id_fkey FOREIGN KEY (object_project_id) REFERENCES project(project_id) ON DELETE CASCADE; + + +-- +-- Name: project_relationship_subject_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_relationship + ADD CONSTRAINT project_relationship_subject_project_id_fkey FOREIGN KEY (subject_project_id) REFERENCES project(project_id) ON DELETE CASCADE; + + +-- +-- Name: project_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY project_relationship + ADD CONSTRAINT project_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE RESTRICT; + + +-- +-- Name: projectprop_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY projectprop + ADD CONSTRAINT projectprop_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON DELETE CASCADE; + + +-- +-- Name: projectprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY projectprop + ADD CONSTRAINT projectprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: protocol_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY protocol + ADD CONSTRAINT protocol_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: protocol_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY protocol + ADD CONSTRAINT protocol_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: protocol_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY protocol + ADD CONSTRAINT protocol_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: protocolparam_datatype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY protocolparam + ADD CONSTRAINT protocolparam_datatype_id_fkey FOREIGN KEY (datatype_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: protocolparam_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY protocolparam + ADD CONSTRAINT protocolparam_protocol_id_fkey FOREIGN KEY (protocol_id) REFERENCES protocol(protocol_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: protocolparam_unittype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY protocolparam + ADD CONSTRAINT protocolparam_unittype_id_fkey FOREIGN KEY (unittype_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pub_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub_dbxref + ADD CONSTRAINT pub_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pub_dbxref_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub_dbxref + ADD CONSTRAINT pub_dbxref_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pub_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub_relationship + ADD CONSTRAINT pub_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pub_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub_relationship + ADD CONSTRAINT pub_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pub_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub_relationship + ADD CONSTRAINT pub_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pub_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pub + ADD CONSTRAINT pub_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pubauthor_contact_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pubauthor_contact + ADD CONSTRAINT pubauthor_contact_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pubauthor_contact_pubauthor_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pubauthor_contact + ADD CONSTRAINT pubauthor_contact_pubauthor_id_fkey FOREIGN KEY (pubauthor_id) REFERENCES pubauthor(pubauthor_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pubauthor_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pubauthor + ADD CONSTRAINT pubauthor_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pubprop_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pubprop + ADD CONSTRAINT pubprop_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: pubprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY pubprop + ADD CONSTRAINT pubprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: qtl_search_ref_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY qtl_search + ADD CONSTRAINT qtl_search_ref_pub_id_fkey FOREIGN KEY (ref_pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: qtl_search_study_project_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY qtl_search + ADD CONSTRAINT qtl_search_study_project_id_fkey FOREIGN KEY (study_project_id) REFERENCES project(project_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: quantification_acquisition_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantification + ADD CONSTRAINT quantification_acquisition_id_fkey FOREIGN KEY (acquisition_id) REFERENCES acquisition(acquisition_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: quantification_operator_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantification + ADD CONSTRAINT quantification_operator_id_fkey FOREIGN KEY (operator_id) REFERENCES contact(contact_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: quantification_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantification + ADD CONSTRAINT quantification_protocol_id_fkey FOREIGN KEY (protocol_id) REFERENCES protocol(protocol_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: quantification_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantification_relationship + ADD CONSTRAINT quantification_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES quantification(quantification_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: quantification_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantification_relationship + ADD CONSTRAINT quantification_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES quantification(quantification_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: quantification_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantification_relationship + ADD CONSTRAINT quantification_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: quantificationprop_quantification_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantificationprop + ADD CONSTRAINT quantificationprop_quantification_id_fkey FOREIGN KEY (quantification_id) REFERENCES quantification(quantification_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: quantificationprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY quantificationprop + ADD CONSTRAINT quantificationprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: search_by_map_featuremap_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY search_by_map + ADD CONSTRAINT search_by_map_featuremap_id_fkey FOREIGN KEY (featuremap_id) REFERENCES featuremap(featuremap_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: search_by_map_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY search_by_map + ADD CONSTRAINT search_by_map_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: search_by_map_pop_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY search_by_map + ADD CONSTRAINT search_by_map_pop_stock_id_fkey FOREIGN KEY (pop_stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: searchable_features_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY searchable_features + ADD CONSTRAINT searchable_features_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: searchable_features_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY searchable_features + ADD CONSTRAINT searchable_features_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: species_summary_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY species_summary + ADD CONSTRAINT species_summary_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_cvterm + ADD CONSTRAINT stock_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_cvterm_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_cvterm + ADD CONSTRAINT stock_cvterm_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_cvterm_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_cvterm + ADD CONSTRAINT stock_cvterm_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_cvtermprop_stock_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_cvtermprop + ADD CONSTRAINT stock_cvtermprop_stock_cvterm_id_fkey FOREIGN KEY (stock_cvterm_id) REFERENCES stock_cvterm(stock_cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: stock_cvtermprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_cvtermprop + ADD CONSTRAINT stock_cvtermprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_dbxref_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_dbxref + ADD CONSTRAINT stock_dbxref_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock + ADD CONSTRAINT stock_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_dbxref_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_dbxref + ADD CONSTRAINT stock_dbxref_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_dbxrefprop_stock_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_dbxrefprop + ADD CONSTRAINT stock_dbxrefprop_stock_dbxref_id_fkey FOREIGN KEY (stock_dbxref_id) REFERENCES stock_dbxref(stock_dbxref_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_dbxrefprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_dbxrefprop + ADD CONSTRAINT stock_dbxrefprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_genotype_genotype_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_genotype + ADD CONSTRAINT stock_genotype_genotype_id_fkey FOREIGN KEY (genotype_id) REFERENCES genotype(genotype_id) ON DELETE CASCADE; + + +-- +-- Name: stock_genotype_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_genotype + ADD CONSTRAINT stock_genotype_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE; + + +-- +-- Name: stock_image_eimage_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_image + ADD CONSTRAINT stock_image_eimage_id_fkey FOREIGN KEY (eimage_id) REFERENCES eimage(eimage_id) ON DELETE CASCADE; + + +-- +-- Name: stock_image_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_image + ADD CONSTRAINT stock_image_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE; + + +-- +-- Name: stock_organism_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock + ADD CONSTRAINT stock_organism_id_fkey FOREIGN KEY (organism_id) REFERENCES organism(organism_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_pub + ADD CONSTRAINT stock_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_pub_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_pub + ADD CONSTRAINT stock_pub_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_relationship_cvterm_cvterm_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship_cvterm + ADD CONSTRAINT stock_relationship_cvterm_cvterm_id_fkey FOREIGN KEY (cvterm_id) REFERENCES cvterm(cvterm_id) ON DELETE RESTRICT; + + +-- +-- Name: stock_relationship_cvterm_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship_cvterm + ADD CONSTRAINT stock_relationship_cvterm_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE RESTRICT; + + +-- +-- Name: stock_relationship_cvterm_stock_relationship_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship_cvterm + ADD CONSTRAINT stock_relationship_cvterm_stock_relationship_id_fkey FOREIGN KEY (stock_relationship_id) REFERENCES stock_relationship(stock_relationship_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_relationship_object_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship + ADD CONSTRAINT stock_relationship_object_id_fkey FOREIGN KEY (object_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_relationship_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship_pub + ADD CONSTRAINT stock_relationship_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_relationship_pub_stock_relationship_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship_pub + ADD CONSTRAINT stock_relationship_pub_stock_relationship_id_fkey FOREIGN KEY (stock_relationship_id) REFERENCES stock_relationship(stock_relationship_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_relationship_subject_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship + ADD CONSTRAINT stock_relationship_subject_id_fkey FOREIGN KEY (subject_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock_relationship + ADD CONSTRAINT stock_relationship_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stock_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stock + ADD CONSTRAINT stock_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stockcollection_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollection + ADD CONSTRAINT stockcollection_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stockcollection_stock_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollection_stock + ADD CONSTRAINT stockcollection_stock_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stockcollection_stock_stockcollection_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollection_stock + ADD CONSTRAINT stockcollection_stock_stockcollection_id_fkey FOREIGN KEY (stockcollection_id) REFERENCES stockcollection(stockcollection_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stockcollection_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollection + ADD CONSTRAINT stockcollection_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: stockcollectionprop_stockcollection_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollectionprop + ADD CONSTRAINT stockcollectionprop_stockcollection_id_fkey FOREIGN KEY (stockcollection_id) REFERENCES stockcollection(stockcollection_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stockcollectionprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockcollectionprop + ADD CONSTRAINT stockcollectionprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id); + + +-- +-- Name: stockprop_pub_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockprop_pub + ADD CONSTRAINT stockprop_pub_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stockprop_pub_stockprop_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockprop_pub + ADD CONSTRAINT stockprop_pub_stockprop_id_fkey FOREIGN KEY (stockprop_id) REFERENCES stockprop(stockprop_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stockprop_stock_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockprop + ADD CONSTRAINT stockprop_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: stockprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY stockprop + ADD CONSTRAINT stockprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: study_assay_assay_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY study_assay + ADD CONSTRAINT study_assay_assay_id_fkey FOREIGN KEY (assay_id) REFERENCES assay(assay_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: study_assay_study_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY study_assay + ADD CONSTRAINT study_assay_study_id_fkey FOREIGN KEY (study_id) REFERENCES study(study_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: study_contact_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY study + ADD CONSTRAINT study_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contact(contact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: study_dbxref_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY study + ADD CONSTRAINT study_dbxref_id_fkey FOREIGN KEY (dbxref_id) REFERENCES dbxref(dbxref_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: study_pub_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY study + ADD CONSTRAINT study_pub_id_fkey FOREIGN KEY (pub_id) REFERENCES pub(pub_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: studydesign_study_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studydesign + ADD CONSTRAINT studydesign_study_id_fkey FOREIGN KEY (study_id) REFERENCES study(study_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: studydesignprop_studydesign_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studydesignprop + ADD CONSTRAINT studydesignprop_studydesign_id_fkey FOREIGN KEY (studydesign_id) REFERENCES studydesign(studydesign_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: studydesignprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studydesignprop + ADD CONSTRAINT studydesignprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: studyfactor_studydesign_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyfactor + ADD CONSTRAINT studyfactor_studydesign_id_fkey FOREIGN KEY (studydesign_id) REFERENCES studydesign(studydesign_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: studyfactor_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyfactor + ADD CONSTRAINT studyfactor_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: studyfactorvalue_assay_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyfactorvalue + ADD CONSTRAINT studyfactorvalue_assay_id_fkey FOREIGN KEY (assay_id) REFERENCES assay(assay_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: studyfactorvalue_studyfactor_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyfactorvalue + ADD CONSTRAINT studyfactorvalue_studyfactor_id_fkey FOREIGN KEY (studyfactor_id) REFERENCES studyfactor(studyfactor_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: studyprop_feature_feature_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyprop_feature + ADD CONSTRAINT studyprop_feature_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES feature(feature_id) ON DELETE CASCADE; + + +-- +-- Name: studyprop_feature_studyprop_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyprop_feature + ADD CONSTRAINT studyprop_feature_studyprop_id_fkey FOREIGN KEY (studyprop_id) REFERENCES studyprop(studyprop_id) ON DELETE CASCADE; + + +-- +-- Name: studyprop_feature_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyprop_feature + ADD CONSTRAINT studyprop_feature_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: studyprop_study_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyprop + ADD CONSTRAINT studyprop_study_id_fkey FOREIGN KEY (study_id) REFERENCES study(study_id) ON DELETE CASCADE; + + +-- +-- Name: studyprop_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY studyprop + ADD CONSTRAINT studyprop_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE; + + +-- +-- Name: synonym_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY synonym + ADD CONSTRAINT synonym_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: treatment_biomaterial_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY treatment + ADD CONSTRAINT treatment_biomaterial_id_fkey FOREIGN KEY (biomaterial_id) REFERENCES biomaterial(biomaterial_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: treatment_protocol_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY treatment + ADD CONSTRAINT treatment_protocol_id_fkey FOREIGN KEY (protocol_id) REFERENCES protocol(protocol_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: treatment_type_id_fkey; Type: FK CONSTRAINT; Schema: chado; Owner: - +-- + +ALTER TABLE ONLY treatment + ADD CONSTRAINT treatment_type_id_fkey FOREIGN KEY (type_id) REFERENCES cvterm(cvterm_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + + +-- +-- Name: cell_line; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line FROM PUBLIC; +REVOKE ALL ON TABLE cell_line FROM postgres; +GRANT ALL ON TABLE cell_line TO postgres; +GRANT ALL ON TABLE cell_line TO PUBLIC; + + +-- +-- Name: cell_line_cvterm; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line_cvterm FROM PUBLIC; +REVOKE ALL ON TABLE cell_line_cvterm FROM postgres; +GRANT ALL ON TABLE cell_line_cvterm TO postgres; +GRANT ALL ON TABLE cell_line_cvterm TO PUBLIC; + + +-- +-- Name: cell_line_cvtermprop; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line_cvtermprop FROM PUBLIC; +REVOKE ALL ON TABLE cell_line_cvtermprop FROM postgres; +GRANT ALL ON TABLE cell_line_cvtermprop TO postgres; +GRANT ALL ON TABLE cell_line_cvtermprop TO PUBLIC; + + +-- +-- Name: cell_line_dbxref; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line_dbxref FROM PUBLIC; +REVOKE ALL ON TABLE cell_line_dbxref FROM postgres; +GRANT ALL ON TABLE cell_line_dbxref TO postgres; +GRANT ALL ON TABLE cell_line_dbxref TO PUBLIC; + + +-- +-- Name: cell_line_feature; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line_feature FROM PUBLIC; +REVOKE ALL ON TABLE cell_line_feature FROM postgres; +GRANT ALL ON TABLE cell_line_feature TO postgres; +GRANT ALL ON TABLE cell_line_feature TO PUBLIC; + + +-- +-- Name: cell_line_library; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line_library FROM PUBLIC; +REVOKE ALL ON TABLE cell_line_library FROM postgres; +GRANT ALL ON TABLE cell_line_library TO postgres; +GRANT ALL ON TABLE cell_line_library TO PUBLIC; + + +-- +-- Name: cell_line_pub; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line_pub FROM PUBLIC; +REVOKE ALL ON TABLE cell_line_pub FROM postgres; +GRANT ALL ON TABLE cell_line_pub TO postgres; +GRANT ALL ON TABLE cell_line_pub TO PUBLIC; + + +-- +-- Name: cell_line_relationship; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line_relationship FROM PUBLIC; +REVOKE ALL ON TABLE cell_line_relationship FROM postgres; +GRANT ALL ON TABLE cell_line_relationship TO postgres; +GRANT ALL ON TABLE cell_line_relationship TO PUBLIC; + + +-- +-- Name: cell_line_synonym; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_line_synonym FROM PUBLIC; +REVOKE ALL ON TABLE cell_line_synonym FROM postgres; +GRANT ALL ON TABLE cell_line_synonym TO postgres; +GRANT ALL ON TABLE cell_line_synonym TO PUBLIC; + + +-- +-- Name: cell_lineprop; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_lineprop FROM PUBLIC; +REVOKE ALL ON TABLE cell_lineprop FROM postgres; +GRANT ALL ON TABLE cell_lineprop TO postgres; +GRANT ALL ON TABLE cell_lineprop TO PUBLIC; + + +-- +-- Name: cell_lineprop_pub; Type: ACL; Schema: chado; Owner: - +-- + +REVOKE ALL ON TABLE cell_lineprop_pub FROM PUBLIC; +REVOKE ALL ON TABLE cell_lineprop_pub FROM postgres; +GRANT ALL ON TABLE cell_lineprop_pub TO postgres; +GRANT ALL ON TABLE cell_lineprop_pub TO PUBLIC; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/schema/drupal7.public.sql b/schema/drupal7.public.sql new file mode 100644 index 0000000..4dd210a --- /dev/null +++ b/schema/drupal7.public.sql @@ -0,0 +1,10716 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +SET search_path = public, pg_catalog; + +-- +-- Name: concat(anynonarray, anynonarray); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION concat(anynonarray, anynonarray) RETURNS text + LANGUAGE sql + AS $_$SELECT CAST($1 AS text) || CAST($2 AS text);$_$; + + +-- +-- Name: concat(anynonarray, text); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION concat(anynonarray, text) RETURNS text + LANGUAGE sql + AS $_$SELECT CAST($1 AS text) || $2;$_$; + + +-- +-- Name: concat(text, anynonarray); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION concat(text, anynonarray) RETURNS text + LANGUAGE sql + AS $_$SELECT $1 || CAST($2 AS text);$_$; + + +-- +-- Name: concat(text, text); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION concat(text, text) RETURNS text + LANGUAGE sql + AS $_$SELECT $1 || $2;$_$; + + +-- +-- Name: first(anyelement, anyelement); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION first(anyelement, anyelement) RETURNS anyelement + LANGUAGE sql + AS $_$SELECT COALESCE($1, $2);$_$; + + +-- +-- Name: gensas_update_seq_rank(integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION gensas_update_seq_rank(seq_group_id integer) RETURNS void + LANGUAGE plpgsql + AS $$ + DECLARE + i int; + id int; + r1 RECORD; + BEGIN + i := 0; + id := seq_group_id; + + -- assign rank to each sequence in a group + FOR r1 IN + SELECT GS.seq_id + FROM gensas_seq GS + WHERE GS.seq_group_id = id + ORDER BY GS.name + LOOP + -- update gensas_seq.rank + UPDATE gensas_seq SET rank = i WHERE seq_id = r1.seq_id; + i := i + 1; + END LOOP; + END; + $$; + + +-- +-- Name: gensas_update_seq_rank_all(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION gensas_update_seq_rank_all() RETURNS void + LANGUAGE plpgsql + AS $$ + DECLARE + r1 RECORD; + BEGIN + -- get all sequence groups + FOR r1 IN + SELECT seq_group_id FROM gensas_seq_group + LOOP + PERFORM gensas_update_seq_rank(r1.seq_group_id); + END LOOP; + END; + $$; + + +-- +-- Name: greatest(numeric, numeric); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION "greatest"(numeric, numeric) RETURNS numeric + LANGUAGE sql + AS $_$SELECT CASE WHEN (($1 > $2) OR ($2 IS NULL)) THEN $1 ELSE $2 END;$_$; + + +-- +-- Name: greatest(numeric, numeric, numeric); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION "greatest"(numeric, numeric, numeric) RETURNS numeric + LANGUAGE sql + AS $_$SELECT greatest($1, greatest($2, $3));$_$; + + +-- +-- Name: rand(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION rand() RETURNS double precision + LANGUAGE sql + AS $$SELECT random();$$; + + +-- +-- Name: substring_index(text, text, integer); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION substring_index(text, text, integer) RETURNS text + LANGUAGE sql + AS $_$SELECT array_to_string((string_to_array($1, $2)) [1:$3], $2);$_$; + + +-- +-- Name: first(anyelement); Type: AGGREGATE; Schema: public; Owner: - +-- + +CREATE AGGREGATE first(anyelement) ( + SFUNC = public.first, + STYPE = anyelement +); + + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: actions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE actions ( + aid character varying(255) DEFAULT '0'::character varying NOT NULL, + type character varying(32) DEFAULT ''::character varying NOT NULL, + callback character varying(255) DEFAULT ''::character varying NOT NULL, + parameters bytea NOT NULL, + label character varying(255) DEFAULT '0'::character varying NOT NULL +); + + +-- +-- Name: TABLE actions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE actions IS 'Stores action information.'; + + +-- +-- Name: COLUMN actions.aid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN actions.aid IS 'Primary Key: Unique actions ID.'; + + +-- +-- Name: COLUMN actions.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN actions.type IS 'The object that that action acts on (node, user, comment, system or custom types.)'; + + +-- +-- Name: COLUMN actions.callback; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN actions.callback IS 'The callback function that executes when the action runs.'; + + +-- +-- Name: COLUMN actions.parameters; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN actions.parameters IS 'Parameters to be passed to the callback function.'; + + +-- +-- Name: COLUMN actions.label; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN actions.label IS 'Label of the action.'; + + +-- +-- Name: authmap; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE authmap ( + aid integer NOT NULL, + uid integer DEFAULT 0 NOT NULL, + authname character varying(128) DEFAULT ''::character varying NOT NULL, + module character varying(128) DEFAULT ''::character varying NOT NULL, + CONSTRAINT authmap_aid_check CHECK ((aid >= 0)) +); + + +-- +-- Name: TABLE authmap; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE authmap IS 'Stores distributed authentication mapping.'; + + +-- +-- Name: COLUMN authmap.aid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN authmap.aid IS 'Primary Key: Unique authmap ID.'; + + +-- +-- Name: COLUMN authmap.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN authmap.uid IS 'User''s users.uid.'; + + +-- +-- Name: COLUMN authmap.authname; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN authmap.authname IS 'Unique authentication name.'; + + +-- +-- Name: COLUMN authmap.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN authmap.module IS 'Module which is controlling the authentication.'; + + +-- +-- Name: authmap_aid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE authmap_aid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: authmap_aid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE authmap_aid_seq OWNED BY authmap.aid; + + +-- +-- Name: batch; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE batch ( + bid bigint NOT NULL, + token character varying(64) NOT NULL, + "timestamp" integer NOT NULL, + batch bytea, + CONSTRAINT batch_bid_check CHECK ((bid >= 0)) +); + + +-- +-- Name: TABLE batch; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE batch IS 'Stores details about batches (processes that run in multiple HTTP requests).'; + + +-- +-- Name: COLUMN batch.bid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN batch.bid IS 'Primary Key: Unique batch ID.'; + + +-- +-- Name: COLUMN batch.token; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN batch.token IS 'A string token generated against the current user''s session id and the batch id, used to ensure that only the user who submitted the batch can effectively access it.'; + + +-- +-- Name: COLUMN batch."timestamp"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN batch."timestamp" IS 'A Unix timestamp indicating when this batch was submitted for processing. Stale batches are purged at cron time.'; + + +-- +-- Name: COLUMN batch.batch; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN batch.batch IS 'A serialized array containing the processing data for the batch.'; + + +-- +-- Name: bims_crop; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_crop ( + crop_id integer NOT NULL, + name character varying(255) NOT NULL, + label character varying(255) NOT NULL, + image_url character varying(255) NOT NULL, + prop text +); + + +-- +-- Name: bims_crop_crop_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_crop_crop_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_crop_crop_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_crop_crop_id_seq OWNED BY bims_crop.crop_id; + + +-- +-- Name: bims_crop_organism; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_crop_organism ( + crop_id integer NOT NULL, + organism_id integer NOT NULL +); + + +-- +-- Name: bims_descriptor_group; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_descriptor_group ( + cv_id integer NOT NULL, + cv_name character varying(255) NOT NULL, + definition text +); + + +-- +-- Name: bims_file; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_file ( + file_id integer NOT NULL, + type character varying(255) NOT NULL, + filename character varying(255) NOT NULL, + filepath character varying(512) NOT NULL, + filesize integer DEFAULT 0 NOT NULL, + uri character varying(255) NOT NULL, + user_id integer NOT NULL, + job_id integer, + submit_date timestamp without time zone NOT NULL, + prop text +); + + +-- +-- Name: bims_file_file_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_file_file_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_file_file_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_file_file_id_seq OWNED BY bims_file.file_id; + + +-- +-- Name: bims_instruction; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_instruction ( + instruction_id integer NOT NULL, + id character varying(255) NOT NULL, + instruction text +); + + +-- +-- Name: bims_instruction_instruction_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_instruction_instruction_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_instruction_instruction_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_instruction_instruction_id_seq OWNED BY bims_instruction.instruction_id; + + +-- +-- Name: bims_job; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_job ( + job_id integer NOT NULL, + name character varying(255) NOT NULL, + type character varying(255) NOT NULL, + class_name character varying(255), + status integer, + param text, + prop text, + user_id integer NOT NULL, + submit_date timestamp without time zone NOT NULL, + complete_date timestamp without time zone +); + + +-- +-- Name: bims_job_job_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_job_job_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_job_job_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_job_job_id_seq OWNED BY bims_job.job_id; + + +-- +-- Name: bims_list; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_list ( + list_id integer NOT NULL, + name character varying(255) NOT NULL, + program_id integer NOT NULL, + user_id integer NOT NULL, + prop text +); + + +-- +-- Name: bims_list_list_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_list_list_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_list_list_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_list_list_id_seq OWNED BY bims_list.list_id; + + +-- +-- Name: bims_mview_cross_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_mview_cross_stats ( + project_id integer NOT NULL, + node_id integer NOT NULL, + nd_experiment_id integer NOT NULL, + name character varying(255) NOT NULL, + cvterm_id integer NOT NULL, + stats text +); + + +-- +-- Name: bims_mview_descriptor; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_mview_descriptor ( + cv_id integer NOT NULL, + category character varying(255), + name character varying(255) NOT NULL, + cvterm_id integer NOT NULL, + alias character varying(255), + format character varying(255), + default_value character varying(255), + min_value character varying(255), + max_value character varying(255), + categories text, + unit character varying(255), + prop text, + definition text +); + + +-- +-- Name: bims_mview_location; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_mview_location ( + nd_geolocation_id integer NOT NULL, + program_id integer NOT NULL, + name character varying(255) NOT NULL, + type character varying(255) NOT NULL, + latitude character varying(255), + longitude character varying(255), + altitude character varying(255), + country character varying(255), + state character varying(255), + region character varying(255), + address character varying(255) +); + + +-- +-- Name: bims_mview_location_program_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_mview_location_program_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_mview_location_program_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_mview_location_program_id_seq OWNED BY bims_mview_location.program_id; + + +-- +-- Name: bims_mview_phenotype_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_mview_phenotype_stats ( + project_id integer NOT NULL, + node_id integer NOT NULL, + stats text, + cvterm_id integer NOT NULL, + name character varying(255) NOT NULL +); + + +-- +-- Name: bims_node; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_node ( + node_id integer NOT NULL, + name character varying(100) NOT NULL, + type character varying(100) NOT NULL, + prop text, + root_id integer, + crop_id integer, + owner_id integer NOT NULL, + project_id integer, + trial_tree text, + breed_line_tree text, + cross_tree text, + description text +); + + +-- +-- Name: bims_node_node_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_node_node_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_node_node_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_node_node_id_seq OWNED BY bims_node.node_id; + + +-- +-- Name: bims_node_relationship; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_node_relationship ( + relationship_id integer NOT NULL, + parent_id integer NOT NULL, + child_id integer NOT NULL +); + + +-- +-- Name: bims_node_relationship_relationship_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_node_relationship_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_node_relationship_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_node_relationship_relationship_id_seq OWNED BY bims_node_relationship.relationship_id; + + +-- +-- Name: bims_program_descriptor_group; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_program_descriptor_group ( + program_descriptor_group_id integer NOT NULL, + program_id integer NOT NULL, + cv_id integer NOT NULL, + name character varying(255) NOT NULL +); + + +-- +-- Name: bims_program_descriptor_group_program_descriptor_group_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_program_descriptor_group_program_descriptor_group_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_program_descriptor_group_program_descriptor_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_program_descriptor_group_program_descriptor_group_id_seq OWNED BY bims_program_descriptor_group.program_descriptor_group_id; + + +-- +-- Name: bims_program_member; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_program_member ( + program_member_id integer NOT NULL, + program_id integer NOT NULL, + user_id integer NOT NULL, + permission character varying(255) NOT NULL +); + + +-- +-- Name: bims_program_member_program_member_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bims_program_member_program_member_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bims_program_member_program_member_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bims_program_member_program_member_id_seq OWNED BY bims_program_member.program_member_id; + + +-- +-- Name: bims_user; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE bims_user ( + user_id integer NOT NULL, + name character varying(255) NOT NULL, + uid integer NOT NULL, + mail character varying(255) NOT NULL, + breeder integer DEFAULT 0 NOT NULL, + contact_id integer, + prop text +); + + +-- +-- Name: block; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE block ( + bid integer NOT NULL, + module character varying(64) DEFAULT ''::character varying NOT NULL, + delta character varying(32) DEFAULT '0'::character varying NOT NULL, + theme character varying(64) DEFAULT ''::character varying NOT NULL, + status smallint DEFAULT 0 NOT NULL, + weight integer DEFAULT 0 NOT NULL, + region character varying(64) DEFAULT ''::character varying NOT NULL, + custom smallint DEFAULT 0 NOT NULL, + visibility smallint DEFAULT 0 NOT NULL, + pages text NOT NULL, + title character varying(255) DEFAULT ''::character varying NOT NULL, + cache smallint DEFAULT 1 NOT NULL +); + + +-- +-- Name: TABLE block; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE block IS 'Stores block settings, such as region and visibility settings.'; + + +-- +-- Name: COLUMN block.bid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.bid IS 'Primary Key: Unique block ID.'; + + +-- +-- Name: COLUMN block.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.module IS 'The module from which the block originates; for example, ''user'' for the Who''s Online block, and ''block'' for any custom blocks.'; + + +-- +-- Name: COLUMN block.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.delta IS 'Unique ID for block within a module.'; + + +-- +-- Name: COLUMN block.theme; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.theme IS 'The theme under which the block settings apply.'; + + +-- +-- Name: COLUMN block.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.status IS 'Block enabled status. (1 = enabled, 0 = disabled)'; + + +-- +-- Name: COLUMN block.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.weight IS 'Block weight within region.'; + + +-- +-- Name: COLUMN block.region; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.region IS 'Theme region within which the block is set.'; + + +-- +-- Name: COLUMN block.custom; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.custom IS 'Flag to indicate how users may control visibility of the block. (0 = Users cannot control, 1 = On by default, but can be hidden, 2 = Hidden by default, but can be shown)'; + + +-- +-- Name: COLUMN block.visibility; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.visibility IS 'Flag to indicate how to show blocks on pages. (0 = Show on all pages except listed pages, 1 = Show only on listed pages, 2 = Use custom PHP code to determine visibility)'; + + +-- +-- Name: COLUMN block.pages; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.pages IS 'Contents of the "Pages" block; contains either a list of paths on which to include/exclude the block or PHP code, depending on "visibility" setting.'; + + +-- +-- Name: COLUMN block.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.title IS 'Custom title for the block. (Empty string will use block default title, will remove the title, text will cause block to use specified title.)'; + + +-- +-- Name: COLUMN block.cache; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block.cache IS 'Binary flag to indicate block cache mode. (-2: Custom cache, -1: Do not cache, 1: Cache per role, 2: Cache per user, 4: Cache per page, 8: Block cache global) See DRUPAL_CACHE_* constants in ../includes/common.inc for more detailed information.'; + + +-- +-- Name: block_bid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE block_bid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: block_bid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE block_bid_seq OWNED BY block.bid; + + +-- +-- Name: block_custom; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE block_custom ( + bid integer NOT NULL, + body text, + info character varying(128) DEFAULT ''::character varying NOT NULL, + format character varying(255), + CONSTRAINT block_custom_bid_check CHECK ((bid >= 0)) +); + + +-- +-- Name: TABLE block_custom; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE block_custom IS 'Stores contents of custom-made blocks.'; + + +-- +-- Name: COLUMN block_custom.bid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_custom.bid IS 'The block''s block.bid.'; + + +-- +-- Name: COLUMN block_custom.body; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_custom.body IS 'Block contents.'; + + +-- +-- Name: COLUMN block_custom.info; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_custom.info IS 'Block description.'; + + +-- +-- Name: COLUMN block_custom.format; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_custom.format IS 'The filter_format.format of the block body.'; + + +-- +-- Name: block_custom_bid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE block_custom_bid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: block_custom_bid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE block_custom_bid_seq OWNED BY block_custom.bid; + + +-- +-- Name: block_node_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE block_node_type ( + module character varying(64) NOT NULL, + delta character varying(32) NOT NULL, + type character varying(32) NOT NULL +); + + +-- +-- Name: TABLE block_node_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE block_node_type IS 'Sets up display criteria for blocks based on content types'; + + +-- +-- Name: COLUMN block_node_type.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_node_type.module IS 'The block''s origin module, from block.module.'; + + +-- +-- Name: COLUMN block_node_type.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_node_type.delta IS 'The block''s unique delta within module, from block.delta.'; + + +-- +-- Name: COLUMN block_node_type.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_node_type.type IS 'The machine-readable name of this type from node_type.type.'; + + +-- +-- Name: block_role; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE block_role ( + module character varying(64) NOT NULL, + delta character varying(32) NOT NULL, + rid bigint NOT NULL, + CONSTRAINT block_role_rid_check CHECK ((rid >= 0)) +); + + +-- +-- Name: TABLE block_role; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE block_role IS 'Sets up access permissions for blocks based on user roles'; + + +-- +-- Name: COLUMN block_role.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_role.module IS 'The block''s origin module, from block.module.'; + + +-- +-- Name: COLUMN block_role.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_role.delta IS 'The block''s unique delta within module, from block.delta.'; + + +-- +-- Name: COLUMN block_role.rid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN block_role.rid IS 'The user''s role ID from users_roles.rid.'; + + +-- +-- Name: blocked_ips; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE blocked_ips ( + iid integer NOT NULL, + ip character varying(40) DEFAULT ''::character varying NOT NULL, + CONSTRAINT blocked_ips_iid_check CHECK ((iid >= 0)) +); + + +-- +-- Name: TABLE blocked_ips; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE blocked_ips IS 'Stores blocked IP addresses.'; + + +-- +-- Name: COLUMN blocked_ips.iid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blocked_ips.iid IS 'Primary Key: unique ID for IP addresses.'; + + +-- +-- Name: COLUMN blocked_ips.ip; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN blocked_ips.ip IS 'IP address'; + + +-- +-- Name: blocked_ips_iid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE blocked_ips_iid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blocked_ips_iid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE blocked_ips_iid_seq OWNED BY blocked_ips.iid; + + +-- +-- Name: cache; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache IS 'Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.'; + + +-- +-- Name: COLUMN cache.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_block; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_block ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_block; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_block IS 'Cache table for the Block module to store already built blocks, identified by module, delta, and various contexts which may change the block, such as theme, locale, and caching mode defined for the block.'; + + +-- +-- Name: COLUMN cache_block.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_block.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_block.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_block.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_block.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_block.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_block.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_block.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_block.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_block.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_bootstrap; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_bootstrap ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_bootstrap; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_bootstrap IS 'Cache table for data required to bootstrap Drupal, may be routed to a shared memory cache.'; + + +-- +-- Name: COLUMN cache_bootstrap.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_bootstrap.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_bootstrap.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_bootstrap.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_bootstrap.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_bootstrap.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_bootstrap.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_bootstrap.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_bootstrap.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_bootstrap.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_field; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_field ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_field; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_field IS 'Cache table for the Field module to store already built field information.'; + + +-- +-- Name: COLUMN cache_field.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_field.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_field.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_field.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_field.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_field.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_field.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_field.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_field.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_field.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_filter; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_filter ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_filter; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_filter IS 'Cache table for the Filter module to store already filtered pieces of text, identified by text format and hash of the text.'; + + +-- +-- Name: COLUMN cache_filter.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_filter.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_filter.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_filter.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_filter.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_filter.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_filter.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_filter.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_filter.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_filter.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_form; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_form ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_form; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_form IS 'Cache table for the form system to store recently built forms and their storage data, to be used in subsequent page requests.'; + + +-- +-- Name: COLUMN cache_form.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_form.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_form.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_form.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_form.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_form.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_form.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_form.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_form.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_form.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_image; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_image ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_image; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_image IS 'Cache table used to store information about image manipulations that are in-progress.'; + + +-- +-- Name: COLUMN cache_image.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_image.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_image.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_image.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_image.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_image.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_image.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_image.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_image.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_image.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_menu; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_menu ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_menu; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_menu IS 'Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.'; + + +-- +-- Name: COLUMN cache_menu.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_menu.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_menu.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_menu.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_menu.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_menu.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_menu.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_menu.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_menu.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_menu.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_page; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_page ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_page; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_page IS 'Cache table used to store compressed pages for anonymous users, if page caching is enabled.'; + + +-- +-- Name: COLUMN cache_page.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_page.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_page.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_page.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_page.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_page.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_page.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_page.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_page.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_page.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_path; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_path ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_path; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_path IS 'Cache table for path alias lookup.'; + + +-- +-- Name: COLUMN cache_path.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_path.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_path.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_path.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_path.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_path.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_path.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_path.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_path.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_path.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_update; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_update ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_update; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_update IS 'Cache table for the Update module to store information about available releases, fetched from central server.'; + + +-- +-- Name: COLUMN cache_update.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_update.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_update.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_update.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_update.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_update.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_update.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_update.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_update.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_update.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_views; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_views ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE cache_views; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_views IS 'Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.'; + + +-- +-- Name: COLUMN cache_views.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_views.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_views.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_views.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_views.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: cache_views_data; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE cache_views_data ( + cid character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + serialized smallint DEFAULT 1 NOT NULL +); + + +-- +-- Name: TABLE cache_views_data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE cache_views_data IS 'Cache table for views to store pre-rendered queries, results, and display output.'; + + +-- +-- Name: COLUMN cache_views_data.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views_data.cid IS 'Primary Key: Unique cache ID.'; + + +-- +-- Name: COLUMN cache_views_data.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views_data.data IS 'A collection of data to cache.'; + + +-- +-- Name: COLUMN cache_views_data.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views_data.expire IS 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.'; + + +-- +-- Name: COLUMN cache_views_data.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views_data.created IS 'A Unix timestamp indicating when the cache entry was created.'; + + +-- +-- Name: COLUMN cache_views_data.serialized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN cache_views_data.serialized IS 'A flag to indicate whether content is serialized (1) or not (0).'; + + +-- +-- Name: comment; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE comment ( + cid integer NOT NULL, + pid integer DEFAULT 0 NOT NULL, + nid integer DEFAULT 0 NOT NULL, + uid integer DEFAULT 0 NOT NULL, + subject character varying(64) DEFAULT ''::character varying NOT NULL, + hostname character varying(128) DEFAULT ''::character varying NOT NULL, + created integer DEFAULT 0 NOT NULL, + changed integer DEFAULT 0 NOT NULL, + status integer DEFAULT 1 NOT NULL, + thread character varying(255) NOT NULL, + name character varying(60), + mail character varying(64), + homepage character varying(255), + language character varying(12) DEFAULT ''::character varying NOT NULL, + CONSTRAINT comment_status_check CHECK ((status >= 0)) +); + + +-- +-- Name: TABLE comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE comment IS 'Stores comments and associated data.'; + + +-- +-- Name: COLUMN comment.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.cid IS 'Primary Key: Unique comment ID.'; + + +-- +-- Name: COLUMN comment.pid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.pid IS 'The comment.cid to which this comment is a reply. If set to 0, this comment is not a reply to an existing comment.'; + + +-- +-- Name: COLUMN comment.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.nid IS 'The node.nid to which this comment is a reply.'; + + +-- +-- Name: COLUMN comment.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.uid IS 'The users.uid who authored the comment. If set to 0, this comment was created by an anonymous user.'; + + +-- +-- Name: COLUMN comment.subject; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.subject IS 'The comment title.'; + + +-- +-- Name: COLUMN comment.hostname; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.hostname IS 'The author''s host name.'; + + +-- +-- Name: COLUMN comment.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.created IS 'The time that the comment was created, as a Unix timestamp.'; + + +-- +-- Name: COLUMN comment.changed; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.changed IS 'The time that the comment was last edited, as a Unix timestamp.'; + + +-- +-- Name: COLUMN comment.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.status IS 'The published status of a comment. (0 = Not Published, 1 = Published)'; + + +-- +-- Name: COLUMN comment.thread; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.thread IS 'The vancode representation of the comment''s place in a thread.'; + + +-- +-- Name: COLUMN comment.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.name IS 'The comment author''s name. Uses users.name if the user is logged in, otherwise uses the value typed into the comment form.'; + + +-- +-- Name: COLUMN comment.mail; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.mail IS 'The comment author''s e-mail address from the comment form, if user is anonymous, and the ''Anonymous users may/must leave their contact information'' setting is turned on.'; + + +-- +-- Name: COLUMN comment.homepage; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.homepage IS 'The comment author''s home page address from the comment form, if user is anonymous, and the ''Anonymous users may/must leave their contact information'' setting is turned on.'; + + +-- +-- Name: COLUMN comment.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN comment.language IS 'The languages.language of this comment.'; + + +-- +-- Name: comment_cid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE comment_cid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: comment_cid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE comment_cid_seq OWNED BY comment.cid; + + +-- +-- Name: ctools_css_cache; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE ctools_css_cache ( + cid character varying(128) NOT NULL, + filename character varying(255), + css text, + filter smallint +); + + +-- +-- Name: TABLE ctools_css_cache; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE ctools_css_cache IS 'A special cache used to store CSS that must be non-volatile.'; + + +-- +-- Name: COLUMN ctools_css_cache.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_css_cache.cid IS 'The CSS ID this cache object belongs to.'; + + +-- +-- Name: COLUMN ctools_css_cache.filename; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_css_cache.filename IS 'The filename this CSS is stored in.'; + + +-- +-- Name: COLUMN ctools_css_cache.css; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_css_cache.css IS 'CSS being stored.'; + + +-- +-- Name: COLUMN ctools_css_cache.filter; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_css_cache.filter IS 'Whether or not this CSS needs to be filtered.'; + + +-- +-- Name: ctools_object_cache; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE ctools_object_cache ( + sid character varying(64) NOT NULL, + name character varying(128) NOT NULL, + obj character varying(128) NOT NULL, + updated bigint DEFAULT 0 NOT NULL, + data bytea, + CONSTRAINT ctools_object_cache_updated_check CHECK ((updated >= 0)) +); + + +-- +-- Name: TABLE ctools_object_cache; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE ctools_object_cache IS 'A special cache used to store objects that are being edited; it serves to save state in an ordinarily stateless environment.'; + + +-- +-- Name: COLUMN ctools_object_cache.sid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_object_cache.sid IS 'The session ID this cache object belongs to.'; + + +-- +-- Name: COLUMN ctools_object_cache.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_object_cache.name IS 'The name of the object this cache is attached to.'; + + +-- +-- Name: COLUMN ctools_object_cache.obj; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_object_cache.obj IS 'The type of the object this cache is attached to; this essentially represents the owner so that several sub-systems can use this cache.'; + + +-- +-- Name: COLUMN ctools_object_cache.updated; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_object_cache.updated IS 'The time this cache was created or updated.'; + + +-- +-- Name: COLUMN ctools_object_cache.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN ctools_object_cache.data IS 'Serialized data being stored.'; + + +-- +-- Name: date_format_locale; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE date_format_locale ( + format character varying(100) NOT NULL, + type character varying(64) NOT NULL, + language character varying(12) NOT NULL +); + + +-- +-- Name: TABLE date_format_locale; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE date_format_locale IS 'Stores configured date formats for each locale.'; + + +-- +-- Name: COLUMN date_format_locale.format; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_format_locale.format IS 'The date format string.'; + + +-- +-- Name: COLUMN date_format_locale.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_format_locale.type IS 'The date format type, e.g. medium.'; + + +-- +-- Name: COLUMN date_format_locale.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_format_locale.language IS 'A languages.language for this format to be used with.'; + + +-- +-- Name: date_format_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE date_format_type ( + type character varying(64) NOT NULL, + title character varying(255) NOT NULL, + locked smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE date_format_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE date_format_type IS 'Stores configured date format types.'; + + +-- +-- Name: COLUMN date_format_type.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_format_type.type IS 'The date format type, e.g. medium.'; + + +-- +-- Name: COLUMN date_format_type.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_format_type.title IS 'The human readable name of the format type.'; + + +-- +-- Name: COLUMN date_format_type.locked; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_format_type.locked IS 'Whether or not this is a system provided format.'; + + +-- +-- Name: date_formats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE date_formats ( + dfid integer NOT NULL, + format character varying(100) NOT NULL, + type character varying(64) NOT NULL, + locked smallint DEFAULT 0 NOT NULL, + CONSTRAINT date_formats_dfid_check CHECK ((dfid >= 0)) +); + + +-- +-- Name: TABLE date_formats; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE date_formats IS 'Stores configured date formats.'; + + +-- +-- Name: COLUMN date_formats.dfid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_formats.dfid IS 'The date format identifier.'; + + +-- +-- Name: COLUMN date_formats.format; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_formats.format IS 'The date format string.'; + + +-- +-- Name: COLUMN date_formats.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_formats.type IS 'The date format type, e.g. medium.'; + + +-- +-- Name: COLUMN date_formats.locked; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN date_formats.locked IS 'Whether or not this format can be modified.'; + + +-- +-- Name: date_formats_dfid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE date_formats_dfid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: date_formats_dfid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE date_formats_dfid_seq OWNED BY date_formats.dfid; + + +-- +-- Name: do_group; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE do_group ( + group_id integer NOT NULL, + name character varying(100) NOT NULL, + tree_json text, + group_node_id integer +); + + +-- +-- Name: do_group_group_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE do_group_group_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: do_group_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE do_group_group_id_seq OWNED BY do_group.group_id; + + +-- +-- Name: do_node; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE do_node ( + node_id integer NOT NULL, + name character varying(100) NOT NULL, + type character varying(100) NOT NULL, + prop text, + rank integer, + description text +); + + +-- +-- Name: do_node_node_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE do_node_node_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: do_node_node_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE do_node_node_id_seq OWNED BY do_node.node_id; + + +-- +-- Name: do_node_relationship; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE do_node_relationship ( + relationship_id integer NOT NULL, + parent_id integer NOT NULL, + child_id integer NOT NULL +); + + +-- +-- Name: do_node_relationship_relationship_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE do_node_relationship_relationship_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: do_node_relationship_relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE do_node_relationship_relationship_id_seq OWNED BY do_node_relationship.relationship_id; + + +-- +-- Name: do_overview; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE do_overview ( + overview_id integer NOT NULL, + group_id integer NOT NULL, + description text, + submit_date timestamp without time zone, + filename character varying(100) NOT NULL +); + + +-- +-- Name: do_overview_overview_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE do_overview_overview_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: do_overview_overview_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE do_overview_overview_id_seq OWNED BY do_overview.overview_id; + + +-- +-- Name: do_user; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE do_user ( + user_id integer NOT NULL, + name character varying(255) NOT NULL, + uid character varying(255) NOT NULL, + mail character varying(255) NOT NULL, + prop text +); + + +-- +-- Name: field_config; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_config ( + id integer NOT NULL, + field_name character varying(32) NOT NULL, + type character varying(128) NOT NULL, + module character varying(128) DEFAULT ''::character varying NOT NULL, + active smallint DEFAULT 0 NOT NULL, + storage_type character varying(128) NOT NULL, + storage_module character varying(128) DEFAULT ''::character varying NOT NULL, + storage_active smallint DEFAULT 0 NOT NULL, + locked smallint DEFAULT 0 NOT NULL, + data bytea NOT NULL, + cardinality smallint DEFAULT 0 NOT NULL, + translatable smallint DEFAULT 0 NOT NULL, + deleted smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: COLUMN field_config.id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.id IS 'The primary identifier for a field'; + + +-- +-- Name: COLUMN field_config.field_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.field_name IS 'The name of this field. Non-deleted field names are unique, but multiple deleted fields can have the same name.'; + + +-- +-- Name: COLUMN field_config.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.type IS 'The type of this field.'; + + +-- +-- Name: COLUMN field_config.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.module IS 'The module that implements the field type.'; + + +-- +-- Name: COLUMN field_config.active; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.active IS 'Boolean indicating whether the module that implements the field type is enabled.'; + + +-- +-- Name: COLUMN field_config.storage_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.storage_type IS 'The storage backend for the field.'; + + +-- +-- Name: COLUMN field_config.storage_module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.storage_module IS 'The module that implements the storage backend.'; + + +-- +-- Name: COLUMN field_config.storage_active; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.storage_active IS 'Boolean indicating whether the module that implements the storage backend is enabled.'; + + +-- +-- Name: COLUMN field_config.locked; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.locked IS '@TODO'; + + +-- +-- Name: COLUMN field_config.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config.data IS 'Serialized data containing the field properties that do not warrant a dedicated column.'; + + +-- +-- Name: field_config_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE field_config_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: field_config_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE field_config_id_seq OWNED BY field_config.id; + + +-- +-- Name: field_config_instance; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_config_instance ( + id integer NOT NULL, + field_id integer NOT NULL, + field_name character varying(32) DEFAULT ''::character varying NOT NULL, + entity_type character varying(32) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + data bytea NOT NULL, + deleted smallint DEFAULT 0 NOT NULL +); + + +-- +-- Name: COLUMN field_config_instance.id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config_instance.id IS 'The primary identifier for a field instance'; + + +-- +-- Name: COLUMN field_config_instance.field_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_config_instance.field_id IS 'The identifier of the field attached by this instance'; + + +-- +-- Name: field_config_instance_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE field_config_instance_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: field_config_instance_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE field_config_instance_id_seq OWNED BY field_config_instance.id; + + +-- +-- Name: field_data_body; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_data_body ( + entity_type character varying(128) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + deleted smallint DEFAULT 0 NOT NULL, + entity_id bigint NOT NULL, + revision_id bigint, + language character varying(32) DEFAULT ''::character varying NOT NULL, + delta bigint NOT NULL, + body_value text, + body_summary text, + body_format character varying(255), + CONSTRAINT field_data_body_delta_check CHECK ((delta >= 0)), + CONSTRAINT field_data_body_entity_id_check CHECK ((entity_id >= 0)), + CONSTRAINT field_data_body_revision_id_check CHECK ((revision_id >= 0)) +); + + +-- +-- Name: TABLE field_data_body; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE field_data_body IS 'Data storage for field 2 (body)'; + + +-- +-- Name: COLUMN field_data_body.entity_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_body.entity_type IS 'The entity type this data is attached to'; + + +-- +-- Name: COLUMN field_data_body.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_body.bundle IS 'The field instance bundle to which this row belongs, used when deleting a field instance'; + + +-- +-- Name: COLUMN field_data_body.deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_body.deleted IS 'A boolean indicating whether this data item has been deleted'; + + +-- +-- Name: COLUMN field_data_body.entity_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_body.entity_id IS 'The entity id this data is attached to'; + + +-- +-- Name: COLUMN field_data_body.revision_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_body.revision_id IS 'The entity revision id this data is attached to, or NULL if the entity type is not versioned'; + + +-- +-- Name: COLUMN field_data_body.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_body.language IS 'The language for this data item.'; + + +-- +-- Name: COLUMN field_data_body.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_body.delta IS 'The sequence number for this data item, used for multi-value fields'; + + +-- +-- Name: field_data_comment_body; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_data_comment_body ( + entity_type character varying(128) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + deleted smallint DEFAULT 0 NOT NULL, + entity_id bigint NOT NULL, + revision_id bigint, + language character varying(32) DEFAULT ''::character varying NOT NULL, + delta bigint NOT NULL, + comment_body_value text, + comment_body_format character varying(255), + CONSTRAINT field_data_comment_body_delta_check CHECK ((delta >= 0)), + CONSTRAINT field_data_comment_body_entity_id_check CHECK ((entity_id >= 0)), + CONSTRAINT field_data_comment_body_revision_id_check CHECK ((revision_id >= 0)) +); + + +-- +-- Name: TABLE field_data_comment_body; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE field_data_comment_body IS 'Data storage for field 1 (comment_body)'; + + +-- +-- Name: COLUMN field_data_comment_body.entity_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_comment_body.entity_type IS 'The entity type this data is attached to'; + + +-- +-- Name: COLUMN field_data_comment_body.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_comment_body.bundle IS 'The field instance bundle to which this row belongs, used when deleting a field instance'; + + +-- +-- Name: COLUMN field_data_comment_body.deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_comment_body.deleted IS 'A boolean indicating whether this data item has been deleted'; + + +-- +-- Name: COLUMN field_data_comment_body.entity_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_comment_body.entity_id IS 'The entity id this data is attached to'; + + +-- +-- Name: COLUMN field_data_comment_body.revision_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_comment_body.revision_id IS 'The entity revision id this data is attached to, or NULL if the entity type is not versioned'; + + +-- +-- Name: COLUMN field_data_comment_body.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_comment_body.language IS 'The language for this data item.'; + + +-- +-- Name: COLUMN field_data_comment_body.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_comment_body.delta IS 'The sequence number for this data item, used for multi-value fields'; + + +-- +-- Name: field_data_field_image; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_data_field_image ( + entity_type character varying(128) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + deleted smallint DEFAULT 0 NOT NULL, + entity_id bigint NOT NULL, + revision_id bigint, + language character varying(32) DEFAULT ''::character varying NOT NULL, + delta bigint NOT NULL, + field_image_fid bigint, + field_image_alt character varying(512), + field_image_title character varying(1024), + field_image_width bigint, + field_image_height bigint, + CONSTRAINT field_data_field_image_delta_check CHECK ((delta >= 0)), + CONSTRAINT field_data_field_image_entity_id_check CHECK ((entity_id >= 0)), + CONSTRAINT field_data_field_image_field_image_fid_check CHECK ((field_image_fid >= 0)), + CONSTRAINT field_data_field_image_field_image_height_check CHECK ((field_image_height >= 0)), + CONSTRAINT field_data_field_image_field_image_width_check CHECK ((field_image_width >= 0)), + CONSTRAINT field_data_field_image_revision_id_check CHECK ((revision_id >= 0)) +); + + +-- +-- Name: TABLE field_data_field_image; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE field_data_field_image IS 'Data storage for field 4 (field_image)'; + + +-- +-- Name: COLUMN field_data_field_image.entity_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.entity_type IS 'The entity type this data is attached to'; + + +-- +-- Name: COLUMN field_data_field_image.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.bundle IS 'The field instance bundle to which this row belongs, used when deleting a field instance'; + + +-- +-- Name: COLUMN field_data_field_image.deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.deleted IS 'A boolean indicating whether this data item has been deleted'; + + +-- +-- Name: COLUMN field_data_field_image.entity_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.entity_id IS 'The entity id this data is attached to'; + + +-- +-- Name: COLUMN field_data_field_image.revision_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.revision_id IS 'The entity revision id this data is attached to, or NULL if the entity type is not versioned'; + + +-- +-- Name: COLUMN field_data_field_image.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.language IS 'The language for this data item.'; + + +-- +-- Name: COLUMN field_data_field_image.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.delta IS 'The sequence number for this data item, used for multi-value fields'; + + +-- +-- Name: COLUMN field_data_field_image.field_image_fid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.field_image_fid IS 'The file_managed.fid being referenced in this field.'; + + +-- +-- Name: COLUMN field_data_field_image.field_image_alt; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.field_image_alt IS 'Alternative image text, for the image''s ''alt'' attribute.'; + + +-- +-- Name: COLUMN field_data_field_image.field_image_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.field_image_title IS 'Image title text, for the image''s ''title'' attribute.'; + + +-- +-- Name: COLUMN field_data_field_image.field_image_width; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.field_image_width IS 'The width of the image in pixels.'; + + +-- +-- Name: COLUMN field_data_field_image.field_image_height; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_image.field_image_height IS 'The height of the image in pixels.'; + + +-- +-- Name: field_data_field_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_data_field_tags ( + entity_type character varying(128) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + deleted smallint DEFAULT 0 NOT NULL, + entity_id bigint NOT NULL, + revision_id bigint, + language character varying(32) DEFAULT ''::character varying NOT NULL, + delta bigint NOT NULL, + field_tags_tid bigint, + CONSTRAINT field_data_field_tags_delta_check CHECK ((delta >= 0)), + CONSTRAINT field_data_field_tags_entity_id_check CHECK ((entity_id >= 0)), + CONSTRAINT field_data_field_tags_field_tags_tid_check CHECK ((field_tags_tid >= 0)), + CONSTRAINT field_data_field_tags_revision_id_check CHECK ((revision_id >= 0)) +); + + +-- +-- Name: TABLE field_data_field_tags; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE field_data_field_tags IS 'Data storage for field 3 (field_tags)'; + + +-- +-- Name: COLUMN field_data_field_tags.entity_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_tags.entity_type IS 'The entity type this data is attached to'; + + +-- +-- Name: COLUMN field_data_field_tags.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_tags.bundle IS 'The field instance bundle to which this row belongs, used when deleting a field instance'; + + +-- +-- Name: COLUMN field_data_field_tags.deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_tags.deleted IS 'A boolean indicating whether this data item has been deleted'; + + +-- +-- Name: COLUMN field_data_field_tags.entity_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_tags.entity_id IS 'The entity id this data is attached to'; + + +-- +-- Name: COLUMN field_data_field_tags.revision_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_tags.revision_id IS 'The entity revision id this data is attached to, or NULL if the entity type is not versioned'; + + +-- +-- Name: COLUMN field_data_field_tags.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_tags.language IS 'The language for this data item.'; + + +-- +-- Name: COLUMN field_data_field_tags.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_data_field_tags.delta IS 'The sequence number for this data item, used for multi-value fields'; + + +-- +-- Name: field_revision_body; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_revision_body ( + entity_type character varying(128) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + deleted smallint DEFAULT 0 NOT NULL, + entity_id bigint NOT NULL, + revision_id bigint NOT NULL, + language character varying(32) DEFAULT ''::character varying NOT NULL, + delta bigint NOT NULL, + body_value text, + body_summary text, + body_format character varying(255), + CONSTRAINT field_revision_body_delta_check CHECK ((delta >= 0)), + CONSTRAINT field_revision_body_entity_id_check CHECK ((entity_id >= 0)), + CONSTRAINT field_revision_body_revision_id_check CHECK ((revision_id >= 0)) +); + + +-- +-- Name: TABLE field_revision_body; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE field_revision_body IS 'Revision archive storage for field 2 (body)'; + + +-- +-- Name: COLUMN field_revision_body.entity_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_body.entity_type IS 'The entity type this data is attached to'; + + +-- +-- Name: COLUMN field_revision_body.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_body.bundle IS 'The field instance bundle to which this row belongs, used when deleting a field instance'; + + +-- +-- Name: COLUMN field_revision_body.deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_body.deleted IS 'A boolean indicating whether this data item has been deleted'; + + +-- +-- Name: COLUMN field_revision_body.entity_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_body.entity_id IS 'The entity id this data is attached to'; + + +-- +-- Name: COLUMN field_revision_body.revision_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_body.revision_id IS 'The entity revision id this data is attached to'; + + +-- +-- Name: COLUMN field_revision_body.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_body.language IS 'The language for this data item.'; + + +-- +-- Name: COLUMN field_revision_body.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_body.delta IS 'The sequence number for this data item, used for multi-value fields'; + + +-- +-- Name: field_revision_comment_body; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_revision_comment_body ( + entity_type character varying(128) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + deleted smallint DEFAULT 0 NOT NULL, + entity_id bigint NOT NULL, + revision_id bigint NOT NULL, + language character varying(32) DEFAULT ''::character varying NOT NULL, + delta bigint NOT NULL, + comment_body_value text, + comment_body_format character varying(255), + CONSTRAINT field_revision_comment_body_delta_check CHECK ((delta >= 0)), + CONSTRAINT field_revision_comment_body_entity_id_check CHECK ((entity_id >= 0)), + CONSTRAINT field_revision_comment_body_revision_id_check CHECK ((revision_id >= 0)) +); + + +-- +-- Name: TABLE field_revision_comment_body; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE field_revision_comment_body IS 'Revision archive storage for field 1 (comment_body)'; + + +-- +-- Name: COLUMN field_revision_comment_body.entity_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_comment_body.entity_type IS 'The entity type this data is attached to'; + + +-- +-- Name: COLUMN field_revision_comment_body.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_comment_body.bundle IS 'The field instance bundle to which this row belongs, used when deleting a field instance'; + + +-- +-- Name: COLUMN field_revision_comment_body.deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_comment_body.deleted IS 'A boolean indicating whether this data item has been deleted'; + + +-- +-- Name: COLUMN field_revision_comment_body.entity_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_comment_body.entity_id IS 'The entity id this data is attached to'; + + +-- +-- Name: COLUMN field_revision_comment_body.revision_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_comment_body.revision_id IS 'The entity revision id this data is attached to'; + + +-- +-- Name: COLUMN field_revision_comment_body.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_comment_body.language IS 'The language for this data item.'; + + +-- +-- Name: COLUMN field_revision_comment_body.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_comment_body.delta IS 'The sequence number for this data item, used for multi-value fields'; + + +-- +-- Name: field_revision_field_image; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_revision_field_image ( + entity_type character varying(128) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + deleted smallint DEFAULT 0 NOT NULL, + entity_id bigint NOT NULL, + revision_id bigint NOT NULL, + language character varying(32) DEFAULT ''::character varying NOT NULL, + delta bigint NOT NULL, + field_image_fid bigint, + field_image_alt character varying(512), + field_image_title character varying(1024), + field_image_width bigint, + field_image_height bigint, + CONSTRAINT field_revision_field_image_delta_check CHECK ((delta >= 0)), + CONSTRAINT field_revision_field_image_entity_id_check CHECK ((entity_id >= 0)), + CONSTRAINT field_revision_field_image_field_image_fid_check CHECK ((field_image_fid >= 0)), + CONSTRAINT field_revision_field_image_field_image_height_check CHECK ((field_image_height >= 0)), + CONSTRAINT field_revision_field_image_field_image_width_check CHECK ((field_image_width >= 0)), + CONSTRAINT field_revision_field_image_revision_id_check CHECK ((revision_id >= 0)) +); + + +-- +-- Name: TABLE field_revision_field_image; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE field_revision_field_image IS 'Revision archive storage for field 4 (field_image)'; + + +-- +-- Name: COLUMN field_revision_field_image.entity_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.entity_type IS 'The entity type this data is attached to'; + + +-- +-- Name: COLUMN field_revision_field_image.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.bundle IS 'The field instance bundle to which this row belongs, used when deleting a field instance'; + + +-- +-- Name: COLUMN field_revision_field_image.deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.deleted IS 'A boolean indicating whether this data item has been deleted'; + + +-- +-- Name: COLUMN field_revision_field_image.entity_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.entity_id IS 'The entity id this data is attached to'; + + +-- +-- Name: COLUMN field_revision_field_image.revision_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.revision_id IS 'The entity revision id this data is attached to'; + + +-- +-- Name: COLUMN field_revision_field_image.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.language IS 'The language for this data item.'; + + +-- +-- Name: COLUMN field_revision_field_image.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.delta IS 'The sequence number for this data item, used for multi-value fields'; + + +-- +-- Name: COLUMN field_revision_field_image.field_image_fid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.field_image_fid IS 'The file_managed.fid being referenced in this field.'; + + +-- +-- Name: COLUMN field_revision_field_image.field_image_alt; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.field_image_alt IS 'Alternative image text, for the image''s ''alt'' attribute.'; + + +-- +-- Name: COLUMN field_revision_field_image.field_image_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.field_image_title IS 'Image title text, for the image''s ''title'' attribute.'; + + +-- +-- Name: COLUMN field_revision_field_image.field_image_width; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.field_image_width IS 'The width of the image in pixels.'; + + +-- +-- Name: COLUMN field_revision_field_image.field_image_height; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_image.field_image_height IS 'The height of the image in pixels.'; + + +-- +-- Name: field_revision_field_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE field_revision_field_tags ( + entity_type character varying(128) DEFAULT ''::character varying NOT NULL, + bundle character varying(128) DEFAULT ''::character varying NOT NULL, + deleted smallint DEFAULT 0 NOT NULL, + entity_id bigint NOT NULL, + revision_id bigint NOT NULL, + language character varying(32) DEFAULT ''::character varying NOT NULL, + delta bigint NOT NULL, + field_tags_tid bigint, + CONSTRAINT field_revision_field_tags_delta_check CHECK ((delta >= 0)), + CONSTRAINT field_revision_field_tags_entity_id_check CHECK ((entity_id >= 0)), + CONSTRAINT field_revision_field_tags_field_tags_tid_check CHECK ((field_tags_tid >= 0)), + CONSTRAINT field_revision_field_tags_revision_id_check CHECK ((revision_id >= 0)) +); + + +-- +-- Name: TABLE field_revision_field_tags; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE field_revision_field_tags IS 'Revision archive storage for field 3 (field_tags)'; + + +-- +-- Name: COLUMN field_revision_field_tags.entity_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_tags.entity_type IS 'The entity type this data is attached to'; + + +-- +-- Name: COLUMN field_revision_field_tags.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_tags.bundle IS 'The field instance bundle to which this row belongs, used when deleting a field instance'; + + +-- +-- Name: COLUMN field_revision_field_tags.deleted; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_tags.deleted IS 'A boolean indicating whether this data item has been deleted'; + + +-- +-- Name: COLUMN field_revision_field_tags.entity_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_tags.entity_id IS 'The entity id this data is attached to'; + + +-- +-- Name: COLUMN field_revision_field_tags.revision_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_tags.revision_id IS 'The entity revision id this data is attached to'; + + +-- +-- Name: COLUMN field_revision_field_tags.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_tags.language IS 'The language for this data item.'; + + +-- +-- Name: COLUMN field_revision_field_tags.delta; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN field_revision_field_tags.delta IS 'The sequence number for this data item, used for multi-value fields'; + + +-- +-- Name: file_managed; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE file_managed ( + fid integer NOT NULL, + uid bigint DEFAULT 0 NOT NULL, + filename character varying(255) DEFAULT ''::character varying NOT NULL, + uri character varying(255) DEFAULT ''::character varying NOT NULL, + filemime character varying(255) DEFAULT ''::character varying NOT NULL, + filesize bigint DEFAULT 0 NOT NULL, + status smallint DEFAULT 0 NOT NULL, + "timestamp" bigint DEFAULT 0 NOT NULL, + CONSTRAINT file_managed_fid_check CHECK ((fid >= 0)), + CONSTRAINT file_managed_filesize_check CHECK ((filesize >= 0)), + CONSTRAINT file_managed_timestamp_check CHECK (("timestamp" >= 0)), + CONSTRAINT file_managed_uid_check CHECK ((uid >= 0)) +); + + +-- +-- Name: TABLE file_managed; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE file_managed IS 'Stores information for uploaded files.'; + + +-- +-- Name: COLUMN file_managed.fid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_managed.fid IS 'File ID.'; + + +-- +-- Name: COLUMN file_managed.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_managed.uid IS 'The users.uid of the user who is associated with the file.'; + + +-- +-- Name: COLUMN file_managed.filename; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_managed.filename IS 'Name of the file with no path components. This may differ from the basename of the URI if the file is renamed to avoid overwriting an existing file.'; + + +-- +-- Name: COLUMN file_managed.uri; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_managed.uri IS 'The URI to access the file (either local or remote).'; + + +-- +-- Name: COLUMN file_managed.filemime; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_managed.filemime IS 'The file''s MIME type.'; + + +-- +-- Name: COLUMN file_managed.filesize; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_managed.filesize IS 'The size of the file in bytes.'; + + +-- +-- Name: COLUMN file_managed.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_managed.status IS 'A field indicating the status of the file. Two status are defined in core: temporary (0) and permanent (1). Temporary files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during a cron run.'; + + +-- +-- Name: COLUMN file_managed."timestamp"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_managed."timestamp" IS 'UNIX timestamp for when the file was added.'; + + +-- +-- Name: file_managed_fid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE file_managed_fid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: file_managed_fid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE file_managed_fid_seq OWNED BY file_managed.fid; + + +-- +-- Name: file_usage; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE file_usage ( + fid bigint NOT NULL, + module character varying(255) DEFAULT ''::character varying NOT NULL, + type character varying(64) DEFAULT ''::character varying NOT NULL, + id bigint DEFAULT 0 NOT NULL, + count bigint DEFAULT 0 NOT NULL, + CONSTRAINT file_usage_count_check CHECK ((count >= 0)), + CONSTRAINT file_usage_fid_check CHECK ((fid >= 0)), + CONSTRAINT file_usage_id_check CHECK ((id >= 0)) +); + + +-- +-- Name: TABLE file_usage; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE file_usage IS 'Track where a file is used.'; + + +-- +-- Name: COLUMN file_usage.fid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_usage.fid IS 'File ID.'; + + +-- +-- Name: COLUMN file_usage.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_usage.module IS 'The name of the module that is using the file.'; + + +-- +-- Name: COLUMN file_usage.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_usage.type IS 'The name of the object type in which the file is used.'; + + +-- +-- Name: COLUMN file_usage.id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_usage.id IS 'The primary key of the object using the file.'; + + +-- +-- Name: COLUMN file_usage.count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN file_usage.count IS 'The number of times this file is used by this object.'; + + +-- +-- Name: filter; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE filter ( + format character varying(255) NOT NULL, + module character varying(64) DEFAULT ''::character varying NOT NULL, + name character varying(32) DEFAULT ''::character varying NOT NULL, + weight integer DEFAULT 0 NOT NULL, + status integer DEFAULT 0 NOT NULL, + settings bytea +); + + +-- +-- Name: TABLE filter; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE filter IS 'Table that maps filters (HTML corrector) to text formats (Filtered HTML).'; + + +-- +-- Name: COLUMN filter.format; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter.format IS 'Foreign key: The filter_format.format to which this filter is assigned.'; + + +-- +-- Name: COLUMN filter.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter.module IS 'The origin module of the filter.'; + + +-- +-- Name: COLUMN filter.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter.name IS 'Name of the filter being referenced.'; + + +-- +-- Name: COLUMN filter.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter.weight IS 'Weight of filter within format.'; + + +-- +-- Name: COLUMN filter.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter.status IS 'Filter enabled status. (1 = enabled, 0 = disabled)'; + + +-- +-- Name: COLUMN filter.settings; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter.settings IS 'A serialized array of name value pairs that store the filter settings for the specific format.'; + + +-- +-- Name: filter_format; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE filter_format ( + format character varying(255) NOT NULL, + name character varying(255) DEFAULT ''::character varying NOT NULL, + cache smallint DEFAULT 0 NOT NULL, + status integer DEFAULT 1 NOT NULL, + weight integer DEFAULT 0 NOT NULL, + CONSTRAINT filter_format_status_check CHECK ((status >= 0)) +); + + +-- +-- Name: TABLE filter_format; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE filter_format IS 'Stores text formats: custom groupings of filters, such as Filtered HTML.'; + + +-- +-- Name: COLUMN filter_format.format; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter_format.format IS 'Primary Key: Unique machine name of the format.'; + + +-- +-- Name: COLUMN filter_format.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter_format.name IS 'Name of the text format (Filtered HTML).'; + + +-- +-- Name: COLUMN filter_format.cache; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter_format.cache IS 'Flag to indicate whether format is cacheable. (1 = cacheable, 0 = not cacheable)'; + + +-- +-- Name: COLUMN filter_format.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter_format.status IS 'The status of the text format. (1 = enabled, 0 = disabled)'; + + +-- +-- Name: COLUMN filter_format.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN filter_format.weight IS 'Weight of text format to use when listing.'; + + +-- +-- Name: flood; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE flood ( + fid integer NOT NULL, + event character varying(64) DEFAULT ''::character varying NOT NULL, + identifier character varying(128) DEFAULT ''::character varying NOT NULL, + "timestamp" integer DEFAULT 0 NOT NULL, + expiration integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE flood; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE flood IS 'Flood controls the threshold of events, such as the number of contact attempts.'; + + +-- +-- Name: COLUMN flood.fid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN flood.fid IS 'Unique flood event ID.'; + + +-- +-- Name: COLUMN flood.event; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN flood.event IS 'Name of event (e.g. contact).'; + + +-- +-- Name: COLUMN flood.identifier; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN flood.identifier IS 'Identifier of the visitor, such as an IP address or hostname.'; + + +-- +-- Name: COLUMN flood."timestamp"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN flood."timestamp" IS 'Timestamp of the event.'; + + +-- +-- Name: COLUMN flood.expiration; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN flood.expiration IS 'Expiration timestamp. Expired events are purged on cron run.'; + + +-- +-- Name: flood_fid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE flood_fid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: flood_fid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE flood_fid_seq OWNED BY flood.fid; + + +-- +-- Name: gensas_category; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_category ( + category_id integer NOT NULL, + category_name character varying NOT NULL, + category_label character varying NOT NULL, + rank integer NOT NULL +); + + +-- +-- Name: gensas_category_category_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_category_category_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_category_category_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_category_category_id_seq OWNED BY gensas_category.category_id; + + +-- +-- Name: gensas_db; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_db ( + db_id integer NOT NULL, + db_name character varying(100) NOT NULL, + label character varying(100) NOT NULL, + url character varying(100), + url_prefix character varying(100), + description text, + regex_id character varying(200), + regex_def character varying(200), + regex_hit_id character varying(200), + regex_hit_acc character varying(200), + regex_hit_def character varying(200), + regex_hit_org character varying(200) +); + + +-- +-- Name: gensas_db_db_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_db_db_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_db_db_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_db_db_id_seq OWNED BY gensas_db.db_id; + + +-- +-- Name: gensas_expire; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_expire ( + task_id character varying(200) NOT NULL, + reset_date timestamp without time zone, + last_notify_date timestamp without time zone, + next_notify_days integer, + exempt integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: gensas_files; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_files ( + file_id integer NOT NULL, + user_id integer NOT NULL, + file_name character varying(1024) NOT NULL, + file_path text NOT NULL, + drupal_path text NOT NULL, + file_size bigint NOT NULL, + type character varying(100) +); + + +-- +-- Name: gensas_files_file_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_files_file_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_files_file_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_files_file_id_seq OWNED BY gensas_files.file_id; + + +-- +-- Name: gensas_gff3; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_gff3 ( + id character varying(200) NOT NULL, + job_id character varying(200) NOT NULL, + parent character varying(200), + prop text, + type character varying(200) NOT NULL, + start integer, + landmark character varying(1024) NOT NULL +); + + +-- +-- Name: gensas_group; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_group ( + group_id integer NOT NULL, + group_name character varying(1024) NOT NULL +); + + +-- +-- Name: gensas_group_group_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_group_group_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_group_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_group_group_id_seq OWNED BY gensas_group.group_id; + + +-- +-- Name: gensas_group_seq; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_group_seq ( + group_id integer NOT NULL, + seq_id integer NOT NULL, + type character varying(100) DEFAULT 'unknown'::character varying NOT NULL +); + + +-- +-- Name: gensas_group_task; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_group_task ( + group_id integer NOT NULL, + task_id character varying(200) NOT NULL +); + + +-- +-- Name: gensas_group_user; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_group_user ( + group_id integer NOT NULL, + user_id integer NOT NULL, + leader integer DEFAULT 0 NOT NULL, + read_only integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: gensas_job; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_job ( + job_id character varying(200) NOT NULL, + id integer NOT NULL, + type character varying(50) NOT NULL, + output text, + create_date timestamp without time zone, + submit_date timestamp without time zone, + complete_date timestamp without time zone, + log text, + status integer, + params text, + output_parsed text, + source character varying(1024), + tool_id integer, + stderr text, + retval character varying(50), + num_run integer, + name character varying(100), + prop text +); + + +-- +-- Name: gensas_job_cmd; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_job_cmd ( + id integer NOT NULL, + index integer NOT NULL, + cmd text, + sanitized_cmd text +); + + +-- +-- Name: gensas_job_execid; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_job_execid ( + job_id character varying(200) NOT NULL, + resource_id integer NOT NULL, + exec_id integer NOT NULL +); + + +-- +-- Name: gensas_job_files; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_job_files ( + job_id character varying(200) NOT NULL, + file_id integer +); + + +-- +-- Name: gensas_job_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_job_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_job_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_job_id_seq OWNED BY gensas_job.id; + + +-- +-- Name: gensas_job_pid; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_job_pid ( + job_id character varying(200) NOT NULL, + pid integer NOT NULL +); + + +-- +-- Name: gensas_job_resource; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_job_resource ( + resource_id integer NOT NULL, + job_id character varying(200) NOT NULL +); + + +-- +-- Name: gensas_job_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_job_stats ( + job_id character varying(200) NOT NULL, + type character varying(50) NOT NULL, + num_features integer +); + + +-- +-- Name: gensas_library; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_library ( + library_id integer NOT NULL, + name character varying(300) NOT NULL, + type_id integer NOT NULL, + label character varying(300) NOT NULL +); + + +-- +-- Name: gensas_library_library_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_library_library_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_library_library_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_library_library_id_seq OWNED BY gensas_library.library_id; + + +-- +-- Name: gensas_library_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_library_type ( + library_type_id integer NOT NULL, + type character varying(300) NOT NULL, + label character varying(300) NOT NULL +); + + +-- +-- Name: gensas_library_type_library_type_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_library_type_library_type_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_library_type_library_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_library_type_library_type_id_seq OWNED BY gensas_library_type.library_type_id; + + +-- +-- Name: gensas_param_group; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_param_group ( + param_group_id integer NOT NULL, + name character varying(128) NOT NULL, + tool_id integer NOT NULL, + title character varying(255) NOT NULL, + description text, + prop text +); + + +-- +-- Name: COLUMN gensas_param_group.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_param_group.name IS 'a computer readable name for the group'; + + +-- +-- Name: COLUMN gensas_param_group.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_param_group.title IS 'a human readable name for the group'; + + +-- +-- Name: gensas_param_group_param_group_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_param_group_param_group_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_param_group_param_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_param_group_param_group_id_seq OWNED BY gensas_param_group.param_group_id; + + +-- +-- Name: gensas_project_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_project_type ( + project_type_id integer NOT NULL, + type character varying(200) NOT NULL, + name character varying(200) NOT NULL +); + + +-- +-- Name: gensas_project_type_project_type_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_project_type_project_type_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_project_type_project_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_project_type_project_type_id_seq OWNED BY gensas_project_type.project_type_id; + + +-- +-- Name: gensas_publish; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_publish ( + job_id character varying(200) NOT NULL, + version integer NOT NULL +); + + +-- +-- Name: gensas_resource; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_resource ( + resource_id integer NOT NULL, + name character varying(150) NOT NULL, + type character varying(10) NOT NULL, + max_slots integer DEFAULT 1 NOT NULL, + rank integer NOT NULL, + enabled integer DEFAULT 1 NOT NULL, + working_directory text, + description text, + seqlib_directory text +); + + +-- +-- Name: COLUMN gensas_resource.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_resource.type IS 'The type of resource (e.g. local, ge or pbs).'; + + +-- +-- Name: COLUMN gensas_resource.max_slots; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_resource.max_slots IS 'The number of free slots on this resource.'; + + +-- +-- Name: COLUMN gensas_resource.rank; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_resource.rank IS 'An integer indicating the order in which resrouces should be selected for use. A lower rank indicates higher priority.'; + + +-- +-- Name: COLUMN gensas_resource.enabled; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_resource.enabled IS 'Set to 0 if this resource should not be used.'; + + +-- +-- Name: COLUMN gensas_resource.working_directory; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_resource.working_directory IS 'The directory on the resource where GenSAS will store temporary needed for and created during execution.'; + + +-- +-- Name: COLUMN gensas_resource.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_resource.description IS 'Provides a brief description about this .'; + + +-- +-- Name: gensas_resource_library; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_resource_library ( + resource_id integer NOT NULL, + library_id character varying(200) NOT NULL, + file_path text NOT NULL +); + + +-- +-- Name: gensas_resource_resource_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_resource_resource_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_resource_resource_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_resource_resource_id_seq OWNED BY gensas_resource.resource_id; + + +-- +-- Name: gensas_resource_submit; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_resource_submit ( + resource_id integer NOT NULL, + hostname character varying(200) NOT NULL, + ssh_port integer NOT NULL, + username character varying(200) NOT NULL +); + + +-- +-- Name: gensas_resource_tool; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_resource_tool ( + resource_id integer NOT NULL, + tool_id integer NOT NULL, + tool_path text NOT NULL +); + + +-- +-- Name: gensas_seq; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_seq ( + seq_id integer NOT NULL, + seq_group_id integer NOT NULL, + create_date timestamp without time zone NOT NULL, + name text NOT NULL, + user_id integer NOT NULL, + description text +); + + +-- +-- Name: gensas_seq_group; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_seq_group ( + seq_group_id integer NOT NULL, + user_id integer NOT NULL, + name character varying(255) NOT NULL, + type character varying(100) NOT NULL, + filename character varying(1028) DEFAULT 'unknown'::character varying NOT NULL, + num_seqs integer DEFAULT 0 NOT NULL, + version character varying(25) DEFAULT ''::character varying NOT NULL, + filtered text, + status character varying(20) +); + + +-- +-- Name: gensas_seq_group_seq_group_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_seq_group_seq_group_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_seq_group_seq_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_seq_group_seq_group_id_seq OWNED BY gensas_seq_group.seq_group_id; + + +-- +-- Name: gensas_seq_seq_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_seq_seq_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_seq_seq_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_seq_seq_id_seq OWNED BY gensas_seq.seq_id; + + +-- +-- Name: gensas_seq_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_seq_stats ( + job_id character varying(200) NOT NULL, + seq_id integer, + type character varying(50) NOT NULL, + num_features integer +); + + +-- +-- Name: gensas_task; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_task ( + task_id character varying(200) NOT NULL, + task_name character varying(50), + submit_date timestamp without time zone, + complete_date timestamp without time zone, + log text, + user_id integer, + status character varying(50), + task_info text, + prop text +); + + +-- +-- Name: gensas_task_files; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_task_files ( + task_id character varying(200) NOT NULL, + file_id integer +); + + +-- +-- Name: gensas_task_job; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_task_job ( + task_id character varying(200) NOT NULL, + job_id character varying(200) NOT NULL, + is_owner smallint DEFAULT 1 NOT NULL +); + + +-- +-- Name: gensas_task_seq_group; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_task_seq_group ( + task_id character varying(200) NOT NULL, + seq_group_id integer +); + + +-- +-- Name: gensas_task_user; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_task_user ( + task_id character varying(200) NOT NULL, + user_id integer NOT NULL, + permission character varying(200) DEFAULT 'readonly'::character varying NOT NULL +); + + +-- +-- Name: gensas_tool; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_tool ( + tool_id integer NOT NULL, + tool_name character varying(100) NOT NULL, + tool_label character varying(100) NOT NULL, + description text, + outfiles_desc text, + url character varying(100), + is_enabled smallint DEFAULT 1 NOT NULL, + category_id integer NOT NULL, + tool_path character varying, + profile_num integer DEFAULT 1 NOT NULL +); + + +-- +-- Name: COLUMN gensas_tool.profile_num; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN gensas_tool.profile_num IS 'Indicates the installed profile for this tool. This number should be increased when updates are made to the values of this table. The GenSAS Tool installer will check this field with the profile in the GenSASToolExec class. If the profile_number in the record differs from the profile_num provided in the install() function for the tool, then the record will be updated.'; + + +-- +-- Name: gensas_tool_param; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_tool_param ( + tool_param_id integer NOT NULL, + tool_id integer NOT NULL, + param_elem_id character varying NOT NULL, + param_label character varying NOT NULL, + param_type character varying NOT NULL, + param_value text, + param_attr character varying, + param_default character varying, + rank integer, + cmd_prefix character varying(30), + cmd_surfix character varying(30), + param_note character varying(1024), + required integer, + param_group_id integer +); + + +-- +-- Name: gensas_tool_param_tool_param_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_tool_param_tool_param_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_tool_param_tool_param_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_tool_param_tool_param_id_seq OWNED BY gensas_tool_param.tool_param_id; + + +-- +-- Name: gensas_tool_param_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_tool_param_type ( + tool_param_type_id integer NOT NULL, + type character varying(300) NOT NULL, + label character varying(300) NOT NULL, + description text +); + + +-- +-- Name: gensas_tool_param_type_tool_param_type_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_tool_param_type_tool_param_type_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_tool_param_type_tool_param_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_tool_param_type_tool_param_type_id_seq OWNED BY gensas_tool_param_type.tool_param_type_id; + + +-- +-- Name: gensas_tool_tool_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_tool_tool_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_tool_tool_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_tool_tool_id_seq OWNED BY gensas_tool.tool_id; + + +-- +-- Name: gensas_tool_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_tool_type ( + tool_type_id integer NOT NULL, + project_type_id integer NOT NULL, + tool_id integer NOT NULL +); + + +-- +-- Name: TABLE gensas_tool_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE gensas_tool_type IS 'Associates tools with the type of project they are appropriate for.'; + + +-- +-- Name: gensas_tool_type_tool_type_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_tool_type_tool_type_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_tool_type_tool_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_tool_type_tool_type_id_seq OWNED BY gensas_tool_type.tool_type_id; + + +-- +-- Name: gensas_user_tool; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE gensas_user_tool ( + user_id integer NOT NULL, + tool_id integer NOT NULL, + status character varying +); + + +-- +-- Name: history; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE history ( + uid integer DEFAULT 0 NOT NULL, + nid integer DEFAULT 0 NOT NULL, + "timestamp" integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE history; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE history IS 'A record of which users have read which nodes.'; + + +-- +-- Name: COLUMN history.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN history.uid IS 'The users.uid that read the node nid.'; + + +-- +-- Name: COLUMN history.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN history.nid IS 'The node.nid that was read.'; + + +-- +-- Name: COLUMN history."timestamp"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN history."timestamp" IS 'The Unix timestamp at which the read occurred.'; + + +-- +-- Name: image_effects; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE image_effects ( + ieid integer NOT NULL, + isid bigint DEFAULT 0 NOT NULL, + weight integer DEFAULT 0 NOT NULL, + name character varying(255) NOT NULL, + data bytea NOT NULL, + CONSTRAINT image_effects_ieid_check CHECK ((ieid >= 0)), + CONSTRAINT image_effects_isid_check CHECK ((isid >= 0)) +); + + +-- +-- Name: TABLE image_effects; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE image_effects IS 'Stores configuration options for image effects.'; + + +-- +-- Name: COLUMN image_effects.ieid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN image_effects.ieid IS 'The primary identifier for an image effect.'; + + +-- +-- Name: COLUMN image_effects.isid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN image_effects.isid IS 'The image_styles.isid for an image style.'; + + +-- +-- Name: COLUMN image_effects.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN image_effects.weight IS 'The weight of the effect in the style.'; + + +-- +-- Name: COLUMN image_effects.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN image_effects.name IS 'The unique name of the effect to be executed.'; + + +-- +-- Name: COLUMN image_effects.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN image_effects.data IS 'The configuration data for the effect.'; + + +-- +-- Name: image_effects_ieid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE image_effects_ieid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: image_effects_ieid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE image_effects_ieid_seq OWNED BY image_effects.ieid; + + +-- +-- Name: image_styles; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE image_styles ( + isid integer NOT NULL, + name character varying(255) NOT NULL, + label character varying(255) DEFAULT ''::character varying NOT NULL, + CONSTRAINT image_styles_isid_check CHECK ((isid >= 0)) +); + + +-- +-- Name: TABLE image_styles; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE image_styles IS 'Stores configuration options for image styles.'; + + +-- +-- Name: COLUMN image_styles.isid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN image_styles.isid IS 'The primary identifier for an image style.'; + + +-- +-- Name: COLUMN image_styles.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN image_styles.name IS 'The style machine name.'; + + +-- +-- Name: COLUMN image_styles.label; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN image_styles.label IS 'The style administrative name.'; + + +-- +-- Name: image_styles_isid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE image_styles_isid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: image_styles_isid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE image_styles_isid_seq OWNED BY image_styles.isid; + + +-- +-- Name: masquerade; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE masquerade ( + sid character varying(64) DEFAULT ''::character varying NOT NULL, + uid_from integer DEFAULT 0 NOT NULL, + uid_as integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE masquerade; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE masquerade IS 'Each masquerading user has their session recorded into the masquerade table. Each record represents a masquerading user.'; + + +-- +-- Name: COLUMN masquerade.sid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN masquerade.sid IS 'The current session for this masquerading user corresponding to their sessions.sid.'; + + +-- +-- Name: COLUMN masquerade.uid_from; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN masquerade.uid_from IS 'The users.uid corresponding to a session.'; + + +-- +-- Name: COLUMN masquerade.uid_as; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN masquerade.uid_as IS 'The users.uid this session is masquerading as.'; + + +-- +-- Name: masquerade_users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE masquerade_users ( + uid_from integer DEFAULT 0 NOT NULL, + uid_to integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE masquerade_users; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE masquerade_users IS 'Per-user permission table granting permissions to switch as a specific user.'; + + +-- +-- Name: COLUMN masquerade_users.uid_from; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN masquerade_users.uid_from IS 'The users.uid that can masquerade as masquerade_users.uid_to.'; + + +-- +-- Name: COLUMN masquerade_users.uid_to; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN masquerade_users.uid_to IS 'The users.uid that masquerade_users.uid_from can masquerade as.'; + + +-- +-- Name: mcl_data_valid; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mcl_data_valid ( + data_valid_id integer NOT NULL, + data_valid_type_id integer NOT NULL, + name character varying(255) NOT NULL, + cvterm_id integer +); + + +-- +-- Name: mcl_data_valid_data_valid_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE mcl_data_valid_data_valid_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mcl_data_valid_data_valid_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE mcl_data_valid_data_valid_id_seq OWNED BY mcl_data_valid.data_valid_id; + + +-- +-- Name: mcl_data_valid_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mcl_data_valid_type ( + data_valid_type_id integer NOT NULL, + type character varying(255) NOT NULL, + cv_id integer +); + + +-- +-- Name: mcl_data_valid_type_data_valid_type_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE mcl_data_valid_type_data_valid_type_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mcl_data_valid_type_data_valid_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE mcl_data_valid_type_data_valid_type_id_seq OWNED BY mcl_data_valid_type.data_valid_type_id; + + +-- +-- Name: mcl_file; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mcl_file ( + file_id integer NOT NULL, + type character varying(255) NOT NULL, + filename character varying(255) NOT NULL, + filepath character varying(512) NOT NULL, + filesize integer DEFAULT 0 NOT NULL, + uri character varying(255) NOT NULL, + user_id integer NOT NULL, + job_id integer, + submit_date timestamp without time zone NOT NULL, + prop text +); + + +-- +-- Name: mcl_file_file_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE mcl_file_file_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mcl_file_file_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE mcl_file_file_id_seq OWNED BY mcl_file.file_id; + + +-- +-- Name: mcl_job; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mcl_job ( + job_id integer NOT NULL, + name character varying(255) NOT NULL, + type character varying(255) NOT NULL, + class_name character varying(255), + status integer, + param text, + prop text, + user_id integer NOT NULL, + submit_date timestamp without time zone NOT NULL, + complete_date timestamp without time zone +); + + +-- +-- Name: mcl_job_job_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE mcl_job_job_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mcl_job_job_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE mcl_job_job_id_seq OWNED BY mcl_job.job_id; + + +-- +-- Name: mcl_template; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mcl_template ( + template_id integer NOT NULL, + template character varying(255) NOT NULL, + template_type_id integer NOT NULL, + public integer DEFAULT 1 +); + + +-- +-- Name: mcl_template_template_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE mcl_template_template_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mcl_template_template_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE mcl_template_template_id_seq OWNED BY mcl_template.template_id; + + +-- +-- Name: mcl_template_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mcl_template_type ( + template_type_id integer NOT NULL, + type character varying(255) NOT NULL, + rank integer NOT NULL +); + + +-- +-- Name: mcl_template_type_template_type_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE mcl_template_type_template_type_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mcl_template_type_template_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE mcl_template_type_template_type_id_seq OWNED BY mcl_template_type.template_type_id; + + +-- +-- Name: mcl_user; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mcl_user ( + user_id integer NOT NULL, + name character varying(255) NOT NULL, + uid integer NOT NULL, + mail character varying(255) NOT NULL, + prop text +); + + +-- +-- Name: mcl_var; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mcl_var ( + var_id integer NOT NULL, + name character varying(255) NOT NULL, + type character varying(255) NOT NULL, + value character varying(1024), + description text +); + + +-- +-- Name: mcl_var_var_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE mcl_var_var_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mcl_var_var_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE mcl_var_var_id_seq OWNED BY mcl_var.var_id; + + +-- +-- Name: menu_custom; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE menu_custom ( + menu_name character varying(32) DEFAULT ''::character varying NOT NULL, + title character varying(255) DEFAULT ''::character varying NOT NULL, + description text +); + + +-- +-- Name: TABLE menu_custom; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE menu_custom IS 'Holds definitions for top-level custom menus (for example, Main menu).'; + + +-- +-- Name: COLUMN menu_custom.menu_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_custom.menu_name IS 'Primary Key: Unique key for menu. This is used as a block delta so length is 32.'; + + +-- +-- Name: COLUMN menu_custom.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_custom.title IS 'Menu title; displayed at top of block.'; + + +-- +-- Name: COLUMN menu_custom.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_custom.description IS 'Menu description.'; + + +-- +-- Name: menu_links; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE menu_links ( + menu_name character varying(32) DEFAULT ''::character varying NOT NULL, + mlid integer NOT NULL, + plid bigint DEFAULT 0 NOT NULL, + link_path character varying(255) DEFAULT ''::character varying NOT NULL, + router_path character varying(255) DEFAULT ''::character varying NOT NULL, + link_title character varying(255) DEFAULT ''::character varying NOT NULL, + options bytea, + module character varying(255) DEFAULT 'system'::character varying NOT NULL, + hidden smallint DEFAULT 0 NOT NULL, + external smallint DEFAULT 0 NOT NULL, + has_children smallint DEFAULT 0 NOT NULL, + expanded smallint DEFAULT 0 NOT NULL, + weight integer DEFAULT 0 NOT NULL, + depth smallint DEFAULT 0 NOT NULL, + customized smallint DEFAULT 0 NOT NULL, + p1 bigint DEFAULT 0 NOT NULL, + p2 bigint DEFAULT 0 NOT NULL, + p3 bigint DEFAULT 0 NOT NULL, + p4 bigint DEFAULT 0 NOT NULL, + p5 bigint DEFAULT 0 NOT NULL, + p6 bigint DEFAULT 0 NOT NULL, + p7 bigint DEFAULT 0 NOT NULL, + p8 bigint DEFAULT 0 NOT NULL, + p9 bigint DEFAULT 0 NOT NULL, + updated smallint DEFAULT 0 NOT NULL, + CONSTRAINT menu_links_mlid_check CHECK ((mlid >= 0)), + CONSTRAINT menu_links_p1_check CHECK ((p1 >= 0)), + CONSTRAINT menu_links_p2_check CHECK ((p2 >= 0)), + CONSTRAINT menu_links_p3_check CHECK ((p3 >= 0)), + CONSTRAINT menu_links_p4_check CHECK ((p4 >= 0)), + CONSTRAINT menu_links_p5_check CHECK ((p5 >= 0)), + CONSTRAINT menu_links_p6_check CHECK ((p6 >= 0)), + CONSTRAINT menu_links_p7_check CHECK ((p7 >= 0)), + CONSTRAINT menu_links_p8_check CHECK ((p8 >= 0)), + CONSTRAINT menu_links_p9_check CHECK ((p9 >= 0)), + CONSTRAINT menu_links_plid_check CHECK ((plid >= 0)) +); + + +-- +-- Name: TABLE menu_links; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE menu_links IS 'Contains the individual links within a menu.'; + + +-- +-- Name: COLUMN menu_links.menu_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.menu_name IS 'The menu name. All links with the same menu name (such as ''navigation'') are part of the same menu.'; + + +-- +-- Name: COLUMN menu_links.mlid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.mlid IS 'The menu link ID (mlid) is the integer primary key.'; + + +-- +-- Name: COLUMN menu_links.plid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.plid IS 'The parent link ID (plid) is the mlid of the link above in the hierarchy, or zero if the link is at the top level in its menu.'; + + +-- +-- Name: COLUMN menu_links.link_path; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.link_path IS 'The Drupal path or external path this link points to.'; + + +-- +-- Name: COLUMN menu_links.router_path; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.router_path IS 'For links corresponding to a Drupal path (external = 0), this connects the link to a menu_router.path for joins.'; + + +-- +-- Name: COLUMN menu_links.link_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.link_title IS 'The text displayed for the link, which may be modified by a title callback stored in menu_router.'; + + +-- +-- Name: COLUMN menu_links.options; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.options IS 'A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.'; + + +-- +-- Name: COLUMN menu_links.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.module IS 'The name of the module that generated this link.'; + + +-- +-- Name: COLUMN menu_links.hidden; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.hidden IS 'A flag for whether the link should be rendered in menus. (1 = a disabled menu item that may be shown on admin screens, -1 = a menu callback, 0 = a normal, visible link)'; + + +-- +-- Name: COLUMN menu_links.external; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.external IS 'A flag to indicate if the link points to a full URL starting with a protocol,::text like http:// (1 = external, 0 = internal).'; + + +-- +-- Name: COLUMN menu_links.has_children; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.has_children IS 'Flag indicating whether any links have this link as a parent (1 = children exist, 0 = no children).'; + + +-- +-- Name: COLUMN menu_links.expanded; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.expanded IS 'Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded)'; + + +-- +-- Name: COLUMN menu_links.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.weight IS 'Link weight among links in the same menu at the same depth.'; + + +-- +-- Name: COLUMN menu_links.depth; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.depth IS 'The depth relative to the top level. A link with plid == 0 will have depth == 1.'; + + +-- +-- Name: COLUMN menu_links.customized; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.customized IS 'A flag to indicate that the user has manually created or edited the link (1 = customized, 0 = not customized).'; + + +-- +-- Name: COLUMN menu_links.p1; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p1 IS 'The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the plid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.'; + + +-- +-- Name: COLUMN menu_links.p2; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p2 IS 'The second mlid in the materialized path. See p1.'; + + +-- +-- Name: COLUMN menu_links.p3; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p3 IS 'The third mlid in the materialized path. See p1.'; + + +-- +-- Name: COLUMN menu_links.p4; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p4 IS 'The fourth mlid in the materialized path. See p1.'; + + +-- +-- Name: COLUMN menu_links.p5; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p5 IS 'The fifth mlid in the materialized path. See p1.'; + + +-- +-- Name: COLUMN menu_links.p6; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p6 IS 'The sixth mlid in the materialized path. See p1.'; + + +-- +-- Name: COLUMN menu_links.p7; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p7 IS 'The seventh mlid in the materialized path. See p1.'; + + +-- +-- Name: COLUMN menu_links.p8; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p8 IS 'The eighth mlid in the materialized path. See p1.'; + + +-- +-- Name: COLUMN menu_links.p9; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.p9 IS 'The ninth mlid in the materialized path. See p1.'; + + +-- +-- Name: COLUMN menu_links.updated; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_links.updated IS 'Flag that indicates that this link was generated during the update from Drupal 5.'; + + +-- +-- Name: menu_links_mlid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE menu_links_mlid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: menu_links_mlid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE menu_links_mlid_seq OWNED BY menu_links.mlid; + + +-- +-- Name: menu_router; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE menu_router ( + path character varying(255) DEFAULT ''::character varying NOT NULL, + load_functions bytea NOT NULL, + to_arg_functions bytea NOT NULL, + access_callback character varying(255) DEFAULT ''::character varying NOT NULL, + access_arguments bytea, + page_callback character varying(255) DEFAULT ''::character varying NOT NULL, + page_arguments bytea, + delivery_callback character varying(255) DEFAULT ''::character varying NOT NULL, + fit integer DEFAULT 0 NOT NULL, + number_parts smallint DEFAULT 0 NOT NULL, + context integer DEFAULT 0 NOT NULL, + tab_parent character varying(255) DEFAULT ''::character varying NOT NULL, + tab_root character varying(255) DEFAULT ''::character varying NOT NULL, + title character varying(255) DEFAULT ''::character varying NOT NULL, + title_callback character varying(255) DEFAULT ''::character varying NOT NULL, + title_arguments character varying(255) DEFAULT ''::character varying NOT NULL, + theme_callback character varying(255) DEFAULT ''::character varying NOT NULL, + theme_arguments character varying(255) DEFAULT ''::character varying NOT NULL, + type integer DEFAULT 0 NOT NULL, + description text NOT NULL, + "position" character varying(255) DEFAULT ''::character varying NOT NULL, + weight integer DEFAULT 0 NOT NULL, + include_file text +); + + +-- +-- Name: TABLE menu_router; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE menu_router IS 'Maps paths to various callbacks (access, page and title)'; + + +-- +-- Name: COLUMN menu_router.path; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.path IS 'Primary Key: the Drupal path this entry describes'; + + +-- +-- Name: COLUMN menu_router.load_functions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.load_functions IS 'A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.'; + + +-- +-- Name: COLUMN menu_router.to_arg_functions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.to_arg_functions IS 'A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.'; + + +-- +-- Name: COLUMN menu_router.access_callback; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.access_callback IS 'The callback which determines the access to this router path. Defaults to user_access.'; + + +-- +-- Name: COLUMN menu_router.access_arguments; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.access_arguments IS 'A serialized array of arguments for the access callback.'; + + +-- +-- Name: COLUMN menu_router.page_callback; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.page_callback IS 'The name of the function that renders the page.'; + + +-- +-- Name: COLUMN menu_router.page_arguments; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.page_arguments IS 'A serialized array of arguments for the page callback.'; + + +-- +-- Name: COLUMN menu_router.delivery_callback; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.delivery_callback IS 'The name of the function that sends the result of the page_callback function to the browser.'; + + +-- +-- Name: COLUMN menu_router.fit; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.fit IS 'A numeric representation of how specific the path is.'; + + +-- +-- Name: COLUMN menu_router.number_parts; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.number_parts IS 'Number of parts in this router path.'; + + +-- +-- Name: COLUMN menu_router.context; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.context IS 'Only for local tasks (tabs) - the context of a local task to control its placement.'; + + +-- +-- Name: COLUMN menu_router.tab_parent; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.tab_parent IS 'Only for local tasks (tabs) - the router path of the parent page (which may also be a local task).'; + + +-- +-- Name: COLUMN menu_router.tab_root; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.tab_root IS 'Router path of the closest non-tab parent page. For pages that are not local tasks, this will be the same as the path.'; + + +-- +-- Name: COLUMN menu_router.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.title IS 'The title for the current page, or the title for the tab if this is a local task.'; + + +-- +-- Name: COLUMN menu_router.title_callback; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.title_callback IS 'A function which will alter the title. Defaults to t()'; + + +-- +-- Name: COLUMN menu_router.title_arguments; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.title_arguments IS 'A serialized array of arguments for the title callback. If empty, the title will be used as the sole argument for the title callback.'; + + +-- +-- Name: COLUMN menu_router.theme_callback; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.theme_callback IS 'A function which returns the name of the theme that will be used to render this page. If left empty, the default theme will be used.'; + + +-- +-- Name: COLUMN menu_router.theme_arguments; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.theme_arguments IS 'A serialized array of arguments for the theme callback.'; + + +-- +-- Name: COLUMN menu_router.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.type IS 'Numeric representation of the type of the menu item,::text like MENU_LOCAL_TASK.'; + + +-- +-- Name: COLUMN menu_router.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.description IS 'A description of this item.'; + + +-- +-- Name: COLUMN menu_router."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router."position" IS 'The position of the block (left or right) on the system administration page for this item.'; + + +-- +-- Name: COLUMN menu_router.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.weight IS 'Weight of the element. Lighter weights are higher up, heavier weights go down.'; + + +-- +-- Name: COLUMN menu_router.include_file; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN menu_router.include_file IS 'The file to include for this element, usually the page callback function lives in this file.'; + + +-- +-- Name: node; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE node ( + nid integer NOT NULL, + vid bigint, + type character varying(32) DEFAULT ''::character varying NOT NULL, + language character varying(12) DEFAULT ''::character varying NOT NULL, + title character varying(255) DEFAULT ''::character varying NOT NULL, + uid integer DEFAULT 0 NOT NULL, + status integer DEFAULT 1 NOT NULL, + created integer DEFAULT 0 NOT NULL, + changed integer DEFAULT 0 NOT NULL, + comment integer DEFAULT 0 NOT NULL, + promote integer DEFAULT 0 NOT NULL, + sticky integer DEFAULT 0 NOT NULL, + tnid bigint DEFAULT 0 NOT NULL, + translate integer DEFAULT 0 NOT NULL, + CONSTRAINT node_nid_check CHECK ((nid >= 0)), + CONSTRAINT node_tnid_check CHECK ((tnid >= 0)), + CONSTRAINT node_vid_check CHECK ((vid >= 0)) +); + + +-- +-- Name: TABLE node; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE node IS 'The base table for nodes.'; + + +-- +-- Name: COLUMN node.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.nid IS 'The primary identifier for a node.'; + + +-- +-- Name: COLUMN node.vid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.vid IS 'The current node_revision.vid version identifier.'; + + +-- +-- Name: COLUMN node.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.type IS 'The node_type.type of this node.'; + + +-- +-- Name: COLUMN node.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.language IS 'The languages.language of this node.'; + + +-- +-- Name: COLUMN node.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.title IS 'The title of this node, always treated as non-markup plain text.'; + + +-- +-- Name: COLUMN node.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.uid IS 'The users.uid that owns this node; initially, this is the user that created it.'; + + +-- +-- Name: COLUMN node.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.status IS 'Boolean indicating whether the node is published (visible to non-administrators).'; + + +-- +-- Name: COLUMN node.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.created IS 'The Unix timestamp when the node was created.'; + + +-- +-- Name: COLUMN node.changed; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.changed IS 'The Unix timestamp when the node was most recently saved.'; + + +-- +-- Name: COLUMN node.comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.comment IS 'Whether comments are allowed on this node: 0 = no, 1 = closed (read only), 2 = open (read/write).'; + + +-- +-- Name: COLUMN node.promote; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.promote IS 'Boolean indicating whether the node should be displayed on the front page.'; + + +-- +-- Name: COLUMN node.sticky; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.sticky IS 'Boolean indicating whether the node should be displayed at the top of lists in which it appears.'; + + +-- +-- Name: COLUMN node.tnid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.tnid IS 'The translation set id for this node, which equals the node id of the source post in each set.'; + + +-- +-- Name: COLUMN node.translate; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node.translate IS 'A boolean indicating whether this translation page needs to be updated.'; + + +-- +-- Name: node_access; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE node_access ( + nid bigint DEFAULT 0 NOT NULL, + gid bigint DEFAULT 0 NOT NULL, + realm character varying(255) DEFAULT ''::character varying NOT NULL, + grant_view integer DEFAULT 0 NOT NULL, + grant_update integer DEFAULT 0 NOT NULL, + grant_delete integer DEFAULT 0 NOT NULL, + CONSTRAINT node_access_gid_check CHECK ((gid >= 0)), + CONSTRAINT node_access_grant_delete_check CHECK ((grant_delete >= 0)), + CONSTRAINT node_access_grant_update_check CHECK ((grant_update >= 0)), + CONSTRAINT node_access_grant_view_check CHECK ((grant_view >= 0)), + CONSTRAINT node_access_nid_check CHECK ((nid >= 0)) +); + + +-- +-- Name: TABLE node_access; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE node_access IS 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.'; + + +-- +-- Name: COLUMN node_access.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_access.nid IS 'The node.nid this record affects.'; + + +-- +-- Name: COLUMN node_access.gid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_access.gid IS 'The grant ID a user must possess in the specified realm to gain this row''s privileges on the node.'; + + +-- +-- Name: COLUMN node_access.realm; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_access.realm IS 'The realm in which the user must possess the grant ID. Each node access node can define one or more realms.'; + + +-- +-- Name: COLUMN node_access.grant_view; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_access.grant_view IS 'Boolean indicating whether a user with the realm/grant pair can view this node.'; + + +-- +-- Name: COLUMN node_access.grant_update; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_access.grant_update IS 'Boolean indicating whether a user with the realm/grant pair can edit this node.'; + + +-- +-- Name: COLUMN node_access.grant_delete; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_access.grant_delete IS 'Boolean indicating whether a user with the realm/grant pair can delete this node.'; + + +-- +-- Name: node_comment_statistics; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE node_comment_statistics ( + nid bigint DEFAULT 0 NOT NULL, + cid integer DEFAULT 0 NOT NULL, + last_comment_timestamp integer DEFAULT 0 NOT NULL, + last_comment_name character varying(60), + last_comment_uid integer DEFAULT 0 NOT NULL, + comment_count bigint DEFAULT 0 NOT NULL, + CONSTRAINT node_comment_statistics_comment_count_check CHECK ((comment_count >= 0)), + CONSTRAINT node_comment_statistics_nid_check CHECK ((nid >= 0)) +); + + +-- +-- Name: TABLE node_comment_statistics; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE node_comment_statistics IS 'Maintains statistics of node and comments posts to show "new" and "updated" flags.'; + + +-- +-- Name: COLUMN node_comment_statistics.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_comment_statistics.nid IS 'The node.nid for which the statistics are compiled.'; + + +-- +-- Name: COLUMN node_comment_statistics.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_comment_statistics.cid IS 'The comment.cid of the last comment.'; + + +-- +-- Name: COLUMN node_comment_statistics.last_comment_timestamp; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_comment_statistics.last_comment_timestamp IS 'The Unix timestamp of the last comment that was posted within this node, from comment.changed.'; + + +-- +-- Name: COLUMN node_comment_statistics.last_comment_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_comment_statistics.last_comment_name IS 'The name of the latest author to post a comment on this node, from comment.name.'; + + +-- +-- Name: COLUMN node_comment_statistics.last_comment_uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_comment_statistics.last_comment_uid IS 'The user ID of the latest author to post a comment on this node, from comment.uid.'; + + +-- +-- Name: COLUMN node_comment_statistics.comment_count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_comment_statistics.comment_count IS 'The total number of comments on this node.'; + + +-- +-- Name: node_nid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE node_nid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: node_nid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE node_nid_seq OWNED BY node.nid; + + +-- +-- Name: node_revision; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE node_revision ( + nid bigint DEFAULT 0 NOT NULL, + vid integer NOT NULL, + uid integer DEFAULT 0 NOT NULL, + title character varying(255) DEFAULT ''::character varying NOT NULL, + log text NOT NULL, + "timestamp" integer DEFAULT 0 NOT NULL, + status integer DEFAULT 1 NOT NULL, + comment integer DEFAULT 0 NOT NULL, + promote integer DEFAULT 0 NOT NULL, + sticky integer DEFAULT 0 NOT NULL, + CONSTRAINT node_revision_nid_check CHECK ((nid >= 0)), + CONSTRAINT node_revision_vid_check CHECK ((vid >= 0)) +); + + +-- +-- Name: TABLE node_revision; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE node_revision IS 'Stores information about each saved version of a node.'; + + +-- +-- Name: COLUMN node_revision.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.nid IS 'The node this version belongs to.'; + + +-- +-- Name: COLUMN node_revision.vid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.vid IS 'The primary identifier for this version.'; + + +-- +-- Name: COLUMN node_revision.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.uid IS 'The users.uid that created this version.'; + + +-- +-- Name: COLUMN node_revision.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.title IS 'The title of this version.'; + + +-- +-- Name: COLUMN node_revision.log; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.log IS 'The log entry explaining the changes in this version.'; + + +-- +-- Name: COLUMN node_revision."timestamp"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision."timestamp" IS 'A Unix timestamp indicating when this version was created.'; + + +-- +-- Name: COLUMN node_revision.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.status IS 'Boolean indicating whether the node (at the time of this revision) is published (visible to non-administrators).'; + + +-- +-- Name: COLUMN node_revision.comment; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.comment IS 'Whether comments are allowed on this node (at the time of this revision): 0 = no, 1 = closed (read only), 2 = open (read/write).'; + + +-- +-- Name: COLUMN node_revision.promote; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.promote IS 'Boolean indicating whether the node (at the time of this revision) should be displayed on the front page.'; + + +-- +-- Name: COLUMN node_revision.sticky; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_revision.sticky IS 'Boolean indicating whether the node (at the time of this revision) should be displayed at the top of lists in which it appears.'; + + +-- +-- Name: node_revision_vid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE node_revision_vid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: node_revision_vid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE node_revision_vid_seq OWNED BY node_revision.vid; + + +-- +-- Name: node_type; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE node_type ( + type character varying(32) NOT NULL, + name character varying(255) DEFAULT ''::character varying NOT NULL, + base character varying(255) NOT NULL, + module character varying(255) NOT NULL, + description text NOT NULL, + help text NOT NULL, + has_title integer NOT NULL, + title_label character varying(255) DEFAULT ''::character varying NOT NULL, + custom smallint DEFAULT 0 NOT NULL, + modified smallint DEFAULT 0 NOT NULL, + locked smallint DEFAULT 0 NOT NULL, + disabled smallint DEFAULT 0 NOT NULL, + orig_type character varying(255) DEFAULT ''::character varying NOT NULL, + CONSTRAINT node_type_has_title_check CHECK ((has_title >= 0)) +); + + +-- +-- Name: TABLE node_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE node_type IS 'Stores information about all defined node types.'; + + +-- +-- Name: COLUMN node_type.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.type IS 'The machine-readable name of this type.'; + + +-- +-- Name: COLUMN node_type.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.name IS 'The human-readable name of this type.'; + + +-- +-- Name: COLUMN node_type.base; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.base IS 'The base string used to construct callbacks corresponding to this node type.'; + + +-- +-- Name: COLUMN node_type.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.module IS 'The module defining this node type.'; + + +-- +-- Name: COLUMN node_type.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.description IS 'A brief description of this type.'; + + +-- +-- Name: COLUMN node_type.help; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.help IS 'Help information shown to the user when creating a node of this type.'; + + +-- +-- Name: COLUMN node_type.has_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.has_title IS 'Boolean indicating whether this type uses the node.title field.'; + + +-- +-- Name: COLUMN node_type.title_label; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.title_label IS 'The label displayed for the title field on the edit form.'; + + +-- +-- Name: COLUMN node_type.custom; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.custom IS 'A boolean indicating whether this type is defined by a module (FALSE) or by a user via Add content type (TRUE).'; + + +-- +-- Name: COLUMN node_type.modified; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.modified IS 'A boolean indicating whether this type has been modified by an administrator; currently not used in any way.'; + + +-- +-- Name: COLUMN node_type.locked; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.locked IS 'A boolean indicating whether the administrator can change the machine name of this type.'; + + +-- +-- Name: COLUMN node_type.disabled; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.disabled IS 'A boolean indicating whether the node type is disabled.'; + + +-- +-- Name: COLUMN node_type.orig_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN node_type.orig_type IS 'The original machine-readable name of this node type. This may be different from the current type name if the locked field is 0.'; + + +-- +-- Name: queue; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE queue ( + item_id integer NOT NULL, + name character varying(255) DEFAULT ''::character varying NOT NULL, + data bytea, + expire integer DEFAULT 0 NOT NULL, + created integer DEFAULT 0 NOT NULL, + CONSTRAINT queue_item_id_check CHECK ((item_id >= 0)) +); + + +-- +-- Name: TABLE queue; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE queue IS 'Stores items in queues.'; + + +-- +-- Name: COLUMN queue.item_id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN queue.item_id IS 'Primary Key: Unique item ID.'; + + +-- +-- Name: COLUMN queue.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN queue.name IS 'The queue name.'; + + +-- +-- Name: COLUMN queue.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN queue.data IS 'The arbitrary data for the item.'; + + +-- +-- Name: COLUMN queue.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN queue.expire IS 'Timestamp when the claim lease expires on the item.'; + + +-- +-- Name: COLUMN queue.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN queue.created IS 'Timestamp when the item was created.'; + + +-- +-- Name: queue_item_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE queue_item_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: queue_item_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE queue_item_id_seq OWNED BY queue.item_id; + + +-- +-- Name: rdf_mapping; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE rdf_mapping ( + type character varying(128) NOT NULL, + bundle character varying(128) NOT NULL, + mapping bytea +); + + +-- +-- Name: TABLE rdf_mapping; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE rdf_mapping IS 'Stores custom RDF mappings for user defined content types or overriden module-defined mappings'; + + +-- +-- Name: COLUMN rdf_mapping.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rdf_mapping.type IS 'The name of the entity type a mapping applies to (node, user, comment, etc.).'; + + +-- +-- Name: COLUMN rdf_mapping.bundle; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rdf_mapping.bundle IS 'The name of the bundle a mapping applies to.'; + + +-- +-- Name: COLUMN rdf_mapping.mapping; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN rdf_mapping.mapping IS 'The serialized mapping of the bundle type and fields to RDF terms.'; + + +-- +-- Name: registry; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE registry ( + name character varying(255) DEFAULT ''::character varying NOT NULL, + type character varying(9) DEFAULT ''::character varying NOT NULL, + filename character varying(255) NOT NULL, + module character varying(255) DEFAULT ''::character varying NOT NULL, + weight integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE registry; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE registry IS 'Each record is a function, class, or interface name and the file it is in.'; + + +-- +-- Name: COLUMN registry.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN registry.name IS 'The name of the function, class, or interface.'; + + +-- +-- Name: COLUMN registry.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN registry.type IS 'Either function or class or interface.'; + + +-- +-- Name: COLUMN registry.filename; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN registry.filename IS 'Name of the file.'; + + +-- +-- Name: COLUMN registry.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN registry.module IS 'Name of the module the file belongs to.'; + + +-- +-- Name: COLUMN registry.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN registry.weight IS 'The order in which this module''s hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.'; + + +-- +-- Name: registry_file; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE registry_file ( + filename character varying(255) NOT NULL, + hash character varying(64) NOT NULL +); + + +-- +-- Name: TABLE registry_file; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE registry_file IS 'Files parsed to build the registry.'; + + +-- +-- Name: COLUMN registry_file.filename; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN registry_file.filename IS 'Path to the file.'; + + +-- +-- Name: COLUMN registry_file.hash; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN registry_file.hash IS 'sha-256 hash of the file''s contents when last parsed.'; + + +-- +-- Name: role; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE role ( + rid integer NOT NULL, + name character varying(64) DEFAULT ''::character varying NOT NULL, + weight integer DEFAULT 0 NOT NULL, + CONSTRAINT role_rid_check CHECK ((rid >= 0)) +); + + +-- +-- Name: TABLE role; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE role IS 'Stores user roles.'; + + +-- +-- Name: COLUMN role.rid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN role.rid IS 'Primary Key: Unique role ID.'; + + +-- +-- Name: COLUMN role.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN role.name IS 'Unique role name.'; + + +-- +-- Name: COLUMN role.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN role.weight IS 'The weight of this role in listings and the user interface.'; + + +-- +-- Name: role_permission; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE role_permission ( + rid bigint NOT NULL, + permission character varying(128) DEFAULT ''::character varying NOT NULL, + module character varying(255) DEFAULT ''::character varying NOT NULL, + CONSTRAINT role_permission_rid_check CHECK ((rid >= 0)) +); + + +-- +-- Name: TABLE role_permission; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE role_permission IS 'Stores the permissions assigned to user roles.'; + + +-- +-- Name: COLUMN role_permission.rid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN role_permission.rid IS 'Foreign Key: role.rid.'; + + +-- +-- Name: COLUMN role_permission.permission; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN role_permission.permission IS 'A single permission granted to the role identified by rid.'; + + +-- +-- Name: COLUMN role_permission.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN role_permission.module IS 'The module declaring the permission.'; + + +-- +-- Name: role_rid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE role_rid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: role_rid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE role_rid_seq OWNED BY role.rid; + + +-- +-- Name: search_dataset; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_dataset ( + sid bigint DEFAULT 0 NOT NULL, + type character varying(16) NOT NULL, + data text NOT NULL, + reindex bigint DEFAULT 0 NOT NULL, + CONSTRAINT search_dataset_reindex_check CHECK ((reindex >= 0)), + CONSTRAINT search_dataset_sid_check CHECK ((sid >= 0)) +); + + +-- +-- Name: TABLE search_dataset; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_dataset IS 'Stores items that will be searched.'; + + +-- +-- Name: COLUMN search_dataset.sid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_dataset.sid IS 'Search item ID, e.g. node ID for nodes.'; + + +-- +-- Name: COLUMN search_dataset.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_dataset.type IS 'Type of item, e.g. node.'; + + +-- +-- Name: COLUMN search_dataset.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_dataset.data IS 'List of space-separated words from the item.'; + + +-- +-- Name: COLUMN search_dataset.reindex; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_dataset.reindex IS 'Set to force node reindexing.'; + + +-- +-- Name: search_index; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_index ( + word character varying(50) DEFAULT ''::character varying NOT NULL, + sid bigint DEFAULT 0 NOT NULL, + type character varying(16) NOT NULL, + score real, + CONSTRAINT search_index_sid_check CHECK ((sid >= 0)) +); + + +-- +-- Name: TABLE search_index; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_index IS 'Stores the search index, associating words, items and scores.'; + + +-- +-- Name: COLUMN search_index.word; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index.word IS 'The search_total.word that is associated with the search item.'; + + +-- +-- Name: COLUMN search_index.sid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index.sid IS 'The search_dataset.sid of the searchable item to which the word belongs.'; + + +-- +-- Name: COLUMN search_index.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index.type IS 'The search_dataset.type of the searchable item to which the word belongs.'; + + +-- +-- Name: COLUMN search_index.score; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_index.score IS 'The numeric score of the word, higher being more important.'; + + +-- +-- Name: search_node_links; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_node_links ( + sid bigint DEFAULT 0 NOT NULL, + type character varying(16) DEFAULT ''::character varying NOT NULL, + nid bigint DEFAULT 0 NOT NULL, + caption text, + CONSTRAINT search_node_links_nid_check CHECK ((nid >= 0)), + CONSTRAINT search_node_links_sid_check CHECK ((sid >= 0)) +); + + +-- +-- Name: TABLE search_node_links; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_node_links IS 'Stores items (like nodes) that link to other nodes, used to improve search scores for nodes that are frequently linked to.'; + + +-- +-- Name: COLUMN search_node_links.sid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_node_links.sid IS 'The search_dataset.sid of the searchable item containing the link to the node.'; + + +-- +-- Name: COLUMN search_node_links.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_node_links.type IS 'The search_dataset.type of the searchable item containing the link to the node.'; + + +-- +-- Name: COLUMN search_node_links.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_node_links.nid IS 'The node.nid that this item links to.'; + + +-- +-- Name: COLUMN search_node_links.caption; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_node_links.caption IS 'The text used to link to the node.nid.'; + + +-- +-- Name: search_total; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE search_total ( + word character varying(50) DEFAULT ''::character varying NOT NULL, + count real +); + + +-- +-- Name: TABLE search_total; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE search_total IS 'Stores search totals for words.'; + + +-- +-- Name: COLUMN search_total.word; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_total.word IS 'Primary Key: Unique word in the search index.'; + + +-- +-- Name: COLUMN search_total.count; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN search_total.count IS 'The count of the word in the index using Zipf''s law to equalize the probability distribution.'; + + +-- +-- Name: semaphore; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE semaphore ( + name character varying(255) DEFAULT ''::character varying NOT NULL, + value character varying(255) DEFAULT ''::character varying NOT NULL, + expire double precision NOT NULL +); + + +-- +-- Name: TABLE semaphore; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE semaphore IS 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.'; + + +-- +-- Name: COLUMN semaphore.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN semaphore.name IS 'Primary Key: Unique name.'; + + +-- +-- Name: COLUMN semaphore.value; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN semaphore.value IS 'A value for the semaphore.'; + + +-- +-- Name: COLUMN semaphore.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN semaphore.expire IS 'A Unix timestamp with microseconds indicating when the semaphore should expire.'; + + +-- +-- Name: sequences; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE sequences ( + value integer NOT NULL, + CONSTRAINT sequences_value_check CHECK ((value >= 0)) +); + + +-- +-- Name: TABLE sequences; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE sequences IS 'Stores IDs.'; + + +-- +-- Name: COLUMN sequences.value; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN sequences.value IS 'The value of the sequence.'; + + +-- +-- Name: sequences_value_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE sequences_value_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sequences_value_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE sequences_value_seq OWNED BY sequences.value; + + +-- +-- Name: sessions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE sessions ( + uid bigint NOT NULL, + sid character varying(128) NOT NULL, + ssid character varying(128) DEFAULT ''::character varying NOT NULL, + hostname character varying(128) DEFAULT ''::character varying NOT NULL, + "timestamp" integer DEFAULT 0 NOT NULL, + cache integer DEFAULT 0 NOT NULL, + session bytea, + CONSTRAINT sessions_uid_check CHECK ((uid >= 0)) +); + + +-- +-- Name: TABLE sessions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE sessions IS 'Drupal''s session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.'; + + +-- +-- Name: COLUMN sessions.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN sessions.uid IS 'The users.uid corresponding to a session, or 0 for anonymous user.'; + + +-- +-- Name: COLUMN sessions.sid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN sessions.sid IS 'A session ID. The value is generated by Drupal''s session handlers.'; + + +-- +-- Name: COLUMN sessions.ssid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN sessions.ssid IS 'Secure session ID. The value is generated by Drupal''s session handlers.'; + + +-- +-- Name: COLUMN sessions.hostname; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN sessions.hostname IS 'The IP address that last used this session ID (sid).'; + + +-- +-- Name: COLUMN sessions."timestamp"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN sessions."timestamp" IS 'The Unix timestamp when this session last requested a page. Old records are purged by PHP automatically.'; + + +-- +-- Name: COLUMN sessions.cache; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN sessions.cache IS 'The time of this user''s last post. This is used when the site has specified a minimum_cache_lifetime. See cache_get().'; + + +-- +-- Name: COLUMN sessions.session; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN sessions.session IS 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.'; + + +-- +-- Name: shortcut_set; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE shortcut_set ( + set_name character varying(32) DEFAULT ''::character varying NOT NULL, + title character varying(255) DEFAULT ''::character varying NOT NULL +); + + +-- +-- Name: TABLE shortcut_set; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE shortcut_set IS 'Stores information about sets of shortcuts links.'; + + +-- +-- Name: COLUMN shortcut_set.set_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN shortcut_set.set_name IS 'Primary Key: The menu_links.menu_name under which the set''s links are stored.'; + + +-- +-- Name: COLUMN shortcut_set.title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN shortcut_set.title IS 'The title of the set.'; + + +-- +-- Name: shortcut_set_users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE shortcut_set_users ( + uid bigint DEFAULT 0 NOT NULL, + set_name character varying(32) DEFAULT ''::character varying NOT NULL, + CONSTRAINT shortcut_set_users_uid_check CHECK ((uid >= 0)) +); + + +-- +-- Name: TABLE shortcut_set_users; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE shortcut_set_users IS 'Maps users to shortcut sets.'; + + +-- +-- Name: COLUMN shortcut_set_users.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN shortcut_set_users.uid IS 'The users.uid for this set.'; + + +-- +-- Name: COLUMN shortcut_set_users.set_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN shortcut_set_users.set_name IS 'The shortcut_set.set_name that will be displayed for this user.'; + + +-- +-- Name: system; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE system ( + filename character varying(255) DEFAULT ''::character varying NOT NULL, + name character varying(255) DEFAULT ''::character varying NOT NULL, + type character varying(12) DEFAULT ''::character varying NOT NULL, + owner character varying(255) DEFAULT ''::character varying NOT NULL, + status integer DEFAULT 0 NOT NULL, + bootstrap integer DEFAULT 0 NOT NULL, + schema_version smallint DEFAULT (-1) NOT NULL, + weight integer DEFAULT 0 NOT NULL, + info bytea +); + + +-- +-- Name: TABLE system; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE system IS 'A list of all modules, themes, and theme engines that are or have been installed in Drupal''s file system.'; + + +-- +-- Name: COLUMN system.filename; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.filename IS 'The path of the primary file for this item, relative to the Drupal root; e.g. modules/node/node.module.'; + + +-- +-- Name: COLUMN system.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.name IS 'The name of the item; e.g. node.'; + + +-- +-- Name: COLUMN system.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.type IS 'The type of the item, either module, theme, or theme_engine.'; + + +-- +-- Name: COLUMN system.owner; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.owner IS 'A theme''s ''parent'' . Can be either a theme or an engine.'; + + +-- +-- Name: COLUMN system.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.status IS 'Boolean indicating whether or not this item is enabled.'; + + +-- +-- Name: COLUMN system.bootstrap; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.bootstrap IS 'Boolean indicating whether this module is loaded during Drupal''s early bootstrapping phase (e.g. even before the page cache is consulted).'; + + +-- +-- Name: COLUMN system.schema_version; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.schema_version IS 'The module''s database schema version number. -1 if the module is not installed (its tables do not exist); 0 or the largest N of the module''s hook_update_N() function that has either been run or existed when the module was first installed.'; + + +-- +-- Name: COLUMN system.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.weight IS 'The order in which this module''s hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.'; + + +-- +-- Name: COLUMN system.info; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN system.info IS 'A serialized array containing information from the module''s .info file; keys can include name, description, package, version, core, dependencies, and php.'; + + +-- +-- Name: taxonomy_index; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE taxonomy_index ( + nid bigint DEFAULT 0 NOT NULL, + tid bigint DEFAULT 0 NOT NULL, + sticky smallint DEFAULT 0, + created integer DEFAULT 0 NOT NULL, + CONSTRAINT taxonomy_index_nid_check CHECK ((nid >= 0)), + CONSTRAINT taxonomy_index_tid_check CHECK ((tid >= 0)) +); + + +-- +-- Name: TABLE taxonomy_index; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE taxonomy_index IS 'Maintains denormalized information about node/term relationships.'; + + +-- +-- Name: COLUMN taxonomy_index.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_index.nid IS 'The node.nid this record tracks.'; + + +-- +-- Name: COLUMN taxonomy_index.tid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_index.tid IS 'The term ID.'; + + +-- +-- Name: COLUMN taxonomy_index.sticky; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_index.sticky IS 'Boolean indicating whether the node is sticky.'; + + +-- +-- Name: COLUMN taxonomy_index.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_index.created IS 'The Unix timestamp when the node was created.'; + + +-- +-- Name: taxonomy_term_data; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE taxonomy_term_data ( + tid integer NOT NULL, + vid bigint DEFAULT 0 NOT NULL, + name character varying(255) DEFAULT ''::character varying NOT NULL, + description text, + format character varying(255), + weight integer DEFAULT 0 NOT NULL, + CONSTRAINT taxonomy_term_data_tid_check CHECK ((tid >= 0)), + CONSTRAINT taxonomy_term_data_vid_check CHECK ((vid >= 0)) +); + + +-- +-- Name: TABLE taxonomy_term_data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE taxonomy_term_data IS 'Stores term information.'; + + +-- +-- Name: COLUMN taxonomy_term_data.tid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_term_data.tid IS 'Primary Key: Unique term ID.'; + + +-- +-- Name: COLUMN taxonomy_term_data.vid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_term_data.vid IS 'The taxonomy_vocabulary.vid of the vocabulary to which the term is assigned.'; + + +-- +-- Name: COLUMN taxonomy_term_data.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_term_data.name IS 'The term name.'; + + +-- +-- Name: COLUMN taxonomy_term_data.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_term_data.description IS 'A description of the term.'; + + +-- +-- Name: COLUMN taxonomy_term_data.format; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_term_data.format IS 'The filter_format.format of the description.'; + + +-- +-- Name: COLUMN taxonomy_term_data.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_term_data.weight IS 'The weight of this term in relation to other terms.'; + + +-- +-- Name: taxonomy_term_data_tid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE taxonomy_term_data_tid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: taxonomy_term_data_tid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE taxonomy_term_data_tid_seq OWNED BY taxonomy_term_data.tid; + + +-- +-- Name: taxonomy_term_hierarchy; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE taxonomy_term_hierarchy ( + tid bigint DEFAULT 0 NOT NULL, + parent bigint DEFAULT 0 NOT NULL, + CONSTRAINT taxonomy_term_hierarchy_parent_check CHECK ((parent >= 0)), + CONSTRAINT taxonomy_term_hierarchy_tid_check CHECK ((tid >= 0)) +); + + +-- +-- Name: TABLE taxonomy_term_hierarchy; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE taxonomy_term_hierarchy IS 'Stores the hierarchical relationship between terms.'; + + +-- +-- Name: COLUMN taxonomy_term_hierarchy.tid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_term_hierarchy.tid IS 'Primary Key: The taxonomy_term_data.tid of the term.'; + + +-- +-- Name: COLUMN taxonomy_term_hierarchy.parent; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_term_hierarchy.parent IS 'Primary Key: The taxonomy_term_data.tid of the term''s parent. 0 indicates no parent.'; + + +-- +-- Name: taxonomy_vocabulary; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE taxonomy_vocabulary ( + vid integer NOT NULL, + name character varying(255) DEFAULT ''::character varying NOT NULL, + machine_name character varying(255) DEFAULT ''::character varying NOT NULL, + description text, + hierarchy integer DEFAULT 0 NOT NULL, + module character varying(255) DEFAULT ''::character varying NOT NULL, + weight integer DEFAULT 0 NOT NULL, + CONSTRAINT taxonomy_vocabulary_hierarchy_check CHECK ((hierarchy >= 0)), + CONSTRAINT taxonomy_vocabulary_vid_check CHECK ((vid >= 0)) +); + + +-- +-- Name: TABLE taxonomy_vocabulary; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE taxonomy_vocabulary IS 'Stores vocabulary information.'; + + +-- +-- Name: COLUMN taxonomy_vocabulary.vid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_vocabulary.vid IS 'Primary Key: Unique vocabulary ID.'; + + +-- +-- Name: COLUMN taxonomy_vocabulary.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_vocabulary.name IS 'Name of the vocabulary.'; + + +-- +-- Name: COLUMN taxonomy_vocabulary.machine_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_vocabulary.machine_name IS 'The vocabulary machine name.'; + + +-- +-- Name: COLUMN taxonomy_vocabulary.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_vocabulary.description IS 'Description of the vocabulary.'; + + +-- +-- Name: COLUMN taxonomy_vocabulary.hierarchy; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_vocabulary.hierarchy IS 'The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'; + + +-- +-- Name: COLUMN taxonomy_vocabulary.module; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_vocabulary.module IS 'The module which created the vocabulary.'; + + +-- +-- Name: COLUMN taxonomy_vocabulary.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN taxonomy_vocabulary.weight IS 'The weight of this vocabulary in relation to other vocabularies.'; + + +-- +-- Name: taxonomy_vocabulary_vid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE taxonomy_vocabulary_vid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: taxonomy_vocabulary_vid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE taxonomy_vocabulary_vid_seq OWNED BY taxonomy_vocabulary.vid; + + +-- +-- Name: tmp; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE tmp ( + col1 character varying, + col2 character varying, + col3 character varying, + col4 character varying, + id integer NOT NULL +); + + +-- +-- Name: tmp2; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE tmp2 ( + col1 character varying, + col2 character varying, + col3 character varying, + col4 character varying, + id integer NOT NULL +); + + +-- +-- Name: tmp2_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE tmp2_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: tmp2_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE tmp2_id_seq OWNED BY tmp2.id; + + +-- +-- Name: tmp3_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE tmp3_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: tmp3_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE tmp3_id_seq OWNED BY tmp.id; + + +-- +-- Name: url_alias; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE url_alias ( + pid integer NOT NULL, + source character varying(255) DEFAULT ''::character varying NOT NULL, + alias character varying(255) DEFAULT ''::character varying NOT NULL, + language character varying(12) DEFAULT ''::character varying NOT NULL, + CONSTRAINT url_alias_pid_check CHECK ((pid >= 0)) +); + + +-- +-- Name: TABLE url_alias; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE url_alias IS 'A list of URL aliases for Drupal paths; a user may visit either the source or destination path.'; + + +-- +-- Name: COLUMN url_alias.pid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN url_alias.pid IS 'A unique path alias identifier.'; + + +-- +-- Name: COLUMN url_alias.source; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN url_alias.source IS 'The Drupal path this alias is for; e.g. node/12.'; + + +-- +-- Name: COLUMN url_alias.alias; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN url_alias.alias IS 'The alias for this path; e.g. title-of-the-story.'; + + +-- +-- Name: COLUMN url_alias.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN url_alias.language IS 'The language this alias is for; if ''und'', the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.'; + + +-- +-- Name: url_alias_pid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE url_alias_pid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: url_alias_pid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE url_alias_pid_seq OWNED BY url_alias.pid; + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE users ( + uid bigint DEFAULT 0 NOT NULL, + name character varying(60) DEFAULT ''::character varying NOT NULL, + pass character varying(128) DEFAULT ''::character varying NOT NULL, + mail character varying(254) DEFAULT ''::character varying, + theme character varying(255) DEFAULT ''::character varying NOT NULL, + signature character varying(255) DEFAULT ''::character varying NOT NULL, + signature_format character varying(255), + created integer DEFAULT 0 NOT NULL, + access integer DEFAULT 0 NOT NULL, + login integer DEFAULT 0 NOT NULL, + status smallint DEFAULT 0 NOT NULL, + timezone character varying(32), + language character varying(12) DEFAULT ''::character varying NOT NULL, + picture integer DEFAULT 0 NOT NULL, + init character varying(254) DEFAULT ''::character varying, + data bytea, + CONSTRAINT users_uid_check CHECK ((uid >= 0)) +); + + +-- +-- Name: TABLE users; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE users IS 'Stores user data.'; + + +-- +-- Name: COLUMN users.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.uid IS 'Primary Key: Unique user ID.'; + + +-- +-- Name: COLUMN users.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.name IS 'Unique user name.'; + + +-- +-- Name: COLUMN users.pass; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.pass IS 'User''s password (hashed).'; + + +-- +-- Name: COLUMN users.mail; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.mail IS 'User''s e-mail address.'; + + +-- +-- Name: COLUMN users.theme; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.theme IS 'User''s default theme.'; + + +-- +-- Name: COLUMN users.signature; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.signature IS 'User''s signature.'; + + +-- +-- Name: COLUMN users.signature_format; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.signature_format IS 'The filter_format.format of the signature.'; + + +-- +-- Name: COLUMN users.created; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.created IS 'Timestamp for when user was created.'; + + +-- +-- Name: COLUMN users.access; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.access IS 'Timestamp for previous time user accessed the site.'; + + +-- +-- Name: COLUMN users.login; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.login IS 'Timestamp for user''s last login.'; + + +-- +-- Name: COLUMN users.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.status IS 'Whether the user is active(1) or blocked(0).'; + + +-- +-- Name: COLUMN users.timezone; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.timezone IS 'User''s time zone.'; + + +-- +-- Name: COLUMN users.language; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.language IS 'User''s default language.'; + + +-- +-- Name: COLUMN users.picture; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.picture IS 'Foreign key: file_managed.fid of user''s picture.'; + + +-- +-- Name: COLUMN users.init; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.init IS 'E-mail address used for initial account creation.'; + + +-- +-- Name: COLUMN users.data; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users.data IS 'A serialized array of name value pairs that are related to the user. Any form values posted during user edit are stored and are loaded into the $user object during user_load(). Use of this field is discouraged and it will likely disappear in a future version of Drupal.'; + + +-- +-- Name: users_roles; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE users_roles ( + uid bigint DEFAULT 0 NOT NULL, + rid bigint DEFAULT 0 NOT NULL, + CONSTRAINT users_roles_rid_check CHECK ((rid >= 0)), + CONSTRAINT users_roles_uid_check CHECK ((uid >= 0)) +); + + +-- +-- Name: TABLE users_roles; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE users_roles IS 'Maps users to roles.'; + + +-- +-- Name: COLUMN users_roles.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users_roles.uid IS 'Primary Key: users.uid for user.'; + + +-- +-- Name: COLUMN users_roles.rid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN users_roles.rid IS 'Primary Key: role.rid for role.'; + + +-- +-- Name: variable; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE variable ( + name character varying(128) DEFAULT ''::character varying NOT NULL, + value bytea NOT NULL +); + + +-- +-- Name: TABLE variable; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE variable IS 'Named variable/value pairs created by Drupal core or any other module or theme. All variables are cached in memory at the start of every Drupal request so developers should not be careless about what is stored here.'; + + +-- +-- Name: COLUMN variable.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN variable.name IS 'The name of the variable.'; + + +-- +-- Name: COLUMN variable.value; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN variable.value IS 'The value of the variable.'; + + +-- +-- Name: views_display; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE views_display ( + vid bigint DEFAULT 0 NOT NULL, + id character varying(64) DEFAULT ''::character varying NOT NULL, + display_title character varying(64) DEFAULT ''::character varying NOT NULL, + display_plugin character varying(64) DEFAULT ''::character varying NOT NULL, + "position" integer DEFAULT 0, + display_options text, + CONSTRAINT views_display_vid_check CHECK ((vid >= 0)) +); + + +-- +-- Name: TABLE views_display; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE views_display IS 'Stores information about each display attached to a view.'; + + +-- +-- Name: COLUMN views_display.vid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_display.vid IS 'The view this display is attached to.'; + + +-- +-- Name: COLUMN views_display.id; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_display.id IS 'An identifier for this display; usually generated from the display_plugin, so should be something::text like page or page_1 or block_2, etc.'; + + +-- +-- Name: COLUMN views_display.display_title; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_display.display_title IS 'The title of the display, viewable by the administrator.'; + + +-- +-- Name: COLUMN views_display.display_plugin; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_display.display_plugin IS 'The type of the display. Usually page, block or embed, but is pluggable so may be other things.'; + + +-- +-- Name: COLUMN views_display."position"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_display."position" IS 'The order in which this display is loaded.'; + + +-- +-- Name: COLUMN views_display.display_options; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_display.display_options IS 'A serialized array of options for this display; it contains options that are generally only pertinent to that display plugin type.'; + + +-- +-- Name: views_view; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE views_view ( + vid integer NOT NULL, + name character varying(128) DEFAULT ''::character varying NOT NULL, + description character varying(255) DEFAULT ''::character varying, + tag character varying(255) DEFAULT ''::character varying, + base_table character varying(64) DEFAULT ''::character varying NOT NULL, + human_name character varying(255) DEFAULT ''::character varying, + core integer DEFAULT 0, + CONSTRAINT views_view_vid_check CHECK ((vid >= 0)) +); + + +-- +-- Name: TABLE views_view; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE views_view IS 'Stores the general data for a view.'; + + +-- +-- Name: COLUMN views_view.vid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_view.vid IS 'The view ID of the field, defined by the database.'; + + +-- +-- Name: COLUMN views_view.name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_view.name IS 'The unique name of the view. This is the primary field views are loaded from, and is used so that views may be internal and not necessarily in the database. May only be alphanumeric characters plus underscores.'; + + +-- +-- Name: COLUMN views_view.description; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_view.description IS 'A description of the view for the admin interface.'; + + +-- +-- Name: COLUMN views_view.tag; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_view.tag IS 'A tag used to group/sort views in the admin interface'; + + +-- +-- Name: COLUMN views_view.base_table; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_view.base_table IS 'What table this view is based on, such as node, user, comment, or term.'; + + +-- +-- Name: COLUMN views_view.human_name; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_view.human_name IS 'A human readable name used to be displayed in the admin interface'; + + +-- +-- Name: COLUMN views_view.core; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN views_view.core IS 'Stores the drupal core version of the view.'; + + +-- +-- Name: views_view_vid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE views_view_vid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: views_view_vid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE views_view_vid_seq OWNED BY views_view.vid; + + +-- +-- Name: watchdog; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE watchdog ( + wid integer NOT NULL, + uid integer DEFAULT 0 NOT NULL, + type character varying(64) DEFAULT ''::character varying NOT NULL, + message text NOT NULL, + variables bytea NOT NULL, + severity integer DEFAULT 0 NOT NULL, + link character varying(255) DEFAULT ''::character varying, + location text NOT NULL, + referer text, + hostname character varying(128) DEFAULT ''::character varying NOT NULL, + "timestamp" integer DEFAULT 0 NOT NULL, + CONSTRAINT watchdog_severity_check CHECK ((severity >= 0)) +); + + +-- +-- Name: TABLE watchdog; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE watchdog IS 'Table that contains logs of all system events.'; + + +-- +-- Name: COLUMN watchdog.wid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.wid IS 'Primary Key: Unique watchdog event ID.'; + + +-- +-- Name: COLUMN watchdog.uid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.uid IS 'The users.uid of the user who triggered the event.'; + + +-- +-- Name: COLUMN watchdog.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.type IS 'Type of log message, for example "user" or "page not found."'; + + +-- +-- Name: COLUMN watchdog.message; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.message IS 'Text of log message to be passed into the t() function.'; + + +-- +-- Name: COLUMN watchdog.variables; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.variables IS 'Serialized array of variables that match the message string and that is passed into the t() function.'; + + +-- +-- Name: COLUMN watchdog.severity; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.severity IS 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)'; + + +-- +-- Name: COLUMN watchdog.link; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.link IS 'Link to view the result of the event.'; + + +-- +-- Name: COLUMN watchdog.location; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.location IS 'URL of the origin of the event.'; + + +-- +-- Name: COLUMN watchdog.referer; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.referer IS 'URL of referring page.'; + + +-- +-- Name: COLUMN watchdog.hostname; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog.hostname IS 'Hostname of the user who triggered the event.'; + + +-- +-- Name: COLUMN watchdog."timestamp"; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN watchdog."timestamp" IS 'Unix timestamp of when event occurred.'; + + +-- +-- Name: watchdog_wid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE watchdog_wid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: watchdog_wid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE watchdog_wid_seq OWNED BY watchdog.wid; + + +-- +-- Name: aid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY authmap ALTER COLUMN aid SET DEFAULT nextval('authmap_aid_seq'::regclass); + + +-- +-- Name: crop_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_crop ALTER COLUMN crop_id SET DEFAULT nextval('bims_crop_crop_id_seq'::regclass); + + +-- +-- Name: file_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_file ALTER COLUMN file_id SET DEFAULT nextval('bims_file_file_id_seq'::regclass); + + +-- +-- Name: instruction_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_instruction ALTER COLUMN instruction_id SET DEFAULT nextval('bims_instruction_instruction_id_seq'::regclass); + + +-- +-- Name: job_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_job ALTER COLUMN job_id SET DEFAULT nextval('bims_job_job_id_seq'::regclass); + + +-- +-- Name: list_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_list ALTER COLUMN list_id SET DEFAULT nextval('bims_list_list_id_seq'::regclass); + + +-- +-- Name: program_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_mview_location ALTER COLUMN program_id SET DEFAULT nextval('bims_mview_location_program_id_seq'::regclass); + + +-- +-- Name: node_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_node ALTER COLUMN node_id SET DEFAULT nextval('bims_node_node_id_seq'::regclass); + + +-- +-- Name: relationship_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_node_relationship ALTER COLUMN relationship_id SET DEFAULT nextval('bims_node_relationship_relationship_id_seq'::regclass); + + +-- +-- Name: program_descriptor_group_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_program_descriptor_group ALTER COLUMN program_descriptor_group_id SET DEFAULT nextval('bims_program_descriptor_group_program_descriptor_group_id_seq'::regclass); + + +-- +-- Name: program_member_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bims_program_member ALTER COLUMN program_member_id SET DEFAULT nextval('bims_program_member_program_member_id_seq'::regclass); + + +-- +-- Name: bid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY block ALTER COLUMN bid SET DEFAULT nextval('block_bid_seq'::regclass); + + +-- +-- Name: bid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY block_custom ALTER COLUMN bid SET DEFAULT nextval('block_custom_bid_seq'::regclass); + + +-- +-- Name: iid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY blocked_ips ALTER COLUMN iid SET DEFAULT nextval('blocked_ips_iid_seq'::regclass); + + +-- +-- Name: cid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY comment ALTER COLUMN cid SET DEFAULT nextval('comment_cid_seq'::regclass); + + +-- +-- Name: dfid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY date_formats ALTER COLUMN dfid SET DEFAULT nextval('date_formats_dfid_seq'::regclass); + + +-- +-- Name: group_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY do_group ALTER COLUMN group_id SET DEFAULT nextval('do_group_group_id_seq'::regclass); + + +-- +-- Name: node_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY do_node ALTER COLUMN node_id SET DEFAULT nextval('do_node_node_id_seq'::regclass); + + +-- +-- Name: relationship_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY do_node_relationship ALTER COLUMN relationship_id SET DEFAULT nextval('do_node_relationship_relationship_id_seq'::regclass); + + +-- +-- Name: overview_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY do_overview ALTER COLUMN overview_id SET DEFAULT nextval('do_overview_overview_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY field_config ALTER COLUMN id SET DEFAULT nextval('field_config_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY field_config_instance ALTER COLUMN id SET DEFAULT nextval('field_config_instance_id_seq'::regclass); + + +-- +-- Name: fid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY file_managed ALTER COLUMN fid SET DEFAULT nextval('file_managed_fid_seq'::regclass); + + +-- +-- Name: fid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY flood ALTER COLUMN fid SET DEFAULT nextval('flood_fid_seq'::regclass); + + +-- +-- Name: category_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_category ALTER COLUMN category_id SET DEFAULT nextval('gensas_category_category_id_seq'::regclass); + + +-- +-- Name: db_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_db ALTER COLUMN db_id SET DEFAULT nextval('gensas_db_db_id_seq'::regclass); + + +-- +-- Name: file_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_files ALTER COLUMN file_id SET DEFAULT nextval('gensas_files_file_id_seq'::regclass); + + +-- +-- Name: group_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_group ALTER COLUMN group_id SET DEFAULT nextval('gensas_group_group_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_job ALTER COLUMN id SET DEFAULT nextval('gensas_job_id_seq'::regclass); + + +-- +-- Name: library_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_library ALTER COLUMN library_id SET DEFAULT nextval('gensas_library_library_id_seq'::regclass); + + +-- +-- Name: library_type_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_library_type ALTER COLUMN library_type_id SET DEFAULT nextval('gensas_library_type_library_type_id_seq'::regclass); + + +-- +-- Name: param_group_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_param_group ALTER COLUMN param_group_id SET DEFAULT nextval('gensas_param_group_param_group_id_seq'::regclass); + + +-- +-- Name: project_type_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_project_type ALTER COLUMN project_type_id SET DEFAULT nextval('gensas_project_type_project_type_id_seq'::regclass); + + +-- +-- Name: resource_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_resource ALTER COLUMN resource_id SET DEFAULT nextval('gensas_resource_resource_id_seq'::regclass); + + +-- +-- Name: seq_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_seq ALTER COLUMN seq_id SET DEFAULT nextval('gensas_seq_seq_id_seq'::regclass); + + +-- +-- Name: seq_group_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_seq_group ALTER COLUMN seq_group_id SET DEFAULT nextval('gensas_seq_group_seq_group_id_seq'::regclass); + + +-- +-- Name: tool_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_tool ALTER COLUMN tool_id SET DEFAULT nextval('gensas_tool_tool_id_seq'::regclass); + + +-- +-- Name: tool_param_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_tool_param ALTER COLUMN tool_param_id SET DEFAULT nextval('gensas_tool_param_tool_param_id_seq'::regclass); + + +-- +-- Name: tool_param_type_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_tool_param_type ALTER COLUMN tool_param_type_id SET DEFAULT nextval('gensas_tool_param_type_tool_param_type_id_seq'::regclass); + + +-- +-- Name: tool_type_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY gensas_tool_type ALTER COLUMN tool_type_id SET DEFAULT nextval('gensas_tool_type_tool_type_id_seq'::regclass); + + +-- +-- Name: ieid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY image_effects ALTER COLUMN ieid SET DEFAULT nextval('image_effects_ieid_seq'::regclass); + + +-- +-- Name: isid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY image_styles ALTER COLUMN isid SET DEFAULT nextval('image_styles_isid_seq'::regclass); + + +-- +-- Name: data_valid_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mcl_data_valid ALTER COLUMN data_valid_id SET DEFAULT nextval('mcl_data_valid_data_valid_id_seq'::regclass); + + +-- +-- Name: data_valid_type_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mcl_data_valid_type ALTER COLUMN data_valid_type_id SET DEFAULT nextval('mcl_data_valid_type_data_valid_type_id_seq'::regclass); + + +-- +-- Name: file_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mcl_file ALTER COLUMN file_id SET DEFAULT nextval('mcl_file_file_id_seq'::regclass); + + +-- +-- Name: job_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mcl_job ALTER COLUMN job_id SET DEFAULT nextval('mcl_job_job_id_seq'::regclass); + + +-- +-- Name: template_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mcl_template ALTER COLUMN template_id SET DEFAULT nextval('mcl_template_template_id_seq'::regclass); + + +-- +-- Name: template_type_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mcl_template_type ALTER COLUMN template_type_id SET DEFAULT nextval('mcl_template_type_template_type_id_seq'::regclass); + + +-- +-- Name: var_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mcl_var ALTER COLUMN var_id SET DEFAULT nextval('mcl_var_var_id_seq'::regclass); + + +-- +-- Name: mlid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY menu_links ALTER COLUMN mlid SET DEFAULT nextval('menu_links_mlid_seq'::regclass); + + +-- +-- Name: nid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY node ALTER COLUMN nid SET DEFAULT nextval('node_nid_seq'::regclass); + + +-- +-- Name: vid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY node_revision ALTER COLUMN vid SET DEFAULT nextval('node_revision_vid_seq'::regclass); + + +-- +-- Name: item_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY queue ALTER COLUMN item_id SET DEFAULT nextval('queue_item_id_seq'::regclass); + + +-- +-- Name: rid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY role ALTER COLUMN rid SET DEFAULT nextval('role_rid_seq'::regclass); + + +-- +-- Name: value; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY sequences ALTER COLUMN value SET DEFAULT nextval('sequences_value_seq'::regclass); + + +-- +-- Name: tid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY taxonomy_term_data ALTER COLUMN tid SET DEFAULT nextval('taxonomy_term_data_tid_seq'::regclass); + + +-- +-- Name: vid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY taxonomy_vocabulary ALTER COLUMN vid SET DEFAULT nextval('taxonomy_vocabulary_vid_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tmp ALTER COLUMN id SET DEFAULT nextval('tmp3_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tmp2 ALTER COLUMN id SET DEFAULT nextval('tmp2_id_seq'::regclass); + + +-- +-- Name: pid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY url_alias ALTER COLUMN pid SET DEFAULT nextval('url_alias_pid_seq'::regclass); + + +-- +-- Name: vid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY views_view ALTER COLUMN vid SET DEFAULT nextval('views_view_vid_seq'::regclass); + + +-- +-- Name: wid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY watchdog ALTER COLUMN wid SET DEFAULT nextval('watchdog_wid_seq'::regclass); + + +-- +-- Name: actions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY actions + ADD CONSTRAINT actions_pkey PRIMARY KEY (aid); + + +-- +-- Name: authmap_authname_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY authmap + ADD CONSTRAINT authmap_authname_key UNIQUE (authname); + + +-- +-- Name: authmap_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY authmap + ADD CONSTRAINT authmap_pkey PRIMARY KEY (aid); + + +-- +-- Name: batch_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY batch + ADD CONSTRAINT batch_pkey PRIMARY KEY (bid); + + +-- +-- Name: bims_crop_organism_ukey_bims_crop_organism_crop_id_organism_id_; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_crop_organism + ADD CONSTRAINT bims_crop_organism_ukey_bims_crop_organism_crop_id_organism_id_ UNIQUE (crop_id, organism_id); + + +-- +-- Name: bims_crop_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_crop + ADD CONSTRAINT bims_crop_pkey PRIMARY KEY (crop_id); + + +-- +-- Name: bims_descriptor_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_descriptor_group + ADD CONSTRAINT bims_descriptor_group_pkey PRIMARY KEY (cv_id); + + +-- +-- Name: bims_file_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_file + ADD CONSTRAINT bims_file_pkey PRIMARY KEY (file_id); + + +-- +-- Name: bims_instruction_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_instruction + ADD CONSTRAINT bims_instruction_pkey PRIMARY KEY (instruction_id); + + +-- +-- Name: bims_job_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_job + ADD CONSTRAINT bims_job_pkey PRIMARY KEY (job_id); + + +-- +-- Name: bims_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_list + ADD CONSTRAINT bims_list_pkey PRIMARY KEY (list_id); + + +-- +-- Name: bims_mview_cross_stats_ukey_bims_mview_cross_stats_project_id_n; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_mview_cross_stats + ADD CONSTRAINT bims_mview_cross_stats_ukey_bims_mview_cross_stats_project_id_n UNIQUE (project_id, nd_experiment_id, cvterm_id); + + +-- +-- Name: bims_mview_descriptor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_mview_descriptor + ADD CONSTRAINT bims_mview_descriptor_pkey PRIMARY KEY (cvterm_id); + + +-- +-- Name: bims_mview_descriptor_ukey_bims_mview_descriptor_cv_id_cvterm_i; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_mview_descriptor + ADD CONSTRAINT bims_mview_descriptor_ukey_bims_mview_descriptor_cv_id_cvterm_i UNIQUE (cv_id, cvterm_id); + + +-- +-- Name: bims_mview_location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_mview_location + ADD CONSTRAINT bims_mview_location_pkey PRIMARY KEY (nd_geolocation_id); + + +-- +-- Name: bims_mview_phenotype_stats_ukey_bims_mview_phenotype_stats_proj; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_mview_phenotype_stats + ADD CONSTRAINT bims_mview_phenotype_stats_ukey_bims_mview_phenotype_stats_proj UNIQUE (project_id, cvterm_id); + + +-- +-- Name: bims_node_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_node + ADD CONSTRAINT bims_node_pkey PRIMARY KEY (node_id); + + +-- +-- Name: bims_node_relationship_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_node_relationship + ADD CONSTRAINT bims_node_relationship_pkey PRIMARY KEY (relationship_id); + + +-- +-- Name: bims_node_relationship_ukey_bims_node_relationship_parent_id_ch; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_node_relationship + ADD CONSTRAINT bims_node_relationship_ukey_bims_node_relationship_parent_id_ch UNIQUE (parent_id, child_id); + + +-- +-- Name: bims_node_ukey_bims_node_name_root_id_owner_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_node + ADD CONSTRAINT bims_node_ukey_bims_node_name_root_id_owner_id_key UNIQUE (name, root_id, owner_id); + + +-- +-- Name: bims_program_descriptor_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_program_descriptor_group + ADD CONSTRAINT bims_program_descriptor_group_pkey PRIMARY KEY (program_descriptor_group_id); + + +-- +-- Name: bims_program_descriptor_group_ukey_bims_mview_descriptor_progra; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_program_descriptor_group + ADD CONSTRAINT bims_program_descriptor_group_ukey_bims_mview_descriptor_progra UNIQUE (program_id, cv_id); + + +-- +-- Name: bims_program_member_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_program_member + ADD CONSTRAINT bims_program_member_pkey PRIMARY KEY (program_member_id); + + +-- +-- Name: bims_program_member_ukey_bims_program_member_program_id_user_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_program_member + ADD CONSTRAINT bims_program_member_ukey_bims_program_member_program_id_user_id UNIQUE (program_id, user_id); + + +-- +-- Name: bims_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY bims_user + ADD CONSTRAINT bims_user_pkey PRIMARY KEY (user_id); + + +-- +-- Name: block_custom_info_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY block_custom + ADD CONSTRAINT block_custom_info_key UNIQUE (info); + + +-- +-- Name: block_custom_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY block_custom + ADD CONSTRAINT block_custom_pkey PRIMARY KEY (bid); + + +-- +-- Name: block_node_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY block_node_type + ADD CONSTRAINT block_node_type_pkey PRIMARY KEY (module, delta, type); + + +-- +-- Name: block_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY block + ADD CONSTRAINT block_pkey PRIMARY KEY (bid); + + +-- +-- Name: block_role_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY block_role + ADD CONSTRAINT block_role_pkey PRIMARY KEY (module, delta, rid); + + +-- +-- Name: block_tmd_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY block + ADD CONSTRAINT block_tmd_key UNIQUE (theme, module, delta); + + +-- +-- Name: blocked_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY blocked_ips + ADD CONSTRAINT blocked_ips_pkey PRIMARY KEY (iid); + + +-- +-- Name: cache_block_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_block + ADD CONSTRAINT cache_block_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_bootstrap_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_bootstrap + ADD CONSTRAINT cache_bootstrap_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_field_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_field + ADD CONSTRAINT cache_field_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_filter_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_filter + ADD CONSTRAINT cache_filter_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_form_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_form + ADD CONSTRAINT cache_form_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_image_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_image + ADD CONSTRAINT cache_image_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_menu_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_menu + ADD CONSTRAINT cache_menu_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_page_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_page + ADD CONSTRAINT cache_page_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_path_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_path + ADD CONSTRAINT cache_path_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache + ADD CONSTRAINT cache_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_update_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_update + ADD CONSTRAINT cache_update_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_views_data_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_views_data + ADD CONSTRAINT cache_views_data_pkey PRIMARY KEY (cid); + + +-- +-- Name: cache_views_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY cache_views + ADD CONSTRAINT cache_views_pkey PRIMARY KEY (cid); + + +-- +-- Name: comment_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY comment + ADD CONSTRAINT comment_pkey PRIMARY KEY (cid); + + +-- +-- Name: ctools_css_cache_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY ctools_css_cache + ADD CONSTRAINT ctools_css_cache_pkey PRIMARY KEY (cid); + + +-- +-- Name: ctools_object_cache_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY ctools_object_cache + ADD CONSTRAINT ctools_object_cache_pkey PRIMARY KEY (sid, obj, name); + + +-- +-- Name: date_format_locale_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY date_format_locale + ADD CONSTRAINT date_format_locale_pkey PRIMARY KEY (type, language); + + +-- +-- Name: date_format_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY date_format_type + ADD CONSTRAINT date_format_type_pkey PRIMARY KEY (type); + + +-- +-- Name: date_formats_formats_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY date_formats + ADD CONSTRAINT date_formats_formats_key UNIQUE (format, type); + + +-- +-- Name: date_formats_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY date_formats + ADD CONSTRAINT date_formats_pkey PRIMARY KEY (dfid); + + +-- +-- Name: do_group_data_overview_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY do_group + ADD CONSTRAINT do_group_data_overview_name_key UNIQUE (name); + + +-- +-- Name: do_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY do_group + ADD CONSTRAINT do_group_pkey PRIMARY KEY (group_id); + + +-- +-- Name: do_node_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY do_node + ADD CONSTRAINT do_node_pkey PRIMARY KEY (node_id); + + +-- +-- Name: do_node_relationship_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY do_node_relationship + ADD CONSTRAINT do_node_relationship_pkey PRIMARY KEY (relationship_id); + + +-- +-- Name: do_node_relationship_ukey_do_node_relationship_parent_id_child_; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY do_node_relationship + ADD CONSTRAINT do_node_relationship_ukey_do_node_relationship_parent_id_child_ UNIQUE (parent_id, child_id); + + +-- +-- Name: do_overview_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY do_overview + ADD CONSTRAINT do_overview_pkey PRIMARY KEY (overview_id); + + +-- +-- Name: do_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY do_user + ADD CONSTRAINT do_user_pkey PRIMARY KEY (user_id); + + +-- +-- Name: field_config_instance_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_config_instance + ADD CONSTRAINT field_config_instance_pkey PRIMARY KEY (id); + + +-- +-- Name: field_config_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_config + ADD CONSTRAINT field_config_pkey PRIMARY KEY (id); + + +-- +-- Name: field_data_body_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_data_body + ADD CONSTRAINT field_data_body_pkey PRIMARY KEY (entity_type, entity_id, deleted, delta, language); + + +-- +-- Name: field_data_comment_body_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_data_comment_body + ADD CONSTRAINT field_data_comment_body_pkey PRIMARY KEY (entity_type, entity_id, deleted, delta, language); + + +-- +-- Name: field_data_field_image_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_data_field_image + ADD CONSTRAINT field_data_field_image_pkey PRIMARY KEY (entity_type, entity_id, deleted, delta, language); + + +-- +-- Name: field_data_field_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_data_field_tags + ADD CONSTRAINT field_data_field_tags_pkey PRIMARY KEY (entity_type, entity_id, deleted, delta, language); + + +-- +-- Name: field_revision_body_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_revision_body + ADD CONSTRAINT field_revision_body_pkey PRIMARY KEY (entity_type, entity_id, revision_id, deleted, delta, language); + + +-- +-- Name: field_revision_comment_body_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_revision_comment_body + ADD CONSTRAINT field_revision_comment_body_pkey PRIMARY KEY (entity_type, entity_id, revision_id, deleted, delta, language); + + +-- +-- Name: field_revision_field_image_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_revision_field_image + ADD CONSTRAINT field_revision_field_image_pkey PRIMARY KEY (entity_type, entity_id, revision_id, deleted, delta, language); + + +-- +-- Name: field_revision_field_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY field_revision_field_tags + ADD CONSTRAINT field_revision_field_tags_pkey PRIMARY KEY (entity_type, entity_id, revision_id, deleted, delta, language); + + +-- +-- Name: file_managed_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY file_managed + ADD CONSTRAINT file_managed_pkey PRIMARY KEY (fid); + + +-- +-- Name: file_managed_uri_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY file_managed + ADD CONSTRAINT file_managed_uri_key UNIQUE (uri); + + +-- +-- Name: file_usage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY file_usage + ADD CONSTRAINT file_usage_pkey PRIMARY KEY (fid, type, id, module); + + +-- +-- Name: filter_format_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY filter_format + ADD CONSTRAINT filter_format_name_key UNIQUE (name); + + +-- +-- Name: filter_format_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY filter_format + ADD CONSTRAINT filter_format_pkey PRIMARY KEY (format); + + +-- +-- Name: filter_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY filter + ADD CONSTRAINT filter_pkey PRIMARY KEY (format, name); + + +-- +-- Name: flood_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY flood + ADD CONSTRAINT flood_pkey PRIMARY KEY (fid); + + +-- +-- Name: gensas_category_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_category + ADD CONSTRAINT gensas_category_pkey PRIMARY KEY (category_id); + + +-- +-- Name: gensas_db_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_db + ADD CONSTRAINT gensas_db_pkey PRIMARY KEY (db_id); + + +-- +-- Name: gensas_db_ukey_gensas_db_db_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_db + ADD CONSTRAINT gensas_db_ukey_gensas_db_db_name_key UNIQUE (db_name); + + +-- +-- Name: gensas_expire_ukey_gensas_expire_uq1_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_expire + ADD CONSTRAINT gensas_expire_ukey_gensas_expire_uq1_key UNIQUE (task_id); + + +-- +-- Name: gensas_gff3_id_job_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_gff3 + ADD CONSTRAINT gensas_gff3_id_job_id_key UNIQUE (id, job_id); + + +-- +-- Name: gensas_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_group + ADD CONSTRAINT gensas_group_pkey PRIMARY KEY (group_id); + + +-- +-- Name: gensas_group_seq_ukey_gensas_group_seq_group_id_group_seq_id_ke; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_group_seq + ADD CONSTRAINT gensas_group_seq_ukey_gensas_group_seq_group_id_group_seq_id_ke UNIQUE (group_id, seq_id); + + +-- +-- Name: gensas_group_task_ukey_gensas_group_task_group_id_task_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_group_task + ADD CONSTRAINT gensas_group_task_ukey_gensas_group_task_group_id_task_id_key UNIQUE (group_id, task_id); + + +-- +-- Name: gensas_group_user_ukey_gensas_group_user_group_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_group_user + ADD CONSTRAINT gensas_group_user_ukey_gensas_group_user_group_id_user_id_key UNIQUE (group_id, user_id); + + +-- +-- Name: gensas_job_cmd_ukey_gensas_job_cmd_id_index_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_job_cmd + ADD CONSTRAINT gensas_job_cmd_ukey_gensas_job_cmd_id_index_key UNIQUE (id, index); + + +-- +-- Name: gensas_job_files_ukey_gensas_job_files_job_id_file_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_job_files + ADD CONSTRAINT gensas_job_files_ukey_gensas_job_files_job_id_file_id_key UNIQUE (job_id, file_id); + + +-- +-- Name: gensas_job_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_job + ADD CONSTRAINT gensas_job_pkey PRIMARY KEY (job_id); + + +-- +-- Name: gensas_job_resource_ukey_gensas_job_resource_resource_id_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_job_resource + ADD CONSTRAINT gensas_job_resource_ukey_gensas_job_resource_resource_id_id_key UNIQUE (resource_id, job_id); + + +-- +-- Name: gensas_job_stats_job_id_type_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_job_stats + ADD CONSTRAINT gensas_job_stats_job_id_type_key UNIQUE (job_id, type); + + +-- +-- Name: gensas_library_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_library + ADD CONSTRAINT gensas_library_pkey PRIMARY KEY (library_id); + + +-- +-- Name: gensas_library_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_library_type + ADD CONSTRAINT gensas_library_type_pkey PRIMARY KEY (library_type_id); + + +-- +-- Name: gensas_library_type_ukey_gensas_library_type_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_library_type + ADD CONSTRAINT gensas_library_type_ukey_gensas_library_type_key UNIQUE (type); + + +-- +-- Name: gensas_library_ukey_gensas_library_label_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_library + ADD CONSTRAINT gensas_library_ukey_gensas_library_label_key UNIQUE (name); + + +-- +-- Name: gensas_param_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_param_group + ADD CONSTRAINT gensas_param_group_pkey PRIMARY KEY (param_group_id); + + +-- +-- Name: gensas_param_group_ukey_param_group_name_tool_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_param_group + ADD CONSTRAINT gensas_param_group_ukey_param_group_name_tool_id_key UNIQUE (name, tool_id); + + +-- +-- Name: gensas_project_type_ukey_gensas_project_type_project_type_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_project_type + ADD CONSTRAINT gensas_project_type_ukey_gensas_project_type_project_type_key UNIQUE (type); + + +-- +-- Name: gensas_publish_ukey_gensas_publish_job_id_version_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_publish + ADD CONSTRAINT gensas_publish_ukey_gensas_publish_job_id_version_key UNIQUE (job_id, version); + + +-- +-- Name: gensas_resource_library_ukey_gensas_resource_library_resource_i; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_resource_library + ADD CONSTRAINT gensas_resource_library_ukey_gensas_resource_library_resource_i UNIQUE (resource_id, library_id); + + +-- +-- Name: gensas_resource_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_resource + ADD CONSTRAINT gensas_resource_pkey PRIMARY KEY (resource_id); + + +-- +-- Name: gensas_resource_submit_ukey_gensas_resource_library_resource_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_resource_submit + ADD CONSTRAINT gensas_resource_submit_ukey_gensas_resource_library_resource_id UNIQUE (resource_id, hostname); + + +-- +-- Name: gensas_resource_tool_ukey_gensas_resource_tool_resource_id_tool; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_resource_tool + ADD CONSTRAINT gensas_resource_tool_ukey_gensas_resource_tool_resource_id_tool UNIQUE (resource_id, tool_id); + + +-- +-- Name: gensas_resource_ukey_gensas_resource_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_resource + ADD CONSTRAINT gensas_resource_ukey_gensas_resource_name_key UNIQUE (name); + + +-- +-- Name: gensas_resource_ukey_gensas_resource_rank_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_resource + ADD CONSTRAINT gensas_resource_ukey_gensas_resource_rank_key UNIQUE (rank); + + +-- +-- Name: gensas_seq_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_seq_group + ADD CONSTRAINT gensas_seq_group_pkey PRIMARY KEY (seq_group_id); + + +-- +-- Name: gensas_seq_group_ukey_gensas_seq_group_user_id_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_seq_group + ADD CONSTRAINT gensas_seq_group_ukey_gensas_seq_group_user_id_name_key UNIQUE (user_id, name); + + +-- +-- Name: gensas_seq_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_seq + ADD CONSTRAINT gensas_seq_pkey PRIMARY KEY (seq_id); + + +-- +-- Name: gensas_seq_stats_job_id_seq_id_type_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_seq_stats + ADD CONSTRAINT gensas_seq_stats_job_id_seq_id_type_key UNIQUE (job_id, seq_id, type); + + +-- +-- Name: gensas_task_files_ukey_gensas_task_files_task_id_file_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_task_files + ADD CONSTRAINT gensas_task_files_ukey_gensas_task_files_task_id_file_id_key UNIQUE (task_id, file_id); + + +-- +-- Name: gensas_task_job_ukey_gensas_task_job_task_id_job_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_task_job + ADD CONSTRAINT gensas_task_job_ukey_gensas_task_job_task_id_job_id_key UNIQUE (task_id, job_id); + + +-- +-- Name: gensas_task_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_task + ADD CONSTRAINT gensas_task_pkey PRIMARY KEY (task_id); + + +-- +-- Name: gensas_task_seq_group_ukey_gensas_task_seq_group_task_id_seq_gr; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_task_seq_group + ADD CONSTRAINT gensas_task_seq_group_ukey_gensas_task_seq_group_task_id_seq_gr UNIQUE (task_id, seq_group_id); + + +-- +-- Name: gensas_task_user_ukey_gensas_task_user_task_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_task_user + ADD CONSTRAINT gensas_task_user_ukey_gensas_task_user_task_id_user_id_key UNIQUE (task_id, user_id); + + +-- +-- Name: gensas_tool_param_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_tool_param + ADD CONSTRAINT gensas_tool_param_pkey PRIMARY KEY (tool_param_id); + + +-- +-- Name: gensas_tool_param_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_tool_param_type + ADD CONSTRAINT gensas_tool_param_type_pkey PRIMARY KEY (tool_param_type_id); + + +-- +-- Name: gensas_tool_param_type_ukey_gensas_tool_param_type_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_tool_param_type + ADD CONSTRAINT gensas_tool_param_type_ukey_gensas_tool_param_type_key UNIQUE (type); + + +-- +-- Name: gensas_tool_param_ukey_gensas_tool_param_param_elem_id_tool_id_; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_tool_param + ADD CONSTRAINT gensas_tool_param_ukey_gensas_tool_param_param_elem_id_tool_id_ UNIQUE (param_elem_id, tool_id); + + +-- +-- Name: gensas_tool_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_tool + ADD CONSTRAINT gensas_tool_pkey PRIMARY KEY (tool_id); + + +-- +-- Name: gensas_tool_type_ukey_gensas_tool_type_tid_ptid_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_tool_type + ADD CONSTRAINT gensas_tool_type_ukey_gensas_tool_type_tid_ptid_key UNIQUE (tool_id, project_type_id); + + +-- +-- Name: gensas_user_tool_ukey_gensas_user_tool_user_id_tool_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY gensas_user_tool + ADD CONSTRAINT gensas_user_tool_ukey_gensas_user_tool_user_id_tool_id_key UNIQUE (user_id, tool_id); + + +-- +-- Name: history_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY history + ADD CONSTRAINT history_pkey PRIMARY KEY (uid, nid); + + +-- +-- Name: image_effects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY image_effects + ADD CONSTRAINT image_effects_pkey PRIMARY KEY (ieid); + + +-- +-- Name: image_styles_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY image_styles + ADD CONSTRAINT image_styles_name_key UNIQUE (name); + + +-- +-- Name: image_styles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY image_styles + ADD CONSTRAINT image_styles_pkey PRIMARY KEY (isid); + + +-- +-- Name: masquerade_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY masquerade_users + ADD CONSTRAINT masquerade_users_pkey PRIMARY KEY (uid_from, uid_to); + + +-- +-- Name: mcl_data_valid_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_data_valid + ADD CONSTRAINT mcl_data_valid_pkey PRIMARY KEY (data_valid_id); + + +-- +-- Name: mcl_data_valid_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_data_valid_type + ADD CONSTRAINT mcl_data_valid_type_pkey PRIMARY KEY (data_valid_type_id); + + +-- +-- Name: mcl_data_valid_type_ukey_mcl_data_valid_type_type_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_data_valid_type + ADD CONSTRAINT mcl_data_valid_type_ukey_mcl_data_valid_type_type_key UNIQUE (type); + + +-- +-- Name: mcl_data_valid_ukey_mcl_data_valid_data_valid_type_id_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_data_valid + ADD CONSTRAINT mcl_data_valid_ukey_mcl_data_valid_data_valid_type_id_name_key UNIQUE (data_valid_type_id, name); + + +-- +-- Name: mcl_file_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_file + ADD CONSTRAINT mcl_file_pkey PRIMARY KEY (file_id); + + +-- +-- Name: mcl_job_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_job + ADD CONSTRAINT mcl_job_pkey PRIMARY KEY (job_id); + + +-- +-- Name: mcl_template_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_template + ADD CONSTRAINT mcl_template_pkey PRIMARY KEY (template_id); + + +-- +-- Name: mcl_template_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_template_type + ADD CONSTRAINT mcl_template_type_pkey PRIMARY KEY (template_type_id); + + +-- +-- Name: mcl_template_type_ukey_mcl_template_type_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_template_type + ADD CONSTRAINT mcl_template_type_ukey_mcl_template_type_key UNIQUE (type); + + +-- +-- Name: mcl_template_ukey_mcl_template_template_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_template + ADD CONSTRAINT mcl_template_ukey_mcl_template_template_key UNIQUE (template); + + +-- +-- Name: mcl_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_user + ADD CONSTRAINT mcl_user_pkey PRIMARY KEY (user_id); + + +-- +-- Name: mcl_var_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_var + ADD CONSTRAINT mcl_var_pkey PRIMARY KEY (var_id); + + +-- +-- Name: mcl_var_ukey_mcl_var_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mcl_var + ADD CONSTRAINT mcl_var_ukey_mcl_var_name_key UNIQUE (name); + + +-- +-- Name: menu_custom_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY menu_custom + ADD CONSTRAINT menu_custom_pkey PRIMARY KEY (menu_name); + + +-- +-- Name: menu_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY menu_links + ADD CONSTRAINT menu_links_pkey PRIMARY KEY (mlid); + + +-- +-- Name: menu_router_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY menu_router + ADD CONSTRAINT menu_router_pkey PRIMARY KEY (path); + + +-- +-- Name: node_access_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY node_access + ADD CONSTRAINT node_access_pkey PRIMARY KEY (nid, gid, realm); + + +-- +-- Name: node_comment_statistics_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY node_comment_statistics + ADD CONSTRAINT node_comment_statistics_pkey PRIMARY KEY (nid); + + +-- +-- Name: node_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY node + ADD CONSTRAINT node_pkey PRIMARY KEY (nid); + + +-- +-- Name: node_revision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY node_revision + ADD CONSTRAINT node_revision_pkey PRIMARY KEY (vid); + + +-- +-- Name: node_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY node_type + ADD CONSTRAINT node_type_pkey PRIMARY KEY (type); + + +-- +-- Name: node_vid_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY node + ADD CONSTRAINT node_vid_key UNIQUE (vid); + + +-- +-- Name: queue_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY queue + ADD CONSTRAINT queue_pkey PRIMARY KEY (item_id); + + +-- +-- Name: rdf_mapping_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY rdf_mapping + ADD CONSTRAINT rdf_mapping_pkey PRIMARY KEY (type, bundle); + + +-- +-- Name: registry_file_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY registry_file + ADD CONSTRAINT registry_file_pkey PRIMARY KEY (filename); + + +-- +-- Name: registry_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY registry + ADD CONSTRAINT registry_pkey PRIMARY KEY (name, type); + + +-- +-- Name: role_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY role + ADD CONSTRAINT role_name_key UNIQUE (name); + + +-- +-- Name: role_permission_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY role_permission + ADD CONSTRAINT role_permission_pkey PRIMARY KEY (rid, permission); + + +-- +-- Name: role_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY role + ADD CONSTRAINT role_pkey PRIMARY KEY (rid); + + +-- +-- Name: search_dataset_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_dataset + ADD CONSTRAINT search_dataset_pkey PRIMARY KEY (sid, type); + + +-- +-- Name: search_index_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_index + ADD CONSTRAINT search_index_pkey PRIMARY KEY (word, sid, type); + + +-- +-- Name: search_node_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_node_links + ADD CONSTRAINT search_node_links_pkey PRIMARY KEY (sid, type, nid); + + +-- +-- Name: search_total_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY search_total + ADD CONSTRAINT search_total_pkey PRIMARY KEY (word); + + +-- +-- Name: semaphore_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY semaphore + ADD CONSTRAINT semaphore_pkey PRIMARY KEY (name); + + +-- +-- Name: sequences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY sequences + ADD CONSTRAINT sequences_pkey PRIMARY KEY (value); + + +-- +-- Name: sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY sessions + ADD CONSTRAINT sessions_pkey PRIMARY KEY (sid, ssid); + + +-- +-- Name: shortcut_set_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY shortcut_set + ADD CONSTRAINT shortcut_set_pkey PRIMARY KEY (set_name); + + +-- +-- Name: shortcut_set_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY shortcut_set_users + ADD CONSTRAINT shortcut_set_users_pkey PRIMARY KEY (uid); + + +-- +-- Name: system_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY system + ADD CONSTRAINT system_pkey PRIMARY KEY (filename); + + +-- +-- Name: taxonomy_term_data_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY taxonomy_term_data + ADD CONSTRAINT taxonomy_term_data_pkey PRIMARY KEY (tid); + + +-- +-- Name: taxonomy_term_hierarchy_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY taxonomy_term_hierarchy + ADD CONSTRAINT taxonomy_term_hierarchy_pkey PRIMARY KEY (tid, parent); + + +-- +-- Name: taxonomy_vocabulary_machine_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY taxonomy_vocabulary + ADD CONSTRAINT taxonomy_vocabulary_machine_name_key UNIQUE (machine_name); + + +-- +-- Name: taxonomy_vocabulary_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY taxonomy_vocabulary + ADD CONSTRAINT taxonomy_vocabulary_pkey PRIMARY KEY (vid); + + +-- +-- Name: url_alias_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY url_alias + ADD CONSTRAINT url_alias_pkey PRIMARY KEY (pid); + + +-- +-- Name: users_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY users + ADD CONSTRAINT users_name_key UNIQUE (name); + + +-- +-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY users + ADD CONSTRAINT users_pkey PRIMARY KEY (uid); + + +-- +-- Name: users_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY users_roles + ADD CONSTRAINT users_roles_pkey PRIMARY KEY (uid, rid); + + +-- +-- Name: variable_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY variable + ADD CONSTRAINT variable_pkey PRIMARY KEY (name); + + +-- +-- Name: views_display_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY views_display + ADD CONSTRAINT views_display_pkey PRIMARY KEY (vid, id); + + +-- +-- Name: views_view_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY views_view + ADD CONSTRAINT views_view_name_key UNIQUE (name); + + +-- +-- Name: views_view_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY views_view + ADD CONSTRAINT views_view_pkey PRIMARY KEY (vid); + + +-- +-- Name: watchdog_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY watchdog + ADD CONSTRAINT watchdog_pkey PRIMARY KEY (wid); + + +-- +-- Name: batch_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX batch_token_idx ON batch USING btree (token); + + +-- +-- Name: block_list_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX block_list_idx ON block USING btree (theme, status, region, weight, module); + + +-- +-- Name: block_node_type_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX block_node_type_type_idx ON block_node_type USING btree (type); + + +-- +-- Name: block_role_rid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX block_role_rid_idx ON block_role USING btree (rid); + + +-- +-- Name: blocked_ips_blocked_ip_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX blocked_ips_blocked_ip_idx ON blocked_ips USING btree (ip); + + +-- +-- Name: cache_block_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_block_expire_idx ON cache_block USING btree (expire); + + +-- +-- Name: cache_bootstrap_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_bootstrap_expire_idx ON cache_bootstrap USING btree (expire); + + +-- +-- Name: cache_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_expire_idx ON cache USING btree (expire); + + +-- +-- Name: cache_field_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_field_expire_idx ON cache_field USING btree (expire); + + +-- +-- Name: cache_filter_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_filter_expire_idx ON cache_filter USING btree (expire); + + +-- +-- Name: cache_form_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_form_expire_idx ON cache_form USING btree (expire); + + +-- +-- Name: cache_image_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_image_expire_idx ON cache_image USING btree (expire); + + +-- +-- Name: cache_menu_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_menu_expire_idx ON cache_menu USING btree (expire); + + +-- +-- Name: cache_page_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_page_expire_idx ON cache_page USING btree (expire); + + +-- +-- Name: cache_path_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_path_expire_idx ON cache_path USING btree (expire); + + +-- +-- Name: cache_update_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_update_expire_idx ON cache_update USING btree (expire); + + +-- +-- Name: cache_views_data_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_views_data_expire_idx ON cache_views_data USING btree (expire); + + +-- +-- Name: cache_views_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX cache_views_expire_idx ON cache_views USING btree (expire); + + +-- +-- Name: comment_comment_created_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX comment_comment_created_idx ON comment USING btree (created); + + +-- +-- Name: comment_comment_nid_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX comment_comment_nid_language_idx ON comment USING btree (nid, language); + + +-- +-- Name: comment_comment_num_new_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX comment_comment_num_new_idx ON comment USING btree (nid, status, created, cid, thread); + + +-- +-- Name: comment_comment_status_pid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX comment_comment_status_pid_idx ON comment USING btree (pid, status); + + +-- +-- Name: comment_comment_uid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX comment_comment_uid_idx ON comment USING btree (uid); + + +-- +-- Name: ctools_object_cache_updated_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX ctools_object_cache_updated_idx ON ctools_object_cache USING btree (updated); + + +-- +-- Name: date_format_type_title_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX date_format_type_title_idx ON date_format_type USING btree (title); + + +-- +-- Name: field_config_active_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_active_idx ON field_config USING btree (active); + + +-- +-- Name: field_config_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_deleted_idx ON field_config USING btree (deleted); + + +-- +-- Name: field_config_field_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_field_name_idx ON field_config USING btree (field_name); + + +-- +-- Name: field_config_instance_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_instance_deleted_idx ON field_config_instance USING btree (deleted); + + +-- +-- Name: field_config_instance_field_name_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_instance_field_name_bundle_idx ON field_config_instance USING btree (field_name, entity_type, bundle); + + +-- +-- Name: field_config_module_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_module_idx ON field_config USING btree (module); + + +-- +-- Name: field_config_storage_active_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_storage_active_idx ON field_config USING btree (storage_active); + + +-- +-- Name: field_config_storage_module_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_storage_module_idx ON field_config USING btree (storage_module); + + +-- +-- Name: field_config_storage_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_storage_type_idx ON field_config USING btree (storage_type); + + +-- +-- Name: field_config_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_config_type_idx ON field_config USING btree (type); + + +-- +-- Name: field_data_body_body_format_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_body_body_format_idx ON field_data_body USING btree (body_format); + + +-- +-- Name: field_data_body_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_body_bundle_idx ON field_data_body USING btree (bundle); + + +-- +-- Name: field_data_body_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_body_deleted_idx ON field_data_body USING btree (deleted); + + +-- +-- Name: field_data_body_entity_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_body_entity_id_idx ON field_data_body USING btree (entity_id); + + +-- +-- Name: field_data_body_entity_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_body_entity_type_idx ON field_data_body USING btree (entity_type); + + +-- +-- Name: field_data_body_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_body_language_idx ON field_data_body USING btree (language); + + +-- +-- Name: field_data_body_revision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_body_revision_id_idx ON field_data_body USING btree (revision_id); + + +-- +-- Name: field_data_comment_body_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_comment_body_bundle_idx ON field_data_comment_body USING btree (bundle); + + +-- +-- Name: field_data_comment_body_comment_body_format_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_comment_body_comment_body_format_idx ON field_data_comment_body USING btree (comment_body_format); + + +-- +-- Name: field_data_comment_body_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_comment_body_deleted_idx ON field_data_comment_body USING btree (deleted); + + +-- +-- Name: field_data_comment_body_entity_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_comment_body_entity_id_idx ON field_data_comment_body USING btree (entity_id); + + +-- +-- Name: field_data_comment_body_entity_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_comment_body_entity_type_idx ON field_data_comment_body USING btree (entity_type); + + +-- +-- Name: field_data_comment_body_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_comment_body_language_idx ON field_data_comment_body USING btree (language); + + +-- +-- Name: field_data_comment_body_revision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_comment_body_revision_id_idx ON field_data_comment_body USING btree (revision_id); + + +-- +-- Name: field_data_field_image_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_image_bundle_idx ON field_data_field_image USING btree (bundle); + + +-- +-- Name: field_data_field_image_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_image_deleted_idx ON field_data_field_image USING btree (deleted); + + +-- +-- Name: field_data_field_image_entity_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_image_entity_id_idx ON field_data_field_image USING btree (entity_id); + + +-- +-- Name: field_data_field_image_entity_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_image_entity_type_idx ON field_data_field_image USING btree (entity_type); + + +-- +-- Name: field_data_field_image_field_image_fid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_image_field_image_fid_idx ON field_data_field_image USING btree (field_image_fid); + + +-- +-- Name: field_data_field_image_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_image_language_idx ON field_data_field_image USING btree (language); + + +-- +-- Name: field_data_field_image_revision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_image_revision_id_idx ON field_data_field_image USING btree (revision_id); + + +-- +-- Name: field_data_field_tags_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_tags_bundle_idx ON field_data_field_tags USING btree (bundle); + + +-- +-- Name: field_data_field_tags_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_tags_deleted_idx ON field_data_field_tags USING btree (deleted); + + +-- +-- Name: field_data_field_tags_entity_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_tags_entity_id_idx ON field_data_field_tags USING btree (entity_id); + + +-- +-- Name: field_data_field_tags_entity_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_tags_entity_type_idx ON field_data_field_tags USING btree (entity_type); + + +-- +-- Name: field_data_field_tags_field_tags_tid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_tags_field_tags_tid_idx ON field_data_field_tags USING btree (field_tags_tid); + + +-- +-- Name: field_data_field_tags_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_tags_language_idx ON field_data_field_tags USING btree (language); + + +-- +-- Name: field_data_field_tags_revision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_data_field_tags_revision_id_idx ON field_data_field_tags USING btree (revision_id); + + +-- +-- Name: field_revision_body_body_format_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_body_body_format_idx ON field_revision_body USING btree (body_format); + + +-- +-- Name: field_revision_body_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_body_bundle_idx ON field_revision_body USING btree (bundle); + + +-- +-- Name: field_revision_body_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_body_deleted_idx ON field_revision_body USING btree (deleted); + + +-- +-- Name: field_revision_body_entity_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_body_entity_id_idx ON field_revision_body USING btree (entity_id); + + +-- +-- Name: field_revision_body_entity_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_body_entity_type_idx ON field_revision_body USING btree (entity_type); + + +-- +-- Name: field_revision_body_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_body_language_idx ON field_revision_body USING btree (language); + + +-- +-- Name: field_revision_body_revision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_body_revision_id_idx ON field_revision_body USING btree (revision_id); + + +-- +-- Name: field_revision_comment_body_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_comment_body_bundle_idx ON field_revision_comment_body USING btree (bundle); + + +-- +-- Name: field_revision_comment_body_comment_body_format_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_comment_body_comment_body_format_idx ON field_revision_comment_body USING btree (comment_body_format); + + +-- +-- Name: field_revision_comment_body_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_comment_body_deleted_idx ON field_revision_comment_body USING btree (deleted); + + +-- +-- Name: field_revision_comment_body_entity_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_comment_body_entity_id_idx ON field_revision_comment_body USING btree (entity_id); + + +-- +-- Name: field_revision_comment_body_entity_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_comment_body_entity_type_idx ON field_revision_comment_body USING btree (entity_type); + + +-- +-- Name: field_revision_comment_body_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_comment_body_language_idx ON field_revision_comment_body USING btree (language); + + +-- +-- Name: field_revision_comment_body_revision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_comment_body_revision_id_idx ON field_revision_comment_body USING btree (revision_id); + + +-- +-- Name: field_revision_field_image_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_image_bundle_idx ON field_revision_field_image USING btree (bundle); + + +-- +-- Name: field_revision_field_image_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_image_deleted_idx ON field_revision_field_image USING btree (deleted); + + +-- +-- Name: field_revision_field_image_entity_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_image_entity_id_idx ON field_revision_field_image USING btree (entity_id); + + +-- +-- Name: field_revision_field_image_entity_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_image_entity_type_idx ON field_revision_field_image USING btree (entity_type); + + +-- +-- Name: field_revision_field_image_field_image_fid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_image_field_image_fid_idx ON field_revision_field_image USING btree (field_image_fid); + + +-- +-- Name: field_revision_field_image_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_image_language_idx ON field_revision_field_image USING btree (language); + + +-- +-- Name: field_revision_field_image_revision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_image_revision_id_idx ON field_revision_field_image USING btree (revision_id); + + +-- +-- Name: field_revision_field_tags_bundle_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_tags_bundle_idx ON field_revision_field_tags USING btree (bundle); + + +-- +-- Name: field_revision_field_tags_deleted_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_tags_deleted_idx ON field_revision_field_tags USING btree (deleted); + + +-- +-- Name: field_revision_field_tags_entity_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_tags_entity_id_idx ON field_revision_field_tags USING btree (entity_id); + + +-- +-- Name: field_revision_field_tags_entity_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_tags_entity_type_idx ON field_revision_field_tags USING btree (entity_type); + + +-- +-- Name: field_revision_field_tags_field_tags_tid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_tags_field_tags_tid_idx ON field_revision_field_tags USING btree (field_tags_tid); + + +-- +-- Name: field_revision_field_tags_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_tags_language_idx ON field_revision_field_tags USING btree (language); + + +-- +-- Name: field_revision_field_tags_revision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX field_revision_field_tags_revision_id_idx ON field_revision_field_tags USING btree (revision_id); + + +-- +-- Name: file_managed_status_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX file_managed_status_idx ON file_managed USING btree (status); + + +-- +-- Name: file_managed_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX file_managed_timestamp_idx ON file_managed USING btree ("timestamp"); + + +-- +-- Name: file_managed_uid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX file_managed_uid_idx ON file_managed USING btree (uid); + + +-- +-- Name: file_usage_fid_count_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX file_usage_fid_count_idx ON file_usage USING btree (fid, count); + + +-- +-- Name: file_usage_fid_module_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX file_usage_fid_module_idx ON file_usage USING btree (fid, module); + + +-- +-- Name: file_usage_type_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX file_usage_type_id_idx ON file_usage USING btree (type, id); + + +-- +-- Name: filter_format_status_weight_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX filter_format_status_weight_idx ON filter_format USING btree (status, weight); + + +-- +-- Name: filter_list_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX filter_list_idx ON filter USING btree (weight, module, name); + + +-- +-- Name: flood_allow_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX flood_allow_idx ON flood USING btree (event, identifier, "timestamp"); + + +-- +-- Name: flood_purge_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX flood_purge_idx ON flood USING btree (expiration); + + +-- +-- Name: gensas_expire_idx1_gensas_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_expire_idx1_gensas_expire_idx ON gensas_expire USING btree (task_id); + + +-- +-- Name: gensas_job_cmd_idx_gensas_job_cmd_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_job_cmd_idx_gensas_job_cmd_id_idx ON gensas_job_cmd USING btree (id); + + +-- +-- Name: gensas_job_files_idx_gensas_job_files_file_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_job_files_idx_gensas_job_files_file_id_idx ON gensas_job_files USING btree (file_id); + + +-- +-- Name: gensas_job_resource_idx_gensas_job_resource_job_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_job_resource_idx_gensas_job_resource_job_id_idx ON gensas_job_resource USING btree (job_id); + + +-- +-- Name: gensas_job_resource_idx_gensas_job_resource_resource_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_job_resource_idx_gensas_job_resource_resource_id_idx ON gensas_job_resource USING btree (resource_id); + + +-- +-- Name: gensas_job_stats_idx_gensas_job_stats_job_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_job_stats_idx_gensas_job_stats_job_id_idx ON gensas_job_stats USING btree (job_id); + + +-- +-- Name: gensas_project_type_idx_gensas_project_type_project_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_project_type_idx_gensas_project_type_project_type_idx ON gensas_project_type USING btree (type); + + +-- +-- Name: gensas_publish_idx_gensas_publish_job_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_publish_idx_gensas_publish_job_id_idx ON gensas_publish USING btree (job_id); + + +-- +-- Name: gensas_resource_idx_gensas_resource_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_resource_idx_gensas_resource_name_idx ON gensas_resource USING btree (name); + + +-- +-- Name: gensas_resource_library_idx_gensas_resource_library_library_id_; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_resource_library_idx_gensas_resource_library_library_id_ ON gensas_resource_library USING btree (library_id); + + +-- +-- Name: gensas_resource_library_idx_gensas_resource_library_resource_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_resource_library_idx_gensas_resource_library_resource_id ON gensas_resource_library USING btree (resource_id); + + +-- +-- Name: gensas_resource_submit_idx_gensas_resource_submit_hostname_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_resource_submit_idx_gensas_resource_submit_hostname_idx ON gensas_resource_submit USING btree (hostname); + + +-- +-- Name: gensas_resource_submit_idx_gensas_resource_submit_resource_id_i; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_resource_submit_idx_gensas_resource_submit_resource_id_i ON gensas_resource_submit USING btree (resource_id); + + +-- +-- Name: gensas_resource_tool_idx_gensas_resource_tool_resource_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_resource_tool_idx_gensas_resource_tool_resource_id_idx ON gensas_resource_tool USING btree (resource_id); + + +-- +-- Name: gensas_resource_tool_idx_gensas_resource_tool_tool_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_resource_tool_idx_gensas_resource_tool_tool_id_idx ON gensas_resource_tool USING btree (tool_id); + + +-- +-- Name: gensas_seq_idx_gensas_seq_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_seq_idx_gensas_seq_name_idx ON gensas_seq USING btree (name); + + +-- +-- Name: gensas_seq_idx_gensas_seq_seq_group_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_seq_idx_gensas_seq_seq_group_id_idx ON gensas_seq USING btree (seq_group_id); + + +-- +-- Name: gensas_seq_stats_idx_gensas_job_stats_job_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_seq_stats_idx_gensas_job_stats_job_id_idx ON gensas_seq_stats USING btree (job_id); + + +-- +-- Name: gensas_seq_stats_idx_gensas_job_stats_seq_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_seq_stats_idx_gensas_job_stats_seq_id_idx ON gensas_seq_stats USING btree (seq_id); + + +-- +-- Name: gensas_task_files_idx_gensas_task_files_file_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_task_files_idx_gensas_task_files_file_id_idx ON gensas_task_files USING btree (file_id); + + +-- +-- Name: gensas_task_files_idx_gensas_task_files_task_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_task_files_idx_gensas_task_files_task_id_idx ON gensas_task_files USING btree (task_id); + + +-- +-- Name: gensas_task_job_idx_gensas_task_job_job_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_task_job_idx_gensas_task_job_job_id_idx ON gensas_task_job USING btree (job_id); + + +-- +-- Name: gensas_task_job_idx_gensas_task_job_task_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_task_job_idx_gensas_task_job_task_id_idx ON gensas_task_job USING btree (task_id); + + +-- +-- Name: gensas_task_seq_group_idx_gensas_task_seq_group_seq_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_task_seq_group_idx_gensas_task_seq_group_seq_id_idx ON gensas_task_seq_group USING btree (seq_group_id); + + +-- +-- Name: gensas_task_seq_group_idx_gensas_task_seq_group_task_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_task_seq_group_idx_gensas_task_seq_group_task_id_idx ON gensas_task_seq_group USING btree (task_id); + + +-- +-- Name: gensas_tool_type_idx_gensas_tool_type_project_type_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_tool_type_idx_gensas_tool_type_project_type_id_idx ON gensas_tool_type USING btree (project_type_id); + + +-- +-- Name: gensas_tool_type_idx_gensas_tool_type_tool_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_tool_type_idx_gensas_tool_type_tool_id_idx ON gensas_tool_type USING btree (tool_id); + + +-- +-- Name: history_nid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX history_nid_idx ON history USING btree (nid); + + +-- +-- Name: image_effects_isid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX image_effects_isid_idx ON image_effects USING btree (isid); + + +-- +-- Name: image_effects_weight_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX image_effects_weight_idx ON image_effects USING btree (weight); + + +-- +-- Name: masquerade_sid_2_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX masquerade_sid_2_idx ON masquerade USING btree (sid, uid_as); + + +-- +-- Name: masquerade_sid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX masquerade_sid_idx ON masquerade USING btree (sid, uid_from); + + +-- +-- Name: menu_links_menu_parents_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX menu_links_menu_parents_idx ON menu_links USING btree (menu_name, p1, p2, p3, p4, p5, p6, p7, p8, p9); + + +-- +-- Name: menu_links_menu_plid_expand_child_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX menu_links_menu_plid_expand_child_idx ON menu_links USING btree (menu_name, plid, expanded, has_children); + + +-- +-- Name: menu_links_path_menu_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX menu_links_path_menu_idx ON menu_links USING btree (substr((link_path)::text, 1, 128), menu_name); + + +-- +-- Name: menu_links_router_path_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX menu_links_router_path_idx ON menu_links USING btree (substr((router_path)::text, 1, 128)); + + +-- +-- Name: menu_router_fit_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX menu_router_fit_idx ON menu_router USING btree (fit); + + +-- +-- Name: menu_router_tab_parent_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX menu_router_tab_parent_idx ON menu_router USING btree (substr((tab_parent)::text, 1, 64), weight, title); + + +-- +-- Name: menu_router_tab_root_weight_title_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX menu_router_tab_root_weight_title_idx ON menu_router USING btree (substr((tab_root)::text, 1, 64), weight, title); + + +-- +-- Name: node_comment_statistics_comment_count_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_comment_statistics_comment_count_idx ON node_comment_statistics USING btree (comment_count); + + +-- +-- Name: node_comment_statistics_last_comment_uid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_comment_statistics_last_comment_uid_idx ON node_comment_statistics USING btree (last_comment_uid); + + +-- +-- Name: node_comment_statistics_node_comment_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_comment_statistics_node_comment_timestamp_idx ON node_comment_statistics USING btree (last_comment_timestamp); + + +-- +-- Name: node_language_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_language_idx ON node USING btree (language); + + +-- +-- Name: node_node_changed_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_node_changed_idx ON node USING btree (changed); + + +-- +-- Name: node_node_created_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_node_created_idx ON node USING btree (created); + + +-- +-- Name: node_node_frontpage_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_node_frontpage_idx ON node USING btree (promote, status, sticky, created); + + +-- +-- Name: node_node_status_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_node_status_type_idx ON node USING btree (status, type, nid); + + +-- +-- Name: node_node_title_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_node_title_type_idx ON node USING btree (title, substr((type)::text, 1, 4)); + + +-- +-- Name: node_node_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_node_type_idx ON node USING btree (substr((type)::text, 1, 4)); + + +-- +-- Name: node_revision_nid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_revision_nid_idx ON node_revision USING btree (nid); + + +-- +-- Name: node_revision_uid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_revision_uid_idx ON node_revision USING btree (uid); + + +-- +-- Name: node_tnid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_tnid_idx ON node USING btree (tnid); + + +-- +-- Name: node_translate_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_translate_idx ON node USING btree (translate); + + +-- +-- Name: node_uid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX node_uid_idx ON node USING btree (uid); + + +-- +-- Name: queue_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX queue_expire_idx ON queue USING btree (expire); + + +-- +-- Name: queue_name_created_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX queue_name_created_idx ON queue USING btree (name, created); + + +-- +-- Name: registry_hook_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX registry_hook_idx ON registry USING btree (type, weight, module); + + +-- +-- Name: role_name_weight_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX role_name_weight_idx ON role USING btree (name, weight); + + +-- +-- Name: role_permission_permission_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX role_permission_permission_idx ON role_permission USING btree (permission); + + +-- +-- Name: search_index_sid_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX search_index_sid_type_idx ON search_index USING btree (sid, type); + + +-- +-- Name: search_node_links_nid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX search_node_links_nid_idx ON search_node_links USING btree (nid); + + +-- +-- Name: semaphore_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX semaphore_expire_idx ON semaphore USING btree (expire); + + +-- +-- Name: semaphore_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX semaphore_value_idx ON semaphore USING btree (value); + + +-- +-- Name: sessions_ssid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX sessions_ssid_idx ON sessions USING btree (ssid); + + +-- +-- Name: sessions_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX sessions_timestamp_idx ON sessions USING btree ("timestamp"); + + +-- +-- Name: sessions_uid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX sessions_uid_idx ON sessions USING btree (uid); + + +-- +-- Name: shortcut_set_users_set_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX shortcut_set_users_set_name_idx ON shortcut_set_users USING btree (set_name); + + +-- +-- Name: system_system_list_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX system_system_list_idx ON system USING btree (status, bootstrap, type, weight, name); + + +-- +-- Name: system_type_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX system_type_name_idx ON system USING btree (type, name); + + +-- +-- Name: taxonomy_index_nid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX taxonomy_index_nid_idx ON taxonomy_index USING btree (nid); + + +-- +-- Name: taxonomy_index_term_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX taxonomy_index_term_node_idx ON taxonomy_index USING btree (tid, sticky, created); + + +-- +-- Name: taxonomy_term_data_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX taxonomy_term_data_name_idx ON taxonomy_term_data USING btree (name); + + +-- +-- Name: taxonomy_term_data_taxonomy_tree_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX taxonomy_term_data_taxonomy_tree_idx ON taxonomy_term_data USING btree (vid, weight, name); + + +-- +-- Name: taxonomy_term_data_vid_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX taxonomy_term_data_vid_name_idx ON taxonomy_term_data USING btree (vid, name); + + +-- +-- Name: taxonomy_term_hierarchy_parent_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX taxonomy_term_hierarchy_parent_idx ON taxonomy_term_hierarchy USING btree (parent); + + +-- +-- Name: taxonomy_vocabulary_list_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX taxonomy_vocabulary_list_idx ON taxonomy_vocabulary USING btree (weight, name); + + +-- +-- Name: url_alias_alias_language_pid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX url_alias_alias_language_pid_idx ON url_alias USING btree (alias, language, pid); + + +-- +-- Name: url_alias_source_language_pid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX url_alias_source_language_pid_idx ON url_alias USING btree (source, language, pid); + + +-- +-- Name: users_access_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX users_access_idx ON users USING btree (access); + + +-- +-- Name: users_created_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX users_created_idx ON users USING btree (created); + + +-- +-- Name: users_mail_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX users_mail_idx ON users USING btree (mail); + + +-- +-- Name: users_picture_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX users_picture_idx ON users USING btree (picture); + + +-- +-- Name: users_roles_rid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX users_roles_rid_idx ON users_roles USING btree (rid); + + +-- +-- Name: views_display_vid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX views_display_vid_idx ON views_display USING btree (vid, "position"); + + +-- +-- Name: watchdog_severity_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX watchdog_severity_idx ON watchdog USING btree (severity); + + +-- +-- Name: watchdog_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX watchdog_type_idx ON watchdog USING btree (type); + + +-- +-- Name: watchdog_uid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX watchdog_uid_idx ON watchdog USING btree (uid); + + +-- +-- Name: public; Type: ACL; Schema: -; Owner: - +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/schema/filter.drupal7.chado.mcl.txt b/schema/filter.drupal7.chado.mcl.txt new file mode 100644 index 0000000..9258ceb --- /dev/null +++ b/schema/filter.drupal7.chado.mcl.txt @@ -0,0 +1,71 @@ +analysisfeature +contact +contactprop +cv +cvterm_relationship +cvterm +cvtermprop +cvtermsynonym +db +dbxref +dbxrefprop +eimage +eimageprop +feature +feature_contact +feature_cvterm +feature_dbxref +feature_genotype +feature_image +feature_nd_geolocation +feature_project +feature_pub +feature_relationship +feature_stock +feature_synonym +featuremap +featuremap_contact +featuremap_organism +featuremap_pub +featuremap_stock +featuremapprop +featureloc +featurepos +featureposprop +featureprop +genotype +genotypeprop +genotype_call +library +library_contact +library_pub +library_synonym +libraryprop +nd_experiment +nd_experiment_contact +nd_experiment_genotype +nd_experiment_phenotype +nd_experiment_project +nd_experiment_pub +nd_experiment_stock +nd_experimentprop +nd_geolocation +nd_geolocationprop +organism +organism_dbxref +organism_pub +organism_relationship +organismprop +phenotype +project +project_contact +project_pub +project_relationship +projectprop +pub +stock +stock_dbxref +stock_pub +stock_relationship +stockprop +synonym diff --git a/schema/filter.drupal7.public.mcl.txt b/schema/filter.drupal7.public.mcl.txt new file mode 100644 index 0000000..ffd8609 --- /dev/null +++ b/schema/filter.drupal7.public.mcl.txt @@ -0,0 +1,9 @@ +mcl_file +mcl_job +mcl_template +mcl_template_type +mcl_user +mcl_var +mcl_data_valid +mcl_data_valid_type +users diff --git a/theme/js/mcl.js b/theme/js/mcl.js index dcf9e96..788d484 100644 --- a/theme/js/mcl.js +++ b/theme/js/mcl.js @@ -23,7 +23,7 @@ url : $(this).attr("log-file"), dataType: "text", success : function (data) { - $(id_viewer).html(name + data.replace(/\n/g, '
')); + $(id_viewer).html(name + '
' + data.replace(/\n/g, '
')); } }); }); From f3a648c53ed2edbbe6cb91ab3232f8abcbb566de Mon Sep 17 00:00:00 2001 From: "T.Lee" Date: Fri, 24 Mar 2017 16:44:31 -0700 Subject: [PATCH 2/5] minor change --- includes/admin/mcl.admin.data_valid.inc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/includes/admin/mcl.admin.data_valid.inc b/includes/admin/mcl.admin.data_valid.inc index ec223e2..a0e4576 100644 --- a/includes/admin/mcl.admin.data_valid.inc +++ b/includes/admin/mcl.admin.data_valid.inc @@ -20,8 +20,18 @@ function mcl_admin_data_valid_form($form, &$form_state) { '#collapsible' => TRUE, '#title' => 'Data validation Type', ); + $desc = " + The table below shows the validation types that currrently defined in MCL. + It is sometimes required that data in certain columns must be restricted. + Suppose you want to restrict type of location as following types. +

greenhouse, open field, orchard and seedling block

+ Create a new data validation type 'location_type' first and add + these types as their members. If the members of the validation type are + cvterms, provide the cv name of the cvterms. Once data validation types are + defined, it can be accessed from a template file by MCL_TEMPATE_DATA_TYPE class. + "; $form['data_valid_type']['table'] = array( - '#markup' => 'Description here..', + '#markup' => $desc, ); // Adds data validation type form. @@ -34,8 +44,12 @@ function mcl_admin_data_valid_form($form, &$form_state) { '#collapsible' => TRUE, '#title' => 'Data validation', ); + $desc = " + The members of each validation type are listed in the table below. + Please add a new member or delete the existing member. + "; $form['data_valid']['table'] = array( - '#markup' => 'Description here..', + '#markup' => $desc, ); // Adds data validation form. @@ -101,7 +115,7 @@ function _mcl_get_mcl_data_valid_type_form(&$form) { ); $form['data_valid_type']['data_valid_types']['add_data_valid_type']['type'] = array( '#type' => 'textfield', - '#title' => t('New data valid type'), + '#title' => t('New data validation type'), '#description' => t("Please type a new type for data validation"), '#attributes' => array('style' => 'width:250px;'), ); From f24efa390be4f6155b00338b257a46aa0a02c7ac Mon Sep 17 00:00:00 2001 From: "T.Lee" Date: Thu, 20 Apr 2017 09:52:41 -0700 Subject: [PATCH 3/5] file structure changed. added data validation on admin page. --- README.md | 4 +- includes/admin/mcl.admin.data_valid.inc | 137 +++--- includes/admin/mcl.admin.template.inc | 102 ++--- .../chado_nd_geolocationprop.class.inc | 1 - .../chado_table_class/chado_table.class.inc | 41 +- .../data_valid/mcl_data_valid_type.class.inc | 36 +- includes/class/job/mcl_job.class.inc | 56 ++- includes/class/job/mcl_job_upload.class.inc | 73 ++-- .../mcl_chado_contact.class.inc | 33 +- .../mcl_chado_class/mcl_chado_cv.class.inc | 39 +- .../mcl_chado_cvterm.class.inc | 204 +++++++-- .../mcl_chado_dataset.class.inc | 47 +- .../mcl_chado_class/mcl_chado_db.class.inc | 24 +- .../mcl_chado_dbxref.class.inc | 43 +- .../mcl_chado_feature.class.inc | 231 +++++++--- .../mcl_chado_featuremap.class.inc | 59 ++- .../mcl_chado_featurepos.class.inc | 17 + .../mcl_chado_genotype.class.inc | 29 +- .../mcl_chado_genotype_call.class.inc | 10 +- .../mcl_chado_class/mcl_chado_image.class.inc | 33 +- .../mcl_chado_library.class.inc | 51 ++- .../mcl_chado_location.class.inc | 69 ++- .../mcl_chado_nd_experiment.class.inc | 116 ++++- .../mcl_chado_organism.class.inc | 53 ++- .../mcl_chado_phenotype.class.inc | 10 +- .../mcl_chado_class/mcl_chado_pub.class.inc | 14 +- .../mcl_chado_class/mcl_chado_stock.class.inc | 153 ++++--- .../mcl_chado_synonym.class.inc | 10 +- .../mcl_chado_class/mcl_chado_trait.class.inc | 16 +- includes/class/mcl_class_loader.class.inc | 54 ++- mcl.info | 2 +- mcl.install | 37 +- mcl.module | 19 +- schema/drupal7.public.sql | 400 +++++++++++++++--- .../core}/mcl_template.class.inc | 186 ++++++-- .../core}/mcl_template_type.class.inc | 0 .../mcl_template_contact.class.inc | 0 .../mcl_template_cross.class.inc | 0 templates/mcl_template_cross_bims.class.inc | 152 +++++++ .../mcl_template_cv.class.inc | 0 .../mcl_template_cvterm.class.inc | 6 + .../mcl_template_cvterm_bims.class.inc | 48 +-- .../mcl_template_dataset.class.inc | 9 - templates/mcl_template_dataset_bims.class.inc | 103 +++++ .../mcl_template_db.class.inc | 0 .../mcl_template_descriptor.class.inc | 2 +- .../mcl_template_descriptor_bims.class.inc | 120 ++++++ .../mcl_template_fieldbook.class.inc | 0 .../mcl_template_genotype.class.inc | 0 .../mcl_template_genotype_snp.class.inc | 0 ...plate_genotype_snp_marker_column.class.inc | 4 +- ...mplate_genotype_snp_stock_column.class.inc | 0 .../mcl_template_genotype_ssr.class.inc | 0 .../mcl_template_image.class.inc | 0 .../mcl_template_library.class.inc | 0 .../mcl_template_map.class.inc | 0 .../mcl_template_map_position.class.inc | 30 +- .../mcl_template_marker.class.inc | 0 .../mcl_template_mtl.class.inc | 10 +- .../mcl_template_organism.class.inc | 0 .../mcl_template_phenotype.class.inc | 27 +- .../mcl_template_phenotype_bims.class.inc | 396 +++++++++++++++++ .../mcl_template_progeny.class.inc | 0 .../mcl_template_progeny_bims.class.inc | 0 .../mcl_template_qtl.class.inc | 14 +- .../mcl_template_qtl_trait_data.class.inc | 0 .../mcl_template_site.class.inc | 1 + templates/mcl_template_site_bims.class.inc | 122 ++++++ .../mcl_template_site_cotton.class.inc | 0 .../mcl_template_stock.class.inc | 20 + templates/mcl_template_stock_bims.class.inc | 234 ++++++++++ .../mcl_template_stock_cotton.class.inc | 20 + .../mcl_template_trait.class.inc | 0 73 files changed, 2984 insertions(+), 743 deletions(-) rename {includes/class/template => templates/core}/mcl_template.class.inc (90%) rename {includes/class/template => templates/core}/mcl_template_type.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_contact.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_cross.class.inc (100%) create mode 100644 templates/mcl_template_cross_bims.class.inc rename {includes/class/template/module => templates}/mcl_template_cv.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_cvterm.class.inc (88%) rename includes/class/template/module/mcl_template_column.class.inc => templates/mcl_template_cvterm_bims.class.inc (54%) rename {includes/class/template/module => templates}/mcl_template_dataset.class.inc (87%) create mode 100644 templates/mcl_template_dataset_bims.class.inc rename {includes/class/template/module => templates}/mcl_template_db.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_descriptor.class.inc (98%) create mode 100644 templates/mcl_template_descriptor_bims.class.inc rename {includes/class/template/module => templates}/mcl_template_fieldbook.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_genotype.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_genotype_snp.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_genotype_snp_marker_column.class.inc (97%) rename {includes/class/template/module => templates}/mcl_template_genotype_snp_stock_column.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_genotype_ssr.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_image.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_library.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_map.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_map_position.class.inc (91%) rename {includes/class/template/module => templates}/mcl_template_marker.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_mtl.class.inc (93%) rename {includes/class/template/module => templates}/mcl_template_organism.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_phenotype.class.inc (92%) create mode 100644 templates/mcl_template_phenotype_bims.class.inc rename {includes/class/template/module => templates}/mcl_template_progeny.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_progeny_bims.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_qtl.class.inc (91%) rename {includes/class/template/module => templates}/mcl_template_qtl_trait_data.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_site.class.inc (97%) create mode 100644 templates/mcl_template_site_bims.class.inc rename {includes/class/template/module => templates}/mcl_template_site_cotton.class.inc (100%) rename {includes/class/template/module => templates}/mcl_template_stock.class.inc (94%) create mode 100644 templates/mcl_template_stock_bims.class.inc rename {includes/class/template/module => templates}/mcl_template_stock_cotton.class.inc (94%) rename {includes/class/template/module => templates}/mcl_template_trait.class.inc (100%) diff --git a/README.md b/README.md index 971025c..2a8b601 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The Mainlab Chado Loader is created by Main Bioinformatics Lab (Main Lab) at Was - Drupal 7.x ## Version -1.0.0 +2.0.0 ##Download The MainLab Chado Loader module can be download from GitHub: @@ -76,7 +76,7 @@ After downloading the module, extract it into your site's module directory The file name should be 'mcl_template_stock_gdr.inc' ``` ii. Place the newly created class file under the template directory. - The template directory is 'mcl/include/class/template/module/'. + The template directory is 'mcl/templates'. b. Go to the admin page. diff --git a/includes/admin/mcl.admin.data_valid.inc b/includes/admin/mcl.admin.data_valid.inc index a0e4576..bed5af9 100644 --- a/includes/admin/mcl.admin.data_valid.inc +++ b/includes/admin/mcl.admin.data_valid.inc @@ -87,7 +87,7 @@ function _mcl_get_mcl_data_valid_type_form(&$form) { // Creates 'Delete' link. $confirm_attr = array( 'attributes' => array( - 'id' => 'delete_data_valid_type_' . $data_valid_type_id, + 'id' => 'delete_data_valid_type_' . $data_valid_type_id, 'class' => array('use-ajax', 'mcl-confirm'), ) ); @@ -229,21 +229,16 @@ function _mcl_get_mcl_data_valid_form(&$form, $target_data_valid_type_id = '') { $label = 'Add cvterm ID'; } $form['data_valid'][$id_fieldset][$id_value] = array( - '#type' => 'textfield', - '#title' => $title, - '#description' => $desc, - '#attributes' => array('style' => 'width:250px;'), + '#type' => 'textfield', + '#title' => $title, + '#description' => $desc, + '#default_value' => '', + '#attributes' => array('style' => 'width:250px;'), ); $form['data_valid'][$id_fieldset][$id_add_btn] = array( '#type' => 'submit', '#name' => $id_add_btn, '#value' => $label, - '#ajax' => array( - 'callback' => "mcl_admin_data_valid_form_ajax_callback", - 'wrapper' => 'mcl-admin-data-valid-form', - 'effect' => 'fade', - 'method' => 'replace', - ), ); } } @@ -255,65 +250,6 @@ function _mcl_get_mcl_data_valid_form(&$form, $target_data_valid_type_id = '') { * @param $form_state */ function mcl_admin_data_valid_form_ajax_callback($form, &$form_state) { - - // Checks for errors. - if (form_get_errors()) { - return $form; - } - - // Gets the trigger element. - $trigger_elem = $form_state['triggering_element']['#name']; - - // If "data_valid_type_btn" button is clicked. - if ($trigger_elem == "data_valid_type_btn") { - - // Gets the new data valid type. - $type = trim($form_state['values']['data_valid_type']['data_valid_types']['add_data_valid_type']['type']); - $cv_name = trim($form_state['values']['data_valid_type']['data_valid_types']['add_data_valid_type']['cv_name']); - - // Sets the type. - $details = array('type' => $type); - - // Gets cv_id. - if ($cv_name) { - $cv = MCL_CHADO_CV::getCV($cv_name); - $details['cv_id'] = $cv->getCvID(); - } - $mcl_data_valid_type = new MCL_DATA_VALID_TYPE($details); - if (!$mcl_data_valid_type->insert()) { - drupal_set_message("Failed to add a new type : $type"); - } - _mcl_get_mcl_data_valid_type_form($form); - } - - // If "data_valid_btn" button is clicked. - else if (preg_match("/data_valid_btn_(\d+)_(\d+)/", $trigger_elem, $matches)) { - $data_valid_type_id = $matches[1]; - $cv_id = $matches[2]; - - // Gets the value. - $id_fieldset = 'fs_' . $data_valid_type_id; - $id_value = 'value_' . $data_valid_type_id; - $value = trim($form_state['values']['data_valid'][$id_fieldset][$id_value]); - - // Add the value. - $details = array( - 'data_valid_type_id' => $data_valid_type_id, - 'name' => $value, - ); - if ($cv_id) { - $cvterm = MCL_CHADO_CVTERM::byKey(array('cvterm_id' => $value)); - $details['name'] = $cvterm->getName(); - $details['cvterm_id'] = $cvterm->getCvtermID(); - } - $data_valid = new PUBLIC_MCL_DATA_VALID($details); - if ($data_valid->insert()) { - _mcl_get_mcl_data_valid_form($form, $data_valid_type_id); - } - else { - drupal_set_message("Failed to add a new value : $value"); - } - } return $form; } @@ -392,8 +328,8 @@ function mcl_admin_data_valid_form_validate($form, &$form_state) { return; } $key = array( - 'cv_id' => $cv_id, - 'cvterm_id' => $value, + 'cv_id' => $cv_id, + 'cvterm_id' => $value, ); $cvterm = MCL_CHADO_CVTERM::byKey($key); if (!$cvterm) { @@ -411,6 +347,61 @@ function mcl_admin_data_valid_form_validate($form, &$form_state) { * @ingroup mcl_admin */ function mcl_admin_data_valid_form_submit($form, &$form_state) { - $form_state['rebuild'] = TRUE; + + // Gets the trigger element. + $trigger_elem = $form_state['triggering_element']['#name']; + + // If "data_valid_type_btn" button is clicked. + if ($trigger_elem == "data_valid_type_btn") { + + // Gets the new data valid type. + $type = trim($form_state['values']['data_valid_type']['data_valid_types']['add_data_valid_type']['type']); + $cv_name = trim($form_state['values']['data_valid_type']['data_valid_types']['add_data_valid_type']['cv_name']); + + // Sets the type. + $details = array('type' => $type); + + // Gets cv_id. + if ($cv_name) { + $cv = MCL_CHADO_CV::getCV($cv_name); + $details['cv_id'] = $cv->getCvID(); + } + $mcl_data_valid_type = new MCL_DATA_VALID_TYPE($details); + if ($mcl_data_valid_type->insert()) { + drupal_set_message("A new type added : $type"); + } + else { + drupal_set_message("Failed to add a new type : $type"); + } + } + + // If "data_valid_btn" button is clicked. + else if (preg_match("/data_valid_btn_(\d+)_(\d+)/", $trigger_elem, $matches)) { + $data_valid_type_id = $matches[1]; + $cv_id = $matches[2]; + + // Gets the value. + $id_fieldset = 'fs_' . $data_valid_type_id; + $id_value = 'value_' . $data_valid_type_id; + $value = trim($form_state['values']['data_valid'][$id_fieldset][$id_value]); + + // Add the value. + $details = array( + 'data_valid_type_id' => $data_valid_type_id, + 'name' => $value, + ); + if ($cv_id) { + $cvterm = MCL_CHADO_CVTERM::byKey(array('cvterm_id' => $value)); + $details['name'] = $cvterm->getName(); + $details['cvterm_id'] = $cvterm->getCvtermID(); + } + $data_valid = new PUBLIC_MCL_DATA_VALID($details); + if ($data_valid->insert()) { + drupal_set_message("A new value added : $value"); + } + else { + drupal_set_message("Failed to add a new value : $value"); + } + } } ?> diff --git a/includes/admin/mcl.admin.template.inc b/includes/admin/mcl.admin.template.inc index 342e411..d3eeb54 100644 --- a/includes/admin/mcl.admin.template.inc +++ b/includes/admin/mcl.admin.template.inc @@ -101,14 +101,16 @@ function mcl_admin_template_form_submit($form, &$form_state) { // Updates the visibility (public or private) of templates. - foreach ($form['templates'] as $template_id => $info) { - if (!preg_match("/^(\d+)$/", $template_id)) { - continue; + if (array_key_exists('templates', $form)) { + foreach ((array)$form['templates'] as $template_id => $info) { + if (!preg_match("/^(\d+)$/", $template_id)) { + continue; + } + $template = MCL_TEMPLATE::byKey(array('template_id' => $template_id)); + $public = $form_state['values']['templates'][$template_id]; + $template->setPublic($public); + $template->update(); } - $template = MCL_TEMPLATE::byKey(array('template_id' => $template_id)); - $public = $form_state['values']['templates'][$template_id]; - $template->setPublic($public); - $template->update(); } // Scans the template directory and add new templates or remove non-existance @@ -130,54 +132,56 @@ function theme_mcl_admin_template_form($variables) { $layout.= "
" . drupal_render($form['template_list']) . '
'; // Gets the template directory. - $template_path = drupal_get_path('module', 'mcl') . '/includes/class/template/module'; + $template_path = drupal_get_path('module', 'mcl') . '/templates'; // Gets all templates and populates the table with the templates. $rows = array(); - foreach ($form['templates'] as $template_id => $info) { - if (!preg_match("/^(\d+)$/", $template_id)) { - continue; - } - $template = MCL_TEMPLATE::byKey(array('template_id' => $template_id)); + if (array_key_exists('templates', $form)) { + foreach ((array)$form['templates'] as $template_id => $info) { + if (!preg_match("/^(\d+)$/", $template_id)) { + continue; + } + $template = MCL_TEMPLATE::byKey(array('template_id' => $template_id)); - // Checks the existance of the class file. - $class_file = 'mcl_template_' . strtolower($template->getTemplate()) . '.class.inc'; - $class_exists = (file_exists("$template_path/$class_file")) ? 'exists' : 'not exist'; + // Checks the existance of the class file. + $class_file = 'mcl_template_' . strtolower($template->getTemplate()) . '.class.inc'; + $class_exists = (file_exists("$template_path/$class_file")) ? 'exists' : 'not exist'; - // Gets the definition. - $description = 'N/A'; - if ($class_exists == 'exists') { - $template = MCL_TEMPLATE::getTemplateByID($template_id); - $description = $template->defineDescription(); - } + // Gets the definition. + $description = 'N/A'; + if ($class_exists == 'exists') { + $template = MCL_TEMPLATE::getTemplateByID($template_id); + $description = $template->defineDescription(); + } - $row = array( - drupal_render($form['templates'][$template_id]), - $template->getTemplateType(FALSE), - $template->getTemplate(), - $class_exists, - $description, - ); - $rows []= $row; + $row = array( + drupal_render($form['templates'][$template_id]), + $template->getTemplateType(FALSE), + $template->getTemplate(), + $class_exists, + $description, + ); + $rows []= $row; + } } - // Sets the headers. - $headers = array( - array('data' => 'Public', 'style' => 'width:10px'), - array('data' => 'Template Type', 'style' => 'width:15%'), - array('data' => 'Template', 'style' => 'width:10%'), - array('data' => 'Class File', 'style' => 'width:8%'), - 'Description', - ); - - $table_vars = array( - 'header' => $headers, - 'rows' => $rows, - 'attributes' => array(), - ); - - // Adds the template table. - $layout .= theme('table', $table_vars); - $layout .= drupal_render_children($form); - return $layout; + // Sets the headers. + $headers = array( + array('data' => 'Public', 'style' => 'width:10px'), + array('data' => 'Template Type', 'style' => 'width:15%'), + array('data' => 'Template', 'style' => 'width:10%'), + array('data' => 'Class File', 'style' => 'width:8%'), + 'Description', + ); + + $table_vars = array( + 'header' => $headers, + 'rows' => $rows, + 'attributes' => array(), + ); + + // Adds the template table. + $layout .= theme('table', $table_vars); + $layout .= drupal_render_children($form); + return $layout; } \ No newline at end of file diff --git a/includes/class/chado_table_class/chado_nd_geolocationprop.class.inc b/includes/class/chado_table_class/chado_nd_geolocationprop.class.inc index b616ce4..213abdd 100644 --- a/includes/class/chado_table_class/chado_nd_geolocationprop.class.inc +++ b/includes/class/chado_table_class/chado_nd_geolocationprop.class.inc @@ -166,7 +166,6 @@ class CHADO_ND_GEOLOCATIONPROP extends CHADO_TABLE { $fields['value'] = $this->value; $fields['rank'] = (is_numeric($this->rank)) ? $this->rank : 0; - // Updates the record. db_update('chado.nd_geolocationprop') ->fields($fields) diff --git a/includes/class/chado_table_class/chado_table.class.inc b/includes/class/chado_table_class/chado_table.class.inc index a9ded2b..1fa95bf 100644 --- a/includes/class/chado_table_class/chado_table.class.inc +++ b/includes/class/chado_table_class/chado_table.class.inc @@ -254,7 +254,7 @@ class CHADO_TABLE { * @return boolean */ public function addPropertyRanked(MCL_TEMPLATE $mcl_tmpl = NULL, $table_name, $target_field, $target_id, $type_id, $value, $rank) { - if ($value) { + if ($value != '') { // Checks duplication before adding a new property. $args = array( @@ -282,6 +282,45 @@ class CHADO_TABLE { } } + /** + * Updates one or more properties + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $table_name + * @param string $target_field + * @param integer $target_id + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function updateProperty(MCL_TEMPLATE $mcl_tmpl = NULL, $table_name, $target_field, $target_id, $type_id, $value) { + if ($value || $value == '0') { + + // Gets the table class. + $args = array( + $target_field => $target_id, + 'type_id' => $type_id, + ); + $class_name = strtoupper('CHADO_' . $table_name); + $obj = $class_name::byKey($args); + + + // If the property exists, update it. Otherwise add a new one. + if ($obj) { + $obj->setValue($value); + return $obj->update(); + } + else { + $args['value'] = $value; + $obj = new $class_name($args); + return $obj->insert(); + } + } + return FALSE; + } + /** * Adds a relationship. * diff --git a/includes/class/data_valid/mcl_data_valid_type.class.inc b/includes/class/data_valid/mcl_data_valid_type.class.inc index ec2902b..0cb2772 100644 --- a/includes/class/data_valid/mcl_data_valid_type.class.inc +++ b/includes/class/data_valid/mcl_data_valid_type.class.inc @@ -149,23 +149,29 @@ class MCL_DATA_VALID_TYPE extends PUBLIC_MCL_DATA_VALID_TYPE { * @return boolean */ public static function validate($data_valid_type, $value) { - if ($value) { + if ($value != '') { + // Gets data_valid_type_id. $mcl_data_valid_type = MCL_DATA_VALID_TYPE::byKey(array('type' => $data_valid_type)); - $data_valid_type_id = $mcl_data_valid_type->getDataValidTypeID(); - - // Checks the value. - $sql = " - SELECT COUNT(data_valid_id) - FROM {mcl_data_valid} - WHERE data_valid_type_id = :data_valid_type_id AND LOWER(name) = LOWER(:name) - "; - $args = array( - ':data_valid_type_id' => $data_valid_type_id, - ':name' => $value, - ); - $num = db_query($sql, $args)->fetchField(); - return ($num) ? TRUE : FALSE; + if (!$mcl_data_valid_type) { + return FALSE; + } + else { + $data_valid_type_id = $mcl_data_valid_type->getDataValidTypeID(); + + // Checks the value. + $sql = " + SELECT COUNT(data_valid_id) + FROM {mcl_data_valid} + WHERE data_valid_type_id = :data_valid_type_id AND LOWER(name) = LOWER(:name) + "; + $args = array( + ':data_valid_type_id' => $data_valid_type_id, + ':name' => $value, + ); + $num = db_query($sql, $args)->fetchField(); + return ($num) ? TRUE : FALSE; + } } return TRUE; } diff --git a/includes/class/job/mcl_job.class.inc b/includes/class/job/mcl_job.class.inc index cdc49b8..4134b01 100644 --- a/includes/class/job/mcl_job.class.inc +++ b/includes/class/job/mcl_job.class.inc @@ -14,6 +14,7 @@ class MCL_JOB extends PUBLIC_MCL_JOB { protected $user_dir = NULL; protected $job_dir = NULL; protected $log_dir = NULL; + protected $std_dir = NULL; protected $file_dir = NULL; protected $pid = NULL; @@ -88,6 +89,10 @@ class MCL_JOB extends PUBLIC_MCL_JOB { if ($log_dir) { $this->log_dir = $log_dir; } + $std_dir = $this->getPropByKey('std_dir'); + if ($std_dir) { + $this->std_dir = $std_dir; + } $file_dir = $this->getPropByKey('file_dir'); if ($file_dir) { $this->file_dir = $file_dir; @@ -142,11 +147,13 @@ class MCL_JOB extends PUBLIC_MCL_JOB { $this->user_dir = "$working_dir/$username"; $this->job_dir = $this->user_dir . '/' . $this->job_id; $this->log_dir = $this->job_dir . '/logs'; + $this->std_dir = $this->job_dir . '/std'; $this->file_dir = $this->job_dir . '/files'; $this->setPropByKey('working_dir', $this->user_dir); $this->setPropByKey('user_dir', $this->user_dir); $this->setPropByKey('job_dir', $this->job_dir); $this->setPropByKey('log_dir', $this->log_dir); + $this->setPropByKey('std_dir', $this->std_dir); $this->setPropByKey('file_dir', $this->file_dir); $this->setPropByKey('pid', $this->pid); $this->update(); @@ -154,6 +161,7 @@ class MCL_JOB extends PUBLIC_MCL_JOB { // Creates directories. mcl_create_dir($this->job_dir); mcl_create_dir($this->log_dir); + mcl_create_dir($this->std_dir); mcl_create_dir($this->file_dir); } else { @@ -197,18 +205,27 @@ class MCL_JOB extends PUBLIC_MCL_JOB { * Returns jobs that belong to the user. * * @parma integer $user_id + * @parma string $type * * @return array of MCL_UPLOAD_JOB */ - public static function getJobsByUser($user_id) { + public static function getJobsByUser($user_id, $type = NULL) { $sql = " SELECT J.job_id, J.class_name FROM {mcl_job} J WHERE J.user_id = :user_id - ORDER BY J.submit_date DESC "; - $results = db_query($sql, array(':user_id' => $user_id)); + $args =array (':user_id' => $user_id); + + // Adds conditions. + if ($type) { + $sql .= ' AND J.type = :type'; + $args[':type'] = $type; + } + + $sql .= ' ORDER BY J.submit_date DESC'; + $results = db_query($sql, $args); $mcl_jobs = array(); while ($obj = $results->fetchObject()) { $class_name = $obj->class_name; @@ -258,6 +275,17 @@ class MCL_JOB extends PUBLIC_MCL_JOB { } } + /** + * Returns the name of the std file. + * + * @param string $ext + * + * @return string + */ + public function getStdFile($ext) { + return $this->getStdDir() . '/mcl-' . date("Y-m-d-G-i-s") . '.' . $ext; + } + /** * Resets the logs. * @@ -352,7 +380,7 @@ class MCL_JOB extends PUBLIC_MCL_JOB { } /** - * Changes the working directory. Needs to update job_dir, log_dir + * Changes the working directory. Needs to update job_dir, log_dir, std_dir * and file_dir. * * @param string $working_dir @@ -364,6 +392,7 @@ class MCL_JOB extends PUBLIC_MCL_JOB { $this->setWorkingDir($working_dir); $this->setJobDir($job_dir); $this->setLogDir("$job_dir/logs"); + $this->setStdDir("$job_dir/std"); $this->setFileDir("$job_dir/files"); return $this->update(); } @@ -536,6 +565,25 @@ class MCL_JOB extends PUBLIC_MCL_JOB { $this->setPropByKey('log_dir', $log_dir); } + /** + * Retrieves the directory of the std files. + * + * @retrun string + */ + public function getStdDir() { + return $this->std_dir; + } + + /** + * Updates the directory of the std files. + * + * @param string $std_dir + */ + public function setStdDir($std_dir) { + $this->std_dir = $std_dir; + $this->setPropByKey('std_dir', $std_dir); + } + /** * Retrieves the directory of the files. * diff --git a/includes/class/job/mcl_job_upload.class.inc b/includes/class/job/mcl_job_upload.class.inc index ba59078..22566a3 100644 --- a/includes/class/job/mcl_job_upload.class.inc +++ b/includes/class/job/mcl_job_upload.class.inc @@ -45,9 +45,6 @@ class MCL_JOB_UPLOAD extends MCL_JOB { mcl_create_dir($this->csv_dir); } - // Resets 'columns' in job properties. - $this->setPropByKey('columns', array()); - // Resets new log files. if ($this->job_id) { $this->resetNewLogFiles(); @@ -713,6 +710,9 @@ class MCL_JOB_UPLOAD extends MCL_JOB { while (!feof($fdr)) { $line = trim(fgets($fdr)); + // Removes white space :   + $line = preg_replace('/\xc2\xa0/', ' ', $line); + // Exits if no data in the line. $check = preg_replace("/[\",\s]/", '', $line); if ($check == '') { @@ -902,8 +902,7 @@ class MCL_JOB_UPLOAD extends MCL_JOB { // Gets MCL_TEMPLATE object. $tmpl_obj = MCL_TEMPLATE::getTemplateClass($this, $csv_file); - // Runs the data error checking. Skips if the error checking has been - // completed. + // Runs the data error checking. Skips if the error checking has been completed. mcl_print("[$mcl_file_id] $filename", 1); mcl_print("- Running the data error checking", 2); if ($csv_file->hasPassed($this->status_int['data error']) && !$this->getForce()) { @@ -1067,36 +1066,43 @@ class MCL_JOB_UPLOAD extends MCL_JOB { // Adds log files (Warning / Errror / Dup-Data) in recent directory. $recent_dir = $this->getRecentLogDir('recent'); - $objects = scandir($recent_dir); - foreach ($objects as $object) { - if ($object === '.' or $object === '..') { - continue; - } - if (is_dir("$recent_dir/$object")) { - preg_match("/(\d+)-([A-Z])/", $object, $matches); - $status_int = $matches[1]; - $type = $matches[2]; - - // Skips new data log. - if ($type == 'N') { + if (file_exists($recent_dir)) { + $objects = scandir($recent_dir); + foreach ($objects as $object) { + if ($object === '.' or $object === '..') { continue; } + if (is_dir("$recent_dir/$object")) { + preg_match("/(\d+)-([A-Z])/", $object, $matches); + $status_int = $matches[1]; + $type = $matches[2]; + + // Skips new data log. + if ($type == 'N') { + continue; + } - // Initialzes the array. - if (!array_key_exists($type, $all_logs)) { - $all_logs[$type] = array(); - } + // Initialzes the array. + if (!array_key_exists($type, $all_logs)) { + $all_logs[$type] = array(); + } + + $files = file_scan_directory("$recent_dir/$object", "/\.log$/"); + $log_files = array(); + foreach ($files as $filepath => $file) { + preg_match("/-([A-Za-z\_]+)\.log$/", $filepath, $matches2); + $key = $matches2[1]; + $log_files []= array( + 'key' => $key, + 'filepath' => $filepath, + 'log_file' => "recent:$object:" . basename($filepath), + ); + } - $files = file_scan_directory("$recent_dir/$object", "/\.log$/"); - $log_files = array(); - foreach ($files as $filepath => $file) { - preg_match("/-([A-Za-z\_]+)\.log$/", $filepath, $matches2); - $key = $matches2[1]; - $log_files []= array( - 'key' => $key, - 'filepath' => $filepath, - 'log_file' => "recent:$object:" . basename($filepath), - ); + // Adds log files. + if (!empty($log_files)) { + $all_logs[$type][$status_int] = $log_files; + } } // Adds log files. @@ -1104,11 +1110,6 @@ class MCL_JOB_UPLOAD extends MCL_JOB { $all_logs[$type][$status_int] = $log_files; } } - - // Adds log files. - if (!empty($log_files)) { - $all_logs[$type][$status_int] = $log_files; - } } // Adds log file for new data. diff --git a/includes/class/mcl_chado_class/mcl_chado_contact.class.inc b/includes/class/mcl_chado_class/mcl_chado_contact.class.inc index 4ca37b4..90de4f2 100644 --- a/includes/class/mcl_chado_class/mcl_chado_contact.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_contact.class.inc @@ -51,8 +51,8 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { // Gets the contacts. $names = preg_split(self::getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { - $mcl_contact = MCL_CHADO_CONTACT::getContact(trim($name)); - if (!$mcl_contact) { + $contact = MCL_CHADO_CONTACT::getContact(trim($name)); + if (!$contact) { self::updateMsg($mcl_tmpl, 'E', "(name) = ($name) not found in contact"); $flag = FALSE; } @@ -93,8 +93,8 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { } // Checks for duplication. - $mcl_contact = MCL_CHADO_CONTACT::byKey($args); - if ($mcl_contact) { + $contact = MCL_CHADO_CONTACT::byKey($args); + if ($contact) { self::addMsg($mcl_tmpl, 'D', 'contact', $args); } else { @@ -102,8 +102,8 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { // Adds a new contact. $args['type_id'] = $type_id; $args['description'] = $description; - $mcl_contact = new MCL_CHADO_CONTACT($args); - if ($mcl_contact->insert()) { + $contact = new MCL_CHADO_CONTACT($args); + if ($contact->insert()) { self::addMsg($mcl_tmpl, 'N', 'contact', $args); } else { @@ -111,7 +111,24 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { return NULL; } } - return $mcl_contact; + return $contact; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'contactprop', 'contact_id', $this->contact_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -126,7 +143,7 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'contactprop', 'contact_id', $this->contact_id, $type_id, $value, $separator); } diff --git a/includes/class/mcl_chado_class/mcl_chado_cv.class.inc b/includes/class/mcl_chado_class/mcl_chado_cv.class.inc index 99e52b0..56e732d 100644 --- a/includes/class/mcl_chado_class/mcl_chado_cv.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_cv.class.inc @@ -48,8 +48,8 @@ class MCL_CHADO_CV extends CHADO_CV { if ($name) { // Gets the cv. - $mcl_cv = MCL_CHADO_CV::getCV($name); - if (!$mcl_cv) { + $cv = MCL_CHADO_CV::getCV($name); + if (!$cv) { self::updateMsg($mcl_tmpl, 'E', "(name) = ($name) not found in cv"); return FALSE; } @@ -77,8 +77,8 @@ class MCL_CHADO_CV extends CHADO_CV { if ($cv_id) { // Gets the cv. - $mcl_cv = MCL_CHADO_CV::byKey(array('cv_id' => $cv_id)); - if (!$mcl_cv) { + $cv = MCL_CHADO_CV::byKey(array('cv_id' => $cv_id)); + if (!$cv) { self::updateMsg($mcl_tmpl, 'E', "(cv_id) = ($cv_id) not found in cv"); return FALSE; } @@ -92,6 +92,17 @@ class MCL_CHADO_CV extends CHADO_CV { return TRUE; } + /** + * Returns the cv by cv ID. + * + * @param integer $cv_id + * + * @return MCL_CHADO_CV + */ + public static function getCVByID($cv_id) { + return MCL_CHADO_CV::bykey(array('cv_id' => $cv_id)); + } + /** * Returns the cv by name. * @@ -119,15 +130,15 @@ class MCL_CHADO_CV extends CHADO_CV { public static function addNull() { // Checks if it has already exists. - $mcl_cv = MCL_CHADO_CV::getCV('null'); - if (!$mcl_cv) { + $cv = MCL_CHADO_CV::getCV('null'); + if (!$cv) { $details = array('name' => 'null'); - $mcl_cv = new MCL_CHADO_CV($details); - if (!$mcl_cv->insert()) { + $cv = new MCL_CHADO_CV($details); + if (!$cv->insert()) { return NULL; } } - return $mcl_cv; + return $cv; } /** @@ -150,16 +161,16 @@ class MCL_CHADO_CV extends CHADO_CV { } // Checks for duplication. - $mcl_cv = MCL_CHADO_CV::byKey($args); - if ($mcl_cv) { + $cv = MCL_CHADO_CV::byKey($args); + if ($cv) { self::addMsg($mcl_tmpl, 'D', 'cv', $args); } else { // Adds a new cv. $args['definition'] = $definition; - $mcl_cv = new MCL_CHADO_CV($args); - if ($mcl_cv->insert()) { + $cv = new MCL_CHADO_CV($args); + if ($cv->insert()) { self::addMsg($mcl_tmpl, 'N', 'cv', $args); } else { @@ -167,6 +178,6 @@ class MCL_CHADO_CV extends CHADO_CV { return NULL; } } - return $mcl_cv; + return $cv; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc b/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc index f70b493..2a1afeb 100644 --- a/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc @@ -33,6 +33,18 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { parent::__destruct(); } + /** + * @see CHADO_CVTERM::delete() + */ + public function delete() { + + // Deletes the dbxref first. + db_delete('chado.dbxref') + ->condition('dbxref_id', $this->dbxref_id, '=') + ->execute(); + parent::delete(); + } + /** * Checks the existance of cvterm. If not, write the error messasge * to the log. @@ -47,8 +59,8 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { if ($cv_name && $cvterm_name) { // Gets the cvterm. - $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); - if (!$mcl_cvterm) { + $cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); + if (!$cvterm) { self::updateMsg($mcl_tmpl, 'E', "(cv_name, cvterm_name) = ($cv_name, $cvterm_name) not found in cvterm"); return FALSE; } @@ -119,7 +131,7 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { } /** - * Returns the cvterm. + * Returns the cvterm by cv and cvterm names. * @param string $cv_name * @param string $cvterm_name @@ -127,9 +139,36 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * @return MCL_CHADO_CVTERM */ public static function getCvterm($cv_name, $cvterm_name) { - $mcl_cv = MCL_CHADO_CV::getCV($cv_name); - if ($mcl_cv) { - return MCL_CHADO_CVTERM::bykey(array('cv_id' => $mcl_cv->getCvID(), 'name' => $cvterm_name)); + $cv = MCL_CHADO_CV::getCV($cv_name); + if ($cv) { + return MCL_CHADO_CVTERM::bykey(array('cv_id' => $cv->getCvID(), 'name' => $cvterm_name)); + } + return NULL; + } + + /** + * Returns the cvterm by cvterm ID. + + * @param integer $cvterm_id + * + * @return MCL_CHADO_CVTERM + */ + public static function getCvtermByID($cvterm_id) { + return MCL_CHADO_CVTERM::bykey(array('cvterm_id' => $cvterm_id)); + } + + /** + * Returns the cvterm by cv ID and cvterm name. + + * @param integer $cvterm_id + * @param string $cvterm_name + * + * @return MCL_CHADO_CVTERM + */ + public static function getCvtermByCvID($cv_id, $cvterm_name) { + $cv = MCL_CHADO_CV::getCVByID($cv_id); + if ($cv) { + return MCL_CHADO_CVTERM::bykey(array('cv_id' => $cv_id, 'name' => $cvterm_name)); } return NULL; } @@ -167,23 +206,23 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { public static function addNull() { // Gets null. - $mcl_cv = MCL_CHADO_CV::addNull(); - $mcl_dbxref = MCL_CHADO_DBXREF::addNull(); + $cv = MCL_CHADO_CV::addNull(); + $dbxref = MCL_CHADO_DBXREF::addNull(); // Checks if it has already exists. - $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm('null', 'null'); - if (!$mcl_cvterm) { + $cvterm = MCL_CHADO_CVTERM::getCvterm('null', 'null'); + if (!$cvterm) { $details = array( 'name' => 'null', - 'cv_id' => $mcl_cv->getCvID(), - 'dbxref_id' => $mcl_dbxref->getDbxrefID(), + 'cv_id' => $cv->getCvID(), + 'dbxref_id' => $dbxref->getDbxrefID(), ); - $mcl_cvterm = new MCL_CHADO_CVTERM($details); - if (!$mcl_cvterm->insert()) { + $cvterm = new MCL_CHADO_CVTERM($details); + if (!$cvterm->insert()) { return NULL; } } - return $mcl_cvterm; + return $cvterm; } /** @@ -221,42 +260,42 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { } // Checks for duplication. - $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); - if ($mcl_cvterm) { + $cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); + if ($cvterm) { self::updateMsg($mcl_tmpl, 'D', "(cv.name, cvterm.name) = ($cv_name, $cvterm_name) found in cvterm"); } else { // Gets db. - $mcl_db = MCL_CHADO_DB::getDB($db_name); - if (!$mcl_db) { + $db = MCL_CHADO_DB::getDB($db_name); + if (!$db) { self::updateMsg($mcl_tmpl, 'E', "(db.name) = ($db_name) not found in db"); return NULL; } // Gets cv. - $mcl_cv = MCL_CHADO_CV::getCV($cv_name); - if (!$mcl_cv) { + $cv = MCL_CHADO_CV::getCV($cv_name); + if (!$cv) { self::updateMsg($mcl_tmpl, 'E', "(cv.name) = ($cv_name) not found in cv"); return NULL; } // Sets the accession. if (!$accession) { - $accession = strtoupper($mcl_db->getName()) . ":$cv_name:$cvterm_name"; + $accession = $cv->getCvID() . ":$cvterm_name"; } // Gets dbxref. $args = array( - 'db_id' => $mcl_db->getDbID(), + 'db_id' => $db->getDbID(), 'accession' => $accession, ); - $mcl_dbxref = MCL_CHADO_DBXREF::byKey($args); - if (!$mcl_dbxref) { + $dbxref = MCL_CHADO_DBXREF::byKey($args); + if (!$dbxref) { // Adds a new dbxref. - $mcl_dbxref = new MCL_CHADO_DBXREF($args); - if ($mcl_dbxref->insert()) { + $dbxref = new MCL_CHADO_DBXREF($args); + if ($dbxref->insert()) { self::addMsg($mcl_tmpl, 'N', 'dbxref', $args); } else { @@ -264,17 +303,22 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { return NULL; } } - - // Adds a new cvterm. - if ($mcl_dbxref) { + // Checks for duplication. + $dbxref_id = $dbxref->getDbxrefID(); + $cvterm = MCL_CHADO_CVTERM::byKey(array('dbxref_id' => $dbxref_id)); + if ($cvterm) { + self::updateMsg($mcl_tmpl, 'D', "(dbxref_id) = ($dbxref_id) found in cvterm"); + } + else { $args = array( - 'dbxref_id' => $mcl_dbxref->getDbxrefID(), - 'cv_id' => $mcl_cv->getCvID(), + 'dbxref_id' => $dbxref_id, + 'cv_id' => $cv->getCvID(), 'name' => $cvterm_name, 'definition' => $definition, ); - $mcl_cvterm = new MCL_CHADO_CVTERM($args); - if ($mcl_cvterm->insert()) { + $cvterm = new MCL_CHADO_CVTERM($args); + dpm($args); + if ($cvterm->insert()) { self::addMsg($mcl_tmpl, 'N', 'cvterm', $args); } else { @@ -283,7 +327,24 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { } } } - return $mcl_cvterm; + return $cvterm; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'cvtermprop', 'cvterm_id', $this->cvterm_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -298,13 +359,31 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'cvtermprop', 'cvterm_id', $this->cvterm_id, $type_id, $value, $separator); } return TRUE; } + /** + * Updates the property. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $cv_name + * @param string $cvterm_name + * @param string $value + * + * @return boolean + */ + public function updateProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value) { + if ($value != '') { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->updateProperty($mcl_tmpl, 'cvtermprop', 'cvterm_id', $this->cvterm_id, $type_id, $value); + } + return TRUE; + } + /** * Adds aliases. * @@ -330,7 +409,7 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { // Poluplates the array with aliases. $alias_arr = array(); if ($separator) { - $alias_arr = preg_split($this->getSepRegex($separator), $value, NULL, PREG_SPLIT_NO_EMPTY); + $alias_arr = preg_split($this->getSepRegex($separator), $alias, NULL, PREG_SPLIT_NO_EMPTY); } else { $alias_arr []= $value; @@ -339,11 +418,10 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { // Adds each alias. $args = array( 'cvterm_id' => $this->cvterm_id, - 'type_id' => $type_id, + 'type_id' => $type_id, ); - $rank = 0; foreach ($alias_arr as $val) { - $args['synonym'] = $val; + $args['synonym'] = trim($val); $cvtermsynonym = CHADO_CVTERMSYNONYM::byKey($args); if ($cvtermsynonym) { $this->addMsg($mcl_tmpl, 'D', 'cvtermsynonym', $args); @@ -363,6 +441,52 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { return $flag; } + /** + * Updates aliases. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $cv_name + * @param string $cvterm_name + * @param string $alias + * @param string $separator + * + * @return boolean + */ + public function updateAlias(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $alias, $separator = '') { + if ($alias) { + + // Removes the existing properties first and add new ones. + if (!$this->deleteAlias($cv_name, $cvterm_name)) { + return FALSE; + } + return $this->addAlias($mcl_tmpl, $cv_name, $cvterm_name, $alias, $separator); + } + return TRUE; + } + + /** + * Deletes all aliases for this cvterm. + * + * @param string $cv_name + * @param string $cvterm_name + * + * @return boolean + */ + public function deleteAlias($cv_name, $cvterm_name) { + + // Gets type_id. + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + $args = array( + 'cvterm_id' => $this->cvterm_id, + 'type_id' => $type_id, + ); + + // Deletes the aliases. + $sql = "DELETE FROM {chado.cvtermsynonym} WHERE cvterm_id = :cvterm_id AND type_id = :type_id"; + db_query($sql, $args); + return TRUE; + } + /** * Adds the provided values for quantitative_code, code and qualitative. * diff --git a/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc b/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc index 7e45f09..5471fec 100644 --- a/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc @@ -47,8 +47,8 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { if ($name) { // Gets the dataset. - $mcl_dataset = MCL_CHADO_DATASET::getDataset($name); - if (!$mcl_dataset) { + $dataset = MCL_CHADO_DATASET::getDataset($name); + if (!$dataset) { self::updateMsg($mcl_tmpl, 'E', "(name) = ($name) not found in project"); return FALSE; } @@ -69,8 +69,8 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { if ($project_id) { // Gets the dataset. - $mcl_dataset = MCL_CHADO_DATASET::byKey(array('project_id' => $project_id)); - if (!$mcl_dataset) { + $dataset = MCL_CHADO_DATASET::byKey(array('project_id' => $project_id)); + if (!$dataset) { self::updateMsg($mcl_tmpl, 'E', "(project_id) = ($project_id) not found in project"); return FALSE; } @@ -124,15 +124,15 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { } // Checks for duplication. - $mcl_dataset = MCL_CHADO_DATASET::byKey($args); - if ($mcl_dataset) { + $dataset = MCL_CHADO_DATASET::byKey($args); + if ($dataset) { self::addMsg($mcl_tmpl, 'D', 'project', $args); } else { // Adds a new dataset. - $mcl_dataset = new MCL_CHADO_DATASET($args); - if ($mcl_dataset->insert()) { + $dataset = new MCL_CHADO_DATASET($args); + if ($dataset->insert()) { self::addMsg($mcl_tmpl, 'N', 'project', $args); } else { @@ -140,7 +140,24 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { return NULL; } } - return $mcl_dataset; + return $dataset; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'projectprop', 'project_id', $this->project_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -155,7 +172,7 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'projectprop', 'project_id', $this->project_id, $type_id, $value, $separator); } @@ -176,9 +193,9 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { if ($contact) { $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { - $mcl_contact = MCL_CHADO_CONTACT::byKey(array('name' => trim($name))); - if ($mcl_contact) { - if (!$this->addLink($mcl_tmpl, 'project_contact', 'project_id', $this->project_id, 'contact_id', $mcl_contact->getContactID())) { + $contact = MCL_CHADO_CONTACT::byKey(array('name' => trim($name))); + if ($contact) { + if (!$this->addLink($mcl_tmpl, 'project_contact', 'project_id', $this->project_id, 'contact_id', $contact->getContactID())) { $flag = FALSE; } } @@ -225,8 +242,8 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); - $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); - if ($mcl_pub) { + $pub = MCL_CHADO_PUB::getPub($pub_id); + if ($pub) { if ($this->addLink($mcl_tmpl, 'project_pub', 'project_id', $this->project_id, 'pub_id', $pub_id)) { $flag = FALSE; } diff --git a/includes/class/mcl_chado_class/mcl_chado_db.class.inc b/includes/class/mcl_chado_class/mcl_chado_db.class.inc index 1ba0703..41c5fcc 100644 --- a/includes/class/mcl_chado_class/mcl_chado_db.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_db.class.inc @@ -47,8 +47,8 @@ class MCL_CHADO_DB extends CHADO_DB { if ($db) { // Gets the db. - $mcl_db = MCL_CHADO_DB::getDB($db); - if (!$mcl_db) { + $db = MCL_CHADO_DB::getDB($db); + if (!$db) { self::updateMsg($mcl_tmpl, 'E', "(name) = ($db) not found in db"); return FALSE; } @@ -80,15 +80,15 @@ class MCL_CHADO_DB extends CHADO_DB { public static function addNull() { // Checks if it has already exists. - $mcl_db = MCL_CHADO_DB::getDB('null'); - if (!$mcl_db) { + $db = MCL_CHADO_DB::getDB('null'); + if (!$db) { $details = array('name' => 'null'); - $mcl_db = new MCL_CHADO_DB($details); - if (!$mcl_db->insert()) { + $db = new MCL_CHADO_DB($details); + if (!$db->insert()) { return NULL; } } - return $mcl_db; + return $db; } /** @@ -113,8 +113,8 @@ class MCL_CHADO_DB extends CHADO_DB { } // Checks for duplication. - $mcl_db = MCL_CHADO_DB::byKey($args); - if ($mcl_db) { + $db = MCL_CHADO_DB::byKey($args); + if ($db) { self::addMsg($mcl_tmpl, 'D', 'db', $args); } else { @@ -123,8 +123,8 @@ class MCL_CHADO_DB extends CHADO_DB { $args['urlprefix'] = $prefix_url; $args['url'] = $url; $args['definition'] = $definition; - $mcl_db = new MCL_CHADO_DB($args); - if ($mcl_db->insert()) { + $db = new MCL_CHADO_DB($args); + if ($db->insert()) { self::addMsg($mcl_tmpl, 'N', 'db', $args); } else { @@ -132,6 +132,6 @@ class MCL_CHADO_DB extends CHADO_DB { return NULL; } } - return $mcl_db; + return $db; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc b/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc index e02e3ec..6b7a951 100644 --- a/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc @@ -42,21 +42,21 @@ class MCL_CHADO_DBXREF extends CHADO_DBXREF { public static function addNull() { // Gets null db. - $mcl_db = MCL_CHADO_DB::addNull(); + $db = MCL_CHADO_DB::addNull(); // Checks if it has already exists. - $mcl_dbxref = MCL_CHADO_DBXREF::byKey(array('accession' => 'local:null')); - if (!$mcl_dbxref) { + $dbxref = MCL_CHADO_DBXREF::byKey(array('accession' => 'local:null')); + if (!$dbxref) { $details = array( 'accession' => 'local:null', - 'db_id' => $mcl_db->getDbID(), + 'db_id' => $db->getDbID(), ); - $mcl_dbxref = new MCL_CHADO_CVTERM($details); - if (!$mcl_dbxref->insert()) { + $dbxref = new MCL_CHADO_CVTERM($details); + if (!$dbxref->insert()) { return NULL; } } - return $mcl_dbxref; + return $dbxref; } /** @@ -82,15 +82,15 @@ class MCL_CHADO_DBXREF extends CHADO_DBXREF { } // Checks for duplication. - $mcl_dbxref = MCL_CHADO_DBXREF::byKey($args); - if ($mcl_dbxref) { + $dbxref = MCL_CHADO_DBXREF::byKey($args); + if ($dbxref) { self::addMsg($mcl_tmpl, 'D', 'dbxref', $args); } else { // Adds a new dbxref. - $mcl_dbxref = new MCL_CHADO_DBXREF($args); - if ($mcl_dbxref->insert()) { + $dbxref = new MCL_CHADO_DBXREF($args); + if ($dbxref->insert()) { self::addMsg($mcl_tmpl, 'N', 'dbxref', $args); } else { @@ -98,7 +98,24 @@ class MCL_CHADO_DBXREF extends CHADO_DBXREF { return NULL; } } - return $mcl_dbxref; + return $dbxref; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'dbxrefrop', 'dbxref_id', $this->dbxref_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -113,7 +130,7 @@ class MCL_CHADO_DBXREF extends CHADO_DBXREF { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'dbxrefrop', 'dbxref_id', $this->dbxref_id, $type_id, $value, $separator); } diff --git a/includes/class/mcl_chado_class/mcl_chado_feature.class.inc b/includes/class/mcl_chado_class/mcl_chado_feature.class.inc index 81f7657..c234050 100644 --- a/includes/class/mcl_chado_class/mcl_chado_feature.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_feature.class.inc @@ -53,9 +53,9 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { // Checks the organism_id. $organism_id = ''; if ($genus && $species) { - $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); - if ($mcl_organism) { - $organism_id = $mcl_organism->getOrganismID(); + $organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if ($organism) { + $organism_id = $organism->getOrganismID(); } else { self::updateMsg($mcl_tmpl, 'E', "$genus $species not found in organism"); @@ -93,15 +93,124 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { } // Checks the feature. - $mcl_feature = MCL_CHADO_FEATURE::byKey($args); - if (!$mcl_feature) { - self::updateMsg($mcl_tmpl, 'E', self::arrStr($args) . " not found in feature"); + $checked = MCL_CHADO_FEATURE::checkFeatureAlias($mcl_tmpl, $uniquename, $genus, $species, $type_id); + if (!$checked) { $flag = FALSE; } } return $flag; } + /** + * Checks the existance of feature. If not, write the error messasge + * to the log. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $feature + * @param string $genus + * @param string $species + * @param integer $type_id + * @param string $separator + * + * @return boolean + */ + public static function checkFeatureAlias(MCL_TEMPLATE $mcl_tmpl = NULL, $feature, $genus, $species, $type_id, $separator = '') { + $flag = TRUE; + + // Checks the organism_id. + $organism_id = ''; + if ($genus && $species) { + $organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if ($organism) { + $organism_id = $organism->getOrganismID(); + } + else { + self::updateMsg($mcl_tmpl, 'E', "$genus $species not found in organism"); + return FALSE; + } + } + + // Gets the uniquenames. + $uniquenames = preg_split(self::getSepRegex($separator), $feature, NULL, PREG_SPLIT_NO_EMPTY); + foreach ($uniquenames as $uniquename) { + $uniquename = trim($uniquename); + + // Sets the arguments. + $args = array( + 'uniquename' => $uniquename, + 'type_id' => $type_id, + ); + if ($organism_id) { + $args['organism_id'] = $organism_id; + } + + // If '::' found in uniquename, update uniquename and organism_id. + if (preg_match("/^(.*?)\s+(.*?)::(.*?)$/", $uniquename, $matches)) { + $genus = trim($matches[1]); + $species = trim($matches[2]); + $uniquename = trim($matches[3]); + $diff_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if ($diff_organism) { + $args['organism_id'] = $diff_organism->getOrganismID(); + } + else { + self::updateMsg($mcl_tmpl, 'E', "$genus $species not found in organism"); + $flag = FALSE; + } + } + + // Checks the feature. + $feature = MCL_CHADO_FEATURE::byKey($args); + if (!$feature) { + + // Search for alias. + $sql = " + SELECT COUNT(S.synonym_id) + FROM {chado.synonym} S + INNER JOIN {chado.feature_synonym} FS on FS.synonym_id = S.synonym_id + WHERE LOWER(S.name) = LOWER(:name) + "; + $num = db_query($sql, array(':name' => $uniquename))->fetchField(); + if ($num > 1) { + self::updateMsg($mcl_tmpl, 'E', "The alias '$uniquename' is ambiguous. Please not use this alias"); + $flag = FALSE; + } + else if ($num < 1) { + self::updateMsg($mcl_tmpl, 'E', self::arrStr($args) . " not found in feature"); + $flag = FALSE; + } + } + } + return $flag; + } + + /** + * Returns the feature by uniquename, genus, species and type_id. + * + * @param string $uniquename + * @param array $type_ids + * + * @return MCL_CHADO_FEATURE + */ + public static function checkMarkerMtlQtl(MCL_TEMPLATE $mcl_tmpl = NULL, $uniquename, $type_ids) { + + // Checks the uniquename for MTL. + $mtl = self::getFeature($uniquename, '', '', $type_ids['mtl']); + if (!$mtl) { + + // Checks the uniquename for QTL. + $qtl = self::getFeature($uniquename, '', '', $type_ids['qtl']); + if (!$qtl) { + + // Checks the uniquename for marker. + $marker = self::checkFeatureAlias($mcl_tmpl, $uniquename, '', '', $type_ids['marker']); + if (!$marker) { + $mcl_tmpl->updateMsg('E', "Error - $uniquename is not 'Genetic marker', 'QTL' or 'MTL'"); + } + } + } + } + /** * Returns the feature by uniquename, genus, species and type_id. * @@ -117,9 +226,9 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { // Gets the organism_id. $organism_id = ''; if ($genus && $species) { - $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); - if ($mcl_organism) { - $organism_id = $mcl_organism->getOrganismID(); + $organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if ($organism) { + $organism_id = $organism->getOrganismID(); } else { return NULL; @@ -153,9 +262,9 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { // Gets the organism_id. $organism_id = ''; if ($genus && $species) { - $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); - if ($mcl_organism) { - $organism_id = $mcl_organism->getOrganismID(); + $organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if ($organism) { + $organism_id = $organism->getOrganismID(); } else { return NULL; @@ -293,6 +402,23 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { return $feature; } + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'featureprop', 'feature_id', $this->feature_id, $type_id, $value, $separator); + } + return TRUE; + } + /** * Adds a property. * @@ -305,7 +431,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'featureprop', 'feature_id', $this->feature_id, $type_id, $value, $separator); } @@ -316,18 +442,19 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * Adds related feature to feature_relationship. * * @param MCL_TEMPLATE $mcl_tmpl - * @param MCL_CHADO_FEATURE $mcl_feature + * @param MCL_CHADO_FEATURE $feature * @param integer $type_id + * @param boolean $swap * * @return boolean */ - public function addRelatedFeature(MCL_TEMPLATE $mcl_tmpl = NULL, $mcl_feature, $type_id, $swap = FALSE) { - if ($mcl_feature) { + public function addRelatedFeature(MCL_TEMPLATE $mcl_tmpl = NULL, $feature, $type_id, $swap = FALSE) { + if ($feature) { if ($swap) { - return $this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $mcl_feature->getFeatureID(), 'object_id', $this->feature_id, $type_id); + return $this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $feature->getFeatureID(), 'object_id', $this->feature_id, $type_id); } else { - return $this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $this->feature_id, 'object_id', $mcl_feature->getFeatureID(), $type_id); + return $this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $this->feature_id, 'object_id', $feature->getFeatureID(), $type_id); } } return TRUE; @@ -342,10 +469,11 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * @param integer $relationship_type_id * @param boollean $use_organism_id * @param string $separator + * @param boolean $swap * * @return boolean */ - public function addRelatedFeatures(MCL_TEMPLATE $mcl_tmpl = NULL, $features, $feature_type_id, $use_organism_id, $relationship_type_id, $separator = '') { + public function addRelatedFeatures(MCL_TEMPLATE $mcl_tmpl = NULL, $features, $feature_type_id, $use_organism_id, $relationship_type_id, $separator = '', $swap = FALSE) { $flag = TRUE; if ($features) { $uniquenames = preg_split($this->getSepRegex($separator), $features, NULL, PREG_SPLIT_NO_EMPTY); @@ -372,10 +500,17 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { } // Adds a feature. - $mcl_feature = MCL_CHADO_FEATURE::byKey($args); - if ($mcl_feature) { - if (!$this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $this->feature_id, 'object_id', $mcl_feature->getFeatureID(), $relationship_type_id)) { - $flag = FALSE; + $feature = MCL_CHADO_FEATURE::byKey($args); + if ($feature) { + if ($swap) { + if (!$this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $feature->getFeatureID(), 'object_id', $this->feature_id, $relationship_type_id)) { + $flag = FALSE; + } + } + else { + if (!$this->addRelationship($mcl_tmpl, 'feature_relationship', 'subject_id', $this->feature_id, 'object_id', $feature->getFeatureID(), $relationship_type_id)) { + $flag = FALSE; + } } } } @@ -456,20 +591,20 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { 'type_id' => $type_id_feature, 'organism_id' => $this->organism_id, ); - $mcl_feature = MCL_CHADO_FEATURE::byKey($args); - if ($mcl_feature) { + $feature = MCL_CHADO_FEATURE::byKey($args); + if ($feature) { $this->addMsg($mcl_tmpl, 'D', 'feature', $args); } else { // Adds a sequence. $args['residues'] = $seq; - $mcl_feature = new MCL_CHADO_FEATURE($args); - if ($mcl_feature->insert()) { + $feature = new MCL_CHADO_FEATURE($args); + if ($feature->insert()) { $this->addMsg($mcl_tmpl, 'N', 'feature', $args); // Adds a relationship. - $this->addRelatedFeature($mcl_tmpl, $mcl_feature, $type_id_relationship, $swap); + $this->addRelatedFeature($mcl_tmpl, $feature, $type_id_relationship, $swap); } else { $this->addMsg($mcl_tmpl, 'E', 'feature', $args); @@ -496,9 +631,9 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $accessions = preg_split($this->getSepRegex($separator), $dbxref, NULL, PREG_SPLIT_NO_EMPTY); foreach ($accessions as $accession) { $accession = trim($accession); - $mcl_dbxref = MCL_CHADO_DBXREF::addDBXref($mcl_tmpl, $db_id, $accession); - if ($mcl_dbxref) { - if (!$this->addLink($mcl_tmpl, 'feature_dbxref', 'feature_id', $this->getFeatureID(), 'dbxref_id', $mcl_dbxref->getDbxrefID())) { + $dbxref = MCL_CHADO_DBXREF::addDBXref($mcl_tmpl, $db_id, $accession); + if ($dbxref) { + if (!$this->addLink($mcl_tmpl, 'feature_dbxref', 'feature_id', $this->getFeatureID(), 'dbxref_id', $dbxref->getDbxrefID())) { $flag = FALSE; } } @@ -635,16 +770,16 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { * Adds synoym and feature_synoym. * * @param MCL_TEMPLATE $mcl_tmpl - * @param MCL_CHADO_SYNONYM $mcl_synonym + * @param MCL_CHADO_SYNONYM $synonym * * @return boolean */ - public function addSynonym(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_SYNONYM $mcl_synonym) { - if ($mcl_synonym) { + public function addSynonym(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_SYNONYM $synonym) { + if ($synonym) { // Checks for duplication. $args = array( - 'synonym_id' => $mcl_synonym->getSynonymID(), + 'synonym_id' => $synonym->getSynonymID(), 'feature_id' => $this->feature_id, 'pub_id' => MCL_VAR::getValueByName('PUB_ID'), ); @@ -683,9 +818,9 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); - $mcl_contact = MCL_CHADO_CONTACT::getContact($name); - if ($mcl_contact) { - if (!$this->addLink($mcl_tmpl, 'feature_contact', 'feature_id', $this->feature_id, 'contact_id', $mcl_contact->getContactID())) { + $contact = MCL_CHADO_CONTACT::getContact($name); + if ($contact) { + if (!$this->addLink($mcl_tmpl, 'feature_contact', 'feature_id', $this->feature_id, 'contact_id', $contact->getContactID())) { $flag = FALSE; } } @@ -769,13 +904,13 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { if ($stock) { // Gets orgaims_id. - $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); - if ($mcl_organism) { + $organism = MCL_CHADO_ORGANISM::getOrganism($genus, $species); + if ($organism) { $uniquenames = preg_split($this->getSepRegex($separator), $stock, NULL, PREG_SPLIT_NO_EMPTY); foreach ($uniquenames as $uniquename) { $uniquename = trim($uniquename); - $organism_id = $mcl_organism->getOrganismID(); + $organism_id = $organism->getOrganismID(); // If '::' found in uniquename, update uniquename and organism_id. if (preg_match("/^(.*?)\s+(.*?)::(.*?)$/", $uniquename, $matches)) { @@ -787,9 +922,9 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { } // Adds a stock. - $mcl_stock = MCL_CHADO_STOCK::byKey(array('uniquename' => $uniquename, 'organism_id' => $organism_id)); + $stock = MCL_CHADO_STOCK::byKey(array('uniquename' => $uniquename, 'organism_id' => $organism_id)); if ($mcl_stock) { - if (!$this->addLink($mcl_tmpl, 'feature_stock', 'feature_id', $this->feature_id, 'stock_id', $mcl_stock->getStockID(), $type_id)) { + if (!$this->addLink($mcl_tmpl, 'feature_stock', 'feature_id', $this->feature_id, 'stock_id', $stock->getStockID(), $type_id)) { $flag = FALSE; } } @@ -859,9 +994,9 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $eimage_ids = preg_split($this->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); foreach ($eimage_ids as $eimage_id) { $eimage_id = trim($eimage_id); - $mcl_image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); - if ($mcl_image) { - if (!$this->addLink($mcl_tmpl, 'feature_image', 'feature_id', $this->feature_id, 'eimage_id', $mcl_image->getEimageID())) { + $image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); + if ($image) { + if (!$this->addLink($mcl_tmpl, 'feature_image', 'feature_id', $this->feature_id, 'eimage_id', $image->getEimageID())) { $flag = FALSE; } } @@ -888,8 +1023,8 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); - $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); - if ($mcl_pub) { + $pub = MCL_CHADO_PUB::getPub($pub_id); + if ($pub) { if (!$this->addLink($mcl_tmpl, 'feature_pub', 'feature_id', $this->feature_id, 'pub_id', $pub_id)) { $flag = FALSE; } diff --git a/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc b/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc index 3afdcb6..22e5828 100644 --- a/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc @@ -52,8 +52,8 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { $names = preg_split(self::getSepRegex($separator), $map, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); - $mcl_map = MCL_CHADO_FEATUREMAP::getMap($name); - if (!$mcl_map) { + $map = MCL_CHADO_FEATUREMAP::getMap($name); + if (!$map) { self::updateMsg($mcl_tmpl, 'E', "(name) = ($name) not found in featuremap"); $flag = FALSE; } @@ -74,8 +74,8 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { public static function checkMapUnit(MCL_TEMPLATE $mcl_tmpl = NULL, $map_unit) { // Gets cvterm for the map unit. - $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm('SITE_CV', $map_unit); - if (!$mcl_cvterm) { + $cvterm = MCL_CHADO_CVTERM::getCvterm('SITE_CV', $map_unit); + if (!$cvterm) { self::updateMsg($mcl_tmpl, 'E', "(map_unit) = ($map_unit) not found in cvterm"); return FALSE; } @@ -114,8 +114,8 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { } // Checks for duplication. - $mcl_featuremap = MCL_CHADO_FEATUREMAP::byKey($args); - if ($mcl_featuremap) { + $featuremap = MCL_CHADO_FEATUREMAP::byKey($args); + if ($featuremap) { self::addMsg($mcl_tmpl, 'D', 'featuremap', $args); } else { @@ -130,8 +130,8 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { // Adds a new map. $args['unittype_id'] = $cvterm->getCvtermID(); $args['description'] = $description; - $mcl_featuremap = new MCL_CHADO_FEATUREMAP($args); - if ($mcl_featuremap->insert()) { + $featuremap = new MCL_CHADO_FEATUREMAP($args); + if ($featuremap->insert()) { self::addMsg($mcl_tmpl, 'N', 'featuremap', $args); } else { @@ -139,7 +139,24 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { return NULL; } } - return $mcl_featuremap; + return $featuremap; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'featuremapprop', 'featuremap_id', $this->featuremap_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -154,7 +171,7 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'featuremapprop', 'featuremap_id', $this->featuremap_id, $type_id, $value, $separator); } @@ -179,9 +196,9 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { $sp = trim($sp); // Gets the organism. - $mcl_organism = MCL_CHADO_ORGANISM::getOrganism($genus, $sp); - if ($mcl_organism) { - if (!$this->addLink($mcl_tmpl, 'featuremap_organism', 'featuremap_id', $this->featuremap_id, 'organism_id', $mcl_organism->getOrganismID())) { + $organism = MCL_CHADO_ORGANISM::getOrganism($genus, $sp); + if ($organism) { + if (!$this->addLink($mcl_tmpl, 'featuremap_organism', 'featuremap_id', $this->featuremap_id, 'organism_id', $organism->getOrganismID())) { $flag = FALSE; } } @@ -231,9 +248,9 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { } // Gets the stock and add it. - $mcl_stock = MCL_CHADO_STOCK::byKey($args); - if ($mcl_stock) { - if (!$this->addLink($mcl_tmpl, 'featuremap_stock', 'featuremap_id', $this->featuremap_id, 'stock_id', $mcl_stock->getStockID())) { + $stock = MCL_CHADO_STOCK::byKey($args); + if ($stock) { + if (!$this->addLink($mcl_tmpl, 'featuremap_stock', 'featuremap_id', $this->featuremap_id, 'stock_id', $stock->getStockID())) { $flag = FALSE; } } @@ -261,9 +278,9 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); - $mcl_contact = MCL_CHADO_CONTACT::getContact($name); - if ($mcl_contact) { - if (!$this->addLink($mcl_tmpl, 'featuremap_contact', 'featuremap_id', $this->featuremap_id, 'contact_id', $mcl_contact->getContactID())) { + $contact = MCL_CHADO_CONTACT::getContact($name); + if ($contact) { + if (!$this->addLink($mcl_tmpl, 'featuremap_contact', 'featuremap_id', $this->featuremap_id, 'contact_id', $contact->getContactID())) { $flag = FALSE; } } @@ -290,8 +307,8 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); - $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); - if ($mcl_pub) { + $pub = MCL_CHADO_PUB::getPub($pub_id); + if ($pub) { if (!$this->addLink($mcl_tmpl, 'featuremap_pub', 'featuremap_id', $this->featuremap_id, 'pub_id', $pub_id)) { $flag = FALSE; } diff --git a/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc b/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc index 40f2828..17dec56 100644 --- a/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc @@ -79,6 +79,23 @@ class MCL_CHADO_FEATUREPOS extends CHADO_FEATUREPOS { return $featurepos; } + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'featureposprop', 'featurepos_id', $this->featurepos_id, $type_id, $value, $separator); + } + return TRUE; + } + /** * Adds a property. * diff --git a/includes/class/mcl_chado_class/mcl_chado_genotype.class.inc b/includes/class/mcl_chado_class/mcl_chado_genotype.class.inc index 603c0e1..76e8648 100644 --- a/includes/class/mcl_chado_class/mcl_chado_genotype.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_genotype.class.inc @@ -58,16 +58,16 @@ class MCL_CHADO_GENOTYPE extends CHADO_GENOTYPE { } // Checks for duplication. - $mcl_genotype = MCL_CHADO_GENOTYPE::byKey($args); - if ($mcl_genotype) { + $genotype = MCL_CHADO_GENOTYPE::byKey($args); + if ($genotype) { self::addMsg($mcl_tmpl, 'D', 'genotype', $args); } else { // Adds a new genotype. $args['description'] = $description; - $mcl_genotype = new MCL_CHADO_GENOTYPE($args); - if ($mcl_genotype->insert()) { + $genotype = new MCL_CHADO_GENOTYPE($args); + if ($genotype->insert()) { self::addMsg($mcl_tmpl, 'N', 'genotype', $args); } else { @@ -75,7 +75,24 @@ class MCL_CHADO_GENOTYPE extends CHADO_GENOTYPE { return NULL; } } - return $mcl_genotype; + return $genotype; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'genotypeprop', 'genotype_id', $this->genotype_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -90,7 +107,7 @@ class MCL_CHADO_GENOTYPE extends CHADO_GENOTYPE { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'genotypeprop', 'genotype_id', $this->genotype_id, $type_id, $value, $separator); } diff --git a/includes/class/mcl_chado_class/mcl_chado_genotype_call.class.inc b/includes/class/mcl_chado_class/mcl_chado_genotype_call.class.inc index aa58d08..7a2509a 100644 --- a/includes/class/mcl_chado_class/mcl_chado_genotype_call.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_genotype_call.class.inc @@ -49,15 +49,15 @@ class MCL_CHADO_GENOTYPE_CALL extends CHADO_GENOTYPE_CALL { } // Checks for duplication. - $mcl_genotype_call = MCL_CHADO_GENOTYPE_CALL::byKey($args); - if ($mcl_genotype_call) { + $genotype_call = MCL_CHADO_GENOTYPE_CALL::byKey($args); + if ($genotype_call) { self::addMsg($mcl_tmpl, 'D', 'genotype_call', $args); } else { // Adds a new genotype. - $mcl_genotype_call = new MCL_CHADO_GENOTYPE_CALL($args); - if ($mcl_genotype_call->insert()) { + $genotype_call = new MCL_CHADO_GENOTYPE_CALL($args); + if ($genotype_call->insert()) { self::addMsg($mcl_tmpl, 'N', 'genotype_call', $args); } else { @@ -65,6 +65,6 @@ class MCL_CHADO_GENOTYPE_CALL extends CHADO_GENOTYPE_CALL { return NULL; } } - return $mcl_genotype_call; + return $genotype_call; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_image.class.inc b/includes/class/mcl_chado_class/mcl_chado_image.class.inc index 0253619..99e3b5d 100644 --- a/includes/class/mcl_chado_class/mcl_chado_image.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_image.class.inc @@ -58,8 +58,8 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { continue; } $args = array('eimage_id' => $eimage_id); - $mcl_image = MCL_CHADO_IMAGE::byKey($args); - if (!$mcl_image) { + $image = MCL_CHADO_IMAGE::byKey($args); + if (!$image) { self::addMsg($mcl_tmpl, 'E', 'eimage', $args); $flag = FALSE; } @@ -93,14 +93,14 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { } // Checks for duplication. - $mcl_image = MCL_CHADO_IMAGE::byKey($args); - if ($mcl_image) { + $image = MCL_CHADO_IMAGE::byKey($args); + if ($image) { self::updateMsg($mcl_tmpl, 'D', 'eimage', $args); } else { // Adds a new image. - $mcl_image = new MCL_CHADO_IMAGE($args); - if ($mcl_image->insert()) { + $image = new MCL_CHADO_IMAGE($args); + if ($image->insert()) { self::updateMsg($mcl_tmpl, 'N', 'eimage', $args); } else { @@ -108,7 +108,24 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { return NULL; } } - return $mcl_image; + return $image; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'eimageprop', 'eimage_id', $this->eimage_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -123,7 +140,7 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'eimageprop', 'eimage_id', $this->eimage_id, $type_id, $value, $separator); } diff --git a/includes/class/mcl_chado_class/mcl_chado_library.class.inc b/includes/class/mcl_chado_class/mcl_chado_library.class.inc index f54148a..accfb75 100644 --- a/includes/class/mcl_chado_class/mcl_chado_library.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_library.class.inc @@ -53,8 +53,8 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { } // Gets the library. - $mcl_library = MCL_CHADO_LIBRARY::getLibrary($uniquename, $type_id, $organism_id); - if (!$mcl_library) { + $library = MCL_CHADO_LIBRARY::getLibrary($uniquename, $type_id, $organism_id); + if (!$library) { self::updateMsg($mcl_tmpl, 'E', "(uniquename, type_id, organism_id) = ($uniquename, $type_id, $organism_id) not found in library"); return FALSE; } @@ -114,16 +114,16 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { } // Checks for duplication. - $mcl_library = MCL_CHADO_LIBRARY::byKey($args); - if ($mcl_library) { + $library = MCL_CHADO_LIBRARY::byKey($args); + if ($library) { self::addMsg($mcl_tmpl, 'D', 'library', $args); } else { // Adds a new library. $args['name'] = $uniquename; - $mcl_library = new MCL_CHADO_LIBRARY($args); - if ($mcl_library->insert()) { + $library = new MCL_CHADO_LIBRARY($args); + if ($library->insert()) { self::addMsg($mcl_tmpl, 'N', 'library', $args); } else { @@ -131,7 +131,24 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { return NULL; } } - return $mcl_library; + return $library; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'libraryprop', 'library_id', $this->library_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -146,7 +163,7 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'libraryprop', 'library_id', $this->library_id, $type_id, $value, $separator); } @@ -157,16 +174,16 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { * Adds synoym and library_synoym. * * @param MCL_TEMPLATE $mcl_tmpl - * @param MCL_CHADO_SYNONYM $mcl_synonym + * @param MCL_CHADO_SYNONYM $synonym * * @return boolean */ - public function addSynonym(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_SYNONYM $mcl_synonym) { - if ($mcl_synonym) { + public function addSynonym(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_SYNONYM $synonym) { + if ($synonym) { // Checks for duplication. $args = array( - 'synonym_id' => $mcl_synonym->getSynonymID(), + 'synonym_id' => $synonym->getSynonymID(), 'library_id' => $this->library_id, 'pub_id' => MCL_VAR::getValueByName('PUB_ID'), ); @@ -205,9 +222,9 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); - $mcl_contact = MCL_CHADO_CONTACT::byKey(array('name' => $name)); - if ($mcl_contact) { - if (!$this->addLink($mcl_tmpl, 'library_contact', 'library_id', $this->library_id, 'contact_id', $mcl_contact->getContactID())) { + $contact = MCL_CHADO_CONTACT::byKey(array('name' => $name)); + if ($contact) { + if (!$this->addLink($mcl_tmpl, 'library_contact', 'library_id', $this->library_id, 'contact_id', $contact->getContactID())) { $flag = FALSE; } } @@ -234,8 +251,8 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); - $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); - if ($mcl_pub) { + $pub = MCL_CHADO_PUB::getPub($pub_id); + if ($pub) { $this->addLink($mcl_tmpl, 'library_pub', 'library_id', $this->library_id, 'pub_id', $pub_id); } else { diff --git a/includes/class/mcl_chado_class/mcl_chado_location.class.inc b/includes/class/mcl_chado_class/mcl_chado_location.class.inc index d12a615..10a1b63 100644 --- a/includes/class/mcl_chado_class/mcl_chado_location.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_location.class.inc @@ -81,9 +81,9 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { $args = array( 'description' => $description, ); - $mcl_location = MCL_CHADO_LOCATION::byKey($args); - if ($mcl_location) { - $nd_geolocation_id = $mcl_location->getNdGeolocationID(); + $location = MCL_CHADO_LOCATION::byKey($args); + if ($location) { + $nd_geolocation_id = $location->getNdGeolocationID(); } else { return NULL; @@ -136,9 +136,9 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { $args = array( 'description' => $site_name, ); - $mcl_location = MCL_CHADO_LOCATION::byKey($args); - if ($mcl_location) { - $nd_geolocation_id = $mcl_location->getNdGeolocationID(); + $location = MCL_CHADO_LOCATION::byKey($args); + if ($location) { + $nd_geolocation_id = $location->getNdGeolocationID(); } else { return NULL; @@ -155,15 +155,15 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { public static function addNA() { // Checks if it has already exists. - $mcl_location = MCL_CHADO_LOCATION::byKey(array('description' => 'Not Available')); - if (!$mcl_location) { + $location = MCL_CHADO_LOCATION::byKey(array('description' => 'Not Available')); + if (!$location) { $details = array('description' => 'Not Available'); - $mcl_location = new MCL_CHADO_LOCATION($details); - if (!$mcl_location->insert()) { + $location = new MCL_CHADO_LOCATION($details); + if (!$location->insert()) { return NULL; } } - return $mcl_location; + return $location; } /** @@ -202,8 +202,8 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { } // Checks for duplication. - $mcl_location = MCL_CHADO_LOCATION::byKey($args); - if ($mcl_location) { + $location = MCL_CHADO_LOCATION::byKey($args); + if ($location) { self::addMsg($mcl_tmpl, 'D', 'nd_geolocation', $args); } else { @@ -215,8 +215,8 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { } // Adds a new location. - $mcl_location = new MCL_CHADO_LOCATION($args); - if ($mcl_location->insert()) { + $location = new MCL_CHADO_LOCATION($args); + if ($location->insert()) { self::addMsg($mcl_tmpl, 'N', 'nd_geolocation', $args); } else { @@ -224,7 +224,24 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { return NULL; } } - return $mcl_location; + return $location; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'nd_geolocationprop', 'nd_geolocation_id', $this->nd_geolocation_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -239,10 +256,28 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'nd_geolocationprop', 'nd_geolocation_id', $this->nd_geolocation_id, $type_id, $value, $separator); } return TRUE; } + + /** + * Updates the property. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $cv_name + * @param string $cvterm_name + * @param string $value + * + * @return boolean + */ + public function updateProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value) { + if ($value != '') { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->updateProperty($mcl_tmpl, 'nd_geolocationprop', 'nd_geolocation_id', $this->nd_geolocation_id, $type_id, $value); + } + return TRUE; + } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc b/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc index 8751223..d5aa310 100644 --- a/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc @@ -79,7 +79,7 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { } /** - * Returns parent by cross number. + * Returns the cross by cross number. * * @param integer $dataset_name * @param string $cross_number @@ -148,7 +148,7 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { $chado_nd_experimentprop = CHADO_ND_EXPERIMENTPROP::byKey($args); if ($chado_nd_experimentprop) { self::updateMsg($mcl_tmpl, 'D', "nd_experiment of the dup_value ($dup_value) for $cvterm_id already exists"); - $mcl_nd_experiment = MCL_CHADO_ND_EXPERIMENT::byKey(array('nd_experiment_id' => $chado_nd_experimentprop->getNdExperimentID())); + $nd_experiment = MCL_CHADO_ND_EXPERIMENT::byKey(array('nd_experiment_id' => $chado_nd_experimentprop->getNdExperimentID())); } else { @@ -157,13 +157,13 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { 'type_id' => $type_id, 'nd_geolocation_id' => $nd_geolocation_id, ); - $mcl_nd_experiment = new MCL_CHADO_ND_EXPERIMENT($args); - if ($mcl_nd_experiment->insert()) { + $nd_experiment = new MCL_CHADO_ND_EXPERIMENT($args); + if ($nd_experiment->insert()) { self::addMsg($mcl_tmpl, 'N', 'nd_experiment', $args); // Adds a new nd_experimentprop. $args = array( - 'nd_experiment_id' => $mcl_nd_experiment->getNdExperimentID(), + 'nd_experiment_id' => $nd_experiment->getNdExperimentID(), 'type_id' => $cvterm_id, 'value' => $dup_value, ); @@ -181,7 +181,24 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { return NULL; } } - return $mcl_nd_experiment; + return $nd_experiment; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'nd_experimentprop', 'nd_experiment_id', $this->nd_experiment_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -196,13 +213,31 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'nd_experimentprop', 'nd_experiment_id', $this->nd_experiment_id, $type_id, $value, $separator); } return TRUE; } + /** + * Updates the property. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param string $cv_name + * @param string $cvterm_name + * @param string $value + * + * @return boolean + */ + public function updateProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value) { + if ($value != '') { + $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); + return $this->updateProperty($mcl_tmpl, 'nd_experimentprop', 'nd_experiment_id', $this->nd_experiment_id, $type_id, $value); + } + return TRUE; + } + /** * Adds stock to nd_experiment_stock. * @@ -211,13 +246,52 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * * @return boolean */ - public function addStock(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_STOCK $mcl_stock, $type_id) { - if ($mcl_stock && $type_id) { - return $this->addLink($mcl_tmpl, 'nd_experiment_stock', 'nd_experiment_id', $this->nd_experiment_id, 'stock_id', $mcl_stock->getStockID(), $type_id); + public function addStock(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_STOCK $stock, $type_id) { + if ($stock && $type_id) { + return $this->addLink($mcl_tmpl, 'nd_experiment_stock', 'nd_experiment_id', $this->nd_experiment_id, 'stock_id', $stock->getStockID(), $type_id); } return TRUE; } + /** + * Updates the stock_id in nd_experiment_stock. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $stock_id + * + * @return boolean + */ + public function updateStockByID(MCL_TEMPLATE $mcl_tmpl = NULL, $stock_id, $type_id) { + if ($type_id) { + + // Sets properties. + $args = array( + 'nd_experiment_id' => $this->nd_experiment_id, + 'type_id' => $type_id, + ); + $nes = CHADO_ND_EXPERIMENT_STOCK::byKey($args); + if ($nes) { + + // Updates the relationship. + if ($stock_id) { + $nes->setStockID($stock_id); + return $nes->update(); + } + + // Removes the relationship. + else { + return $nes->delete(); + } + } + else { + $args['stock_id'] = $stock_id; + $nes = new CHADO_ND_EXPERIMENT_STOCK($args); + return $nes->insert(); + } + } + return FALSE; + } + /** * Adds phenotype to nd_experiment_phenotype. * @@ -226,9 +300,9 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * * @return boolean */ - public function addPhenotype(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_PHENOTYPE $mcl_phenotype) { - if ($mcl_phenotype) { - return $this->addLink($mcl_tmpl, 'nd_experiment_phenotype', 'nd_experiment_id', $this->nd_experiment_id, 'phenotype_id', $mcl_phenotype->getPhenotypeID()); + public function addPhenotype(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_PHENOTYPE $phenotype) { + if ($phenotype) { + return $this->addLink($mcl_tmpl, 'nd_experiment_phenotype', 'nd_experiment_id', $this->nd_experiment_id, 'phenotype_id', $phenotype->getPhenotypeID()); } return TRUE; } @@ -241,9 +315,9 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { * * @return boolean */ - public function addGenotype(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_GENOTYPE $mcl_genotype) { - if ($mcl_genotype) { - return $this->addLink($mcl_tmpl, 'nd_experiment_genotype', 'nd_experiment_id', $this->nd_experiment_id, 'genotype_id', $mcl_genotype->getGenotypeID()); + public function addGenotype(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_GENOTYPE $genotype) { + if ($genotype) { + return $this->addLink($mcl_tmpl, 'nd_experiment_genotype', 'nd_experiment_id', $this->nd_experiment_id, 'genotype_id', $genotype->getGenotypeID()); } return TRUE; } @@ -282,9 +356,9 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); - $mcl_contact = MCL_CHADO_CONTACT::getContact($name); - if ($mcl_contact) { - if (!$this->addLink($mcl_tmpl, 'nd_experiment_contact', 'nd_experiment_id', $this->nd_experiment_id, 'contact_id', $mcl_contact->getContactID())) { + $contact = MCL_CHADO_CONTACT::getContact($name); + if ($contact) { + if (!$this->addLink($mcl_tmpl, 'nd_experiment_contact', 'nd_experiment_id', $this->nd_experiment_id, 'contact_id', $contact->getContactID())) { $flag = FALSE; } } @@ -311,8 +385,8 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); - $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); - if ($mcl_pub) { + $pub = MCL_CHADO_PUB::getPub($pub_id); + if ($pub) { if (!$this->addLink($mcl_tmpl, 'nd_experiment_pub', 'nd_experiment_id', $this->nd_experiment_id, 'pub_id', $pub_id)) { $flag = FALSE; } diff --git a/includes/class/mcl_chado_class/mcl_chado_organism.class.inc b/includes/class/mcl_chado_class/mcl_chado_organism.class.inc index 1799fb0..a4a64ba 100644 --- a/includes/class/mcl_chado_class/mcl_chado_organism.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_organism.class.inc @@ -73,8 +73,8 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { $sp = trim($sp); // Gets the orgainsm. - $mcl_orgainsm = MCL_CHADO_ORGANISM::getOrganism($genus, $sp); - if (!$mcl_orgainsm) { + $orgainsm = MCL_CHADO_ORGANISM::getOrganism($genus, $sp); + if (!$orgainsm) { self::updateMsg($mcl_tmpl, 'E', "(genus, species) = ($genus, $sp) not found in organism"); $flag = FALSE; } @@ -122,8 +122,8 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { } // Checks for duplication. - $mcl_orgainsm = MCL_CHADO_ORGANISM::byKey($args); - if ($mcl_orgainsm) { + $orgainsm = MCL_CHADO_ORGANISM::byKey($args); + if ($orgainsm) { self::addMsg($mcl_tmpl, 'D', 'orgainsm', $args); } else { @@ -131,8 +131,8 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { // Adds a new orgainsm. $args['type_id'] = $type_id; $args['description'] = $description; - $mcl_orgainsm = new MCL_CHADO_ORGANISM($args); - if ($mcl_orgainsm->insert()) { + $orgainsm = new MCL_CHADO_ORGANISM($args); + if ($orgainsm->insert()) { self::addMsg($mcl_tmpl, 'N', 'orgainsm', $args); } else { @@ -140,7 +140,7 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { return NULL; } } - return $mcl_orgainsm; + return $orgainsm; } /** @@ -151,18 +151,35 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { public static function addNA() { // Checks if it has already exists. - $mcl_organism = MCL_CHADO_ORGANISM::getOrganism('N/A', 'N/A'); - if (!$mcl_organism) { + $organism = MCL_CHADO_ORGANISM::getOrganism('N/A', 'N/A'); + if (!$organism) { $details = array( 'genus' => 'N/A', 'species' => 'N/A', ); - $mcl_organism = new MCL_CHADO_ORGANISM($details); - if (!$mcl_organism->insert()) { + $organism = new MCL_CHADO_ORGANISM($details); + if (!$organism->insert()) { return NULL; } } - return $mcl_organism; + return $organism; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'organismprop', 'organism_id', $this->organism_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -177,7 +194,7 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'organismprop', 'organism_id', $this->organism_id, $type_id, $value, $separator); } @@ -227,9 +244,9 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { $eimage_ids = preg_split($this->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); foreach ($eimage_ids as $eimage_id) { $eimage_id = trim($eimage_id); - $mcl_image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); - if ($mcl_image) { - if (!$this->addLink($mcl_tmpl, 'organism_image', 'organism_id', $this->organism_id, 'eimage_id', $mcl_image->getEimageID())) { + $image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); + if ($image) { + if (!$this->addLink($mcl_tmpl, 'organism_image', 'organism_id', $this->organism_id, 'eimage_id', $image->getEimageID())) { $flag = FALSE; } } @@ -256,8 +273,8 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); - $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); - if ($mcl_pub) { + $pub = MCL_CHADO_PUB::getPub($pub_id); + if ($pub) { if (!$this->addLink($mcl_tmpl, 'organism_pub', 'organism_id', $this->organism_id, 'pub_id', $pub_id)) { $flag = FALSE; } diff --git a/includes/class/mcl_chado_class/mcl_chado_phenotype.class.inc b/includes/class/mcl_chado_class/mcl_chado_phenotype.class.inc index 83347c5..616c97d 100644 --- a/includes/class/mcl_chado_class/mcl_chado_phenotype.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_phenotype.class.inc @@ -47,8 +47,8 @@ class MCL_CHADO_PHENOTYPE extends CHADO_PHENOTYPE { } // Checks for duplication. - $mcl_phenotype = MCL_CHADO_PHENOTYPE::byKey($args); - if ($mcl_phenotype) { + $phenotype = MCL_CHADO_PHENOTYPE::byKey($args); + if ($phenotype) { self::addMsg($mcl_tmpl, 'D', 'phenotype', $args); } else { @@ -56,8 +56,8 @@ class MCL_CHADO_PHENOTYPE extends CHADO_PHENOTYPE { // Adds a new phenotype. $args['value'] = $value; $args['attr_id'] = $attr_id; - $mcl_phenotype = new MCL_CHADO_PHENOTYPE($args); - if ($mcl_phenotype->insert()) { + $phenotype = new MCL_CHADO_PHENOTYPE($args); + if ($phenotype->insert()) { self::addMsg($mcl_tmpl, 'N', 'phenotype', $args); } else { @@ -65,6 +65,6 @@ class MCL_CHADO_PHENOTYPE extends CHADO_PHENOTYPE { return NULL; } } - return $mcl_phenotype; + return $phenotype; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_pub.class.inc b/includes/class/mcl_chado_class/mcl_chado_pub.class.inc index 490432d..6548a06 100644 --- a/includes/class/mcl_chado_class/mcl_chado_pub.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_pub.class.inc @@ -81,20 +81,20 @@ class MCL_CHADO_PUB extends CHADO_PUB { public static function addNull() { // Gets null cvterm. - $mcl_cvterm = MCL_CHADO_CVTERM::addNull(); + $cvterm = MCL_CHADO_CVTERM::addNull(); // Checks if it has already exists. - $mcl_pub = MCL_CHADO_PUB::byKey(array('uniquename' => 'null')); - if (!$mcl_pub) { + $pub = MCL_CHADO_PUB::byKey(array('uniquename' => 'null')); + if (!$pub) { $details = array( 'uniquename' => 'null', - 'type_id' => $mcl_cvterm->getCvtermID(), + 'type_id' => $cvterm->getCvtermID(), ); - $mcl_pub = new MCL_CHADO_PUB($details); - if (!$mcl_pub->insert()) { + $pub = new MCL_CHADO_PUB($details); + if (!$pub->insert()) { return NULL; } } - return $mcl_pub; + return $pub; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_stock.class.inc b/includes/class/mcl_chado_class/mcl_chado_stock.class.inc index a3f2bc4..a63ba71 100644 --- a/includes/class/mcl_chado_class/mcl_chado_stock.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_stock.class.inc @@ -8,15 +8,6 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { /** * Class data members. */ - // Valid stock types. - public static $stock_types = array( - 'breeding_research_material', - 'cultivar', - 'landrace', - 'population', - 'species', - 'wild_unimproved', - ); /** * @see CHADO_STOCK::__construct() @@ -43,24 +34,6 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { parent::__destruct(); } - /** - * Returns stock types. - * - * @return array of stock types. - */ - public static function getStockTypeArray() { - - // Gets all stock types. - $stock_arr = array(); - foreach (self::$stock_types as $stock_type) { - $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm('SITE_CV', $stock_type); - if ($mcl_cvterm) { - $stock_arr[$mcl_cvterm->getCvtermID()] = $stock_type; - } - } - return $stock_arr; - } - /** * Checks the existance of stock. If not, write the error messasge * to the log. @@ -115,8 +88,8 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { } // Checks the stock. - $mcl_stock = MCL_CHADO_STOCK::byKey($args); - if (!$mcl_stock) { + $stock = MCL_CHADO_STOCK::byKey($args); + if (!$stock) { self::updateMsg($mcl_tmpl, 'E', self::arrStr($args) . " not found in stock"); $flag = FALSE; } @@ -201,8 +174,8 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { } // Checks for duplication. - $mcl_stock = MCL_CHADO_STOCK::byKey($args); - if ($mcl_stock) { + $stock = MCL_CHADO_STOCK::byKey($args); + if ($stock) { self::addMsg($mcl_tmpl, 'D', 'stock', $args); } else { @@ -210,8 +183,8 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { // Adds a new stock. $args['type_id'] = $type_id; $args['name'] = $name; - $mcl_stock = new MCL_CHADO_STOCK($args); - if ($mcl_stock->insert()) { + $stock = new MCL_CHADO_STOCK($args); + if ($stock->insert()) { self::addMsg($mcl_tmpl, 'N', 'stock', $args); } else { @@ -219,7 +192,7 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { return NULL; } } - return $mcl_stock; + return $stock; } /** @@ -252,8 +225,8 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { 'name' => $secondary_id, 'organism_id' => $organism_id, ); - $mcl_stock = MCL_CHADO_STOCK::byKey($args); - if ($mcl_stock) { + $stock = MCL_CHADO_STOCK::byKey($args); + if ($stock) { self::addMsg($mcl_tmpl, 'D', 'stock', $args); } else { @@ -263,8 +236,8 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { 'uniquename' => $uniquename, 'organism_id' => $organism_id, ); - $mcl_stock = MCL_CHADO_STOCK::byKey($args); - if ($mcl_stock) { + $stock = MCL_CHADO_STOCK::byKey($args); + if ($stock) { self::updateMsg($mcl_tmpl, 'E', "The uniquename ($uniquename) has a different secondary ID"); } else { @@ -276,8 +249,8 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { 'organism_id' => $organism_id, 'type_id' => $type_id, ); - $mcl_stock = new MCL_CHADO_STOCK($args); - if ($mcl_stock->insert()) { + $stock = new MCL_CHADO_STOCK($args); + if ($stock->insert()) { self::addMsg($mcl_tmpl, 'N', 'stock', $args); } else { @@ -286,7 +259,24 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { } } } - return $mcl_stock; + return $stock; + } + + /** + * Adds a property by type ID (cvterm ID). + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $type_id + * @param string $value + * @param string $separator + * + * @return boolean + */ + public function addPropByID(MCL_TEMPLATE $mcl_tmpl = NULL, $type_id, $value, $separator = '') { + if ($value != '') { + return $this->addProperty($mcl_tmpl, 'stockprop', 'stock_id', $this->stock_id, $type_id, $value, $separator); + } + return TRUE; } /** @@ -301,7 +291,7 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { * @return boolean */ public function addProp(MCL_TEMPLATE $mcl_tmpl = NULL, $cv_name, $cvterm_name, $value, $separator = '') { - if ($value) { + if ($value != '') { $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); return $this->addProperty($mcl_tmpl, 'stockprop', 'stock_id', $this->stock_id, $type_id, $value, $separator); } @@ -376,13 +366,72 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { } } else { - $this->updateMsg($mcl_tmpl, 'E', "Parent '$uniquename' dose not exists in stock table."); - return FALSE; + + if ($mcl_tmpl) { + + // Saves the parent that could not find in stock table. It may be in the + // later row of the same Excel file. Adds them after processing the + // stock sheet. + $missing_parent = array( + 'uniquename' => $uniquename, + 'organism_id' => $organism_id, + 'type_id' => $type_id_relationship, + ); + $parents = $mcl_tmpl->getTmpByKey('stock_parents'); + if (!is_array($parents)) { + $parents = array(); + } + $parents[$this->stock_id] = $missing_parent; + $mcl_tmpl->setTmpByKey('stock_parents', $parents); + } + else { + return FALSE; + } } } return TRUE; } + /** + * Updates the parent by stock ID. + * + * @param MCL_TEMPLATE $mcl_tmpl + * @param integer $stock_id + * @param integer $type_id + * + * @return boolean + */ + public function updateParentByID(MCL_TEMPLATE $mcl_tmpl = NULL, $stock_id, $type_id) { + if ($type_id) { + + // Sets properties. + $args = array( + 'object_id' => $this->stock_id, + 'type_id' => $type_id, + ); + $rel = CHADO_STOCK_RELATIONSHIP::byKey($args); + if ($rel) { + + // Updates the relationship. + if ($stock_id) { + $rel->setSubjectID($stock_id); + return $rel->update(); + } + + // Removes the relationship if stock ID is empty. + else { + return $rel->delete(); + } + } + else { + $args['subject_id'] = $stock_id; + $rel = new CHADO_STOCK_RELATIONSHIP($args); + return $rel->insert(); + } + } + return FALSE; + } + /** * Adds alias to stockprop. * @@ -442,9 +491,9 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { $names = preg_split($this->getSepRegex($separator), $contact, NULL, PREG_SPLIT_NO_EMPTY); foreach ($names as $name) { $name = trim($name); - $mcl_contact = MCL_CHADO_CONTACT::getContact($name); - if ($mcl_contact) { - if (!$this->addLink($mcl_tmpl, 'stock_contact', 'stock_id', $this->stock_id, 'contact_id', $mcl_contact->getContactID())) { + $contact = MCL_CHADO_CONTACT::getContact($name); + if ($contact) { + if (!$this->addLink($mcl_tmpl, 'stock_contact', 'stock_id', $this->stock_id, 'contact_id', $contact->getContactID())) { $flag = FALSE; } } @@ -471,9 +520,9 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { $eimage_ids = preg_split($this->getSepRegex($separator), $image, NULL, PREG_SPLIT_NO_EMPTY); foreach ($eimage_ids as $eimage_id) { $eimage_id = trim($eimage_id); - $mcl_image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); - if ($mcl_image) { - if (!$this->addLink($mcl_tmpl, 'stock_image', 'stock_id', $this->stock_id, 'eimage_id', $mcl_image->getEimageID())) { + $image = MCL_CHADO_IMAGE::byKey(array('eimage_id' => $eimage_id)); + if ($image) { + if (!$this->addLink($mcl_tmpl, 'stock_image', 'stock_id', $this->stock_id, 'eimage_id', $image->getEimageID())) { $flag = FALSE; } } @@ -500,8 +549,8 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { $pub_ids = preg_split($this->getSepRegex($separator), $reference, NULL, PREG_SPLIT_NO_EMPTY); foreach ($pub_ids as $pub_id) { $pub_id = trim($pub_id); - $mcl_pub = MCL_CHADO_PUB::getPub($pub_id); - if ($mcl_pub) { + $pub = MCL_CHADO_PUB::getPub($pub_id); + if ($pub) { if (!$this->addLink($mcl_tmpl, 'stock_pub', 'stock_id', $this->stock_id, 'pub_id', $pub_id)) { $flag = FALSE; } diff --git a/includes/class/mcl_chado_class/mcl_chado_synonym.class.inc b/includes/class/mcl_chado_class/mcl_chado_synonym.class.inc index 4c8dbcd..8478af6 100644 --- a/includes/class/mcl_chado_class/mcl_chado_synonym.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_synonym.class.inc @@ -73,15 +73,15 @@ class MCL_CHADO_SYNONYM extends CHADO_SYNONYM { } // Checks for duplication. - $mcl_synonym = MCL_CHADO_SYNONYM::byKey($args); - if ($mcl_synonym) { + $synonym = MCL_CHADO_SYNONYM::byKey($args); + if ($synonym) { self::addMsg($mcl_tmpl, 'D', 'synonym', $args); } else { // Adds a new synonym. - $mcl_synonym = new MCL_CHADO_SYNONYM($args); - if ($mcl_synonym->insert()) { + $synonym = new MCL_CHADO_SYNONYM($args); + if ($synonym->insert()) { self::addMsg($mcl_tmpl, 'N', 'synonym', $args); } else { @@ -89,6 +89,6 @@ class MCL_CHADO_SYNONYM extends CHADO_SYNONYM { return NULL; } } - return $mcl_synonym; + return $synonym; } } \ No newline at end of file diff --git a/includes/class/mcl_chado_class/mcl_chado_trait.class.inc b/includes/class/mcl_chado_class/mcl_chado_trait.class.inc index e69fbb9..d04f0b3 100644 --- a/includes/class/mcl_chado_class/mcl_chado_trait.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_trait.class.inc @@ -54,8 +54,8 @@ class MCL_CHADO_TRAIT extends MCL_CHADO_CVTERM { if ($cv_name && $cvterm_name) { // Gets the cvterm. - $mcl_cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); - if (!$mcl_cvterm) { + $cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); + if (!$cvterm) { self::updateMsg($mcl_tmpl, 'E', "(cv_name, cvterm_name) = ($cv_name, $cvterm_name) not found in cvterm"); return FALSE; } @@ -77,9 +77,9 @@ class MCL_CHADO_TRAIT extends MCL_CHADO_CVTERM { if (!$cv_name) { $cv_name = MCL_VAR::getValueByName('SITE_TRAIT_ONTOLOGY'); } - $mcl_cv = MCL_CHADO_CV::getCV($cv_name); - if ($mcl_cv) { - return MCL_CHADO_CVTERM::bykey(array('cv_id' => $mcl_cv->getCvID(), 'name' => $cvterm_name)); + $cv = MCL_CHADO_CV::getCV($cv_name); + if ($cv) { + return MCL_CHADO_CVTERM::bykey(array('cv_id' => $cv->getCvID(), 'name' => $cvterm_name)); } return NULL; } @@ -120,9 +120,9 @@ class MCL_CHADO_TRAIT extends MCL_CHADO_CVTERM { $categories = preg_split("/[,;]/", $trait_category, NULL, PREG_SPLIT_NO_EMPTY); $cv_name = MCL_VAR::getValueByName('SITE_TRAIT_ONTOLOGY'); foreach ($categories as $category) { - $mcl_category = MCL_CHADO_CVTERM::getCvterm($cv_name, $category); - if ($mcl_category) { - if (!$this->addRelationship($mcl_tmpl, 'cvterm_relationship', 'subject_id', $this->cvterm_id, 'object_id', $mcl_category->getCvtermID(), $type_id)) { + $category = MCL_CHADO_CVTERM::getCvterm($cv_name, $category); + if ($category) { + if (!$this->addRelationship($mcl_tmpl, 'cvterm_relationship', 'subject_id', $this->cvterm_id, 'object_id', $category->getCvtermID(), $type_id)) { $flag = FALSE; } } diff --git a/includes/class/mcl_class_loader.class.inc b/includes/class/mcl_class_loader.class.inc index 5644be6..595b393 100644 --- a/includes/class/mcl_class_loader.class.inc +++ b/includes/class/mcl_class_loader.class.inc @@ -9,15 +9,18 @@ class MCL_CLASS_LOADER { * Class data members. * */ - private $module_path = NULL; - private $class_path = NULL; + private $module_path = NULL; + private $class_path = NULL; + private $template_path = NULL; /** * Implements the class constructor. */ - public function __construct($module_path) { - $this->module_path = $module_path; - $this->class_path = "$module_path/includes/class"; + public function __construct() { + $module_path = drupal_get_path('module', 'mcl'); + $this->module_path = $module_path; + $this->class_path = $module_path . '/includes/class'; + $this->template_path = $module_path . '/templates'; } /** @@ -43,7 +46,18 @@ class MCL_CLASS_LOADER { * * @return boolean */ - public function loadClass($class_name) { + public function loadClass($class_name) { + + // Template classes. + if (preg_match("/^MCL_TEMPLATE/", $class_name, $matches)) { + $path = '/'; + if (preg_match("/^MCL_(TEMPLATE|TEMPLATE_TYPE)$/", $class_name, $matches)) { + $path = '/core/'; + } + $class_filepath = $this->template_path . $path . strtolower($class_name) . '.class.inc'; + require_once($class_filepath); + return TRUE; + } // Gets the path to the class file. $path = '/'; @@ -71,12 +85,6 @@ class MCL_CLASS_LOADER { else if (preg_match("/^MCL_TABLE/", $class_name, $matches)) { $path .= 'table/'; } - else if (preg_match("/^MCL_(TEMPLATE|TEMPLATE_TYPE)$/", $class_name, $matches)) { - $path .= 'template/'; - } - else if (preg_match("/^MCL_TEMPLATE/", $class_name, $matches)) { - $path .= 'template/module/'; - } else if (preg_match("/^MCL_([A-Z\_]+)/", $class_name, $matches)) { // Does nothing. The file is in the root of class directory. } @@ -89,4 +97,26 @@ class MCL_CLASS_LOADER { require_once($class_filepath); return TRUE; } + + /* + * Defines getters and setters below. + */ + /** + * Returns the module path. + */ + public function getModulePath() { + return $this->module_path; + } + /** + * Returns the class path. + */ + public function getClassPath() { + return $this->class_path; + } + /** + * Returns the template path. + */ + public function getTemplatePath() { + return $this->template_path; + } } \ No newline at end of file diff --git a/mcl.info b/mcl.info index fd0026b..a3e8851 100644 --- a/mcl.info +++ b/mcl.info @@ -4,5 +4,5 @@ package = Mainlab project = MCL core = 7.x version = 7.x-1.0 -configure = admin/mainlab_chado_loader +configure = admin/mcl dependencies[] = file \ No newline at end of file diff --git a/mcl.install b/mcl.install index 0dfdd47..de6e9de 100644 --- a/mcl.install +++ b/mcl.install @@ -360,7 +360,7 @@ function mcl_populate_table_defaults() { // Registers autoloader. require_once "$module_path/includes/class/mcl_class_loader.class.inc"; - $bims_autoloader = new MCL_CLASS_LOADER($module_path); + $bims_autoloader = new MCL_CLASS_LOADER(); $bims_autoloader->register(); // Populates mcl_var table. @@ -370,7 +370,7 @@ function mcl_populate_table_defaults() { mcl_populate_mcl_templates(); // Populates mcl_data_type table. - mcl_populate_mcl_data_type(); + mcl_populate_mcl_data_valid_type(); } /** @@ -413,14 +413,13 @@ function mcl_populate_mcl_templates() { // Default template types. $template_types = array( - 'COLUMN', 'DB', 'CV', + 'TRAIT', 'CVTERM', 'ORGANISM', 'CONTACT', 'LIBRARY', - 'TRAIT', 'DATASET', 'IMAGE', 'DESCRIPTOR', @@ -431,7 +430,6 @@ function mcl_populate_mcl_templates() { 'MARKER', 'MTL', 'QTL', - 'PROGENY', 'MAP', 'MAP_POSITION', 'FIELD_BOOK', @@ -492,14 +490,16 @@ function mcl_populate_mcl_data_valid_type() { // Adds descriptor format types. $data_types['descriptor_format'] = array( - 'numeric', - 'date', - 'percent', + 'audio', 'boolean', 'categorical', - 'text', + 'counter', + 'date', + 'multicat', + 'numeric', + 'percent', 'photo', - 'audio', + 'text', ); // Adds descriptor types. @@ -557,9 +557,12 @@ function mcl_populate_mcl_data_valid_type() { ); // Gets cv_id. - $cv_id= ''; + $cv_id = ''; if ($cv_name) { $cv = MCL_CHADO_CV::getCV($cv_name); + if (!$cv) { + continue; + } $cv_id = $cv->getCvID(); $details['cv_id'] = $cv_id; } @@ -607,7 +610,7 @@ function mcl_update_7019() { // Registers autoloader. $module_path = drupal_get_path('module', 'mcl'); require_once "$module_path/includes/class/mcl_class_loader.class.inc"; - $bims_autoloader = new MCL_CLASS_LOADER($module_path); + $bims_autoloader = new MCL_CLASS_LOADER(); $bims_autoloader->register(); $transaction = db_transaction(); @@ -626,16 +629,6 @@ function mcl_update_7019() { throw new Exception("Failed to populate data valid type"); } } - - // Adds a new template type. - $mcl_template_type = MCL_TEMPLATE_TYPE::byKey(array('type' => 'COLUMN')); - if (!$mcl_template_type) { - $details = array('type' => 'COLUMN', 'rank' => 10); - $mcl_template_type = new MCL_TEMPLATE_TYPE($details); - if (!$mcl_template_type->insert()) { - throw new Exception("Failed to add a template type"); - } - } } catch (\Exception $e) { $transaction->rollback(); diff --git a/mcl.module b/mcl.module index 745fd36..73fac70 100644 --- a/mcl.module +++ b/mcl.module @@ -15,7 +15,7 @@ function mcl_init() { // Registers autoloader. require_once "$module_path/includes/class/mcl_class_loader.class.inc"; - $mcl_autoloader = new MCL_CLASS_LOADER($module_path); + $mcl_autoloader = new MCL_CLASS_LOADER(); $mcl_autoloader->register(); // Includes .inc file. @@ -64,7 +64,6 @@ function mcl_access($access_args) { * Implementation of hook_theme(). */ function mcl_theme () { - $template_path = drupal_get_path('module', 'mcl') . '/theme/templates'; return array( 'mcl_admin_template_form' => array('render element' => 'form'), ); @@ -420,6 +419,22 @@ function mcl_download_template_excel($args) { return TRUE; } +/** + * Adds additional ajax commands to be returned by the bims_ajax_render_alter hook(). + * This is useful in the case of ajax callbacks on forms where the form still needs + * to be returned as usual via the form callback hook but ajax commands also need + * to be executed + * + * @param $commands + * A single Drupal compatible ajax command created by calling ajax_command_invoke(). + */ +function mcl_add_ajax_command($command) { + if(!array_key_exists('mcl-ajax-commands', $_SESSION)) { + $_SESSION['mcl-ajax-commands'] = array(); + } + $_SESSION['mcl-ajax-commands'][] = $command; +} + /************************************************/ /* EMAIL */ /************************************************/ diff --git a/schema/drupal7.public.sql b/schema/drupal7.public.sql index 4dd210a..2a4ee5b 100644 --- a/schema/drupal7.public.sql +++ b/schema/drupal7.public.sql @@ -544,7 +544,7 @@ CREATE TABLE bims_mview_descriptor ( min_value character varying(255), max_value character varying(255), categories text, - unit character varying(255), + data_unit character varying(255), prop text, definition text ); @@ -1074,6 +1074,48 @@ CREATE SEQUENCE blocked_ips_iid_seq ALTER SEQUENCE blocked_ips_iid_seq OWNED BY blocked_ips.iid; +-- +-- Name: book; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE book ( + mlid bigint DEFAULT 0 NOT NULL, + nid bigint DEFAULT 0 NOT NULL, + bid bigint DEFAULT 0 NOT NULL, + CONSTRAINT book_bid_check CHECK ((bid >= 0)), + CONSTRAINT book_mlid_check CHECK ((mlid >= 0)), + CONSTRAINT book_nid_check CHECK ((nid >= 0)) +); + + +-- +-- Name: TABLE book; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE book IS 'Stores book outline information. Uniquely connects each node in the outline to a link in menu_links'; + + +-- +-- Name: COLUMN book.mlid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN book.mlid IS 'The book page''s menu_links.mlid.'; + + +-- +-- Name: COLUMN book.nid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN book.nid IS 'The book page''s node.nid.'; + + +-- +-- Name: COLUMN book.bid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN book.bid IS 'The book ID is the book.nid of the top-level page.'; + + -- -- Name: cache; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -1936,6 +1978,89 @@ CREATE SEQUENCE comment_cid_seq ALTER SEQUENCE comment_cid_seq OWNED BY comment.cid; +-- +-- Name: contact; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE contact ( + cid integer NOT NULL, + category character varying(255) DEFAULT ''::character varying NOT NULL, + recipients text NOT NULL, + reply text NOT NULL, + weight integer DEFAULT 0 NOT NULL, + selected smallint DEFAULT 0 NOT NULL, + CONSTRAINT contact_cid_check CHECK ((cid >= 0)) +); + + +-- +-- Name: TABLE contact; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE contact IS 'Contact form category settings.'; + + +-- +-- Name: COLUMN contact.cid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contact.cid IS 'Primary Key: Unique category ID.'; + + +-- +-- Name: COLUMN contact.category; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contact.category IS 'Category name.'; + + +-- +-- Name: COLUMN contact.recipients; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contact.recipients IS 'Comma-separated list of recipient e-mail addresses.'; + + +-- +-- Name: COLUMN contact.reply; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contact.reply IS 'Text of the auto-reply message.'; + + +-- +-- Name: COLUMN contact.weight; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contact.weight IS 'The category''s weight.'; + + +-- +-- Name: COLUMN contact.selected; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN contact.selected IS 'Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)'; + + +-- +-- Name: contact_cid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE contact_cid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contact_cid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE contact_cid_seq OWNED BY contact.cid; + + -- -- Name: ctools_css_cache; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -3648,16 +3773,35 @@ ALTER SEQUENCE gensas_files_file_id_seq OWNED BY gensas_files.file_id; -- CREATE TABLE gensas_gff3 ( - id character varying(200) NOT NULL, job_id character varying(200) NOT NULL, - parent character varying(200), prop text, - type character varying(200) NOT NULL, + id character varying(255) NOT NULL, + type character varying(255) NOT NULL, start integer, + parent character varying(255), landmark character varying(1024) NOT NULL ); +-- +-- Name: gensas_gff3_location_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE gensas_gff3_location_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gensas_gff3_location_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE gensas_gff3_location_seq OWNED BY gensas_gff3.start; + + -- -- Name: gensas_group; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -4399,8 +4543,9 @@ CREATE TABLE gensas_user_tool ( CREATE TABLE history ( uid integer DEFAULT 0 NOT NULL, - nid integer DEFAULT 0 NOT NULL, - "timestamp" integer DEFAULT 0 NOT NULL + nid bigint DEFAULT 0 NOT NULL, + "timestamp" integer DEFAULT 0 NOT NULL, + CONSTRAINT history_nid_check CHECK ((nid >= 0)) ); @@ -6922,32 +7067,19 @@ ALTER SEQUENCE taxonomy_vocabulary_vid_seq OWNED BY taxonomy_vocabulary.vid; -- CREATE TABLE tmp ( + id integer NOT NULL, col1 character varying, col2 character varying, col3 character varying, - col4 character varying, - id integer NOT NULL -); - - --- --- Name: tmp2; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE tmp2 ( - col1 character varying, - col2 character varying, - col3 character varying, - col4 character varying, - id integer NOT NULL + col4 character varying ); -- --- Name: tmp2_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: tmp_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE tmp2_id_seq +CREATE SEQUENCE tmp_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -6956,29 +7088,10 @@ CREATE SEQUENCE tmp2_id_seq -- --- Name: tmp2_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: tmp_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE tmp2_id_seq OWNED BY tmp2.id; - - --- --- Name: tmp3_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE tmp3_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: tmp3_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE tmp3_id_seq OWNED BY tmp.id; +ALTER SEQUENCE tmp_id_seq OWNED BY tmp.id; -- @@ -7048,6 +7161,88 @@ CREATE SEQUENCE url_alias_pid_seq ALTER SEQUENCE url_alias_pid_seq OWNED BY url_alias.pid; +-- +-- Name: user_restrictions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE user_restrictions ( + urid integer NOT NULL, + mask character varying(255) DEFAULT ''::character varying NOT NULL, + type character varying(255) DEFAULT ''::character varying NOT NULL, + subtype character varying(255) DEFAULT ''::character varying NOT NULL, + status smallint DEFAULT 0 NOT NULL, + expire integer DEFAULT 0 NOT NULL +); + + +-- +-- Name: TABLE user_restrictions; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE user_restrictions IS 'Stores user restrictions.'; + + +-- +-- Name: COLUMN user_restrictions.urid; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_restrictions.urid IS 'Primary Key: Unique user restriction ID.'; + + +-- +-- Name: COLUMN user_restrictions.mask; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_restrictions.mask IS 'Text mask used for filtering restrictions.'; + + +-- +-- Name: COLUMN user_restrictions.type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_restrictions.type IS 'Type of access rule: name, mail, or any value defined from a third-party module.'; + + +-- +-- Name: COLUMN user_restrictions.subtype; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_restrictions.subtype IS 'Sub-type of access rule.'; + + +-- +-- Name: COLUMN user_restrictions.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_restrictions.status IS 'Whether the restriction is to allow (1), or deny access (0).'; + + +-- +-- Name: COLUMN user_restrictions.expire; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN user_restrictions.expire IS 'A Unix timestamp indicating when the restriction expires.'; + + +-- +-- Name: user_restrictions_urid_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE user_restrictions_urid_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_restrictions_urid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE user_restrictions_urid_seq OWNED BY user_restrictions.urid; + + -- -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -7639,6 +7834,13 @@ ALTER TABLE ONLY blocked_ips ALTER COLUMN iid SET DEFAULT nextval('blocked_ips_i ALTER TABLE ONLY comment ALTER COLUMN cid SET DEFAULT nextval('comment_cid_seq'::regclass); +-- +-- Name: cid; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY contact ALTER COLUMN cid SET DEFAULT nextval('contact_cid_seq'::regclass); + + -- -- Name: dfid; Type: DEFAULT; Schema: public; Owner: - -- @@ -7937,21 +8139,21 @@ ALTER TABLE ONLY taxonomy_vocabulary ALTER COLUMN vid SET DEFAULT nextval('taxon -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY tmp ALTER COLUMN id SET DEFAULT nextval('tmp3_id_seq'::regclass); +ALTER TABLE ONLY tmp ALTER COLUMN id SET DEFAULT nextval('tmp_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: pid; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY tmp2 ALTER COLUMN id SET DEFAULT nextval('tmp2_id_seq'::regclass); +ALTER TABLE ONLY url_alias ALTER COLUMN pid SET DEFAULT nextval('url_alias_pid_seq'::regclass); -- --- Name: pid; Type: DEFAULT; Schema: public; Owner: - +-- Name: urid; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY url_alias ALTER COLUMN pid SET DEFAULT nextval('url_alias_pid_seq'::regclass); +ALTER TABLE ONLY user_restrictions ALTER COLUMN urid SET DEFAULT nextval('user_restrictions_urid_seq'::regclass); -- @@ -8224,6 +8426,22 @@ ALTER TABLE ONLY blocked_ips ADD CONSTRAINT blocked_ips_pkey PRIMARY KEY (iid); +-- +-- Name: book_nid_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY book + ADD CONSTRAINT book_nid_key UNIQUE (nid); + + +-- +-- Name: book_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY book + ADD CONSTRAINT book_pkey PRIMARY KEY (mlid); + + -- -- Name: cache_block_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -8336,6 +8554,22 @@ ALTER TABLE ONLY comment ADD CONSTRAINT comment_pkey PRIMARY KEY (cid); +-- +-- Name: contact_category_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact + ADD CONSTRAINT contact_category_key UNIQUE (category); + + +-- +-- Name: contact_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY contact + ADD CONSTRAINT contact_pkey PRIMARY KEY (cid); + + -- -- Name: ctools_css_cache_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -8609,11 +8843,11 @@ ALTER TABLE ONLY gensas_expire -- --- Name: gensas_gff3_id_job_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: gensas_gff3_job_id_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY gensas_gff3 - ADD CONSTRAINT gensas_gff3_id_job_id_key UNIQUE (id, job_id); + ADD CONSTRAINT gensas_gff3_job_id_id_key UNIQUE (job_id, id); -- @@ -9320,6 +9554,14 @@ ALTER TABLE ONLY url_alias ADD CONSTRAINT url_alias_pkey PRIMARY KEY (pid); +-- +-- Name: user_restrictions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY user_restrictions + ADD CONSTRAINT user_restrictions_pkey PRIMARY KEY (urid); + + -- -- Name: users_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -9384,6 +9626,13 @@ ALTER TABLE ONLY watchdog ADD CONSTRAINT watchdog_pkey PRIMARY KEY (wid); +-- +-- Name: authmap_uid_module_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX authmap_uid_module_idx ON authmap USING btree (uid, module); + + -- -- Name: batch_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: -- @@ -9419,6 +9668,13 @@ CREATE INDEX block_role_rid_idx ON block_role USING btree (rid); CREATE INDEX blocked_ips_blocked_ip_idx ON blocked_ips USING btree (ip); +-- +-- Name: book_bid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX book_bid_idx ON book USING btree (bid); + + -- -- Name: cache_block_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: -- @@ -9545,6 +9801,13 @@ CREATE INDEX comment_comment_status_pid_idx ON comment USING btree (pid, status) CREATE INDEX comment_comment_uid_idx ON comment USING btree (uid); +-- +-- Name: contact_list_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX contact_list_idx ON contact USING btree (weight, category); + + -- -- Name: ctools_object_cache_updated_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: -- @@ -10098,6 +10361,13 @@ CREATE INDEX flood_purge_idx ON flood USING btree (expiration); CREATE INDEX gensas_expire_idx1_gensas_expire_idx ON gensas_expire USING btree (task_id); +-- +-- Name: gensas_gff3_landmark_job_id_id_key; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX gensas_gff3_landmark_job_id_id_key ON gensas_gff3 USING btree (job_id, id, landmark); + + -- -- Name: gensas_job_cmd_idx_gensas_job_cmd_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: -- @@ -10637,6 +10907,34 @@ CREATE INDEX url_alias_alias_language_pid_idx ON url_alias USING btree (alias, l CREATE INDEX url_alias_source_language_pid_idx ON url_alias USING btree (source, language, pid); +-- +-- Name: user_restrictions_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX user_restrictions_expire_idx ON user_restrictions USING btree (expire); + + +-- +-- Name: user_restrictions_status_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX user_restrictions_status_idx ON user_restrictions USING btree (status); + + +-- +-- Name: user_restrictions_subtype_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX user_restrictions_subtype_idx ON user_restrictions USING btree (substr((subtype)::text, 1, 32)); + + +-- +-- Name: user_restrictions_type_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX user_restrictions_type_idx ON user_restrictions USING btree (substr((type)::text, 1, 32)); + + -- -- Name: users_access_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: -- diff --git a/includes/class/template/mcl_template.class.inc b/templates/core/mcl_template.class.inc similarity index 90% rename from includes/class/template/mcl_template.class.inc rename to templates/core/mcl_template.class.inc index fdcab78..ee6a5fe 100644 --- a/includes/class/template/mcl_template.class.inc +++ b/templates/core/mcl_template.class.inc @@ -16,6 +16,7 @@ class MCL_TEMPLATE extends PUBLIC_MCL_TEMPLATE { protected $job = NULL; protected $line_no = NULL; protected $stats = NULL; + private $tmp = array(); /** * @see PUBLIC_MCL_TEMPLATE::__construct() @@ -214,7 +215,8 @@ DESC; public static function updateTemplates($remove = FALSE, $refresh = FALSE) { // Gets the template folder. - $template_dir = drupal_get_path('module', 'mcl') . '/includes/class/template/module'; + $class_loader = new MCL_CLASS_LOADER(); + $template_dir = $class_loader->getTemplatePath(); // Removes all templates from the table. if ($refresh) { @@ -226,6 +228,12 @@ DESC; $files = file_scan_directory($template_dir, "/\.inc$/"); $template_class = array(); foreach ($files as $filepath => $file) { + + // Skips files in /templates/core directory. + if (preg_match("/\/templates\/core/", $filepath)) { + continue; + } + if (preg_match("/^mcl_template_(.*)\.class$/", $file->name, $matches)) { $template_name = $matches[1]; $template_class[$template_name] = TRUE; @@ -367,11 +375,6 @@ DESC; */ public static function validateTemplate($template) { - // Updates the template name. - if (MCL_TEMPLATE::isColumnTemplate($template)) { - $template = 'COLUMN'; - } - // Checks if a template for this template exists. $mcl_template = MCL_TEMPLATE::byKey(array('template' => $template)); if ($mcl_template) { @@ -395,11 +398,6 @@ DESC; */ public static function getRank($template) { - // Updates the template name. - if (preg_match("/^([A-Za-z0-9\_]+)_column$/", $template, $matches)) { - $template = $matches[1]; - } - // Gets the rank of the template. $mcl_template = MCL_TEMPLATE::byKey(array('template' => $template)); return $mcl_template->template_type->getRank(); @@ -415,13 +413,8 @@ DESC; */ public static function getTemplateClass(MCL_JOB_UPLOAD $job, MCL_FILE_CSV $csv) { - // Gets and updates the template. - $template = $csv->getTemplate(); - if (MCL_TEMPLATE::isColumnTemplate($template)) { - $template = 'column'; - } - // Gets the child class object of MCL_TEMPLATE. + $template = $csv->getTemplate(); $class_name = 'MCL_TEMPLATE_' . strtoupper($template); $mcl_template = $class_name::byKey(array('template' => $template)); if ($mcl_template) { @@ -640,9 +633,15 @@ DESC; * * @param string $key * @param string $msg + * @param boolean $flag_line_no */ - public function updateMsg($key, $msg) { - $this->job->updateMsg($key, $msg, $this->line_no); + public function updateMsg($key, $msg, $flag_line_no = TRUE) { + if ($flag_line_no) { + $this->job->updateMsg($key, $msg, $this->line_no); + } + else { + $this->job->updateMsg($key, $msg); + } } /** @@ -889,10 +888,39 @@ DESC; continue; } - // Sets column #. - if (array_key_exists($column_name, $this->headers) || preg_match($regex, $column_name)) { + // Updates the header column array. + if (array_key_exists($column_name, $this->headers)) { $this->headers[$column_name]['col'] = $i; } + + // Handles the special coulmns. + else if (preg_match($regex, $column_name, $matches)) { + $this->headers[$column_name]['col'] = $i; + $prefix = $matches[0]; + $prefix_len = strlen($prefix); + + // Type 1 : double special character + cvterm.name. + if ($prefix_len == 2) { + + // Gets cv_id. + $cv_id = $this->getCvByPrefix($prefix); + if ($cv) { + + // Gets the cvterm. + $cvterm_name = substr($column_name, $prefix_len); + $cvterm = MCL_CHADO_CVTERM::getCvtermByCvID($cv_id, $cvterm_name); + if ($cvterm) { + $this->headers[$column_name]['cvterm_id'] = $cvterm->getCvtermID(); + } + else { + $this->updateMsg('E', "Error : $cvterm_name not found in cvterm table."); + } + } + else { + $this->updateMsg('E', "Error : cv could not found for $prefix."); + } + } + } } } @@ -920,6 +948,28 @@ DESC; return $this->isPassed(); } + /** + * Returns cv.cv_id from the parameter of this job if found. Otherwise, + * returns cv_id of 'SITE_CV'. + * + * @param string $prefix + * + * @return MCL_CHADO_CV + */ + public function getCvByPrefix($prefix) { + + // Returns cv_id for this prefix if it found in job param array. + $cv_id_map = $this->getJob()->getParamByKey('cv_id_map'); + if (is_array($cv_id_map) && array_key_exists($this->template, $cv_id_map)) { + if (array_key_exists($prefix, $cv_id_map[$this->template])) { + return MCL_CHADO_CV::getCVByID($cv_id_map[$this->template][$prefix]); + } + } + + // Returns MCL_CHADO_CV for 'SITE_TRAIT_ONTOLOGY'. + return MCL_CHADO_CV::getCV('SITE_TRAIT_ONTOLOGY'); + } + /** * Checks a data line for this template. * @@ -1017,6 +1067,9 @@ DESC; } } fclose($fh); + + // Calls postProcess(). + $this->postProcess(); return $this->isPassed(); } @@ -1030,27 +1083,51 @@ DESC; } /** - * Adds custom columns. + * The function to be called after uploading data. + */ + public function postProcess() { + // Defined in child class. + } + + /** + * Returns the special columns that start with the provided prefix. * * @param string $prefix - * @param MCL_TEMPLATE $mcl_template - * @param array $line + * + * @return array */ - public function addCustomColumns($prefix, MCL_TEMPLATE $mcl_template, $line) { + public function getSpecialColumns($prefix) { - // Checks if a column-template exists. - $columns = $this->job->getPropByKey('columns'); - $column_arr = array(); - if (array_key_exists($this->getTemplate(), $columns)) { - $column_arr = $columns[$this->getTemplate()]; + // Sets the regular expression. + $separator = "\\"; + $regex = '/^' . $separator . implode($separator, str_split($prefix)) . '.+/'; + + // Gets the matced columns. + $columns = array(); + foreach ($this->headers as $column_name => $prop) { + if (preg_match($regex, $column_name)) { + $columns[$column_name] = $prop; + } } + return $columns; + } - // Uploads a custom columns for this line. - if (!empty($column_arr)) { - foreach ($column_arr as $cvterm_name => $cv_name) { - $value = $line[$prefix . $cvterm_name]; - if ($value) { - $mcl_template->addProp($this, $cv_name, $cvterm_name, $value); + /** + * Adds special columns. + * + * @param string $prefix + * @param MCL_TEMPLATE $mcl_template + * @param array $line + */ + public function addSpecialColumns($prefix, MCL_TEMPLATE $mcl_template, $line) { + + // Gets the special columns. + $columns = $this->getSpecialColumns($prefix); + if (!empty($columns)) { + foreach ($columns as $column_name => $prop) { + $value = $line[$column_name]; + if ($value != '') { + $mcl_template->addPropByID($this, $prop['cvterm_id'], $value); } } } @@ -1067,7 +1144,7 @@ DESC; * @param string $separator */ public function addProperty($table_name, $target_field, $target_id, $type_id, $value, $separator = '') { - if ($value) { + if ($value != '') { // Checks duplication before adding a new property. $args = array( @@ -1112,7 +1189,7 @@ DESC; * @param integer $rank */ public function addPropertyRanked($table_name, $target_field, $target_id, $type_id, $value, $rank) { - if ($value) { + if ($value != '') { // Checks duplication before adding a new property. $args = array( @@ -1343,15 +1420,6 @@ DESC; return empty($data_str); } - /** - * Returns if this is a column-template. - * - * @return boolean - */ - public static function isColumnTemplate($template) { - return preg_match("/_column$/i", $template); - } - /* * Defines getters and setters below. */ @@ -1449,4 +1517,28 @@ DESC; public function setLineNo($line_no) { $this->line_no = $line_no; } + + /** + * Retrieves the value of the provided key in $this->tmp. + * + * @param string $key + * + * @return string + */ + public function getTmpByKey($key) { + if (array_key_exists($key, $this->tmp)) { + return $this->tmp[$key]; + } + return NULL; + } + + /** + * Updates the value of the provided key in $this->tmp. + * + * @param string $template_type + * @param string $value + */ + public function setTmpByKey($key, $value) { + $this->tmp[$key] = $value; + } } \ No newline at end of file diff --git a/includes/class/template/mcl_template_type.class.inc b/templates/core/mcl_template_type.class.inc similarity index 100% rename from includes/class/template/mcl_template_type.class.inc rename to templates/core/mcl_template_type.class.inc diff --git a/includes/class/template/module/mcl_template_contact.class.inc b/templates/mcl_template_contact.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_contact.class.inc rename to templates/mcl_template_contact.class.inc diff --git a/includes/class/template/module/mcl_template_cross.class.inc b/templates/mcl_template_cross.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_cross.class.inc rename to templates/mcl_template_cross.class.inc diff --git a/templates/mcl_template_cross_bims.class.inc b/templates/mcl_template_cross_bims.class.inc new file mode 100644 index 0000000..39bc3d4 --- /dev/null +++ b/templates/mcl_template_cross_bims.class.inc @@ -0,0 +1,152 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for cross sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'site_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Site information where the stock for the phenotyping is planted. It should match 'site_name' in the 'Site' sheet."), + 'cross_number' => array('req' => TRUE, 'width' => 17, 'desc' => "ID number or name for this specific cross."), + 'mother' => array('req' => TRUE, 'width' => 13, 'desc' => "ID name or number for the seed parent for the cross. This ID must also be an entry in the Stock sheet."), + 'mother_location' => array('req' => FALSE, 'width' => 17, 'desc' => "Location details for the mother of this cross (eg. Plant location, individual stock name, etc)."), + 'father' => array('req' => TRUE, 'width' => 13, 'desc' => "ID name or number for the pollen parent for the cross. This ID must also be an entry in the Stock sheet."), + 'father_location' => array('req' => FALSE, 'width' => 17, 'desc' => "Location details for the father of this cross (eg. Plant location, individual stock name, etc)."), + 'cross_date' => array('req' => FALSE, 'width' => 15, 'desc' => "Date for the cross."), + ); + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['cross_experiment'] = -1; + $cvterms['SITE_CV']['cross_date'] = -1; + $cvterms['SITE_CV']['cross_number'] = -1; + $cvterms['SITE_CV']['mother_location'] = -1; + $cvterms['SITE_CV']['father_location'] = -1; + $cvterms['SITE_CV']['maternal_parent'] = -1; + $cvterms['SITE_CV']['paternal_parent'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks program_id. + $program_id = $this->getJob()->getParamByKey('program_id'); + if (!$program_id) { + $this->updateMsg('E', "program_id not found in job.param"); + } + + // Checks cross dataset. + $project_id_cross = $this->getJob()->getParamByKey('project_id_cross'); + if ($project_id_cross) { + MCL_CHADO_DATASET::checkDatasetByID($this, $project_id_cross); + } + else { + $this->updateMsg('E', "project_id_cross not found in job.param"); + } + + // Checks site. + if ($line['site_name']) { + MCL_CHADO_LOCATION::checkSite($this, $program_id . '.' . $line['site_name']); + } + + // Checks maternal parent. + if ($line['mother'] != 'N/A') { + MCL_CHADO_STOCK::checkStock($this, $program_id . '.' . $line['mother']); + } + + // Checks paternal parent. + if ($line['father'] != 'N/A') { + MCL_CHADO_STOCK::checkStock($this, $program_id . '.' . $line['father']); + } + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Gets the program_id. + $program_id = $this->getJob()->getParamByKey('program_id'); + + // Gets cross dataset. + $project_id_cross = $this->getJob()->getParamByKey('project_id_cross'); + $cross_dataset = MCL_CHADO_DATASET::byKey(array('project_id' => $project_id_cross)); + + // Gets nd_geolocation_id. + $site_name = $line['site_name']; + if ($site_name) { + $site_name = $program_id . '.' . $line['site_name']; + } + $nd_geolocation_id = MCL_CHADO_LOCATION::getLocationIDBySite($site_name); + + // Adds a nd_experiment. + $dup_key = $project_id_cross . '_' . $line['cross_number']; + $cross = MCL_CHADO_ND_EXPERIMENT::addNdExperiment($this, $this->cvterms['SITE_CV']['cross_experiment'], $nd_geolocation_id, $this->cvterms['SITE_CV']['cross_experiment'], $dup_key); + if ($cross) { + + // Adds properties. + $cross->addProp($this, 'SITE_CV', 'cross_number', $line['cross_number']); + $cross->addProp($this, 'SITE_CV', 'cross_date', $line['cross_date']); + $cross->addProp($this, 'SITE_CV', 'mother_location', $line['mother_location']); + $cross->addProp($this, 'SITE_CV', 'father_location', $line['father_location']); + + // Adds a dataset. + $cross->addDataset($this, $cross_dataset->getName()); + + // Adds a maternal parent. + if ($line['mother'] != 'N/A') { + $mother = $program_id . '.' . $line['mother']; + $maternal_parent = MCL_CHADO_STOCK::getStock($mother); + $cross->addStock($this, $maternal_parent, $this->cvterms['SITE_CV']['maternal_parent']); + } + + // Adds a paternal parent. + if ($line['father'] != 'N/A') { + $father = $program_id . '.' . $line['father']; + $paternal_parent = MCL_CHADO_STOCK::getStock($father); + $cross->addStock($this, $paternal_parent, $this->cvterms['SITE_CV']['paternal_parent']); + } + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_cv.class.inc b/templates/mcl_template_cv.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_cv.class.inc rename to templates/mcl_template_cv.class.inc diff --git a/includes/class/template/module/mcl_template_cvterm.class.inc b/templates/mcl_template_cvterm.class.inc similarity index 88% rename from includes/class/template/module/mcl_template_cvterm.class.inc rename to templates/mcl_template_cvterm.class.inc index 5285891..3bd2016 100644 --- a/includes/class/template/module/mcl_template_cvterm.class.inc +++ b/templates/mcl_template_cvterm.class.inc @@ -42,6 +42,7 @@ class MCL_TEMPLATE_CVTERM extends MCL_TEMPLATE { 'db_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the db."), 'cv_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the control vocabulary."), 'cvterm_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the cvterm."), + 'alias' => array('req' => FALSE, 'width' => 15, 'desc' => "Alias of the cvterm."), 'accession' => array('req' => TRUE, 'width' => 10, 'desc' => "Accession of the cvterm."), 'definition' => array('req' => FALSE, 'width' => 15, 'desc' => "Definition of the cvterm."), ); @@ -53,6 +54,7 @@ class MCL_TEMPLATE_CVTERM extends MCL_TEMPLATE { */ public function defineCvterms() { $cvterms = array(); + $cvterms['SITE_CV']['alias'] = -1; return $cvterms; } @@ -75,5 +77,9 @@ class MCL_TEMPLATE_CVTERM extends MCL_TEMPLATE { // Adds a cvterm. $cvterm = MCL_CHADO_CVTERM::addCvterm($this, $line['db_name'], $line['cv_name'], $line['cvterm_name'], $line['definition'], $line['accession']); + if ($cvterm) { + // Adds aliases. + $cvterm->addAlias($this, 'SITE_CV', 'alias', $line['alias'], '[,;]'); + } } } \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_column.class.inc b/templates/mcl_template_cvterm_bims.class.inc similarity index 54% rename from includes/class/template/module/mcl_template_column.class.inc rename to templates/mcl_template_cvterm_bims.class.inc index 4f7ccb3..af2c885 100644 --- a/includes/class/template/module/mcl_template_column.class.inc +++ b/templates/mcl_template_cvterm_bims.class.inc @@ -1,9 +1,9 @@ array('req' => TRUE, 'width' => 10, 'desc' => "Name of the cvterm."), + 'cvterm_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the cvterm."), 'alias' => array('req' => FALSE, 'width' => 15, 'desc' => "Alias of the cvterm."), - 'cv_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the control vocabulary."), - 'definition' => array('req' => FALSE, 'width' => 15, 'desc' => "Definition of the control vocabulary."), + 'definition' => array('req' => FALSE, 'width' => 15, 'desc' => "Definition of the cvterm."), ); return $headers; } @@ -52,6 +51,7 @@ class MCL_TEMPLATE_COLUMN extends MCL_TEMPLATE { */ public function defineCvterms() { $cvterms = array(); + $cvterms['SITE_CV']['alias'] = -1; return $cvterms; } @@ -60,11 +60,12 @@ class MCL_TEMPLATE_COLUMN extends MCL_TEMPLATE { */ public function runErrorCheckDataLine($line) { + // Checks cv_id. + $cv_id = $this->getJob()->getParamByKey('cv_id'); + MCL_CHADO_CV::checkCVByID($this, $cv_id, TRUE); + // Checks db. MCL_CHADO_DB::checkDB($this, MCL_VAR::getValueByName('SITE_DB')); - - // Checks cv. - MCL_CHADO_CV::checkCV($this, $line['cv_name']); } /** @@ -72,32 +73,19 @@ class MCL_TEMPLATE_COLUMN extends MCL_TEMPLATE { */ public function uploadDataLine($line) { - // Gets the template name for this columns. - $csv_filepath = $this->csv->getFilepath(); - if (preg_match("/\/([A-Za-z0-9\_]+)_column.csv$/", $csv_filepath, $matches)) { - $template = $matches[1]; - } - // Gets db. $db = MCL_CHADO_DB::getDB(MCL_VAR::getValueByName('SITE_DB')); + // Gets cv. + $cv_id = $this->getJob()->getParamByKey('cv_id'); + $cv = MCL_CHADO_CV::byKey(array('cv_id' => $cv_id)); + // Adds a cvterm. - $accession = $line['name']; - $cvterm = MCL_CHADO_CVTERM::addCvterm($this, $db->getName(), $line['cv_name'], $line['name'], $line['definition'], $accession); + $cvterm = MCL_CHADO_CVTERM::addCvterm($this, $db->getName(), $cv->getName(), $line['cvterm_name'], $line['definition'], $line['accession']); if ($cvterm) { - // Gets cv. - $cv = MCL_CHADO_CV::byKey(array('cv_id' => $cvterm->getCvID())); - - // Saves in job properties. - $prop = $this->job->getPropByKey('columns'); - if (array_key_exists($template, $prop)) { - $prop[$template][$cvterm->getName()] = $cv->getName(); - } - else { - $prop[$template] = array($cvterm->getName() => $cv->getName()); - } - $this->job->setPropByKey('columns', $prop); + // Adds aliases. + $cvterm->addAlias($this, 'SITE_CV', 'alias', $line['alias'], '[,;]'); } } } \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_dataset.class.inc b/templates/mcl_template_dataset.class.inc similarity index 87% rename from includes/class/template/module/mcl_template_dataset.class.inc rename to templates/mcl_template_dataset.class.inc index 06ce4c2..439e44b 100644 --- a/includes/class/template/module/mcl_template_dataset.class.inc +++ b/templates/mcl_template_dataset.class.inc @@ -43,7 +43,6 @@ class MCL_TEMPLATE_DATASET extends MCL_TEMPLATE { 'type' => array('req' => TRUE, 'width' => 12, 'desc' => "Breeding, growing (for cultivar performance data), diversity (for study of genetic diversity) or QTL."), 'sub_type' => array('req' => FALSE, 'width' => 12, 'desc' => "To specify whether the markers used were SSR or SNP when the dataset is SSR or SNP genotyping data."), 'super_dataset' => array('req' => FALSE, 'width' => 16, 'desc' => "Larger dataset that this sub_dataset belngs to."), - 'trait_descriptor_set' => array('req' => FALSE, 'width' => 16, 'desc' => "The name of the trait descriptor set that each dataset or breeder uses. This is a required column if a type of a dataset is 'breeding'."), 'pi' => array('req' => FALSE, 'width' => 12, 'desc' => "Principal Investigator (eg. breeder, corresponding author of the QTL paper) of the Dataset. It should match a 'contact_name' column in 'Contact' sheet."), 'crop' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the crop for the dataset."), 'comments' => array('req' => FALSE, 'width' => 15, 'desc' => "Any comments for the dataset."), @@ -63,7 +62,6 @@ class MCL_TEMPLATE_DATASET extends MCL_TEMPLATE { public function defineCvterms() { $cvterms = array(); $cvterms['SITE_CV']['project_type'] = -1; - $cvterms['SITE_CV']['trait_descriptor'] = -1; $cvterms['SITE_CV']['sub_type'] = -1; $cvterms['SITE_CV']['description'] = -1; $cvterms['SITE_CV']['comments'] = -1; @@ -78,12 +76,6 @@ class MCL_TEMPLATE_DATASET extends MCL_TEMPLATE { */ public function runErrorCheckDataLine($line) { - // Checks 'trait_descriptor_set' column. The column becomes required column - // if dataset type is 'breeding'. - if ($line['type'] == 'breeding') { - MCL_CHADO_CV::checkCV($this, $line['trait_descriptor_set']); - } - // Checks super_datatset. MCL_CHADO_DATASET::checkDataset($this, $line['super_datatset']); @@ -105,7 +97,6 @@ class MCL_TEMPLATE_DATASET extends MCL_TEMPLATE { // Adds properties. $dataset->addProp($this, 'SITE_CV', 'project_type', $line['type']); - $dataset->addProp($this, 'SITE_CV', 'trait_descriptor', $line['trait_descriptor_set']); $dataset->addProp($this, 'SITE_CV', 'sub_type', $line['sub_type']); $dataset->addProp($this, 'SITE_CV', 'description', $line['description']); $dataset->addProp($this, 'SITE_CV', 'crop', $line['crop']); diff --git a/templates/mcl_template_dataset_bims.class.inc b/templates/mcl_template_dataset_bims.class.inc new file mode 100644 index 0000000..ea71215 --- /dev/null +++ b/templates/mcl_template_dataset_bims.class.inc @@ -0,0 +1,103 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for dataset sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'dataset_name' => array('req' => TRUE, 'width' => 20, 'desc' => "Names of the datasets."), + 'type' => array('req' => TRUE, 'width' => 12, 'desc' => "Breeding, growing (for cultivar performance data), diversity (for study of genetic diversity) or QTL."), + 'pi' => array('req' => FALSE, 'width' => 12, 'desc' => "Principal Investigator (eg. breeder, corresponding author of the QTL paper) of the Dataset. It should match a 'contact_name' column in 'Contact' sheet."), + 'crop' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the crop for the dataset."), + 'comments' => array('req' => FALSE, 'width' => 15, 'desc' => "Any comments for the dataset."), + 'permission' => array('req' => FALSE, 'width' => 10, 'desc' => "Permission of the dataset. '0' or empty indicates public. Other positive integer indicates private."), + 'description' => array('req' => FALSE, 'width' => 90, 'desc' => "General description of the dataset (purpose, target, how many crosses, etc)."), + ); + + // Adds labels. + $headers['pi']['label'] = 'PI'; + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['project_type'] = -1; + $cvterms['SITE_CV']['description'] = -1; + $cvterms['SITE_CV']['comments'] = -1; + $cvterms['SITE_CV']['crop'] = -1; + $cvterms['SITE_CV']['permission'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks super_datatset. + MCL_CHADO_DATASET::checkDataset($this, $line['super_datatset']); + + // Checks PI. + MCL_CHADO_CONTACT::checkContact($this, $line['pi']); + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Adds a dataset for BIMS. Sets the database name [program_id + dataset_name]. + $program_id = $this->getJob()->getParamByKey('program_id'); + $dataset_name = $program_id . '.' . $line['dataset_name']; + $dataset = MCL_CHADO_DATASET::addDataset($this, $dataset_name); + if ($dataset) { + + // Adds properties. + $dataset->addProp($this, 'SITE_CV', 'project_type', $line['type']); + $dataset->addProp($this, 'SITE_CV', 'description', $line['description']); + $dataset->addProp($this, 'SITE_CV', 'crop', $line['crop']); + $dataset->addProp($this, 'SITE_CV', 'comments', $line['comments']); + $dataset->addProp($this, 'SITE_CV', 'permission', $line['permission']); + + // Adds PI. + $dataset->addContact($this, $line['pi']); + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_db.class.inc b/templates/mcl_template_db.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_db.class.inc rename to templates/mcl_template_db.class.inc diff --git a/includes/class/template/module/mcl_template_descriptor.class.inc b/templates/mcl_template_descriptor.class.inc similarity index 98% rename from includes/class/template/module/mcl_template_descriptor.class.inc rename to templates/mcl_template_descriptor.class.inc index d337360..572e931 100644 --- a/includes/class/template/module/mcl_template_descriptor.class.inc +++ b/templates/mcl_template_descriptor.class.inc @@ -85,7 +85,7 @@ class MCL_TEMPLATE_DESCRIPTOR extends MCL_TEMPLATE { MCL_CHADO_CVTERM::checkCvterm($this, MCL_VAR::getValueByName('SITE_TRAIT_ONTOLOGY'), $line['trait_name']); // Checks descirptor type. - if (!MCL_DATA_VALID_TYPE::validate('descirptor_type', $line['data_type'])) { + if (!MCL_DATA_VALID_TYPE::validate('descriptor_type', $line['data_type'])) { $this->updateMsg('E', 'Invalid descirptor type : ' . $line['data_type']); } } diff --git a/templates/mcl_template_descriptor_bims.class.inc b/templates/mcl_template_descriptor_bims.class.inc new file mode 100644 index 0000000..cbd6d08 --- /dev/null +++ b/templates/mcl_template_descriptor_bims.class.inc @@ -0,0 +1,120 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for descriptor sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'descriptor_name' => array('req' => TRUE, 'width' => 15, 'desc' => "Any trait descriptor that a breeder uses in their own program. These descriptors would be used as column heads the Cross or Phenotype sheets, with a '#' prefix."), + 'alias' => array('req' => FALSE, 'width' => 15, 'desc' => "Alias of the descriptor."), + 'trait_name' => array('req' => FALSE, 'width' => 20, 'desc' => "crop trait ontology term (no specific protocol or code is involved with trait name) that corresponds to the trait descriptor (name). This should exist in 'Trait' sheet."), + 'format' => array('req' => TRUE, 'width' => 15, 'desc' => "The format of the descriptor (numerical, categorical, date, text, etc.)."), + 'categories' => array('req' => FALSE, 'width' => 10, 'desc' => "The values of the categorical descriptor separated by '/'."), + 'data_unit' => array('req' => FALSE, 'width' => 10, 'desc' => "Unit for the trait descriptor."), + 'minimum' => array('req' => FALSE, 'width' => 10, 'desc' => "The minimum value of the descriptor."), + 'maximum' => array('req' => FALSE, 'width' => 10, 'desc' => "The maximum value of the descriptor."), + 'default_value' => array('req' => FALSE, 'width' => 10, 'desc' => "The default value of the descriptor."), + 'definition' => array('req' => FALSE, 'width' => 90, 'desc' => "The definition of the descriptor."), + ); + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['alias'] = -1; + $cvterms['SITE_CV']['format'] = -1; + $cvterms['SITE_CV']['categories'] = -1; + $cvterms['SITE_CV']['min_value'] = -1; + $cvterms['SITE_CV']['max_value'] = -1; + $cvterms['SITE_CV']['default_value'] = -1; + $cvterms['SITE_CV']['data_unit'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks cv_id. + $cv_id = $this->getJob()->getParamByKey('cv_id'); + MCL_CHADO_CV::checkCVByID($this, $cv_id, TRUE); + + // Checks db. + MCL_CHADO_DB::checkDB($this, MCL_VAR::getValueByName('SITE_DB')); + + // Check categories. + MCL_CHADO_CVTERM::checkCategories($this, $line['categories']); + + // Checks descirptor format. + if (!MCL_DATA_VALID_TYPE::validate('descriptor_format', $line['format'])) { + $this->updateMsg('E', 'Invalid descirptor format : ' . $line['format']); + } + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Gets db. + $db = MCL_CHADO_DB::getDB(MCL_VAR::getValueByName('SITE_DB')); + + // Gets cv. + $cv_id = $this->getJob()->getParamByKey('cv_id'); + $cv = MCL_CHADO_CV::byKey(array('cv_id' => $cv_id)); + + // Adds a descriptor. + $descriptor = MCL_CHADO_CVTERM::addCvterm($this, $db->getName(), $cv->getName(), $line['descriptor_name'], $line['definition']); + if ($descriptor) { + + // Adds properties. + $descriptor->addProp($this, 'SITE_CV', 'format', $line['format']); + $descriptor->addProp($this, 'SITE_CV', 'categories', $line['categories']); + $descriptor->addProp($this, 'SITE_CV', 'min_value', $line['minimum']); + $descriptor->addProp($this, 'SITE_CV', 'max_value', $line['maximum']); + $descriptor->addProp($this, 'SITE_CV', 'default_value', $line['default_value']); + $descriptor->addProp($this, 'SITE_CV', 'data_unit', $line['data_unit']); + + // Adds aliases. + $descriptor->addAlias($this, 'SITE_CV', 'alias', $line['alias'], '[,;]'); + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_fieldbook.class.inc b/templates/mcl_template_fieldbook.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_fieldbook.class.inc rename to templates/mcl_template_fieldbook.class.inc diff --git a/includes/class/template/module/mcl_template_genotype.class.inc b/templates/mcl_template_genotype.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_genotype.class.inc rename to templates/mcl_template_genotype.class.inc diff --git a/includes/class/template/module/mcl_template_genotype_snp.class.inc b/templates/mcl_template_genotype_snp.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_genotype_snp.class.inc rename to templates/mcl_template_genotype_snp.class.inc diff --git a/includes/class/template/module/mcl_template_genotype_snp_marker_column.class.inc b/templates/mcl_template_genotype_snp_marker_column.class.inc similarity index 97% rename from includes/class/template/module/mcl_template_genotype_snp_marker_column.class.inc rename to templates/mcl_template_genotype_snp_marker_column.class.inc index afcdf4f..5f011f2 100644 --- a/includes/class/template/module/mcl_template_genotype_snp_marker_column.class.inc +++ b/templates/mcl_template_genotype_snp_marker_column.class.inc @@ -121,9 +121,11 @@ class MCL_TEMPLATE_GENOTYPE_SNP_MARKER_COLUMN extends MCL_TEMPLATE { private function _checkMarkers($line) { // This should be called once. - if ($line['line_no'] != 3 || $this->getJob()->getParamByKey('marker_cols')) { + if ($line['line_no'] != 3) { return; } + //$this->getJob()->getParamByKey('marker_cols') + //$this->getJob()->getForce()) { // Gets feature_id for the markers. $markers = array(); diff --git a/includes/class/template/module/mcl_template_genotype_snp_stock_column.class.inc b/templates/mcl_template_genotype_snp_stock_column.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_genotype_snp_stock_column.class.inc rename to templates/mcl_template_genotype_snp_stock_column.class.inc diff --git a/includes/class/template/module/mcl_template_genotype_ssr.class.inc b/templates/mcl_template_genotype_ssr.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_genotype_ssr.class.inc rename to templates/mcl_template_genotype_ssr.class.inc diff --git a/includes/class/template/module/mcl_template_image.class.inc b/templates/mcl_template_image.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_image.class.inc rename to templates/mcl_template_image.class.inc diff --git a/includes/class/template/module/mcl_template_library.class.inc b/templates/mcl_template_library.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_library.class.inc rename to templates/mcl_template_library.class.inc diff --git a/includes/class/template/module/mcl_template_map.class.inc b/templates/mcl_template_map.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_map.class.inc rename to templates/mcl_template_map.class.inc diff --git a/includes/class/template/module/mcl_template_map_position.class.inc b/templates/mcl_template_map_position.class.inc similarity index 91% rename from includes/class/template/module/mcl_template_map_position.class.inc rename to templates/mcl_template_map_position.class.inc index 83691d8..7c32afc 100644 --- a/includes/class/template/module/mcl_template_map_position.class.inc +++ b/templates/mcl_template_map_position.class.inc @@ -88,28 +88,12 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { MCL_CHADO_FEATUREMAP::checkMap($this, $line['map_name']); // Checks feature. It must be generic marker, MTL or QTL. - $marker_qtl_mtl = $line['marker_qtl_mtl']; - - // Gets genetic marker. - $feature = MCL_CHADO_FEATURE::getFeatureAlias($marker_qtl_mtl, $genus, $species, $this->cvterms['sequence']['genetic_marker']); - if (!$feature) { - - // Gets the QTL. - $args = array( - 'uniquename' => $marker_qtl_mtl, - 'type_id' => $this->cvterms['sequence']['qtl'], - ); - $feature = MCL_CHADO_FEATURE::byKey($args); - if (!$feature) { - - // Gets the MTL. - $args['type_id'] = $this->cvterms['sequence']['heritable_phenotypic_marker']; - $feature = MCL_CHADO_FEATURE::byKey($args); - if (!$feature) { - $this->updateMsg('E', "Error - $marker_qtl_mtl is not 'Marker, 'QTL' or 'MTL'"); - } - } - } + $type_ids = array( + 'marker' => $this->cvterms['sequence']['genetic_marker'], + 'qtl' => $this->cvterms['sequence']['qtl'], + 'mtl' => $this->cvterms['sequence']['heritable_phenotypic_marker'], + ); + MCL_CHADO_FEATURE::checkMarkerMtlQtl($this, $line['marker_qtl_mtl'], $type_ids); } /** @@ -187,7 +171,7 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { $bin_name = $line['bin_name']; if ($bin_name) { $uniquename = $map->getName() . '.' . $bin_name; - $bin = MCL_CHADO_FEATURE::addFeature($this, $uniquename, '', $this->cvterms['SITE_CV']['bin'], $organism_id); + $bin = MCL_CHADO_FEATURE::addFeature($this, $uniquename, '', $this->cvterms['SITE_CV']['bin'], $organism_id_lg); if ($bin) { // Adds a relationship. diff --git a/includes/class/template/module/mcl_template_marker.class.inc b/templates/mcl_template_marker.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_marker.class.inc rename to templates/mcl_template_marker.class.inc diff --git a/includes/class/template/module/mcl_template_mtl.class.inc b/templates/mcl_template_mtl.class.inc similarity index 93% rename from includes/class/template/module/mcl_template_mtl.class.inc rename to templates/mcl_template_mtl.class.inc index 621efd0..732bef7 100644 --- a/includes/class/template/module/mcl_template_mtl.class.inc +++ b/templates/mcl_template_mtl.class.inc @@ -71,7 +71,7 @@ class MCL_TEMPLATE_MTL extends MCL_TEMPLATE { $cvterms['SITE_CV']['screening_method'] = -1; $cvterms['SITE_CV']['description'] = -1; $cvterms['SITE_CV']['published_symbol'] = -1; - $cvterms['sequence']['genetic_marker'] = -1; + $cvterms['sequence']['marker_locus'] = -1; $cvterms['sequence']['heritable_phenotypic_marker'] = -1; $cvterms['relationship']['located_in'] = -1; $cvterms['relationship']['adjacent_to'] = -1; @@ -93,10 +93,10 @@ class MCL_TEMPLATE_MTL extends MCL_TEMPLATE { MCL_CHADO_TRAIT::checkTrait($this, $line['trait_name'], $line['trait_descriptor_set']); // Checks colocalized_markers. - MCL_CHADO_FEATURE::checkFeature($this, $line['neighboring_marker'], $line['genus'], $line['species'], $this->cvterms['sequence']['genetic_marker'], '[;,]'); + MCL_CHADO_FEATURE::checkFeature($this, $line['colocalized_marker'], $line['genus'], $line['species'], $this->cvterms['sequence']['marker_locus'], '[;,]'); // Checks neighboring_markers. - MCL_CHADO_FEATURE::checkFeature($this, $line['neighboring_marker'], $line['genus'], $line['species'], $this->cvterms['sequence']['genetic_marker'], '[;,]'); + MCL_CHADO_FEATURE::checkFeature($this, $line['neighboring_marker'], $line['genus'], $line['species'], $this->cvterms['sequence']['marker_locus'], '[;,]'); // Checks images. MCL_CHADO_IMAGE::checkImage($this, $line['image'], '[;,]'); @@ -124,10 +124,10 @@ class MCL_TEMPLATE_MTL extends MCL_TEMPLATE { $mtl->addProp($this, 'SITE_CV', 'published_symbol', $line['published_symbol']); // Adds colocalized_markers. - $mtl->addRelatedFeatures($this, $line['colocalized_marker'], $this->cvterms['sequence']['genetic_marker'], FALSE, $this->cvterms['relationship']['adjacent_to'], "[,;]"); + $mtl->addRelatedFeatures($this, $line['colocalized_marker'], $this->cvterms['sequence']['marker_locus'], FALSE, $this->cvterms['relationship']['adjacent_to'], "[,;]", TRUE); // Adds neighboring_markers. - $mtl->addRelatedFeatures($this, $line['neighboring_marker'], $this->cvterms['sequence']['genetic_marker'], FALSE, $this->cvterms['relationship']['located_in'], "[,;]"); + $mtl->addRelatedFeatures($this, $line['neighboring_marker'], $this->cvterms['sequence']['marker_locus'], FALSE, $this->cvterms['relationship']['located_in'], "[,;]", TRUE); // Adds dbxref. $db = MCL_CHADO_DB::getDB('DB:genbank'); diff --git a/includes/class/template/module/mcl_template_organism.class.inc b/templates/mcl_template_organism.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_organism.class.inc rename to templates/mcl_template_organism.class.inc diff --git a/includes/class/template/module/mcl_template_phenotype.class.inc b/templates/mcl_template_phenotype.class.inc similarity index 92% rename from includes/class/template/module/mcl_template_phenotype.class.inc rename to templates/mcl_template_phenotype.class.inc index 345a9f4..35dde79 100644 --- a/includes/class/template/module/mcl_template_phenotype.class.inc +++ b/templates/mcl_template_phenotype.class.inc @@ -56,6 +56,8 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { 'data_year' => array('req' => FALSE, 'width' => 10, 'desc' => "Phenotyping date if only year is known."), 'evaluation_date' => array('req' => FALSE, 'width' => 10, 'desc' => "Date of phenotype evaluation."), 'pick_date' => array('req' => FALSE, 'width' => 10, 'desc' => "Date of the sample collection if the collection is done on a different date than the phenotype evaluation."), + 'previous_entry' => array('req' => FALSE, 'width' => 10, 'desc' => "stock ID of the previous entry."), + 'barcode' => array('req' => FALSE, 'width' => 10, 'desc' => "Barcode"), 'fiber_pkg' => array('req' => FALSE, 'width' => 10, 'desc' => "Group of samples for phenotyping, can contain samples from multiple germplasm."), 'storage_time' => array('req' => FALSE, 'width' => 10, 'desc' => "Time between collection and phenotyping."), 'storage_regime' => array('req' => FALSE, 'width' => 10, 'desc' => "The condition of sample storage between the collection and phenotyping."), @@ -89,9 +91,10 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { $cvterms['SITE_CV']['evaluation_date'] = -1; $cvterms['SITE_CV']['storage_time'] = -1; $cvterms['SITE_CV']['storage_regime'] = -1; + $cvterms['SITE_CV']['previous_entry'] = -1; + $cvterms['SITE_CV']['barcode'] = -1; $cvterms['SITE_CV']['fiber_pkg'] = -1; $cvterms['SITE_CV']['comments'] = -1; - $cvterms['SITE_CV']['trait_descriptor'] = -1; $cvterms['SITE_CV']['source'] = -1; $cvterms['SITE_CV']['previous_entry'] = -1; @@ -195,12 +198,13 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { $sample->addProp($this, 'SITE_CV', 'plant_date', $line['plant_date']); $sample->addProp($this, 'SITE_CV', 'pick_date', $line['pick_date']); $sample->addProp($this, 'SITE_CV', 'storage_time', $line['storage_time']); + $sample->addProp($this, 'SITE_CV', 'barcode', $line['barcode']); $sample->addProp($this, 'SITE_CV', 'fiber_pkg', $line['fiber_pkg']); $sample->addProp($this, 'SITE_CV', 'storage_regime', $line['storage_regime']); $sample->addProp($this, 'SITE_CV', 'comments', $line['comments']); // Adds previous-entry. - $sample->addPreviousEntry($this, $line['##previous-entry']); + $sample->addPreviousEntry($this, $line['previous-entry']); // Adds phenotyping data for each descriptor. $descriptors = $this->getJob()->getParamByKey('descriptors'); @@ -212,7 +216,7 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { } // Adds a phenotype. - $uniquename = substr($descriptor . '_' . $line[$descriptor], 1); + $uniquename = $descriptor . '_' . $line[$descriptor]; $phenotype = MCL_CHADO_PHENOTYPE::addPhenotype($this, $uniquename, $cvterm_id, $line[$descriptor]); // Adds a nd_experiment. @@ -246,18 +250,19 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { private function _checkDescriptors($line, $dataset_name) { // This should be called once. - if ($line['line_no'] != 3 || $this->getJob()->getParamByKey('descriptors')) { + if ($line['line_no'] != 3) { return; } + //$this->getJob()->getParamByKey('descriptors') + //$this->getJob()->getForce()) { - // Gets the project ID and check for trait_descriptor. - $dataset = MCL_CHADO_DATASET::getDataset($line['dataset_name']); - $project_id = $dataset->getProjectID(); - $cv_name = $dataset->getProp('SITE_CV', 'trait_descriptor'); - if (!$cv_name) { - $this->updateMsg('E', "$dataset_name does not have trait_descriptor as a project property"); + // Gets the cv for the descriptors. + $cv = $this->getCvByPrefix('#'); + if (!$cv) { + $this->updateMsg('E', "cv does not exist for prefix '#'."); return; } + $cv_id = $cv->getCvID(); // Go through headers stord in the line array. $descriptors = array(); @@ -265,7 +270,7 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { if (preg_match("/^#[A-Za-z0-9\_]/", $column)) { $cvterm_name = str_replace('#', '', $column); - $cvterm = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name); + $cvterm = MCL_CHADO_CVTERM::getCvtermByCvID($cv_id, $cvterm_name); if ($cvterm) { $descriptors[$column] = $cvterm->getCvtermID(); } diff --git a/templates/mcl_template_phenotype_bims.class.inc b/templates/mcl_template_phenotype_bims.class.inc new file mode 100644 index 0000000..6e848d3 --- /dev/null +++ b/templates/mcl_template_phenotype_bims.class.inc @@ -0,0 +1,396 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for phenotype sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'dataset_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the phenotyping dataset. It should match a 'dataset_name' column entry in the 'Dataset' sheet."), + 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "ID of the stock that has been phenotyped. It should match a 'stock_name' column entry in the 'Stock' sheet."), + 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => ""), + 'species' => array('req' => TRUE, 'width' => 10, 'desc' => ""), + 'sample_id' => array('req' => TRUE, 'width' => 10, 'desc' => "The ID of the smallest sample or sub-sample that was tested (Each row should have unique sample_ID). If there is no unique sample ID, users can concatenate a set of columns that gives a unique phenotypic value and those columns become required fields. For example, if a combination of dataset_name, ID, phenotyping_date is unique for the specific phenotype, those three can be concatenated with '_' in between."), + 'clone_id' => array('req' => FALSE, 'width' => 10, 'desc' => "ID of a spefic clone if available (eg. individual tree)."), + 'evaluator' => array('req' => FALSE, 'width' => 10, 'desc' => "Person who did the phenotyping. Multiple person can be entered with ';' in between. It should match 'contact_name' of the Contact sheet."), + 'site_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Site information where the stock for the phenotyping is planted. It should match 'site_name' in the 'Site' sheet."), + 'rep' => array('req' => FALSE, 'width' => 10, 'desc' => "Any repetition number."), + 'rootstock' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the rootstock if the plant are grafted to a rootstock. It should match an 'stock_name' column of the 'Stock' sheet."), + 'plot' => array('req' => FALSE, 'width' => 10, 'desc' => "Plot name."), + 'row' => array('req' => FALSE, 'width' => 10, 'desc' => "Row."), + 'position' => array('req' => FALSE, 'width' => 10, 'desc' => "Position of the plant."), + 'plant_date' => array('req' => FALSE, 'width' => 10, 'desc' => "Date of the planting."), + 'data_year' => array('req' => FALSE, 'width' => 10, 'desc' => "Phenotyping date if only year is known."), + 'evaluation_date' => array('req' => FALSE, 'width' => 10, 'desc' => "Date of phenotype evaluation."), + 'pick_date' => array('req' => FALSE, 'width' => 10, 'desc' => "Date of the sample collection if the collection is done on a different date than the phenotype evaluation."), + 'previous_entry' => array('req' => FALSE, 'width' => 10, 'desc' => "stock ID of the previous entry."), + 'barcode' => array('req' => FALSE, 'width' => 10, 'desc' => "Barcode"), + 'fiber_pkg' => array('req' => FALSE, 'width' => 10, 'desc' => "Group of samples for phenotyping, can contain samples from multiple germplasm."), + 'storage_time' => array('req' => FALSE, 'width' => 10, 'desc' => "Time between collection and phenotyping."), + 'storage_regime' => array('req' => FALSE, 'width' => 10, 'desc' => "The condition of sample storage between the collection and phenotyping."), + 'comments' => array('req' => FALSE, 'width' => 10, 'desc' => "Any comments for the phenotyping."), + '$$' => array('req' => FALSE, 'width' => 10, 'desc' => "Followed by cvterm name. The data will be stored in stockprop table."), + '##' => array('req' => FALSE, 'width' => 10, 'desc' => "Followed by cvterm name. The data will be stored in nd_experiementprop table."), + ); + + // Adds labels. + $headers['sample_id']['label'] = 'sample_ID'; + $headers['clone_id']['label'] = 'clone_ID'; + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['phenotyping'] = -1; + $cvterms['SITE_CV']['rootstock_id'] = -1; + $cvterms['SITE_CV']['nd_geolocation_id'] = -1; + $cvterms['SITE_CV']['sample'] = -1; + $cvterms['SITE_CV']['sample_of'] = -1; + $cvterms['SITE_CV']['clone'] = -1; + $cvterms['SITE_CV']['clone_of'] = -1; + $cvterms['SITE_CV']['clone_id'] = -1; + $cvterms['SITE_CV']['plot'] = -1; + $cvterms['SITE_CV']['row'] = -1; + $cvterms['SITE_CV']['position'] = -1; + $cvterms['SITE_CV']['data_year'] = -1; + $cvterms['SITE_CV']['plant_date'] = -1; + $cvterms['SITE_CV']['pick_date'] = -1; + $cvterms['SITE_CV']['evaluation_date'] = -1; + $cvterms['SITE_CV']['storage_time'] = -1; + $cvterms['SITE_CV']['storage_regime'] = -1; + $cvterms['SITE_CV']['previous_entry'] = -1; + $cvterms['SITE_CV']['barcode'] = -1; + $cvterms['SITE_CV']['fiber_pkg'] = -1; + $cvterms['SITE_CV']['comments'] = -1; + $cvterms['SITE_CV']['source'] = -1; + $cvterms['SITE_CV']['previous_entry'] = -1; + + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Gets the program_id. + $program_id = $this->getJob()->getParamByKey('program_id'); + + // Adds prefix. + $dataset_name = $program_id . '.' . $line['dataset_name']; + $stock_name = $program_id . '.' . $line['stock_name']; + $clone_id = $program_id . '.' . $line['clone_id']; + $site_name = $program_id . '.' . $line['site_name']; + + // Checks dataset. + MCL_CHADO_DATASET::checkDataset($this, $dataset_name); + + // Checks organisms. + MCL_CHADO_ORGANISM::checkOrganism($this, $line['genus'], $line['species']); + + // Checks stock. + MCL_CHADO_STOCK::checkStock($this, $stock_name, $line['genus'], $line['species']); + + // Checks rootstock. + if ($line['rootstock']) { + $rootstock_name = $program_id . '.' . $line['rootstock']; + MCL_CHADO_STOCK::checkStock($this, $rootstock_name, $line['genus'], $line['species']); + } + + // Checks evaluator for contact. + MCL_CHADO_CONTACT::checkContact($this, $line['evaluator'], '[;]'); + + // Checks site. + MCL_CHADO_LOCATION::checkSite($this, $site_name); + + // Checks phenotypic descriptor. + $this->_checkDescriptors($line); + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Checks the data column. Skip this line if no data presents. + if ($this->isEmptyRow($line, '^#')) { + return TRUE; + } + + // Gets the organims. + $organism = MCL_CHADO_ORGANISM::getOrganism($line['genus'], $line['species']); + + // Gets the program_id. + $program_id = $this->getJob()->getParamByKey('program_id'); + + // Adds prefix. + $dataset_name = $program_id . '.' . $line['dataset_name']; + $stock_name = $program_id . '.' . $line['stock_name']; + $site_name = $program_id . '.' . $line['site_name']; + $sample_id = $program_id . '.' . $line['sample_id']; + + // Gets the stock. + $args = array( + 'uniquename' => $stock_name, + 'organism_id' => $organism->getOrganismID(), + ); + $stock = MCL_CHADO_STOCK::byKey($args); + if ($stock) { + + // Adds sample. + $sample = MCL_CHADO_STOCK::addStock($this, $sample_id, $line['sample_id'], $organism->getOrganismID(), $this->cvterms['SITE_CV']['sample']); + if (!$sample) { + return FALSE; + } + + // Adds clone. + $clone_id = $line['clone_id']; + $clone = NULL; + if ($clone_id) { + $clone_id = $program_id . '.' . $clone_id; + $clone = MCL_CHADO_STOCK::addStock($this, $clone_id, '', $organism->getOrganismID(), $this->cvterms['SITE_CV']['clone']); + } + + // Adds relationships between stock, sample and clone. + if ($clone) { + $clone->addRelatedStock($this, $stock, $this->cvterms['SITE_CV']['clone_of']); + $sample->addRelatedStock($this, $clone, $this->cvterms['SITE_CV']['sample_of']); + } + $sample->addRelatedStock($this, $stock, $this->cvterms['SITE_CV']['sample_of']); + + // Gets rootstock_id. + $rootstock_id = ''; + if ($line['rootstock']) { + $rootstock_name = $program_id . '.' . $line['rootstock']; + $rootstock = MCL_CHADO_STOCK::getStock($rootstock_name, $line['genus'], $line['species']); + if ($rootstock) { + $rootstock_id = $rootstock->getStockID(); + } + + // Adds rootstock. + $sample->addProp($this, 'SITE_CV', 'rootstock_id', $rootstock_id); + if ($clone) { + $clone->addProp($this, 'SITE_CV', 'rootstock_id', $rootstock_id); + } + } + + // Gets nd_geolocation_id. + $nd_geolocation_id = MCL_CHADO_LOCATION::getLocationIDBySite($site_name); + + // Adds clone properties. + if ($clone) { + $clone->addProp($this, 'SITE_CV', 'nd_geolocation_id', $nd_geolocation_id); + $clone->addProp($this, 'SITE_CV', 'clone_id', $clone_id); + $clone->addProp($this, 'SITE_CV', 'rep', $line['rep']); + $clone->addProp($this, 'SITE_CV', 'plot', $line['plot']); + $clone->addProp($this, 'SITE_CV', 'row', $line['row']); + $clone->addProp($this, 'SITE_CV', 'position', $line['position']); + $clone->addProp($this, 'SITE_CV', 'plant_date', $line['plant_date']); + } + + // Adds sample properties. + $sample->addProp($this, 'SITE_CV', 'nd_geolocation_id', $nd_geolocation_id); + $sample->addProp($this, 'SITE_CV', 'clone_id', $clone_id); + $sample->addProp($this, 'SITE_CV', 'rep', $line['rep']); + $sample->addProp($this, 'SITE_CV', 'plot', $line['plot']); + $sample->addProp($this, 'SITE_CV', 'row', $line['row']); + $sample->addProp($this, 'SITE_CV', 'position', $line['position']); + $sample->addProp($this, 'SITE_CV', 'plant_date', $line['plant_date']); + $sample->addProp($this, 'SITE_CV', 'pick_date', $line['pick_date']); + $sample->addProp($this, 'SITE_CV', 'storage_time', $line['storage_time']); + $sample->addProp($this, 'SITE_CV', 'barcode', $line['barcode']); + $sample->addProp($this, 'SITE_CV', 'fiber_pkg', $line['fiber_pkg']); + $sample->addProp($this, 'SITE_CV', 'storage_regime', $line['storage_regime']); + $sample->addProp($this, 'SITE_CV', 'comments', $line['comments']); + + // Adds special columns. + $this->addSpecialColumns('$$', $sample, $line); + + // Adds previous-entry. + $sample->addPreviousEntry($this, $line['previous-entry']); + + // Gets phenotyping data. + $descriptors = $this->getJob()->getParamByKey('descriptors'); + foreach ($descriptors as $cvterm_id => $descriptor) { + $name = strtolower($descriptor['name']); + + // Adds the value. + $value = $line['#' . $name]; + + // Sets the default value if provided. + if (!$value && $descriptor['default_value']) { + $value = $descriptor['default_value']; + } + + // Adds the value. + if ($value || $value == '0') { + + // Checks the value for min and max. + if ($descriptor['max_value']) {} + if ($descriptor['min_value']) {} + + // Adds a phenotype. + $uniquename = $program_id . '.' . $name . '_' . $value; + $phenotype = MCL_CHADO_PHENOTYPE::addPhenotype($this, $uniquename, $cvterm_id, $value); + + // Adds a nd_experiment. + $nd_experiment = MCL_CHADO_ND_EXPERIMENT::addNdExperiment($this, $this->cvterms['SITE_CV']['phenotyping'], $nd_geolocation_id, $cvterm_id, $sample->getStockID()); + + if ($nd_experiment) { + + // Adds properties. + $nd_experiment->addProp($this, 'SITE_CV', 'data_year', $line['data_year']); + $nd_experiment->addProp($this, 'SITE_CV', 'evaluation_date', $line['evaluation_date']); + + // Adds special columns. + $this->addSpecialColumns('##', $nd_experiment, $line); + + // Adds evaluators. + $nd_experiment->addContact($this, $line['evaluator'], "[;]"); + + // Adds a stock. + $nd_experiment->addStock($this, $sample, $sample->getTypeID()); + + // Adds a dataset. + $nd_experiment->addDataset($this, $dataset_name); + + // Adds a phenotype. + $nd_experiment->addPhenotype($this, $phenotype); + } + } + } + } + } + + /** + * Checks trait descriptors for cvterm_id. Save them in job.param. + * + * @param array $line + */ + private function _checkDescriptors($line) { + + // This should be called once. + if ($line['line_no'] != 3) { + return; + } + + // Gets the cv for the descriptors. + $cv = $this->getCvByPrefix('#'); + if (!$cv) { + $this->updateMsg('E', "cv does not exist for prefix '#'."); + return; + } + $cv_id = $cv->getCvID(); + + // Go through headers stored in the line array. + $descriptors = array(); + foreach ($line as $column => $value) { + if (preg_match("/^#[A-Za-z0-9\_]/", $column)) { + + $cvterm_name = str_replace('#', '', $column); + $cvterm = MCL_CHADO_CVTERM::getCvtermByCvID($cv_id, $cvterm_name); + if ($cvterm) { + $cvterm_id = $cvterm->getCvtermID(); + $sql = " + SELECT C.cvterm_id, C.name, FORMAT.value AS format, + MIN_VAL.value AS min_value, MAX_VAL.value AS max_value, + DEF_VAL.value AS default_value, CAT.value AS categories + FROM {chado.cvterm} C + LEFT JOIN ( + SELECT CP.cvterm_id, CP.value + FROM chado.cvtermprop CP + INNER JOIN chado.cvterm C on C.cvterm_id = CP.type_id + INNER JOIN chado.cv CV on CV.cv_id = C.cv_id + WHERE LOWER(C.name) = :format AND LOWER(CV.name) = :cv_name + ) FORMAT on FORMAT.cvterm_id = C.cvterm_id + LEFT JOIN ( + SELECT CP.cvterm_id, CP.value + FROM chado.cvtermprop CP + INNER JOIN chado.cvterm C on C.cvterm_id = CP.type_id + INNER JOIN chado.cv CV on CV.cv_id = C.cv_id + WHERE LOWER(C.name) = :min_value AND LOWER(CV.name) = :cv_name + ) MIN_VAL on MIN_VAL.cvterm_id = C.cvterm_id + LEFT JOIN ( + SELECT CP.cvterm_id, CP.value + FROM chado.cvtermprop CP + INNER JOIN chado.cvterm C on C.cvterm_id = CP.type_id + INNER JOIN chado.cv CV on CV.cv_id = C.cv_id + WHERE LOWER(C.name) = :max_value AND LOWER(CV.name) = :cv_name + ) MAX_VAL on MAX_VAL.cvterm_id = C.cvterm_id + LEFT JOIN ( + SELECT CP.cvterm_id, CP.value + FROM chado.cvtermprop CP + INNER JOIN chado.cvterm C on C.cvterm_id = CP.type_id + INNER JOIN chado.cv CV on CV.cv_id = C.cv_id + WHERE LOWER(C.name) = :default_value AND LOWER(CV.name) = :cv_name + ) DEF_VAL on DEF_VAL.cvterm_id = C.cvterm_id + LEFT JOIN ( + SELECT CP.cvterm_id, CP.value + FROM chado.cvtermprop CP + INNER JOIN chado.cvterm C on C.cvterm_id = CP.type_id + INNER JOIN chado.cv CV on CV.cv_id = C.cv_id + WHERE LOWER(C.name) = :categories AND LOWER(CV.name) = :cv_name + ) CAT on CAT.cvterm_id = C.cvterm_id + WHERE C.cvterm_id = :cvterm_id + "; + $args = array( + ':cv_name' => 'main', + ':format' => 'format', + ':min_value' => 'min_value', + ':max_value' => 'max_value', + ':default_value' => 'default_value', + ':categories' => 'categories', + ':cvterm_id' => $cvterm_id + ); + $obj = db_query($sql, $args)->fetch(PDO::FETCH_ASSOC); + $descriptors[$cvterm_id] = $obj; + } + else { + $this->updateMsg('E', "$cvterm_name not found in cvterm"); + } + } + } + $this->getJob()->setParamByKey('descriptors', $descriptors); + $this->getJob()->update(); + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_progeny.class.inc b/templates/mcl_template_progeny.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_progeny.class.inc rename to templates/mcl_template_progeny.class.inc diff --git a/includes/class/template/module/mcl_template_progeny_bims.class.inc b/templates/mcl_template_progeny_bims.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_progeny_bims.class.inc rename to templates/mcl_template_progeny_bims.class.inc diff --git a/includes/class/template/module/mcl_template_qtl.class.inc b/templates/mcl_template_qtl.class.inc similarity index 91% rename from includes/class/template/module/mcl_template_qtl.class.inc rename to templates/mcl_template_qtl.class.inc index 45a0fb4..3b31660 100644 --- a/includes/class/template/module/mcl_template_qtl.class.inc +++ b/templates/mcl_template_qtl.class.inc @@ -55,8 +55,8 @@ class MCL_TEMPLATE_QTL extends MCL_TEMPLATE { 'dominance_effect' => array('req' => FALSE, 'width' => 10, 'desc' => "The deviation of the heterozygote phenotype from the mean of the homozygotes."), 'additivity_dominance_ratio' => array('req' => FALSE, 'width' => 10, 'desc' => "The average phenotype effect of substituting a q allele for a Q allele dominance effect The deviation of the heterozygote phenotype from the mean of the homozygotes."), 'direction' => array('req' => FALSE, 'width' => 10, 'desc' => " The direction of additive effect on the phenotype."), - 'colocalized_marker' => array('req' => FALSE, 'width' => 10, 'desc' => "Marker that are mapped within the interval defined by the QTL. Multiple markers can be added, separated by a semicolon (;)."), - 'neighboring_marker' => array('req' => FALSE, 'width' => 10, 'desc' => "Marker that is mapped in the nearest flanking position outside the interval defined by the QTL. Used to estimate QTL position if no appropriate colocalized markers are found. Multiple markers can be added, separated by a semicolon (;)."), + 'colocalized_marker' => array('req' => FALSE, 'width' => 10, 'desc' => "Marker locus that are mapped within the interval defined by the QTL. Multiple markers can be added, separated by a semicolon (;)."), + 'neighboring_marker' => array('req' => FALSE, 'width' => 10, 'desc' => "Marker locus that is mapped in the nearest flanking position outside the interval defined by the QTL. Used to estimate QTL position if no appropriate colocalized markers are found. Multiple markers can be added, separated by a semicolon (;)."), 'screening_method' => array('req' => FALSE, 'width' => 10, 'desc' => "Any specific method for the phenotypic inspection."), 'comments' => array('req' => FALSE, 'width' => 10, 'desc' => "Any comments."), 'mean' => array('req' => FALSE, 'width' => 10, 'desc' => "Mean value of the phenotype (if one QTL has multiple mean values based on the condition and/or population, enter them in QTL_trait_Data sheet."), @@ -97,7 +97,7 @@ class MCL_TEMPLATE_QTL extends MCL_TEMPLATE { $cvterms['SITE_CV']['comments'] = -1; $cvterms['SITE_CV']['population_low_value'] = -1; $cvterms['SITE_CV']['population_high_value'] = -1; - $cvterms['sequence']['genetic_marker'] = -1; + $cvterms['sequence']['marker_locus'] = -1; $cvterms['sequence']['qtl'] = -1; $cvterms['relationship']['located_in'] = -1; $cvterms['relationship']['adjacent_to'] = -1; @@ -122,10 +122,10 @@ class MCL_TEMPLATE_QTL extends MCL_TEMPLATE { MCL_CHADO_LOCATION::checkSite($this, $line['site_name']); // Checks colocalized_markers. - MCL_CHADO_FEATURE::checkFeature($this, $line['colocalized_marker'], '', '', $this->cvterms['sequence']['genetic_marker'], '[;,]'); + MCL_CHADO_FEATURE::checkFeature($this, $line['colocalized_marker'], '', '', $this->cvterms['sequence']['marker_locus'], '[;,]'); // Checks neighboring_markers. - MCL_CHADO_FEATURE::checkFeature($this, $line['neighboring_marker'], '', '', $this->cvterms['sequence']['genetic_marker'], '[;,]'); + MCL_CHADO_FEATURE::checkFeature($this, $line['neighboring_marker'], '', '', $this->cvterms['sequence']['marker_locus'], '[;,]'); // Checks references. MCL_CHADO_PUB::checkPub($this, $line['reference'], '[;,]'); @@ -177,10 +177,10 @@ class MCL_TEMPLATE_QTL extends MCL_TEMPLATE { $qtl->addSite($this, $line['site_name']); // Adds colocalized markers. - $qtl->addRelatedFeatures($this, $line['colocalized_marker'], $this->cvterms['sequence']['genetic_marker'], FALSE, $this->cvterms['relationship']['adjacent_to'], "[,;]"); + $qtl->addRelatedFeatures($this, $line['colocalized_marker'], $this->cvterms['sequence']['marker_locus'], FALSE, $this->cvterms['relationship']['adjacent_to'], "[,;]", TRUE); // Adds neighboring markers. - $qtl->addRelatedFeatures($this, $line['neighboring_marker'], $this->cvterms['sequence']['genetic_marker'], FALSE, $this->cvterms['relationship']['located_in'], "[,;]"); + $qtl->addRelatedFeatures($this, $line['neighboring_marker'], $this->cvterms['sequence']['marker_locus'], FALSE, $this->cvterms['relationship']['located_in'], "[,;]", TRUE); // Adds stocks. $qtl->addStock($this, $line['source'], $line['genus'], $line['species'], $this->cvterms['SITE_CV']['source'], "[,;]"); diff --git a/includes/class/template/module/mcl_template_qtl_trait_data.class.inc b/templates/mcl_template_qtl_trait_data.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_qtl_trait_data.class.inc rename to templates/mcl_template_qtl_trait_data.class.inc diff --git a/includes/class/template/module/mcl_template_site.class.inc b/templates/mcl_template_site.class.inc similarity index 97% rename from includes/class/template/module/mcl_template_site.class.inc rename to templates/mcl_template_site.class.inc index 401212b..5c7079b 100644 --- a/includes/class/template/module/mcl_template_site.class.inc +++ b/templates/mcl_template_site.class.inc @@ -40,6 +40,7 @@ class MCL_TEMPLATE_SITE extends MCL_TEMPLATE { public function defineHeaders() { $headers = array( 'site_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Curator-assigned name of the site."), + 'site_long_name' => array('req' => FALSE, 'width' => 10, 'desc' => "long name of the site."), 'latitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The decimal latitude coordinate of the georeference, using positive and negative sign to indicate N and S, respectively."), 'longitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The decimal longitude coordinate of the georeference, using positive and negative sign to indicate E and W, respectively."), 'altitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The altitude (elevation) of the location in meters. If the altitude is only known as a range, this is the average, and altitude_dev will hold half of the width of the range."), diff --git a/templates/mcl_template_site_bims.class.inc b/templates/mcl_template_site_bims.class.inc new file mode 100644 index 0000000..5bc3325 --- /dev/null +++ b/templates/mcl_template_site_bims.class.inc @@ -0,0 +1,122 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for site sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'site_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Curator-assigned name of the site."), + 'site_long_name' => array('req' => FALSE, 'width' => 10, 'desc' => "long name of the site."), + 'latitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The decimal latitude coordinate of the georeference, using positive and negative sign to indicate N and S, respectively."), + 'longitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The decimal longitude coordinate of the georeference, using positive and negative sign to indicate E and W, respectively."), + 'altitude' => array('req' => FALSE, 'width' => 10, 'desc' => "The altitude (elevation) of the location in meters. If the altitude is only known as a range, this is the average, and altitude_dev will hold half of the width of the range."), + 'geodetic_datum' => array('req' => FALSE, 'width' => 10, 'desc' => "The geodetic system on which the geo-reference coordinates are based. For geo-references measured between 1984 and 2010, this will typically be WGS84."), + 'type' => array('req' => FALSE, 'width' => 10, 'desc' => "'orchard', 'nursery' or any other types of location."), + 'country' => array('req' => FALSE, 'width' => 10, 'desc' => "Country where the site belongs to."), + 'state' => array('req' => FALSE, 'width' => 10, 'desc' => "State where the site belongs to."), + 'region' => array('req' => FALSE, 'width' => 10, 'desc' => "Region where the site belongs to."), + 'address' => array('req' => FALSE, 'width' => 10, 'desc' => "The entire address except the country."), + 'comments' => array('req' => FALSE, 'width' => 10, 'desc' => "Any further comments on the site."), + ); + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['type'] = -1; + $cvterms['SITE_CV']['site_long_name'] = -1; + $cvterms['SITE_CV']['country'] = -1; + $cvterms['SITE_CV']['state'] = -1; + $cvterms['SITE_CV']['region'] = -1; + $cvterms['SITE_CV']['address'] = -1; + $cvterms['SITE_CV']['comments'] = -1; + $cvterms['SITE_CV']['site_code'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks for the contact type. + if (!MCL_DATA_VALID_TYPE::validate('location_type', $line['type'])) { + $this->updateMsg('E', 'Invalid location type : ' . $line['type']); + } + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Adds a location. + $loc_info = array(); + if ($line['latitude']) { + $loc_info['latitude'] = $line['latitude']; + } + if ($line['longitude']) { + $loc_info['longitude'] = $line['longitude']; + } + if ($line['altitude']) { + $loc_info['altitude'] = $line['altitude']; + } + if ($line['geodetic_datum']) { + $loc_info['geodetic_datum'] = $line['geodetic_datum']; + } + + // Sets the site name [program_id + site_name]. + $program_id = $this->getJob()->getParamByKey('program_id'); + $site_name = $program_id . '.' . $line['site_name']; + $location = MCL_CHADO_LOCATION::addLocation($this, $site_name, $loc_info); + if ($location) { + + // Adds properties. + $location->addProp($this, 'SITE_CV', 'type', $line['type']); + $location->addProp($this, 'SITE_CV', 'site_long_name', $line['site_long_name']); + $location->addProp($this, 'SITE_CV', 'country', $line['country']); + $location->addProp($this, 'SITE_CV', 'state', $line['state']); + $location->addProp($this, 'SITE_CV', 'region', $line['region']); + $location->addProp($this, 'SITE_CV', 'address', $line['address']); + $location->addProp($this, 'SITE_CV', 'country', $line['country']); + $location->addProp($this, 'SITE_CV', 'comments', $line['comments']); + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_site_cotton.class.inc b/templates/mcl_template_site_cotton.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_site_cotton.class.inc rename to templates/mcl_template_site_cotton.class.inc diff --git a/includes/class/template/module/mcl_template_stock.class.inc b/templates/mcl_template_stock.class.inc similarity index 94% rename from includes/class/template/module/mcl_template_stock.class.inc rename to templates/mcl_template_stock.class.inc index 3c5d665..99c3c7f 100644 --- a/includes/class/template/module/mcl_template_stock.class.inc +++ b/templates/mcl_template_stock.class.inc @@ -190,4 +190,24 @@ class MCL_TEMPLATE_STOCK extends MCL_TEMPLATE { $stock->addReference($this, $line['reference'], "[,;]"); } } + + /** + * @see MCL_TEMPLATE::postProcess() + */ + public function postProcess() { + + // Adds all missing parents now. + $parents = $this->getTmpByKey('stock_parents'); + foreach ((array)$parents as $stock_id => $info) { + + // Gets the parent info. + $uniquename = $info['uniquename']; + $organism_id = $info['organism_id']; + $type_id = $info['type_id']; + + // Adds the parent. + $stock = MCL_CHADO_STOCK::byKey(array('stock_id' => $stock_id)); + $stock->addParent($this, $uniquename, $organism_id, $type_id); + } + } } \ No newline at end of file diff --git a/templates/mcl_template_stock_bims.class.inc b/templates/mcl_template_stock_bims.class.inc new file mode 100644 index 0000000..6b32283 --- /dev/null +++ b/templates/mcl_template_stock_bims.class.inc @@ -0,0 +1,234 @@ +getMemberArr()); + } + } + + /** + * @see MCL_TEMPLATE::defineDescription() + */ + public function defineDescription() { + $desc = 'The description for stock sheet'; + return $desc; + } + + /** + * @see MCL_TEMPLATE::defineHeaders() + */ + public function defineHeaders() { + $headers = array( + 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Primary ID or name of stock. The most important ID or name (unique and stable at least within the breeding program) should be in this column. For mapping population, follow the naming convention of each database."), + 'germplasm_type' => array('req' => TRUE, 'width' => 10, 'desc' => "Select from the three choices (cultivar, breeding_research_material, or wild_unimproved) for an individual germplasm or 'population' for a group of individual."), + 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => "Genus to which the stock belongs to."), + 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "Species name. Enter 'sp.' to represent one unknown species, 'spp.' to represent multiple unknown species."), + 'grin_id' => array('req' => FALSE, 'width' => 10, 'desc' => "Accession ID (ACID) in the GRIN database, if it is known."), + 'subspecies' => array('req' => FALSE, 'width' => 10, 'desc' => "Subspecies name."), + 'description' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name for the pollen parent of this entry. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'secondary_id' => array('req' => FALSE, 'width' => 10, 'desc' => "Alternate ID or name that is commonly used to refer to the entry."), + 'paternal_parent' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name for the pollen parent of this entry. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'maternal_parent' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name for the seed parent of this entry. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'mutation_parent' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name of the mutaion parent. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'selfing_parent' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock_name of the selfing parent. This stock_name must also have its own record in this table (it should be entered before being listed as a parent)."), + 'alias' => array('req' => FALSE, 'width' => 10, 'desc' => "A concatenation of all other less commonly used names or designations for the entry. the aliases. The format is 'Alias type1:Alias1; Alias type2:Alias2'. When there is no specific type for aliases, just write the aliases without the specific type. (eg. Collector:98HT-227; Site:W6 21306; ABC-1; 21306) The format is 'Alias type1:Alias1; Alias type2:Alias2'. When there is no specific type for an alias, just write the aliases without the specific type. (eg. Collector:98HT-227; Site:W6 21306; ABC-1; 21306)."), + 'cultivar' => array('req' => FALSE, 'width' => 10, 'desc' => "Cultivar name if It is a named, cultivated variety."), + 'pedigree' => array('req' => FALSE, 'width' => 10, 'desc' => "Any additional pedigree information: When the exact parents are not known, or any additional information beyond just parents (eg. Red-fruit sport of Jonathan, Pyrus sp. X Cydonia sp., etc)."), + 'origin' => array('req' => FALSE, 'width' => 10, 'desc' => "The original country for the variety (especially for wild variety)."), + 'population_size' => array('req' => FALSE, 'width' => 10, 'desc' => "Only for type 'population'."), + 'germplasm_center' => array('req' => FALSE, 'width' => 10, 'desc' => "Stock center or lab where the stock is distributed. Otherwise, provide the details of the contact person in contact column (from whom the material can be obtained) in the 'Contact' sheet."), + 'description' => array('req' => FALSE, 'width' => 10, 'desc' => "any description for the stock."), + 'comments' => array('req' => FALSE, 'width' => 10, 'desc' => "Any comments on the stock."), + 'image' => array('req' => FALSE, 'width' => 10, 'desc' => "Image_ID of any associated image (Detailed info in 'Image' sheet.) Multiple images, separated by comma, can be added."), + 'reference' => array('req' => FALSE, 'width' => 10, 'desc' => "pub_id if any publication is associated with the stock."), + '##stockprop' => array('req' => FALSE, 'width' => 10, 'desc' => "Special columns (##) : followed by cvterm name of the stockprop type_id."), + ); + + // Adds labels. + $headers['grin_id']['label'] = 'GRIN_ID'; + $headers['secondary_id']['label'] = 'secondary_ID'; + return $headers; + } + + /** + * @see MCL_TEMPLATE::defineCvterms() + */ + public function defineCvterms() { + $cvterms = array(); + $cvterms['SITE_CV']['alias'] = -1; + $cvterms['SITE_CV']['secondary_id'] = -1; + $cvterms['SITE_CV']['germplasm_center'] = -1; + $cvterms['SITE_CV']['variety'] = -1; + $cvterms['SITE_CV']['cultivar'] = -1; + $cvterms['SITE_CV']['breeding_research_material'] = -1; + $cvterms['SITE_CV']['wild_unimproved'] = -1; + $cvterms['SITE_CV']['tbd'] = -1; + $cvterms['SITE_CV']['landrace'] = -1; + $cvterms['SITE_CV']['germplasm'] = -1; + $cvterms['SITE_CV']['population'] = -1; + $cvterms['SITE_CV']['species'] = -1; + $cvterms['SITE_CV']['is_a_maternal_parent_of'] = -1; + $cvterms['SITE_CV']['is_a_paternal_parent_of'] = -1; + $cvterms['SITE_CV']['is_a_mutation_parent_of'] = -1; + $cvterms['SITE_CV']['is_a_selfing_parent_of'] = -1; + $cvterms['SITE_CV']['maternal_parent'] = -1; + $cvterms['SITE_CV']['paternal_parent'] = -1; + $cvterms['SITE_CV']['mutation_parent'] = -1; + $cvterms['SITE_CV']['selfing_parent'] = -1; + $cvterms['SITE_CV']['pedigree'] = -1; + $cvterms['SITE_CV']['description'] = -1; + $cvterms['SITE_CV']['origin'] = -1; + $cvterms['SITE_CV']['comments'] = -1; + $cvterms['SITE_CV']['population_size'] = -1; + $cvterms['SITE_CV']['subspecies'] = -1; + return $cvterms; + } + + /** + * @see MCL_TEMPLATE::runErrorCheckDataLine() + */ + public function runErrorCheckDataLine($line) { + + // Checks program_id. + $program_id = $this->getJob()->getParamByKey('program_id'); + if (!$program_id) { + $this->updateMsg('E', "program_id not found in job.param"); + } + + // Checks DB for GRIN. + MCL_CHADO_DB::checkDB($this, 'GRIN'); + + // Checks organism. + MCL_CHADO_ORGANISM::checkOrganism($this, $line['genus'], $line['species']); + + // Checks aliases. + MCL_CHADO_STOCK::checkAlias($this, $line['alias'], '[;,]'); + + // Checks images. + MCL_CHADO_IMAGE::checkImage($this, $line['image'], '[;,]'); + + // Checks references. + MCL_CHADO_PUB::checkPub($this, $line['reference'], '[;,]'); + + // Checks germplasm type. + if (!MCL_DATA_VALID_TYPE::validate('stock_type', $line['germplasm_type'])) { + $this->updateMsg('E', 'Invalid stock type : ' . $line['germplasm_type']); + } + } + + /** + * @see MCL_TEMPLATE::uploadDataLine() + */ + public function uploadDataLine($line) { + + // Gets the organism. + $organism = MCL_CHADO_ORGANISM::getOrganism($line['genus'], $line['species']); + $organism_id = $organism->getOrganismID(); + + // Gets type_id. + $type_id = $this->cvterms['SITE_CV'][strtolower($line['germplasm_type'])]; + + // Updates name. + $name = ($line['secondary_id']) ? $line['secondary_id'] : ''; + + // Gets the program_id. + $program_id = $this->getJob()->getParamByKey('program_id'); + + // Sets the uniquename [program_id + stock_name]. + $uniquename = $program_id . '.' . $line['stock_name']; + + // Adds a stock. + $stock = MCL_CHADO_STOCK::addStock($this, $uniquename, $line['stock_name'], $organism_id, $type_id); + if ($stock) { + + // Gets db of GRIN and add a dbxref. + $db = MCL_CHADO_DB::getDB('GRIN'); + $dbxref = MCL_CHADO_DBXREF::addDBXref($this, $db->getDbID(), $line['grin_id']); + if ($dbxref) { + + // Adds dbxref to stock_dbxref table. + $stock->addDBXref($this, $dbxref); + + // Updates stock.dbxref_id. + $stock->setDbxrefID($dbxref->getDbxrefID()); + $stock->update(); + } + + // Adds properties. + $stock->addProp($this, 'SITE_CV', 'secondary_id', $line['secondary_id']); + $stock->addProp($this, 'SITE_CV', 'description', $line['description']); + $stock->addProp($this, 'SITE_CV', 'cultivar', $line['cultivar']); + $stock->addProp($this, 'SITE_CV', 'pedigree', $line['pedigree']); + $stock->addProp($this, 'SITE_CV', 'origin', $line['origin']); + $stock->addProp($this, 'SITE_CV', 'population_size', $line['population_size']); + $stock->addProp($this, 'SITE_CV', 'subspecies', $line['subspecies']); + $stock->addProp($this, 'SITE_CV', 'germplasm_center', $line['germplasm_center']); + $stock->addProp($this, 'SITE_CV', 'comments', $line['comments']); + + // Adds aliases. + $stock->addAlias($this, $line['alias'], "[,;]"); + + // Adds parents. + if ($line['paternal_parent']) { + $stock->addParent($this, $program_id . '.' . $line['paternal_parent'], '', $this->cvterms['SITE_CV']['is_a_maternal_parent_of']); + } + if ($line['maternal_parent']) { + $stock->addParent($this, $program_id . '.' . $line['maternal_parent'], '', $this->cvterms['SITE_CV']['is_a_paternal_parent_of']); + } + if ($line['mutation_parent']) { + $stock->addParent($this, $program_id . '.' . $line['mutation_parent'], '', $this->cvterms['SITE_CV']['is_a_mutation_parent_of']); + } + if ($line['selfing_parent']) { + $stock->addParent($this, $program_id . '.' . $line['selfing_parent'], '', $this->cvterms['SITE_CV']['is_a_selfing_parent_of']); + } + + // Adds images. + $stock->addImage($this, $line['image'], "[,;]"); + + // Adds references. + $stock->addReference($this, $line['reference'], "[,;]"); + } + } + + /** + * @see MCL_TEMPLATE::postProcess() + */ + public function postProcess() { + + // Gets the program_id. + $program_id = $this->getJob()->getParamByKey('program_id'); + + // Adds all missing parents now. + $parents = $this->getTmpByKey('stock_parents'); + foreach ((array)$parents as $stock_id => $info) { + // Gets the parent info. + $uniquename = $info['uniquename']; + $organism_id = $info['organism_id']; + $type_id = $info['type_id']; + + // Adds the parent. + $stock = MCL_CHADO_STOCK::byKey(array('stock_id' => $stock_id)); + $stock->addParent($this, $program_id . '.' . $uniquename, $organism_id, $type_id); + } + } +} \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_stock_cotton.class.inc b/templates/mcl_template_stock_cotton.class.inc similarity index 94% rename from includes/class/template/module/mcl_template_stock_cotton.class.inc rename to templates/mcl_template_stock_cotton.class.inc index 5d7802e..67d519f 100644 --- a/includes/class/template/module/mcl_template_stock_cotton.class.inc +++ b/templates/mcl_template_stock_cotton.class.inc @@ -187,4 +187,24 @@ class MCL_TEMPLATE_STOCK_COTTON extends MCL_TEMPLATE { $stock->addReference($this, $line['reference'], "[,;]"); } } + + /** + * @see MCL_TEMPLATE::postProcess() + */ + public function postProcess() { + + // Adds all missing parents now. + $parents = $this->getTmpByKey('stock_parents'); + foreach ((array)$parents as $stock_id => $info) { + + // Gets the parent info. + $uniquename = $info['uniquename']; + $organism_id = $info['organism_id']; + $type_id = $info['type_id']; + + // Adds the parent. + $stock = MCL_CHADO_STOCK::byKey(array('stock_id' => $stock_id)); + $stock->addParent($this, $uniquename, $organism_id, $type_id); + } + } } \ No newline at end of file diff --git a/includes/class/template/module/mcl_template_trait.class.inc b/templates/mcl_template_trait.class.inc similarity index 100% rename from includes/class/template/module/mcl_template_trait.class.inc rename to templates/mcl_template_trait.class.inc From a97a2dc72252739e878a77828beccb813d4e0795 Mon Sep 17 00:00:00 2001 From: dsenalik Date: Sun, 4 Feb 2018 09:10:36 -0600 Subject: [PATCH 4/5] Spelling errors on 7.x-4.0 branch issue #3 --- includes/admin/mcl.admin.config.inc | 2 +- includes/admin/mcl.admin.data_valid.inc | 2 +- includes/admin/mcl.admin.global_var.inc | 10 +++++----- includes/admin/mcl.admin.template.inc | 6 +++--- includes/class/job/mcl_job_upload.class.inc | 4 ++-- .../mcl_chado_contact.class.inc | 2 +- .../mcl_chado_class/mcl_chado_cv.class.inc | 6 +++--- .../mcl_chado_cvterm.class.inc | 4 ++-- .../mcl_chado_dataset.class.inc | 4 ++-- .../mcl_chado_class/mcl_chado_db.class.inc | 4 ++-- .../mcl_chado_dbxref.class.inc | 2 +- .../mcl_chado_feature.class.inc | 4 ++-- .../mcl_chado_featuremap.class.inc | 2 +- .../mcl_chado_class/mcl_chado_image.class.inc | 2 +- .../mcl_chado_library.class.inc | 2 +- .../mcl_chado_location.class.inc | 2 +- .../mcl_chado_nd_experiment.class.inc | 2 +- .../mcl_chado_organism.class.inc | 4 ++-- .../mcl_chado_class/mcl_chado_pub.class.inc | 4 ++-- .../mcl_chado_class/mcl_chado_stock.class.inc | 2 +- .../mcl_chado_class/mcl_chado_trait.class.inc | 2 +- includes/class/table/mcl_table.class.inc | 2 +- includes/form/mcl.job_view.form.inc | 2 +- includes/form/mcl.upload_data.form.inc | 12 +++++------ mcl.drush.inc | 20 +++++++++---------- templates/core/mcl_template.class.inc | 2 +- templates/mcl_template_genotype.class.inc | 2 +- templates/mcl_template_genotype_snp.class.inc | 2 +- ...plate_genotype_snp_marker_column.class.inc | 2 +- templates/mcl_template_genotype_ssr.class.inc | 2 +- templates/mcl_template_marker.class.inc | 2 +- templates/mcl_template_phenotype.class.inc | 2 +- .../mcl_template_phenotype_bims.class.inc | 2 +- .../mcl_template_qtl_trait_data.class.inc | 2 +- templates/mcl_template_trait.class.inc | 2 +- 35 files changed, 64 insertions(+), 64 deletions(-) diff --git a/includes/admin/mcl.admin.config.inc b/includes/admin/mcl.admin.config.inc index af8802f..a647599 100644 --- a/includes/admin/mcl.admin.config.inc +++ b/includes/admin/mcl.admin.config.inc @@ -47,7 +47,7 @@ function mcl_admin_config_form($form, &$form_state) { // MCL Library directory. $form['config_path']['mcl_library_dir'] = array( - '#title' => t('MCL Library Directasory'), + '#title' => t('MCL Library Directory'), '#type' => t('textfield'), '#description' => t("Please specify the library directory for MCL."), '#required' => TRUE, diff --git a/includes/admin/mcl.admin.data_valid.inc b/includes/admin/mcl.admin.data_valid.inc index bed5af9..d387b5a 100644 --- a/includes/admin/mcl.admin.data_valid.inc +++ b/includes/admin/mcl.admin.data_valid.inc @@ -145,7 +145,7 @@ function _mcl_get_mcl_data_valid_type_form(&$form) { */ function _mcl_get_mcl_data_valid_form(&$form, $target_data_valid_type_id = '') { - // Gets the site varibles. + // Gets the site variables. $data_valid_types = MCL_DATA_VALID_TYPE::getDataValidTypes(FALSE); foreach ($data_valid_types as $data_valid_type) { $data_valid_type_id = $data_valid_type->getDataValidTypeID(); diff --git a/includes/admin/mcl.admin.global_var.inc b/includes/admin/mcl.admin.global_var.inc index 6595681..9d16a56 100644 --- a/includes/admin/mcl.admin.global_var.inc +++ b/includes/admin/mcl.admin.global_var.inc @@ -18,7 +18,7 @@ function mcl_admin_global_var_form($form, &$form_state) { '#type' => 'fieldset', '#collapsed' => FALSE, '#collapsible' => TRUE, - '#title' => 'Site varibles', + '#title' => 'Site variables', ); $form['site_var']['table'] = array( '#markup' => _mcl_get_mcl_global_vars_table('SITE'), @@ -29,10 +29,10 @@ function mcl_admin_global_var_form($form, &$form_state) { '#type' => 'fieldset', '#collapsed' => FALSE, '#collapsible' => TRUE, - '#title' => 'Default varibles', + '#title' => 'Default variables', ); - // Adds default varibles. + // Adds default variables. $form['default_var']['table'] = array( '#markup' => _mcl_get_mcl_global_vars_table('DEFAULT'), ); @@ -42,7 +42,7 @@ function mcl_admin_global_var_form($form, &$form_state) { '#type' => 'fieldset', '#collapsed' => TRUE, '#collapsible' => TRUE, - '#title' => 'Add a new varibles', + '#title' => 'Add a new variable', ); $form['add_var']['type'] = array( '#type' => 'select', @@ -92,7 +92,7 @@ function mcl_admin_global_var_form($form, &$form_state) { */ function _mcl_get_mcl_global_vars_table($type) { - // Gets the site varibles. + // Gets the site variables. $mcl_vars = MCL_VAR::getGlobalVars($type); $rows = array(); foreach ($mcl_vars as $mcl_var) { diff --git a/includes/admin/mcl.admin.template.inc b/includes/admin/mcl.admin.template.inc index d3eeb54..821e278 100644 --- a/includes/admin/mcl.admin.template.inc +++ b/includes/admin/mcl.admin.template.inc @@ -113,10 +113,10 @@ function mcl_admin_template_form_submit($form, &$form_state) { } } - // Scans the template directory and add new templates or remove non-existance + // Scans the template directory and add new templates or remove non-existence // ones from the database. MCL_TEMPLATE::updateTemplates(TRUE); - drupal_set_message('The templates has been updated'); + drupal_set_message('The templates have been updated'); } } @@ -143,7 +143,7 @@ function theme_mcl_admin_template_form($variables) { } $template = MCL_TEMPLATE::byKey(array('template_id' => $template_id)); - // Checks the existance of the class file. + // Checks the existence of the class file. $class_file = 'mcl_template_' . strtolower($template->getTemplate()) . '.class.inc'; $class_exists = (file_exists("$template_path/$class_file")) ? 'exists' : 'not exist'; diff --git a/includes/class/job/mcl_job_upload.class.inc b/includes/class/job/mcl_job_upload.class.inc index 22566a3..bd00b55 100644 --- a/includes/class/job/mcl_job_upload.class.inc +++ b/includes/class/job/mcl_job_upload.class.inc @@ -20,7 +20,7 @@ class MCL_JOB_UPLOAD extends MCL_JOB { public function __construct($details = array()) { parent::__construct($details); - // Adds status for a uploading job. + // Adds status for an uploading job. $this->status_label['20'] = 'copying'; $this->status_label['30'] = 'syntax error'; $this->status_label['40'] = 'data error'; @@ -746,7 +746,7 @@ class MCL_JOB_UPLOAD extends MCL_JOB { else { $class_name = 'MCL_TEMPLATE_' . strtoupper($template); $msg = "\nThe sheet name '$template' is not a valid template name.\nIt could be the following reason.\n\n"; - $msg .= " 1. wrong spell.\n"; + $msg .= " 1. wrong spelling.\n"; $msg .= " 2. $class_name is not defined.\n\n"; $msg .= "'$template' is skipped.\n\n"; $this->updateMsg('W', $msg); diff --git a/includes/class/mcl_chado_class/mcl_chado_contact.class.inc b/includes/class/mcl_chado_class/mcl_chado_contact.class.inc index 90de4f2..2eccc76 100644 --- a/includes/class/mcl_chado_class/mcl_chado_contact.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_contact.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_CONTACT extends CHADO_CONTACT { } /** - * Checks the existance of contact. If not, write the error messasge + * Checks the existence of contact. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/mcl_chado_class/mcl_chado_cv.class.inc b/includes/class/mcl_chado_class/mcl_chado_cv.class.inc index 56e732d..87541bc 100644 --- a/includes/class/mcl_chado_class/mcl_chado_cv.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_cv.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_CV extends CHADO_CV { } /** - * Checks the existance of cv by name. If not, write the error messasge + * Checks the existence of cv by name. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl @@ -64,7 +64,7 @@ class MCL_CHADO_CV extends CHADO_CV { } /** - * Checks the existance of cv by cv_id. If not, write the error messasge + * Checks the existence of cv by cv_id. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl @@ -129,7 +129,7 @@ class MCL_CHADO_CV extends CHADO_CV { */ public static function addNull() { - // Checks if it has already exists. + // Checks if it already exists. $cv = MCL_CHADO_CV::getCV('null'); if (!$cv) { $details = array('name' => 'null'); diff --git a/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc b/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc index 2a1afeb..f44d6e5 100644 --- a/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc @@ -46,7 +46,7 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { } /** - * Checks the existance of cvterm. If not, write the error messasge + * Checks the existence of cvterm. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl @@ -209,7 +209,7 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { $cv = MCL_CHADO_CV::addNull(); $dbxref = MCL_CHADO_DBXREF::addNull(); - // Checks if it has already exists. + // Checks if it already exists. $cvterm = MCL_CHADO_CVTERM::getCvterm('null', 'null'); if (!$cvterm) { $details = array( diff --git a/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc b/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc index 5471fec..d403aab 100644 --- a/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_dataset.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { } /** - * Checks the existance of dataset. If not, write the error messasge + * Checks the existence of dataset. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl @@ -57,7 +57,7 @@ class MCL_CHADO_DATASET extends CHADO_PROJECT { } /** - * Checks the existance of dataset by ID. If not, write the error messasge + * Checks the existence of dataset by ID. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/mcl_chado_class/mcl_chado_db.class.inc b/includes/class/mcl_chado_class/mcl_chado_db.class.inc index 41c5fcc..ef1e0af 100644 --- a/includes/class/mcl_chado_class/mcl_chado_db.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_db.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_DB extends CHADO_DB { } /** - * Checks the existance of db. If not, write the error messasge + * Checks the existence of db. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl @@ -79,7 +79,7 @@ class MCL_CHADO_DB extends CHADO_DB { */ public static function addNull() { - // Checks if it has already exists. + // Checks if it already exists. $db = MCL_CHADO_DB::getDB('null'); if (!$db) { $details = array('name' => 'null'); diff --git a/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc b/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc index 6b7a951..98d562a 100644 --- a/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_dbxref.class.inc @@ -44,7 +44,7 @@ class MCL_CHADO_DBXREF extends CHADO_DBXREF { // Gets null db. $db = MCL_CHADO_DB::addNull(); - // Checks if it has already exists. + // Checks if it already exists. $dbxref = MCL_CHADO_DBXREF::byKey(array('accession' => 'local:null')); if (!$dbxref) { $details = array( diff --git a/includes/class/mcl_chado_class/mcl_chado_feature.class.inc b/includes/class/mcl_chado_class/mcl_chado_feature.class.inc index c234050..27950b9 100644 --- a/includes/class/mcl_chado_class/mcl_chado_feature.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_feature.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { } /** - * Checks the existance of feature. If not, write the error messasge + * Checks the existence of feature. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl @@ -102,7 +102,7 @@ class MCL_CHADO_FEATURE extends CHADO_FEATURE { } /** - * Checks the existance of feature. If not, write the error messasge + * Checks the existence of feature. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc b/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc index 22e5828..5335597 100644 --- a/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_featuremap.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_FEATUREMAP extends CHADO_FEATUREMAP { } /** - * Checks the existance of featuremap. If not, write the error messasge + * Checks the existence of featuremap. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/mcl_chado_class/mcl_chado_image.class.inc b/includes/class/mcl_chado_class/mcl_chado_image.class.inc index 99e3b5d..71bde72 100644 --- a/includes/class/mcl_chado_class/mcl_chado_image.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_image.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_IMAGE extends CHADO_EIMAGE { } /** - * Checks the existance of eimage. If not, write the error messasge + * Checks the existence of eimage. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/mcl_chado_class/mcl_chado_library.class.inc b/includes/class/mcl_chado_class/mcl_chado_library.class.inc index accfb75..cc891da 100644 --- a/includes/class/mcl_chado_class/mcl_chado_library.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_library.class.inc @@ -34,7 +34,7 @@ class MCL_CHADO_LIBRARY extends CHADO_LIBRARY { } /** - * Checks the existance of library. If not, write the error messasge + * Checks the existence of library. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/mcl_chado_class/mcl_chado_location.class.inc b/includes/class/mcl_chado_class/mcl_chado_location.class.inc index 10a1b63..a184b43 100644 --- a/includes/class/mcl_chado_class/mcl_chado_location.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_location.class.inc @@ -154,7 +154,7 @@ class MCL_CHADO_LOCATION extends CHADO_ND_GEOLOCATION { */ public static function addNA() { - // Checks if it has already exists. + // Checks if it already exists. $location = MCL_CHADO_LOCATION::byKey(array('description' => 'Not Available')); if (!$location) { $details = array('description' => 'Not Available'); diff --git a/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc b/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc index d5aa310..eaba45d 100644 --- a/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_nd_experiment.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_ND_EXPERIMENT extends CHADO_ND_EXPERIMENT { } /** - * Checks the existance of contact. If not, write the error messasge + * Checks the existence of contact. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/mcl_chado_class/mcl_chado_organism.class.inc b/includes/class/mcl_chado_class/mcl_chado_organism.class.inc index a4a64ba..e71a512 100644 --- a/includes/class/mcl_chado_class/mcl_chado_organism.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_organism.class.inc @@ -54,7 +54,7 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { } /** - * Checks the existance of orgainsm. If not, write the error messasge + * Checks the existence of orgainsm. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl @@ -150,7 +150,7 @@ class MCL_CHADO_ORGANISM extends CHADO_ORGANISM { */ public static function addNA() { - // Checks if it has already exists. + // Checks if it already exists. $organism = MCL_CHADO_ORGANISM::getOrganism('N/A', 'N/A'); if (!$organism) { $details = array( diff --git a/includes/class/mcl_chado_class/mcl_chado_pub.class.inc b/includes/class/mcl_chado_class/mcl_chado_pub.class.inc index 6548a06..68cd6c9 100644 --- a/includes/class/mcl_chado_class/mcl_chado_pub.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_pub.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_PUB extends CHADO_PUB { } /** - * Checks the existance of db. If not, write the error messasge + * Checks the existence of db. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl @@ -83,7 +83,7 @@ class MCL_CHADO_PUB extends CHADO_PUB { // Gets null cvterm. $cvterm = MCL_CHADO_CVTERM::addNull(); - // Checks if it has already exists. + // Checks if it already exists. $pub = MCL_CHADO_PUB::byKey(array('uniquename' => 'null')); if (!$pub) { $details = array( diff --git a/includes/class/mcl_chado_class/mcl_chado_stock.class.inc b/includes/class/mcl_chado_class/mcl_chado_stock.class.inc index a63ba71..1538284 100644 --- a/includes/class/mcl_chado_class/mcl_chado_stock.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_stock.class.inc @@ -35,7 +35,7 @@ class MCL_CHADO_STOCK extends CHADO_STOCK { } /** - * Checks the existance of stock. If not, write the error messasge + * Checks the existence of stock. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/mcl_chado_class/mcl_chado_trait.class.inc b/includes/class/mcl_chado_class/mcl_chado_trait.class.inc index d04f0b3..f1ce1e3 100644 --- a/includes/class/mcl_chado_class/mcl_chado_trait.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_trait.class.inc @@ -34,7 +34,7 @@ class MCL_CHADO_TRAIT extends MCL_CHADO_CVTERM { } /** - * Checks the existance of trait. If not, write the error messasge + * Checks the existence of trait. If not, write the error messasge * to the log. * * @param MCL_TEMPLATE $mcl_tmpl diff --git a/includes/class/table/mcl_table.class.inc b/includes/class/table/mcl_table.class.inc index 714235a..ed6d4f1 100644 --- a/includes/class/table/mcl_table.class.inc +++ b/includes/class/table/mcl_table.class.inc @@ -41,7 +41,7 @@ class MCL_TABLE { 'DATE' => array('timestamp', 'timestamp_without_time_zone'), ); - // Sets contraints. + // Sets constraints. $this->constraints = array('unique', 'foreign'); } diff --git a/includes/form/mcl.job_view.form.inc b/includes/form/mcl.job_view.form.inc index 9227489..10e47d5 100644 --- a/includes/form/mcl.job_view.form.inc +++ b/includes/form/mcl.job_view.form.inc @@ -79,7 +79,7 @@ function mcl_job_view_form($form, &$form_state, $job_id = NULL) { $form['job_rerun']['no_transaction_cb'] = array( '#type' => 'checkbox', '#title' => 'No transaction', - '#description' => "Check if the size of your uploading file are large.", + '#description' => "Check if the size of your uploading file is large.", '#default_value' => $default, ); $form['job_rerun']['rerun_btn'] = array( diff --git a/includes/form/mcl.upload_data.form.inc b/includes/form/mcl.upload_data.form.inc index bec08a5..897ce94 100644 --- a/includes/form/mcl.upload_data.form.inc +++ b/includes/form/mcl.upload_data.form.inc @@ -209,13 +209,13 @@ function _mcl_get_add_job_form(&$form, MCL_USER $mcl_user) { $form['add_upload_job']['no_transaction_cb'] = array( '#type' => 'checkbox', '#title' => 'No transaction', - '#description' => "Check if the size of your uploading file are large.", + '#description' => "Check if the size of your uploading file is large.", '#default_value' => FALSE, ); $form['add_upload_job']['add_btn'] = array( '#type' => 'submit', '#name' => 'add_btn', - '#value' => 'Add a uploading job', + '#value' => 'Add an uploading job', ); } @@ -325,19 +325,19 @@ function mcl_upload_data_form_submit($form, &$form_state) { $cmd = "drush mcl-rerun-job $job_id $dest_filepath --move_input $opt_no_transaction > /dev/null 2>/dev/null & "; $pid = exec($cmd, $output, $return_var); if ($return_var) { - drupal_set_message("Failed to add a uploading job"); + drupal_set_message("Failed to add an uploading job"); } } else { - drupal_set_message("Failed to add a uploading job : Error on updating job property"); + drupal_set_message("Failed to add an uploading job : Error on updating job property"); } } else { - drupal_set_message("Failed to add a uploading job : Error on adding a file"); + drupal_set_message("Failed to add an uploading job : Error on adding a file"); } } else { - drupal_set_message("Failed to add a uploading job : Error on adding a job"); + drupal_set_message("Failed to add an uploading job : Error on adding a job"); } // Re-direct to "Data Uploading" page. diff --git a/mcl.drush.inc b/mcl.drush.inc index bd5b93f..fc1e37a 100644 --- a/mcl.drush.inc +++ b/mcl.drush.inc @@ -93,7 +93,7 @@ function mcl_drush_command() { ), ); $items['mcl-submit-uploading-job'] = array( - 'description' => t('Submits a uploading job.'), + 'description' => t('Submits an uploading job.'), 'arguments' => array( 'username' => t('Drupal user name.'), 'filepath' => t('The filename of the uploading file with path.'), @@ -481,7 +481,7 @@ function drush_mcl_delete_jobs($job_ids) { function drush_mcl_test_template() { // Gets all templates to be tested. If the filepath option is provided, - // the listed tempate in the file are tested. + // the listed templates in the file are tested. $templates = MCL_TEMPLATE::getTemplates(); $filepath = drush_get_option('filepath'); if ($filepath) { @@ -561,7 +561,7 @@ function drush_mcl_get_template($template) { } /** - * Callback for submitting a uploading job. + * Callback for submitting an uploading job. * * @param string $username * @param string $filepath @@ -593,10 +593,10 @@ function drush_mcl_submit_uploading_job($username, $filepath) { // Gets MCL_USER. $mcl_user = MCL_USER::byKey(array('name' => $username)); - // Prepares a uploading job. + // Prepares an uploading job. $mcl_job = mcl_prepare_uploading_job($mcl_user, $filepath, $working_dir, $job_name, FALSE); if ($mcl_job) { - mcl_print("Error : Failed to prepare a uploading job", 1, 3); + mcl_print("Error : Failed to prepare an uploading job", 1, 3); exit; } @@ -664,10 +664,10 @@ function drush_mcl_upload_data($username, $filepath) { // Gets MCL_USER. $mcl_user = MCL_USER::byKey(array('name' => $username)); - // Prepares a uploading job. + // Prepares an uploading job. $mcl_job = mcl_prepare_uploading_job($mcl_user, $filepath, $move_input, $trans, $working_dir, $job_name, $param); if (!$mcl_job) { - mcl_print("Error : Failed to prepare a uploading job", 1, 3); + mcl_print("Error : Failed to prepare an uploading job", 1, 3); exit; } @@ -713,7 +713,7 @@ function drush_mcl_upload_data($username, $filepath) { } /** - * Prepares for a uploading job. + * Prepares for an uploading job. * * 1. Checks arguments. * 2. Copies an input file to job folder. @@ -744,7 +744,7 @@ function mcl_prepare_uploading_job(MCL_USER $mcl_user, $filepath, $move_input, $ $name = $job_name; } - // Prepares for a uploading job. + // Prepares for an uploading job. $transaction = db_transaction(); try { @@ -952,7 +952,7 @@ function mcl_check_working_dir($working_dir) { // Checks the working directory. if ($working_dir) { - // Checks the existance. + // Checks the existence. if (!file_exists($working_dir)) { mcl_print("Error : The working directory ($working_dir) dose not exist", 1, 3); return FALSE; diff --git a/templates/core/mcl_template.class.inc b/templates/core/mcl_template.class.inc index ee6a5fe..9e1d054 100644 --- a/templates/core/mcl_template.class.inc +++ b/templates/core/mcl_template.class.inc @@ -735,7 +735,7 @@ DESC; // Ignore the column name starting with '#', '@' or '$'. $column_name = strtolower($column_name_orig); if (!array_key_exists($column_name, $this->headers) && !preg_match($regex, $column_name)) { - $this->updateMsg('W', "Invalid header : '$column_name_orig' is not valid header name, so this column would be ignored."); + $this->updateMsg('W', "Invalid header : '$column_name_orig' is not a valid header name, so this column would be ignored."); } else { diff --git a/templates/mcl_template_genotype.class.inc b/templates/mcl_template_genotype.class.inc index 0061fd1..212949f 100644 --- a/templates/mcl_template_genotype.class.inc +++ b/templates/mcl_template_genotype.class.inc @@ -40,7 +40,7 @@ class MCL_TEMPLATE_GENOTYPE extends MCL_TEMPLATE { public function defineHeaders() { $headers = array( 'dataset_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the genotyping dataset. It should match a dataset_name in 'Dataset' sheet."), - 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match an 'stock_name' of the 'Stock' sheet."), + 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match a 'stock_name' of the 'Stock' sheet."), 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => "Genus of the stock"), 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "Species of the stock"), 'sample_id' => array('req' => TRUE, 'width' => 10, 'desc' => "ID of a sample. Normally it is the same as ID unless the user want to keep tract of genotype of a specific sample."), diff --git a/templates/mcl_template_genotype_snp.class.inc b/templates/mcl_template_genotype_snp.class.inc index 1e45215..6d15cfd 100644 --- a/templates/mcl_template_genotype_snp.class.inc +++ b/templates/mcl_template_genotype_snp.class.inc @@ -40,7 +40,7 @@ class MCL_TEMPLATE_GENOTYPE_SNP extends MCL_TEMPLATE { public function defineHeaders() { $headers = array( 'dataset_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the genotyping dataset. It should match a dataset_name in 'Dataset' sheet."), - 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match an 'stock_name' of the 'Stock' sheet."), + 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match a 'stock_name' of the 'Stock' sheet."), 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => "Genus of the stock"), 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "Species of the stock"), 'marker' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the marker used for genotyping. It should match a marker_name in the 'Marker' sheet."), diff --git a/templates/mcl_template_genotype_snp_marker_column.class.inc b/templates/mcl_template_genotype_snp_marker_column.class.inc index 5f011f2..9d107ae 100644 --- a/templates/mcl_template_genotype_snp_marker_column.class.inc +++ b/templates/mcl_template_genotype_snp_marker_column.class.inc @@ -44,7 +44,7 @@ class MCL_TEMPLATE_GENOTYPE_SNP_MARKER_COLUMN extends MCL_TEMPLATE { public function defineHeaders() { $headers = array( 'dataset_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the genotyping dataset. It should match a dataset_name in 'Dataset' sheet."), - 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match an 'stock_name' of the 'Stock' sheet."), + 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match a 'stock_name' of the 'Stock' sheet."), 'genus' => array('req' => FALSE, 'width' => 10, 'desc' => "Genus of the stock"), 'species' => array('req' => FALSE, 'width' => 10, 'desc' => "Species of the stock"), '$marker_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Special columns ($) : followed by marker name"), diff --git a/templates/mcl_template_genotype_ssr.class.inc b/templates/mcl_template_genotype_ssr.class.inc index 5e7bdb9..2404ea0 100644 --- a/templates/mcl_template_genotype_ssr.class.inc +++ b/templates/mcl_template_genotype_ssr.class.inc @@ -40,7 +40,7 @@ class MCL_TEMPLATE_GENOTYPE_SSR extends MCL_TEMPLATE { public function defineHeaders() { $headers = array( 'dataset_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the genotyping dataset. It should match a dataset_name in 'Dataset' sheet."), - 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match an 'stock_name' of the 'Stock' sheet."), + 'stock_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the stock genotyped. It should match a 'stock_name' of the 'Stock' sheet."), 'genus' => array('req' => TRUE, 'width' => 10, 'desc' => "Genus of the stock"), 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "Species of the stock"), 'sample_id' => array('req' => TRUE, 'width' => 10, 'desc' => "ID of a sample. Normally it is the same as ID unless the user want to keep tract of genotype of a specific sample."), diff --git a/templates/mcl_template_marker.class.inc b/templates/mcl_template_marker.class.inc index 5d2caf6..ddd7772 100644 --- a/templates/mcl_template_marker.class.inc +++ b/templates/mcl_template_marker.class.inc @@ -72,7 +72,7 @@ class MCL_TEMPLATE_MARKER extends MCL_TEMPLATE { 'image' => array('req' => FALSE, 'width' => 10, 'desc' => "Image_ID of any associated image (Detailed info in 'Image' sheet.) Multiple images, separated by comma, can be added."), 'contact' => array('req' => FALSE, 'width' => 10, 'desc' => "Contact person for the marker (Please provide the contact info of these researchers in 'Contact' sheet)."), 'reference' => array('req' => FALSE, 'width' => 10, 'desc' => "Reference where the marker is originally described (pub_id), Multiple references, separated by comma, can be added."), - '~idendifier' => array('req' => FALSE, 'width' => 10, 'desc' => "Special columns (~) : An identifier must be either primer or probe followed by numerical number and name or seq. (e.g.) primer1_seq and primer1_name."), + '~identifier' => array('req' => FALSE, 'width' => 10, 'desc' => "Special columns (~) : An identifier must be either primer or probe followed by numerical number and name or seq. (e.g.) primer1_seq and primer1_name."), ); // Adds labels. diff --git a/templates/mcl_template_phenotype.class.inc b/templates/mcl_template_phenotype.class.inc index 35dde79..e9bf59b 100644 --- a/templates/mcl_template_phenotype.class.inc +++ b/templates/mcl_template_phenotype.class.inc @@ -48,7 +48,7 @@ class MCL_TEMPLATE_PHENOTYPE extends MCL_TEMPLATE { 'evaluator' => array('req' => FALSE, 'width' => 10, 'desc' => "Person who did the phenotyping. Multiple person can be entered with ';' in between. It should match 'contact_name' of the Contact sheet."), 'site_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Site information where the stock for the phenotyping is planted. It should match 'site_name' in the 'Site' sheet."), 'rep' => array('req' => FALSE, 'width' => 10, 'desc' => "Any repetition number."), - 'rootstock' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of tje rootstock if the plant are grafted to a rootstock. It should match an 'stock_name' column of the 'Stock' sheet."), + 'rootstock' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the rootstock if the plant is grafted to a rootstock. It should match a 'stock_name' column of the 'Stock' sheet."), 'plot' => array('req' => FALSE, 'width' => 10, 'desc' => "Plot name."), 'row' => array('req' => FALSE, 'width' => 10, 'desc' => "Row."), 'position' => array('req' => FALSE, 'width' => 10, 'desc' => "Position of the plant."), diff --git a/templates/mcl_template_phenotype_bims.class.inc b/templates/mcl_template_phenotype_bims.class.inc index 6e848d3..296c648 100644 --- a/templates/mcl_template_phenotype_bims.class.inc +++ b/templates/mcl_template_phenotype_bims.class.inc @@ -52,7 +52,7 @@ class MCL_TEMPLATE_PHENOTYPE_BIMS extends MCL_TEMPLATE { 'evaluator' => array('req' => FALSE, 'width' => 10, 'desc' => "Person who did the phenotyping. Multiple person can be entered with ';' in between. It should match 'contact_name' of the Contact sheet."), 'site_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Site information where the stock for the phenotyping is planted. It should match 'site_name' in the 'Site' sheet."), 'rep' => array('req' => FALSE, 'width' => 10, 'desc' => "Any repetition number."), - 'rootstock' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the rootstock if the plant are grafted to a rootstock. It should match an 'stock_name' column of the 'Stock' sheet."), + 'rootstock' => array('req' => FALSE, 'width' => 10, 'desc' => "Name of the rootstock if the plant is grafted to a rootstock. It should match a 'stock_name' column of the 'Stock' sheet."), 'plot' => array('req' => FALSE, 'width' => 10, 'desc' => "Plot name."), 'row' => array('req' => FALSE, 'width' => 10, 'desc' => "Row."), 'position' => array('req' => FALSE, 'width' => 10, 'desc' => "Position of the plant."), diff --git a/templates/mcl_template_qtl_trait_data.class.inc b/templates/mcl_template_qtl_trait_data.class.inc index 8e3a02c..24fd749 100644 --- a/templates/mcl_template_qtl_trait_data.class.inc +++ b/templates/mcl_template_qtl_trait_data.class.inc @@ -54,7 +54,7 @@ name of the QTL trait study, the dataset_name should exist in 'dataset_name' col 'species' => array('req' => TRUE, 'width' => 10, 'desc' => "Species name. Enter 'sp.' to represent one unknown species, 'spp.' to represent multiple unknown species."), 'descriptor' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the trait. It should exist in 'trait_name' column of the 'Trait' sheet and 'QTL' sheet."), 'trait_descriptor_set' => array('req' => FALSE, 'width' => 20, 'desc' => "The name of the crop trait ontology that is stored in cv table of chado (eg. 'rosaceae_trait_ontology' for GDR, 'cotton_trait_ontology' for cotton). In Main Lab, we develop crop trait ontology for Rosaceae, cool season food legumes, cotton and citrus, and map them to the Plant Trait Ontology. If not provided, the site trait ontology will be used."), - 'site_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Location/environment where the plant was grown. Site_name should exist in 'site_name' column of the 'Site' sheet. If the phenotypic measurement has bee done in multiple years, create multiple site_code even if it is done in the same location."), + 'site_name' => array('req' => FALSE, 'width' => 10, 'desc' => "Location/environment where the plant was grown. Site_name should exist in 'site_name' column of the 'Site' sheet. If the phenotypic measurement has been done in multiple years, create multiple site_code even if it is done in the same location."), 'mean' => array('req' => TRUE, 'width' => 10, 'desc' => "The mean value of the traits for each parent and progeny."), 'min_value' => array('req' => FALSE, 'width' => 10, 'desc' => "The minimum value of the traits for each parent and progeny."), 'max_value' => array('req' => FALSE, 'width' => 10, 'desc' => "The maximum value of the traits for each parent and progeny."), diff --git a/templates/mcl_template_trait.class.inc b/templates/mcl_template_trait.class.inc index 049da90..2baa537 100644 --- a/templates/mcl_template_trait.class.inc +++ b/templates/mcl_template_trait.class.inc @@ -40,7 +40,7 @@ class MCL_TEMPLATE_TRAIT extends MCL_TEMPLATE { public function defineHeaders() {; $headers = array( 'trait_name' => array('req' => TRUE, 'width' => 20, 'desc' => "Trait ontology term for the database or crop. QTLs, MTLs and phenotypic descriptors used in breeding programs can be associated with trait names."), - 'trait_category' => array('req' => FALSE, 'width' => 20, 'desc' => "The root term of the Plant Tait Ontology for the trait name. Choose one from the list (biochemical trait | growth and development trait | anatomy and morphology trait | quality trait | stature or vigor trait | sterility or fertility trait | stress trait | yield trait)."), + 'trait_category' => array('req' => FALSE, 'width' => 20, 'desc' => "The root term of the Plant Trait Ontology for the trait name. Choose one from the list (biochemical trait | growth and development trait | anatomy and morphology trait | quality trait | stature or vigor trait | sterility or fertility trait | stress trait | yield trait)."), 'abbreviation' => array('req' => FALSE, 'width' => 14, 'desc' => "Abbreviation of the trait ontology term (trait_name)."), 'definition' => array('req' => FALSE, 'width' => 50, 'desc' => "Definition of trait ontology term (trait_name)."), ); From 63a17a839a784aaafda3459a666009182b866e24 Mon Sep 17 00:00:00 2001 From: dsenalik Date: Wed, 7 Feb 2018 15:44:30 -0600 Subject: [PATCH 5/5] More spelling, and one error in code MCL_CHADO_FEATRUE --- includes/class/chado_table_class/chado_table.class.inc | 2 +- includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc | 2 +- .../class/mcl_chado_class/mcl_chado_featurepos.class.inc | 8 ++++---- templates/core/mcl_template.class.inc | 2 +- templates/mcl_template_map_position.class.inc | 2 +- templates/mcl_template_mtl.class.inc | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/class/chado_table_class/chado_table.class.inc b/includes/class/chado_table_class/chado_table.class.inc index 1fa95bf..e24a8c1 100644 --- a/includes/class/chado_table_class/chado_table.class.inc +++ b/includes/class/chado_table_class/chado_table.class.inc @@ -217,7 +217,7 @@ class CHADO_TABLE { } else { - // Poluplates the array with values. + // Populates the array with values. $value_arr = preg_split($this->getSepRegex($separator), $value, NULL, PREG_SPLIT_NO_EMPTY); // Adds each property. diff --git a/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc b/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc index f44d6e5..1d5752f 100644 --- a/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_cvterm.class.inc @@ -406,7 +406,7 @@ class MCL_CHADO_CVTERM extends CHADO_CVTERM { } $type_id = MCL_CHADO_CVTERM::getCvterm($cv_name, $cvterm_name)->getCvtermID(); - // Poluplates the array with aliases. + // Populates the array with aliases. $alias_arr = array(); if ($separator) { $alias_arr = preg_split($this->getSepRegex($separator), $alias, NULL, PREG_SPLIT_NO_EMPTY); diff --git a/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc b/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc index 17dec56..1d6df5a 100644 --- a/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc +++ b/includes/class/mcl_chado_class/mcl_chado_featurepos.class.inc @@ -38,13 +38,13 @@ class MCL_CHADO_FEATUREPOS extends CHADO_FEATUREPOS { * Adds a featurepos. * * @param MCL_TEMPLATE $mcl_tmpl - * @param MCL_CHADO_FEATRUE $target_feature - * @param MCL_CHADO_FEATRUEMAP $map - * @param MCL_CHADO_FEATRUE $linkage_group + * @param MCL_CHADO_FEATURE $target_feature + * @param MCL_CHADO_FEATUREMAP $map + * @param MCL_CHADO_FEATURE $linkage_group * * @return MCL_CHADO_FEATUREPOS */ - public static function addFeaturepos(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_FEATRUE $feature, MCL_CHADO_FEATRUEMAP $map, MCL_CHADO_FEATRUE $map_feature) { + public static function addFeaturepos(MCL_TEMPLATE $mcl_tmpl = NULL, MCL_CHADO_FEATURE $feature, MCL_CHADO_FEATUREMAP $map, MCL_CHADO_FEATURE $map_feature) { // Sets the arguments. $args = array( diff --git a/templates/core/mcl_template.class.inc b/templates/core/mcl_template.class.inc index 9e1d054..ebd4118 100644 --- a/templates/core/mcl_template.class.inc +++ b/templates/core/mcl_template.class.inc @@ -1158,7 +1158,7 @@ DESC; } else { - // Poluplates the array with values. + // Populates the array with values. $value_arr = preg_split(CHADO_TABLE::getSepRegex($separator), $value, NULL, PREG_SPLIT_NO_EMPTY); // Adds each property. diff --git a/templates/mcl_template_map_position.class.inc b/templates/mcl_template_map_position.class.inc index 7c32afc..bc04443 100644 --- a/templates/mcl_template_map_position.class.inc +++ b/templates/mcl_template_map_position.class.inc @@ -39,7 +39,7 @@ class MCL_TEMPLATE_MAP_POSITION extends MCL_TEMPLATE { */ public function defineHeaders() { $headers = array( - 'marker_qtl_mtl' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the marker, QTL or MTL. Please provide the detailr data in 'Marker', 'QTL', or 'MTL' sheet."), + 'marker_qtl_mtl' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the marker, QTL or MTL. Please provide the detailed data in 'Marker', 'QTL', or 'MTL' sheet."), 'locus_name' => array('req' => FALSE, 'width' => 10, 'desc' => "When a RFLP (eg. AA07) corresponds to more than one locus, the marker name (eg. AA07) is recorded in marker/qtl/mtl column and the specific name for each map position (eg. AA07A, AA07B) is recorded in this 'locus_name' column. Use AA07 as a marker name and the loci names as aliases for the marker name in 'Marker' Sheet. When a MTL is mapped to multiple locations, use the MTL_name in 'MTL' sheet in 'marker/qtl/mtl' column and the locus name of the specific map position in 'locus_name'' colum."), 'map_name' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the genetic map."), 'linkage_group' => array('req' => TRUE, 'width' => 10, 'desc' => "Name of the linkage group."), diff --git a/templates/mcl_template_mtl.class.inc b/templates/mcl_template_mtl.class.inc index 732bef7..b5a6ff8 100644 --- a/templates/mcl_template_mtl.class.inc +++ b/templates/mcl_template_mtl.class.inc @@ -47,7 +47,7 @@ class MCL_TEMPLATE_MTL extends MCL_TEMPLATE { 'gb_id' => array('req' => FALSE, 'width' => 10, 'desc' => "Associated genbank ID if available."), 'alias' => array('req' => FALSE, 'width' => 10, 'desc' => "Other names used for the trait. Multiple aliases, separated by comma, can be added."), 'screening_method' => array('req' => FALSE, 'width' => 10, 'desc' => "Any specific method for the phenotypic inspection."), - 'description' => array('req' => FALSE, 'width' => 10, 'desc' => "Desctiption for the trait. The more detail, the better. You can describe the phenotype of the various cultivar and provide the pictures."), + 'description' => array('req' => FALSE, 'width' => 10, 'desc' => "Description for the trait. The more detail, the better. You can describe the phenotype of the various cultivar and provide the pictures."), 'published_symbol' => array('req' => FALSE, 'width' => 10, 'desc' => "Published symbol for the MTL."), 'colocalized_marker' => array('req' => FALSE, 'width' => 10, 'desc' => "Molecular marker that colocalizes with the MTL."), 'neighboring_marker' => array('req' => FALSE, 'width' => 10, 'desc' => "Molecular marker that is mapped near MTL. Multiple markers can be added, separated by a semicolon (;)."),