2 # See the NOTICE file distributed with this work for additional information
3 # regarding copyright ownership.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
25 #effectively add this directory to the PERL5LIB automatically
26 my $dir = cwd() .
'/' . __FILE__;
33 my ($file, $user, $password, $verbose, $force, $help, $schema, $vega_schema, $limit);
35 GetOptions (
'file=s' => \$file,
36 'schema=s' => \$schema,
37 'vega_schema=s' => \$vega_schema,
39 'password=s' => \$password,
40 'verbose' => \$verbose,
45 usage(
"-file option is required") if(!$file);
46 usage("-schema option is required") if(!$schema);
49 open(FILE, $file) or die("Could not open input file '$file'");
51 my @all_species_converters;
53 while( my $line = <FILE> ) {
55 next
if $line =~ /^#/;
58 my ( $species, $host, $source_db_name, $target_db_name ) =
63 $species =
"vega::".$species;
64 eval
"require SeqStoreConverter::$species";
66 warn(
"Could not require conversion module SeqStoreConverter::$species\n" .
67 "Using SeqStoreConverter::BasicConverter instead:\n$@");
69 $species =
"BasicConverter";
72 warn
"Using conversion module SeqStoreConverter::$species\n";
77 eval
"require SeqStoreConverter::$species";
79 warn(
"Could not require conversion module SeqStoreConverter::$species\n" .
80 "Using SeqStoreConverter::BasicConverter instead:\n$@");
82 $species =
"BasicConverter";
88 $converter =
"SeqStoreConverter::$species"->
new
89 ( $user, $password, $host, $source_db_name, $target_db_name,
90 $schema, $vega_schema, $force, $verbose, $limit );
93 push @all_species_converters, $converter;
97 for my $converter ( @all_species_converters ) {
98 $converter->debug(
"\n\n*** converting " . $converter->source .
" to " .
99 $converter->target() .
" ***");
100 $converter->transfer_meta();
101 $converter->create_coord_systems();
102 $converter->create_seq_regions();
103 $converter->create_assembly();
104 $converter->create_attribs();
105 $converter->set_top_level();
107 $converter->transfer_dna();
108 $converter->transfer_genes();
109 $converter->transfer_prediction_transcripts();
110 $converter->transfer_features();
112 $converter->transfer_vega_stable_ids();
114 $converter->transfer_stable_ids();
116 $converter->copy_other_tables();
117 $converter->copy_repeat_consensus();
118 $converter->create_meta_coord();
120 $converter->update_clone_info();
121 $converter->remove_supercontigs();
122 $converter->copy_internal_clone_names();
127 print STDERR
"*** All finished ***\n";
132 print STDERR
"$msg\n\n" if($msg);
135 usage: perl convert_seqstore <options>
137 options: -file <input_file> input file with tab delimited
'species',
138 'host',
'source_db',
'target_db' values
141 -schema <table_file> file containing SQL schema definition
143 -vega_schema <table_file> file containing SQL
for additional Vega tables
145 -user <user> a mysql db user with read/write priveleges
147 -password <password> the mysql user
's password
149 -verbose print out debug statements
151 -force replace any target dbs that already exists
153 -limit <num_rows> limit the number of features transfered to
156 -help display this message
158 example: perl convert_seqstore.pl -file converter.input \\
159 -schema ../../sql/table.sql -user ensadmin -password secret \\