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(path_append);
72 use Bio::EnsEMBL::IdMapping::Cache;
73 use Bio::EnsEMBL::IdMapping::SyntenyFramework;
74 use Bio::EnsEMBL::IdMapping::ScoredMappingMatrix;
76 # parse configuration and commandline arguments
77 my $conf = new Bio::EnsEMBL::Utils::ConfParser(
78 -SERVERROOT => "$Bin/../../..",
79 -DEFAULT_CONF => "$Bin/default.conf"
83 'basedir|basedir=s
' => 1,
85 'chromosomes|chr=s@
' => 0,
89 # append job index to logfile name
90 my $index = $conf->param('index
');
91 my $logautobase = $conf->param('logautobase
') || 'synteny_rescore
';
93 # get log filehandle and print heading and parameters to logfile
94 my $logger = new Bio::EnsEMBL::Utils::Logger(
95 -LOGFILE => $conf->param('logfile
'),
96 -LOGAUTO => $conf->param('logauto
'),
97 -LOGAUTOBASE => $logautobase,
98 -LOGAUTOID => $conf->param('logautoid
'),
99 -LOGPATH => $conf->param('logpath
'),
100 -LOGAPPEND => $conf->param('logappend
'),
101 -LOGLEVEL => $conf->param('loglevel
'),
105 # loading cache from file
106 my $cache = Bio::EnsEMBL::IdMapping::Cache->new(
112 # load SyntenyFramework and gene ScoredMappingMatrix from files
113 my $basedir = $conf->param('basedir
');
115 my $sf = Bio::EnsEMBL::IdMapping::SyntenyFramework->new(
116 -DUMP_PATH => path_append($basedir, 'mapping
'),
117 -CACHE_FILE => 'synteny_framework.ser
',
124 my $gene_scores = Bio::EnsEMBL::IdMapping::ScoredMappingMatrix->new(
125 -DUMP_PATH => path_append($basedir, 'matrix/synteny_rescore
'),
126 -CACHE_FILE => "gene_matrix_synteny$index.ser",
130 # synteny rescore and serialise results to file
131 $gene_scores = $sf->rescore_gene_matrix($gene_scores);
132 $gene_scores->write_to_file;
134 # set flag to indicate everything went fine
135 my $success_file = $conf->param('logpath
')."/synteny_rescore.$index.success";
136 open(TMPFILE, '>
', $success_file) and close TMPFILE
137 or die "Can't open $success_file
for writing: $!
";