Przeglądaj źródła

Added the first stages of a chado loader. So far, the additions will load chado v1.11 into a 'chado' schema within the same database that Drupal is installed. It also populates the tables with the same data when using the perl scripts.

spficklin 14 lat temu
rodzic
commit
372e4626ba

+ 201 - 0
tripal_core/chado_install.php

@@ -0,0 +1,201 @@
+<?php
+/*************************************************************************
+*
+*/
+function tripal_core_install_job (){
+   global $user;
+
+   $args = array();
+   tripal_add_job("Install Chado",'tripal_core',
+      'tripal_core_install_chado',$args,$user->uid);
+
+   return '';
+}
+/*************************************************************************
+*
+*/
+function tripal_core_install_chado ($dummy = NULL, $job = NULL){
+   $schema_file = drupal_get_path('module', 'tripal_core').'/default_schema.sql';
+   $init_file = drupal_get_path('module', 'tripal_core').'/initialize.sql';
+   tripal_core_reset_chado_schema();
+   tripal_core_install_sql($schema_file);
+   tripal_core_install_sql($init_file);      
+}
+/*************************************************************************
+*
+*/
+function tripal_core_reset_chado_schema (){
+   global $active_db;
+
+   // iterate through the lines of the schema file and rebuild the SQL
+   pg_query($active_db,"drop schema chado cascade");
+   pg_query($active_db,"drop schema genetic_code cascade");
+   pg_query($active_db,"drop schema so cascade");
+   pg_query($active_db,"drop schema frange cascade");
+   pg_query($active_db,"create schema chado");
+   pg_query($active_db,"create language plpgsql");
+}
+/*************************************************************************
+*
+*/
+function tripal_core_install_sql ($sql_file){
+   global $active_db;
+
+   pg_query($active_db,"set search_path to chado,public");
+
+   print "Loading $sql_file...\n";
+   $lines = file($sql_file,FILE_SKIP_EMPTY_LINES);
+   if(!$lines){
+      return 'Cannot open $schema_file';
+   }
+
+   $stack = array();
+   $in_string = 0;
+
+   $query = '';
+   $i = 0;
+   foreach ($lines as $line_num => $line) {
+      $i++;
+      $type = '';
+
+      // find and remove comments except when inside of strings
+      if(preg_match('/--/',$line) and !$in_string and !preg_match("/'.*?--.*?'/",$line)){
+         $line = preg_replace('/--.*$/','',$line);  // remove comments
+      }
+      if(preg_match('/\/\*.*?\*\//',$line)){
+         $line = preg_replace('/\/\*.*?\*\//','',$line);  // remove comments
+      }
+      // skip empty lines
+      if(preg_match('/^\s*$/',$line) or strcmp($line,'')==0){
+         continue;
+      }
+
+      // Find SQL for new objects
+      if(preg_match('/^\s*CREATE\s+TABLE/i',$line) and !$in_string){
+         $stack[] = 'table';
+      }
+      if(preg_match('/^\s*ALTER\s+TABLE/i',$line) and !$in_string){
+         $stack[] = 'alter table';
+      }
+      if(preg_match('/^\s*SET/i',$line) and !$in_string){
+         $stack[] = 'set';
+      }
+      if(preg_match('/^\s*CREATE\s+SCHEMA/i',$line) and !$in_string){
+         $stack[] = 'schema';
+      }
+      if(preg_match('/^\s*CREATE\s+SEQUENCE/i',$line) and !$in_string){
+         $stack[] = 'sequence';
+      }
+      if(preg_match('/^\s*CREATE\s+(?:OR\s+REPLACE\s+)*VIEW/i',$line) and !$in_string){
+         $stack[] = 'view';
+      }
+      if(preg_match('/^\s*COMMENT/i',$line) and !$in_string and sizeof($stack)==0){
+         $stack[] = 'comment';  
+      }
+      if(preg_match('/^\s*CREATE\s+(?:OR\s+REPLACE\s+)*FUNCTION/i',$line) and !$in_string){
+         $stack[] = 'function';
+      }
+      if(preg_match('/^\s*CREATE\s+INDEX/i',$line) and !$in_string){
+         $stack[] = 'index';
+      }
+      if(preg_match('/^\s*INSERT\s+INTO/i',$line) and !$in_string){
+         $stack[] = 'insert';
+      }
+      if(preg_match('/^\s*CREATE\s+TYPE/i',$line) and !$in_string){
+         $stack[] = 'type';
+      }
+      if(preg_match('/^\s*GRANT/i',$line) and !$in_string){
+         $stack[] = 'grant';
+      }
+      if(preg_match('/^\s*CREATE\s+AGGREGATE/i',$line) and !$in_string){
+         $stack[] = 'aggregate';
+      }
+
+      // determine if we are in a string that spans a line
+      $matches = preg_match_all("/[']/i",$line,$temp);
+      $in_string = $in_string - ($matches % 2);
+      $in_string = abs($in_string);
+
+      // if we've reached the end of an object the pop the stack 
+      if(strcmp($stack[sizeof($stack)-1],'table') == 0 and preg_match('/\);\s*$/',$line)){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'alter table') == 0 and preg_match('/;\s*$/',$line) and !$in_string){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'set') == 0 and preg_match('/;\s*$/',$line) and !$in_string){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'schema') == 0 and preg_match('/;\s*$/',$line) and !$in_string){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'sequence') == 0 and preg_match('/;\s*$/',$line) and !$in_string){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'view') == 0 and preg_match('/;\s*$/',$line) and !$in_string){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'comment') == 0 and preg_match('/;\s*$/',$line) and !$in_string){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'function') == 0 and preg_match("/LANGUAGE.*?;\s+$/i",$line)){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'index') == 0 and preg_match('/;\s*$/',$line) and !$in_string){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'insert') == 0 and preg_match('/\);\s*$/',$line)){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'type') == 0 and preg_match('/\);\s*$/',$line)){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'grant') == 0 and preg_match('/;\s*$/',$line) and !$in_string){
+         $type = array_pop($stack);
+      }
+      if(strcmp($stack[sizeof($stack)-1],'aggregate') == 0 and preg_match('/\);\s*$/',$line)){
+         $type = array_pop($stack);
+      }
+
+
+      // if we're in a recognized SQL statement then let's keep track of lines
+      if($type or sizeof($stack) > 0){
+         $query .= "$line";
+      } else {
+         print "UNHANDLED $i, $in_string: $line";
+         return tripal_core_chado_install_done();
+      }
+
+      if(preg_match_all("/\n/",$query,$temp) > 100){
+         print "SQL query is too long.  Terminating:\n$query\n";
+         return tripal_core_chado_install_done();
+      }
+
+      if($type and sizeof($stack) == 0){
+         print "Adding $type: line $i\n";
+         // rewrite the set serach_path to make 'public' be 'chado'
+         if(strcmp($type,'set')==0){
+            $query = preg_replace("/public/m","chado",$query);
+         }
+         $result = pg_query($active_db, $query);
+         if(!$result){
+            $error  = pg_last_error();
+            print "Installation failed:\nSQL $i, $in_string: $query\n$error\n";
+            pg_query($active_db,"set search_path to public,chado");  
+            return tripal_core_chado_install_done();
+         }
+         $query = '';
+      }    
+   }
+
+   print "Installation Complete!\n";
+   tripal_core_chado_install_done(); 
+}
+/*************************************************************************
+*
+*/
+function tripal_core_chado_install_done (){
+   // return the search path to normal
+   global $active_db;
+   pg_query($active_db,"set search_path to public,chado");  
+}

Plik diff jest za duży
+ 2423 - 0
tripal_core/default_schema.sql


+ 232 - 0
tripal_core/initialize.sql

@@ -0,0 +1,232 @@
+/* For load_gff3.pl */
+insert into organism (abbreviation, genus, species, common_name)
+       values ('H.sapiens', 'Homo','sapiens','human');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('D.melanogaster', 'Drosophila','melanogaster','fruitfly');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('M.musculus', 'Mus','musculus','mouse');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('A.gambiae', 'Anopheles','gambiae','mosquito');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('R.norvegicus', 'Rattus','norvegicus','rat');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('A.thaliana', 'Arabidopsis','thaliana','mouse-ear cress');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('C.elegans', 'Caenorhabditis','elegans','worm');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('D.rerio', 'Danio','rerio','zebrafish');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('O.sativa', 'Oryza','sativa','rice');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('S.cerevisiae', 'Saccharomyces','cerevisiae','yeast');
+insert into organism (abbreviation, genus, species, common_name)
+       values ('X.laevis', 'Xenopus','laevis','frog');
+insert into organism (abbreviation, genus, species,common_name) 
+       values ('D.discoideum','Dictyostelium','discoideum','dicty');
+insert into contact (name) values ('Affymetrix');
+insert into contact (name,description) values ('null','null');
+insert into cv (name) values ('null');
+insert into cv (name,definition) values ('local','Locally created terms');
+insert into cv (name,definition) values ('Statistical Terms','Locally created terms for statistics');
+insert into db (name, description) values ('null','a fake database for local items');
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'local:null');
+insert into cvterm (name,cv_id,dbxref_id) values ('null',(select cv_id from cv where name = 'null'),(select dbxref_id from dbxref where accession='local:null'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'local:computer file');
+insert into cvterm (name,cv_id,dbxref_id) values ('computer file', (select cv_id from cv where name = 'null'),(select dbxref_id from dbxref where accession='local:computer file'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'local:glass');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('glass','glass array',(select cv_id from cv where name = 'local'),(select dbxref_id from dbxref where accession='local:glass'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'local:photochemical_oligo');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('photochemical_oligo','in-situ photochemically synthesized oligoes',(select cv_id from cv where name = 'local'),(select dbxref_id from dbxref where accession='local:photochemical_oligo'));
+
+insert into pub (miniref,uniquename,type_id) values ('null','null',(select cvterm_id from cvterm where name = 'null'));
+insert into db (name, description) values ('GFF_source', 'A collection of sources (ie, column 2) from GFF files');
+
+insert into db (name) values ('ATCC');
+
+insert into db (name) values ('DB:refseq');
+insert into db (name) values ('DB:genbank');
+insert into db (name) values ('DB:EMBL');
+insert into db (name) values ('DB:TIGR');
+insert into db (name) values ('DB:ucsc');
+insert into db (name) values ('DB:ucla');
+insert into db (name) values ('DB:SGD');
+
+insert into db (name) values ('DB:PFAM');
+insert into db (name) values ('DB:SUPERFAMILY');
+insert into db (name) values ('DB:PROFILE');
+insert into db (name) values ('DB:PRODOM');
+insert into db (name) values ('DB:PRINTS');
+insert into db (name) values ('DB:SMART');
+insert into db (name) values ('DB:TIGRFAMs');
+insert into db (name) values ('DB:PIR');
+
+insert into db (name) values ('DB:Affymetrix_U133');
+insert into db (name) values ('DB:Affymetrix_U133PLUS');
+insert into db (name) values ('DB:Affymetrix_U95');
+insert into db (name) values ('DB:LocusLink');
+insert into db (name) values ('DB:RefSeq_protein');
+insert into db (name) values ('DB:GenBank_protein');
+insert into db (name) values ('DB:OMIM');
+insert into db (name) values ('DB:Swiss');
+insert into db (name) values ('DB:RefSNP');
+insert into db (name) values ('DB:TSC');
+--insert into db (name, contact_id, description, urlprefix) values ('DB:affy:U133',(select contact_id from contact where name = 'null'),'Affymetrix U133','http://https://www.affymetrix.com/analysis/netaffx/fullrecord.affx?pk=HG-U133_PLUS_2:');
+--insert into db (name, contact_id, description, urlprefix) values ('DB:affy:U95',(select contact_id from contact where name = 'null'),'Affymetrix U95','http://https://www.affymetrix.com/analysis/netaffx/fullrecord.affx?pk=HG-U95AV2:');
+
+insert into db (name, description) values ('DB:GR','Gramene');
+insert into db (name, description, urlprefix) values ('DB:uniprot','UniProt/TrEMBL','http://us.expasy.org/cgi-bin/niceprot.pl?');
+insert into db (name, description, urlprefix) values ('DB:refseq:mrna','RefSeq mRNA','http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=search&db=nucleotide&dopt=GenBank&term=');
+insert into db (name, description, urlprefix) values ('DB:refseq:protein','RefSeq Protein','http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=search&db=protein&dopt=GenBank&term=');
+insert into db (name, description, urlprefix) values ('DB:unigene','Unigene','http://www.ncbi.nih.gov/entrez/query.fcgi?db=unigene&cmd=search&term=');
+insert into db (name, description, urlprefix) values ('DB:omim','OMIM','http://www.ncbi.nlm.nih.gov/entrez/dispomim.cgi?id=');
+insert into db (name, description, urlprefix) values ('DB:locuslink','LocusLink','http://www.ncbi.nlm.nih.gov/LocusLink/LocRpt.cgi?l=');
+insert into db (name, description, urlprefix) values ('DB:genbank:mrna','GenBank mRNA','http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=search&db=nucleotide&dopt=GenBank&term=');
+insert into db (name, description, urlprefix) values ('DB:genbank:protein','GenBank Protein','http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=search&db=protein&dopt=GenBank&term=');
+insert into db (name, description, urlprefix) values ('DB:swissprot:display','SwissProt','http://us.expasy.org/cgi-bin/niceprot.pl?');
+insert into db (name, description, urlprefix) values ('DB:pfam','Pfam','http://www.sanger.ac.uk/cgi-bin/Pfam/dql.pl?query=');
+
+insert into analysis (name,program,programversion) values ('dabg' ,'dabg' ,'dabg' );
+insert into analysis (name,program,programversion) values ('dchip','dchip','dchip');
+insert into analysis (name,program,programversion) values ('gcrma','gcrma','gcrma');
+insert into analysis (name,program,programversion) values ('mas5' ,'mas5' ,'mas5' );
+insert into analysis (name,program,programversion) values ('mpam' ,'mpam' ,'mpam' );
+insert into analysis (name,program,programversion) values ('plier','plier','plier');
+insert into analysis (name,program,programversion) values ('rma'  ,'rma'  ,'rma'  );
+insert into analysis (name,program,programversion) values ('sea'  ,'sea'  ,'sea'  );
+insert into analysis (name,program,programversion) values ('vsn'  ,'vsn'  ,'vsn'  );
+
+insert into arraydesign (name,manufacturer_id,platformtype_id) values ('unknown'                                    , (select contact_id from contact where name = 'null'),(select cvterm_id from cvterm where name = 'null'));
+insert into arraydesign (name,manufacturer_id,platformtype_id) values ('virtual array'                              , (select contact_id from contact where name = 'null'),(select cvterm_id from cvterm where name = 'null'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U133_Plus_2' , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U133A'       , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U133A_2'     , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U133B'       , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U95Av2'      , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U95B'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U95C'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U95D'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HG-U95E'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HuExon1'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_HuGeneFL'       , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_U74Av2'         , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_MG-U74Av2'      , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_MG-U74Bv2'      , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_MG-U74Cv2'      , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_RG-U34A'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_RG-U34B'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_RG-U34C'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_RT-U34'         , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_RN-U34'         , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_YG-S98'         , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Yeast_2'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_RAE230A'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_RAE230B'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Rat230_2'       , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_MOE430A'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_MOE430B'        , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Mouse430_2'     , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Mouse430A_2'    , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_ATH1-121501'    , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Mapping100K_Hind240' , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Mapping100K_Xba240'  , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Mapping10K_Xba131'   , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Mapping10K_Xba142'   , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Mapping500K_NspI'    , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+insert into arraydesign (name,manufacturer_id,platformtype_id,substratetype_id) values ('Affymetrix_Mapping500K_StyI'    , (select contact_id from contact where name = 'Affymetrix'),(select cvterm_id from cvterm where name = 'photochemical_oligo'),(select cvterm_id from cvterm where name = 'glass'));
+
+insert into cv (name) values ('developmental stages');
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'developmental stages:fetus');
+insert into cvterm (name,cv_id,dbxref_id) values ('fetus',      (select cv_id from cv where name = 'local'),(select dbxref_id from dbxref where accession='developmental stages:fetus'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'developmental stages:neonate');
+insert into cvterm (name,cv_id,dbxref_id) values ('neonate',    (select cv_id from cv where name = 'developmental stages'), (select dbxref_id from dbxref where accession='developmental stages:neonate'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'developmental stages:child');
+insert into cvterm (name,cv_id,dbxref_id) values ('child',      (select cv_id from cv where name = 'developmental stages'), (select dbxref_id from dbxref where accession='developmental stages:child'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'developmental stages:adult_young');
+insert into cvterm (name,cv_id,dbxref_id) values ('adult_young',(select cv_id from cv where name = 'developmental stages'),(select dbxref_id from dbxref where accession='developmental stages:adult_young'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'developmental stages:adult');
+insert into cvterm (name,cv_id,dbxref_id) values ('adult',      (select cv_id from cv where name = 'developmental stages'),(select dbxref_id from dbxref where accession='developmental stages:adult'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'developmental stages:adult_old');
+insert into cvterm (name,cv_id,dbxref_id) values ('adult_old',  (select cv_id from cv where name = 'developmental stages'), (select dbxref_id from dbxref where accession='developmental stages:adult_old'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'local:survival_time');
+insert into cvterm (name,cv_id,dbxref_id) values ('survival_time',(select cv_id from cv where name = 'local'),(select dbxref_id from dbxref where accession='local:survival_time'));
+
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:n');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('n','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:n'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:minimum');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('minimum','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:minimum'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:maximum');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('maximum','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:maximum'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:modality');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('modality','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:modality'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:modality p');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('modality p','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:modality p'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:mean');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('mean','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:mean'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:median');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('median','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:median'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:mode');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('mode','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:mode'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:quartile 1');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('quartile 1','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:quartile 1'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:quartile 3');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('quartile 3','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:quartile 3'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:skewness');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('skewness','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:skewness'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:kurtosis');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('kurtosis','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:kurtosis'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:chi square p');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('chi square p','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:chi square p'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:standard deviation');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('standard deviation','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:standard deviation'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:expectation maximization gaussian mean');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('expectation maximization gaussian mean','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:expectation maximization gaussian mean'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:expectation maximization p');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('expectation maximization p','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:expectation maximization p'));
+
+insert into dbxref (db_id,accession) values ((select db_id from db where name='null'), 'Statistical Terms:histogram');
+insert into cvterm (name,definition,cv_id,dbxref_id) values ('histogram','sensu statistica',  (select cv_id from cv where name = 'Statistical Terms'),(select dbxref_id from dbxref where accession='Statistical Terms:histogram'));
+
+insert into cv (name,definition) values ('autocreated','Terms that are automatically inserted by loading software');
+
+
+--this table will probably end up in general.sql
+ CREATE TABLE public.materialized_view   (       
+                                materialized_view_id SERIAL,
+                                last_update TIMESTAMP,
+                                refresh_time INT,
+                                name VARCHAR(64) UNIQUE,
+                                mv_schema VARCHAR(64),
+                                mv_table VARCHAR(128),
+                                mv_specs TEXT,
+                                indexed TEXT,
+                                query TEXT,
+                                special_index TEXT
+                                );
+
+

+ 9 - 0
tripal_core/tripal_core.module

@@ -7,6 +7,8 @@
 require_once "jobs.php";
 require_once "mviews.php";
 require_once "cvterms.php";
+require_once "chado_install.php";
+
 /*************************************************************************
 *
 */
@@ -115,6 +117,13 @@ function tripal_core_menu() {
      'access arguments' => array('access administration pages'),
      'type' => MENU_CALLBACK | MENU_LINKS_TO_PARENT 
    );
+   $items['admin/tripal/chado_install'] = array(
+     'title' => 'Install Chado v1.11',
+     'description' => 'Installs Chado version 1.11 inside the current Drupal database',
+     'page callback' => 'tripal_core_install_job',
+     'access arguments' => array('access administration pages'),
+     'type' => MENU_NORMAL_ITEM,
+   );
   return $items;
 }
 /************************************************************************

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików