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.
20 dump_scores.pl - dump scores from serialised ScoredMappingMatrix
'es for debugging
24 dump_scores.pl [arguments]
28 --basedir=PATH base directory of ID mapping results
32 --conffile, --conf=FILE read parameters from FILE
33 (default: conf/Conversion.ini)
35 --logfile, --log=FILE log to FILE (default: *STDOUT)
36 --logpath=PATH write logfile to PATH (default: .)
37 --logappend, --log_append append to logfile (default: truncate)
38 --loglevel=LEVEL define log level (default: INFO)
40 -i, --interactive=0|1 run script interactively (default: true)
41 -h, --help, -? print help (this message)
45 This script reads gene, transcript and exon scores from serialised
46 ScoredMappingMatrix files and dumps the data (old_internal_id, new_internal_id,
47 score) to a text file for debugging.
49 Note that if you ran the ID mapping with loglevel=DEBUG, these dummps are
50 generated automatically so you won't need to
run this script.
55 Patrick Meidl <meidl@ebi.ac.uk>, Ensembl core API team
59 Please post comments/questions to the Ensembl development list
66 no warnings
'uninitialized';
74 # parse configuration and commandline arguments
76 -SERVERROOT =>
"$Bin/../../../..",
77 -DEFAULT_CONF =>
"$Bin/default.conf"
81 'basedir|basedir=s' => 1,
85 unless ($conf->param(
'logpath')) {
86 $conf->param(
'logpath', path_append($conf->param(
'basedir'),
'log'));
89 # get log filehandle and print heading and parameters to logfile
91 -LOGFILE => $conf->param(
'logfile'),
92 -LOGAUTO => $conf->param(
'logauto'),
93 -LOGAUTOBASE =>
'dump_scores',
94 -LOGAUTOID => $conf->param(
'logautoid'),
95 -LOGPATH => $conf->param(
'logpath'),
96 -LOGAPPEND => $conf->param(
'logappend'),
97 -LOGLEVEL => $conf->param(
'loglevel'),
101 $logger->init_log($conf->list_param_values);
103 my $dump_path = path_append($conf->param(
'basedir'),
'matrix');
110 my $transcript_matrix = &
read_matrix(
'transcript');
115 my $exonerate_matrix = &
read_matrix(
'exon_exonerate');
116 $exon_matrix->merge($exonerate_matrix);
131 -DUMP_PATH => $dump_path,
132 -CACHE_FILE =>
"${type}_matrix.ser",
140 $logger->info(
"Reading $type scoring matrix from file...\n", 0,
'stamped');
141 $logger->debug(
"Cache file $cache.\n", 1);
142 $matrix->read_from_file;
143 $logger->info(
"Done.\n\n", 0,
'stamped');
146 $logger->warning(
"No cache file found at $cache.\n");
157 $logger->info(
"Dumping $type scores to file...\n", 0,
'stamped');
159 my $debug_path = path_append($conf->param(
'basedir'),
'debug');
160 my $logfile =
"$debug_path/${type}_scores.txt";
162 open(my $fh,
'>', $logfile) or
163 throw(
"Unable to open $logfile for writing: $!");
166 foreach my $entry (@{ $matrix->get_all_Entries }) {
167 #$logger->info($entry->to_string."\n");
168 #last if (++$i == 10);
169 print $fh ($entry->to_string.
"\n");
174 $logger->info(
"Done.\n\n", 0,
'stamped');