my $self = shift;
my $transcript_scores = shift;
my $gene_mappings = shift;
my $tsb = shift;
# argument checks
unless ($transcript_scores and
$transcript_scores->isa('Bio::EnsEMBL::IdMapping::ScoredMappingMatrix')) {
throw('Need a transcript Bio::EnsEMBL::IdMapping::ScoredMappingMatrix.');
}
unless ($gene_mappings and
$gene_mappings->isa('Bio::EnsEMBL::IdMapping::MappingList')) {
throw('Need a gene Bio::EnsEMBL::IdMapping::MappingList.');
}
unless ($tsb and
$tsb->isa('Bio::EnsEMBL::IdMapping::TranscriptScoreBuilder')) {
throw('Need a Bio::EnsEMBL::IdMapping::TranscriptScoreBuilder.');
}
$self->logger->info("== Internal ID mapping for transcripts...\n\n", 0, 'stamped');
my $dump_path = path_append($self->conf->param('basedir'), 'mapping');
-DUMP_PATH => $dump_path,
-CACHE_FILE => 'transcript_mappings.ser',
);
if (-s $mapping_cache) {
# read from file
$self->logger->info("Reading transcript mappings from file...\n", 0,
'stamped');
$self->logger->debug("Cache file $mapping_cache.\n", 1);
$mappings->read_from_file;
$self->logger->info("Done.\n\n", 0, 'stamped');
} else {
# create transcript mappings
$self->logger->info("No transcript mappings found. Will calculate them now.\n");
# determine which plugin methods to run
my @default_plugins = (qw(
));
my @plugins = $self->conf->param('plugin_internal_id_mappers_transcript');
@plugins = @default_plugins unless (defined($plugins[0]));
-DUMP_PATH => $dump_path,
-CACHE_FILE => 'transcript_mappings0.ser',
);
my @mappings = ();
my $i = 0;
#
# run the scoring chain
#
foreach my $plugin (@plugins) {
($transcript_scores, $new_mappings) = $self->delegate_to_plugin($plugin,
$i++, $tsb, $new_mappings, $transcript_scores, $gene_mappings);
push(@mappings, $new_mappings);
}
# report remaining ambiguities
$self->logger->info($transcript_scores->get_source_count.
" source transcripts are ambiguous with ".
$transcript_scores->get_target_count." target transcripts.\n\n");
$self->log_ambiguous($transcript_scores, 'transcript');
# merge mappings and write to file
$mappings->add_all(@mappings);
$mappings->write_to_file;
if ($self->logger->loglevel eq 'debug') {
$mappings->log('transcript', $self->conf->param('basedir'));
}
$self->logger->info("Done.\n\n", 0, 'stamped');
}
return $mappings;
}