|
@@ -266,143 +266,130 @@ function tripal_chado_prepare_chado($job = NULL) {
|
|
|
|
|
|
drush_print("Creating common Tripal Content Types...");
|
|
|
drush_print("This may take awhile if you are upgrading a site that has lots of data...");
|
|
|
-
|
|
|
- // Create the 'Organism' entity type. This uses the obi:organism term.
|
|
|
- drush_print("Creating Organism...");
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'OBI',
|
|
|
- 'accession' => '0100026',
|
|
|
- 'term_name' => 'organism',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'organism',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'OBI', 'accession' => '0100026'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "Organism" Tripal Content Type.';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
- if ($report_progress) {
|
|
|
- $job->setProgress(74);
|
|
|
- }
|
|
|
-
|
|
|
- // Create the 'Analysis' entity type. This uses the local:analysis term.
|
|
|
- drush_print("Creating Analysis...");
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'operation',
|
|
|
- 'accession' => '2945',
|
|
|
- 'term_name' => 'Analysis',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'analysis',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'operation', 'accession' => '2945'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "Analysis" Tripal Content Type.';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
if ($report_progress) {
|
|
|
- $job->setProgress(78);
|
|
|
+ $job->setProgress(85);
|
|
|
}
|
|
|
+ tripal_chado_prepare_general_types($job);
|
|
|
+ tripal_chado_prepare_genomic_types($job);
|
|
|
+ tripal_chado_prepare_genetic_types($job);
|
|
|
+ tripal_chado_prepare_germplasm_types($job);
|
|
|
+ tripal_chado_prepare_expression_types($job);
|
|
|
+
|
|
|
+ // Add the supported loaders
|
|
|
+ variable_set('tripal_pub_supported_dbs', array('PMID', 'AGL'));
|
|
|
|
|
|
- // Create the 'Project' entity type. This uses the local:project term.
|
|
|
- drush_print("Creating Project...");
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'local',
|
|
|
- 'accession' => 'project',
|
|
|
- 'term_name' => 'project',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'project',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'local', 'accession' => 'project'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "Project" Tripal Content Type.';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
+ // Set a variable to indicate the site is prepared.
|
|
|
+ variable_set('tripal_chado_is_prepared', TRUE);
|
|
|
+
|
|
|
if ($report_progress) {
|
|
|
- $job->setProgress(82);
|
|
|
- }
|
|
|
+ $job->setProgress(100);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception $e) {
|
|
|
+ $job->logMessage($e);
|
|
|
+ throw new Exception($e);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Clear the Drupal menu cache so that the new content types have "add" links.
|
|
|
+ menu_cache_clear_all();
|
|
|
+}
|
|
|
|
|
|
- // Create the 'Map' entity type. This uses the local:project term.
|
|
|
- drush_print("Creating Map...");
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'data',
|
|
|
- 'accession' => '1274',
|
|
|
- 'term_name' => 'Map',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'featuremap',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'data', 'accession' => '1274'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "Map" Tripal Content Type.';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
- // Add cvterm mapping for the Map entity type
|
|
|
- $identifier = array(
|
|
|
- 'cv_id' => array('name' => 'EDAM'),
|
|
|
- 'name' => 'Map'
|
|
|
- );
|
|
|
- $cvterm = chado_get_cvterm($identifier);
|
|
|
- tripal_chado_add_cvterm_mapping($cvterm->cvterm_id, 'featuremap', NULL);
|
|
|
- if ($report_progress) {
|
|
|
- $job->setProgress(86);
|
|
|
- }
|
|
|
+/**
|
|
|
+ * Creates the "General" category of content types.
|
|
|
+ */
|
|
|
+function tripal_chado_prepare_general_types($job) {
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Organism' entity type. This uses the obi:organism term.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'OBI',
|
|
|
+ 'accession' => '0100026',
|
|
|
+ 'term_name' => 'organism',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'organism',
|
|
|
+ ),
|
|
|
+ 'category' => 'General'
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Analysis' entity type. This uses the local:analysis term.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'operation',
|
|
|
+ 'accession' => '2945',
|
|
|
+ 'term_name' => 'Analysis',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'analysis',
|
|
|
+ ),
|
|
|
+ 'category' => 'General'
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Project' entity type. This uses the local:project term.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'NCIT',
|
|
|
+ 'accession' => 'C47885',
|
|
|
+ 'term_name' => 'Project',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'project',
|
|
|
+ ),
|
|
|
+ 'category' => 'General'
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Study' entity type. This uses the local:project term.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'SIO',
|
|
|
+ 'accession' => '001066',
|
|
|
+ 'term_name' => 'Study',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'study',
|
|
|
+ ),
|
|
|
+ 'category' => 'General'
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Contact' entity type. This uses the local:contact term.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'local',
|
|
|
+ 'accession' => 'contact',
|
|
|
+ 'term_name' => 'contact',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'contact',
|
|
|
+ ),
|
|
|
+ 'category' => 'General'
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Publication' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'TPUB',
|
|
|
+ 'accession' => '0000002',
|
|
|
+ 'term_name' => 'Publication',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'pub',
|
|
|
+ ),
|
|
|
+ 'category' => 'General'
|
|
|
+ );
|
|
|
+ $bundle = tripal_load_bundle_entity(['accession' => $args['vocabulary'] . ':' . $args['accession']]);
|
|
|
+ if (!$bundle) {
|
|
|
// Import a publication so we get all of the properties before
|
|
|
// creating the content type.
|
|
|
chado_import_pub_by_dbxref('PMID:24163125');
|
|
|
-
|
|
|
- // Create the 'Publication' entity type.
|
|
|
- drush_print("Creating Publication...");
|
|
|
- $error = '';
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'TPUB',
|
|
|
- 'accession' => '0000002',
|
|
|
- 'term_name' => 'Publication',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'pub',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'TPUB', 'accession' => '0000002'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "Publication" Tripal Content Type.';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
- // Add cvterm mapping for the Publication entity type
|
|
|
- $identifier = array(
|
|
|
- 'cv_id' => array('name' => 'tripal_pub'),
|
|
|
- 'name' => 'Publication'
|
|
|
- );
|
|
|
- $cvterm = chado_get_cvterm($identifier);
|
|
|
- tripal_chado_add_cvterm_mapping($cvterm->cvterm_id, 'pub', NULL);
|
|
|
-
|
|
|
+
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
// Now remove the publication that was added above.
|
|
|
$values = array(
|
|
|
'dbxref_id' => array(
|
|
@@ -414,117 +401,388 @@ function tripal_chado_prepare_chado($job = NULL) {
|
|
|
);
|
|
|
$result = chado_select_record('pub_dbxref', array('pub_id'), $values);
|
|
|
chado_delete_record('pub', array('pub_id' => $result[0]->pub_id));
|
|
|
- if ($report_progress) {
|
|
|
- $job->setProgress(90);
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Protocol' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'sep',
|
|
|
+ 'accession' => '00101',
|
|
|
+ 'term_name' => 'Protocol',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'protocol',
|
|
|
+ ),
|
|
|
+ 'category' => 'General'
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+}
|
|
|
|
|
|
- // Create the 'Gene' entity type.
|
|
|
- drush_print("Creating Gene...");
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'SO',
|
|
|
- 'accession' => '0000704',
|
|
|
- 'term_name' => 'gene',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'feature',
|
|
|
- 'type_column' => 'type_id',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'SO', 'accession' => '0000704'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "Gene" Tripal Content Type.';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
- if ($report_progress) {
|
|
|
- $job->setProgress(94);
|
|
|
- }
|
|
|
+/**
|
|
|
+ * Creates the "Genomic" category of content types.
|
|
|
+ */
|
|
|
+function tripal_chado_prepare_genomic_types($job) {
|
|
|
+ //
|
|
|
+ // Create the 'Gene' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'SO',
|
|
|
+ 'accession' => '0000704',
|
|
|
+ 'term_name' => 'gene',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'feature',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Genomic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'mRNA' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'SO',
|
|
|
+ 'accession' => '0000234',
|
|
|
+ 'term_name' => 'mRNA',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'feature',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Genomic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Phylogenetic tree' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'data',
|
|
|
+ 'accession' => '0872',
|
|
|
+ 'term_name' => 'Phylogenetic tree',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'phylotree',
|
|
|
+ ),
|
|
|
+ 'category' => 'Genomic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ // Create the 'Physical Map' entity type.
|
|
|
+ $cvterm = tripal_get_cvterm(['id' => 'rdfs:type']);
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'data',
|
|
|
+ 'accession' => '1280',
|
|
|
+ 'term_name' => 'Physical Map',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'featuremap',
|
|
|
+ 'type_linker_table' => 'featuremapprop',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ 'type_id' => $cvterm->cvterm_id,
|
|
|
+ 'type_value' => 'physical'
|
|
|
+ ),
|
|
|
+ 'category' => 'Genomic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ // Create the 'DNA Library' entity type.
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'NCIT',
|
|
|
+ 'accession' => 'C16223',
|
|
|
+ 'term_name' => 'DNA Library',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'library',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Genomic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ // Create the 'Genome Assembly' entity type.
|
|
|
+ $cvterm = tripal_get_cvterm(['id' => 'rdfs:type']);
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'operation',
|
|
|
+ 'accession' => '0525',
|
|
|
+ 'term_name' => 'Genome Assembly',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'analysis',
|
|
|
+ 'type_linker_table' => 'analysisprop',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ 'type_id' => $cvterm->cvterm_id,
|
|
|
+ 'type_value' => 'genome_assembly'
|
|
|
+ ),
|
|
|
+ 'category' => 'Genomic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ // Create the 'Genome Annotation' entity type.
|
|
|
+ $cvterm = tripal_get_cvterm(['id' => 'rdfs:type']);
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'operation',
|
|
|
+ 'accession' => '0362',
|
|
|
+ 'term_name' => 'Genome Annotation',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'analysis',
|
|
|
+ 'type_linker_table' => 'analysisprop',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ 'type_id' => $cvterm->cvterm_id,
|
|
|
+ 'type_value' => 'genome_annotation'
|
|
|
+ ),
|
|
|
+ 'category' => 'Genomic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ // Create the 'Genome Annotation' entity type.
|
|
|
+ $cvterm = tripal_get_cvterm(['id' => 'rdfs:type']);
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'local',
|
|
|
+ 'accession' => 'Genome Project',
|
|
|
+ 'term_name' => 'Genome Project',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'project',
|
|
|
+ 'type_linker_table' => 'projectprop',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ 'type_id' => $cvterm->cvterm_id,
|
|
|
+ 'type_value' => 'genome_project'
|
|
|
+ ),
|
|
|
+ 'category' => 'Genomic',
|
|
|
+ );
|
|
|
+ $bundle = tripal_load_bundle_entity(['accession' => $args['vocabulary'] . ':' . $args['accession']]);
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+}
|
|
|
|
|
|
- // Create the 'mRNA' entity type.
|
|
|
- drush_print("Creating mRNA...");
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'SO',
|
|
|
- 'accession' => '0000234',
|
|
|
- 'term_name' => 'mRNA',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'feature',
|
|
|
- 'type_column' => 'type_id',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'SO', 'accession' => '0000234'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "mRNA" Tripal Content Type.';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
- if ($report_progress) {
|
|
|
- $job->setProgress(98);
|
|
|
- }
|
|
|
+/**
|
|
|
+ * Creates the "Expression" category of content types.
|
|
|
+ */
|
|
|
+function tripal_chado_prepare_expression_types($job) {
|
|
|
+ //
|
|
|
+ // Create the 'biological sample' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'sep',
|
|
|
+ 'accession' => '00195',
|
|
|
+ 'term_name' => 'biological sample',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'biomaterial',
|
|
|
+ ),
|
|
|
+ 'Expression',
|
|
|
+ );
|
|
|
+ $bundle = tripal_load_bundle_entity(['accession' => $args['vocabulary'] . ':' . $args['accession']]);
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Assay' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'OBI',
|
|
|
+ 'accession' => '0000070',
|
|
|
+ 'term_name' => 'Assay',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'assay',
|
|
|
+ ),
|
|
|
+ 'Expression',
|
|
|
+ );
|
|
|
+ $bundle = tripal_load_bundle_entity(['accession' => $args['vocabulary'] . ':' . $args['accession']]);
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Array Design' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'EFO',
|
|
|
+ 'accession' => '0000269',
|
|
|
+ 'term_name' => 'Assay Design',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'arraydesign',
|
|
|
+ ),
|
|
|
+ 'Expression',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+}
|
|
|
|
|
|
- // Create the 'biological sample' entity type.
|
|
|
- drush_print("Creating Biological Sample...");
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'sep',
|
|
|
- 'accession' => '00195',
|
|
|
- 'term_name' => 'biological sample',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'biomaterial',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'sep', 'accession' => '00195'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "Biological Sample" Tripal Content Type.';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
- if ($report_progress) {
|
|
|
- $job->setProgress(99);
|
|
|
- }
|
|
|
+/**
|
|
|
+ * Creates the "Germplasm/Breeding" category of content types.
|
|
|
+ */
|
|
|
+function tripal_chado_prepare_germplasm_types($job) {
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Phenotypic Trait' entity type.
|
|
|
+ //
|
|
|
+ /**
|
|
|
+ * SPF: We need a bit more testing before we add this conteont type as
|
|
|
+ * it resolves to the cvterm table. Currently, it can't be created.
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'NCIT',
|
|
|
+ 'accession' => 'C85496',
|
|
|
+ 'term_name' => 'Phenotypic Trait',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'cvterm',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Germplasm/Breeding',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+ */
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Germplasm Accession' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'CO_010',
|
|
|
+ 'accession' => '0000044',
|
|
|
+ 'term_name' => 'Germplasm Accession',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'stock',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Germplasm/Breeding',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Breeding Cross' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'CO_010',
|
|
|
+ 'accession' => '0000255',
|
|
|
+ 'term_name' => 'Generated germplasm (breeding cross)',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'stock',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Germplasm/Breeding',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Germplasm Variety' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'CO_010',
|
|
|
+ 'accession' => '0000029',
|
|
|
+ 'term_name' => 'Cultivar (germplasm variety)',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'stock',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Germplasm/Breeding',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Germplasm Variety' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'CO_010',
|
|
|
+ 'accession' => '0000162',
|
|
|
+ 'term_name' => 'Recombinant Inbred Line',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'stock',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Germplasm/Breeding',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+}
|
|
|
|
|
|
- // Create the 'Phylogenetic tree' entity type.
|
|
|
- drush_print("Creating Phylogenetic tree...");
|
|
|
- $args = array(
|
|
|
- 'vocabulary' => 'data',
|
|
|
- 'accession' => '0872',
|
|
|
- 'term_name' => 'Phylogenetic tree',
|
|
|
- 'storage_args' => array(
|
|
|
- 'data_table' => 'phylotree',
|
|
|
- )
|
|
|
- );
|
|
|
- $term = tripal_load_term_entity(array('vocabulary' => 'data', 'accession' => '0872'));
|
|
|
- if ($term) {
|
|
|
- $bundle = tripal_load_bundle_entity(array('term_id' => $term->id));
|
|
|
- }
|
|
|
- if (!$term or !$bundle) {
|
|
|
- if (!tripal_create_bundle($args)) {
|
|
|
- $msg = 'Error Encountered creating "Phylogenetic tree" Tripal Content Type';
|
|
|
- throw new Exception($msg);
|
|
|
- }
|
|
|
- }
|
|
|
- if ($report_progress) {
|
|
|
- $job->setProgress(99);
|
|
|
+/**
|
|
|
+ * Creates the "Genetic" category of content types.
|
|
|
+ */
|
|
|
+function tripal_chado_prepare_genetic_types($job) {
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Genetic Map' entity type.
|
|
|
+ //
|
|
|
+ $cvterm = tripal_get_cvterm(['id' => 'rdfs:type']);
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'data',
|
|
|
+ 'accession' => '1278',
|
|
|
+ 'term_name' => 'Genetic Map',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'featuremap',
|
|
|
+ 'type_linker_table' => 'featuremapprop',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ 'type_id' => $cvterm->cvterm_id,
|
|
|
+ 'type_value' => 'genetic'
|
|
|
+ ),
|
|
|
+ 'category' => 'Genetic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'QTL' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'SO',
|
|
|
+ 'accession' => '0000771',
|
|
|
+ 'term_name' => 'QTL',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'feature',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Genetic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Sequence Variant' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'SO',
|
|
|
+ 'accession' => '0001060',
|
|
|
+ 'term_name' => 'Sequence Variant',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'feature',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Genetic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Genetic Marker' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'SO',
|
|
|
+ 'accession' => '0001645',
|
|
|
+ 'term_name' => 'Genetic Marker',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'feature',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Genetic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+
|
|
|
+
|
|
|
+ //
|
|
|
+ // Create the 'Heritable Phenotypic Marker' entity type.
|
|
|
+ //
|
|
|
+ $args = array(
|
|
|
+ 'vocabulary' => 'SO',
|
|
|
+ 'accession' => '0001500',
|
|
|
+ 'term_name' => 'Heritable Phenotypic Marker',
|
|
|
+ 'storage_args' => array(
|
|
|
+ 'data_table' => 'feature',
|
|
|
+ 'type_column' => 'type_id',
|
|
|
+ ),
|
|
|
+ 'category' => 'Genetic',
|
|
|
+ );
|
|
|
+ _tripal_chado_preapre_create_bundle($args, $job);
|
|
|
+}
|
|
|
+/**
|
|
|
+ * A helper function to consolidate the code used to create a bundle.
|
|
|
+ */
|
|
|
+function _tripal_chado_preapre_create_bundle($args, $job) {
|
|
|
+
|
|
|
+ $bundle = tripal_load_bundle_entity(['accession' => $args['vocabulary'] . ':' . $args['accession']]);
|
|
|
+ if (!$bundle) {
|
|
|
+ drush_print("Creating " . $args['term_name'] . "...");
|
|
|
+ if (!tripal_create_bundle($args, $job)) {
|
|
|
+ $msg = t('Error encountered creating !type Content Type.', ['!type' => $args['term_name']]);
|
|
|
+ throw new Exception($msg);
|
|
|
}
|
|
|
-
|
|
|
- // Add the supported loaders
|
|
|
- variable_set('tripal_pub_supported_dbs', array('PMID', 'AGL'));
|
|
|
-
|
|
|
- // Set a variable to indicate the site is prepared.
|
|
|
- variable_set('tripal_chado_is_prepared', TRUE);
|
|
|
}
|
|
|
- catch (Exception $e) {
|
|
|
- $job->logMessage($e);
|
|
|
- throw new Exception($e);
|
|
|
+ else {
|
|
|
+ drush_print("Content type already created (skipping): " . $args['term_name'] . "...");
|
|
|
}
|
|
|
}
|
|
|
|