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.
17 # Don't change the above line.
18 # Change the PATH in the myRun.ksh script if you want to use another perl.
29 --dbname, db_name=NAME database name NAME
30 --host, --dbhost, --db_host=HOST database host HOST
31 --port, --dbport, --db_port=PORT database port PORT
32 --user, --dbuser, --db_user=USER database username USER
33 --pass, --dbpass, --db_pass=PASS database passwort PASS
37 --conffile, --conf=FILE read parameters from FILE
38 (
default: conf/Conversion.ini)
40 --logfile, --log=FILE log to FILE (
default: *STDOUT)
41 --logpath=PATH write logfile to PATH (
default: .)
42 --logappend, --log_append append to logfile (
default: truncate)
43 --loglevel=LEVEL define log level (
default: INFO)
45 -i, --interactive=0|1
run script interactively (
default:
true)
46 -n, --dry_run, --dry=0|1 don
't write results to database
47 -h, --help, -? print help (this message)
55 Patrick Meidl <meidl@ebi.ac.uk>, Ensembl core API team
59 Please post comments/questions to the Ensembl development list
60 <http://lists.ensembl.org/mailman/listinfo/dev>
66 no warnings 'uninitialized
';
69 use Bio::EnsEMBL::Utils::ConfParser;
70 use Bio::EnsEMBL::Utils::Logger;
71 use Bio::EnsEMBL::Utils::ScriptUtils qw(inject path_append);
72 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
74 # parse configuration and commandline arguments
75 my $conf = new Bio::EnsEMBL::Utils::ConfParser(
76 -SERVERROOT => "$Bin/../../..",
77 -DEFAULT_CONF => "$Bin/default.conf"
81 'sourcehost|source_host=s
' => 1,
82 'sourceport|source_port=n
' => 1,
83 'sourceuser|source_user=s
' => 1,
84 'sourcepass|source_pass=s
' => 0,
85 'sourcedbname|source_dbname=s
' => 1,
86 'targethost|target_host=s
' => 1,
87 'targetport|target_port=n
' => 1,
88 'targetuser|target_user=s
' => 1,
89 'targetpass|target_pass=s
' => 0,
90 'targetdbname|target_dbname=s
' => 1,
91 'basedir|basedir=s
' => 1,
93 'biotypes_include=s@
' => 0,
94 'biotypes_exclude=s@
' => 0,
100 # set default logpath
101 unless ($conf->param('logpath
')) {
102 $conf->param('logpath
', path_append($conf->param('basedir
'), 'log
'));
104 # log to a subdirectory to prevent clutter
105 $conf->param('logpath
', path_append($conf->param('logpath
'),
106 'dump_by_seq_region
'));
108 # append job index to logfile name
109 my $dbtype = $conf->param('dbtype
');
110 my $index = $conf->param('index
');
111 my $logautobase = ($conf->param('logautobase
') || 'dump_by_seq_region
').
114 # get log filehandle and print heading and parameters to logfile
115 my $logger = new Bio::EnsEMBL::Utils::Logger(
116 -LOGFILE => $conf->param('logfile
'),
117 -LOGAUTO => $conf->param('logauto
'),
118 -LOGAUTOBASE => $logautobase,
119 -LOGAUTOID => $conf->param('logautoid
'),
120 -LOGPATH => $conf->param('logpath
'),
122 -LOGLEVEL => $conf->param('loglevel
'),
127 my $cache_impl = $conf->param('cache_impl
');
130 my $cache = $cache_impl->new(
135 # determine which slice to process. to do so, read the file containing the
136 # slices to be processed, and take the one at position $index
137 my $logpath = $conf->param('logpath
');
138 my $filename = "$dbtype.dump_cache.slices.txt";
139 open(my $fh, '<
', "$logpath/$filename") or
140 throw("Unable to open $logpath/$filename for reading: $!");
141 my @slice_names = <$fh>;
142 my $slice_name = $slice_names[$index-1];
146 # no build the cache for this slice
147 $cache->build_cache_by_slice($dbtype, $slice_name);
149 # set flag to indicate everything went fine
150 my $success_file = $conf->param('logpath
')."/$logautobase.$index.success";
151 open(TMPFILE, '>
', $success_file) and close TMPFILE
152 or throw "Can't open $success_file
for writing: $!
";