Skip to content
Snippets Groups Projects
Commit 75f6f745 authored by Patrick Meidl's avatar Patrick Meidl
Browse files

logging improvements

parent bfdb73b8
No related branches found
No related tags found
No related merge requests found
......@@ -152,10 +152,15 @@ sub map_stable_ids {
# generate a new mapping_session and write all mapping_session data to a file
$self->generate_mapping_session;
$self->logger->info("== Stable ID mapping for $type...\n\n", 0, 'stamped');
# check if there are any objects of this type at all
my %all_sources = %{ $self->cache->get_by_name("${type}s_by_id", 'source') };
my %all_targets = %{ $self->cache->get_by_name("${type}s_by_id", 'target') };
return unless (scalar(keys %all_sources));
unless (scalar(keys %all_sources)) {
$self->logger->info("No cached ${type}s found.\n\n");
return;
}
my %stats = map { $_ => 0 }
qw(mapped_known mapped_novel new lost_known lost_novel);
......@@ -313,6 +318,7 @@ sub map_stable_ids {
# also generate and write stats to file
$self->generate_mapping_stats($type, \%stats);
$self->logger->info("Done.\n\n");
}
......@@ -624,15 +630,15 @@ sub write_stable_ids_to_file {
# check for missing created and modified dates
my $created_date = $obj->created_date;
unless ($created_date) {
$self->logger->debug("Missing created_date for target ".
$obj->to_string."\n", 1);
#$self->logger->debug("Missing created_date for target ".
# $obj->to_string."\n", 1);
$created_date = $self->mapping_session_date;
}
my $modified_date = $obj->modified_date;
unless ($modified_date) {
$self->logger->debug("Missing modified_date for target ".
$obj->to_string."\n", 1);
#$self->logger->debug("Missing modified_date for target ".
# $obj->to_string."\n", 1);
$modified_date = $self->mapping_session_date;
}
......
......@@ -52,7 +52,7 @@ sub score_transcripts {
throw('Need a Bio::EnsEMBL::IdMapping::ScoredMappingMatrix.');
}
$self->logger->info("Starting transcript scoring...\n\n", 0, 'stamped');
$self->logger->info("-- Scoring transcripts...\n\n", 0, 'stamped');
# build scores based on exon scores
my $matrix = $self->scores_from_exon_scores($exon_matrix);
......@@ -65,15 +65,9 @@ sub score_transcripts {
$self->logger->info(sprintf($fmt, "Total source transcripts:",
$self->cache->get_count_by_name('transcripts_by_id', 'source')), 1);
$self->logger->info(sprintf($fmt, "Scored source transcripts:",
$matrix->get_source_count), 1);
$self->logger->info(sprintf($fmt, "Total target transcripts:",
$self->cache->get_count_by_name('transcripts_by_id', 'target')), 1);
$self->logger->info(sprintf($fmt, "Scored target transcripts:",
$matrix->get_target_count), 1);
$self->log_matrix_stats($matrix);
$self->logger->info("\nDone with transcript scoring.\n\n");
......@@ -162,6 +156,7 @@ sub flag_matrix_from_exon_scores {
my $i;
my $num_transcripts =
scalar(keys %{ $self->cache->get_by_name('transcripts_by_id', 'source') });
my $progress_id = $self->logger->init_progress($num_transcripts, 100);
$self->logger->info("Creating flag matrix...\n", 1);
......@@ -169,7 +164,7 @@ sub flag_matrix_from_exon_scores {
foreach my $source_transcript (values %{ $self->cache->get_by_name('transcripts_by_id', 'source') }) {
# log progress
$self->logger->log_progress($num_transcripts, ++$i, 20, 1, 0);
$self->logger->log_progress($progress_id, ++$i, 1);
# get all exons for the source transcript
foreach my $source_exon (@{ $source_transcript->get_all_Exons }) {
......@@ -222,6 +217,7 @@ sub score_matrix_from_flag_matrix {
my $i;
my $num_transcripts =
scalar(keys %{ $self->cache->get_by_name('transcripts_by_id', 'source') });
my $progress_id = $self->logger->init_progress($num_transcripts, 100);
$self->logger->info("Creating score matrix from flag matrix...\n", 1);
......@@ -229,7 +225,7 @@ sub score_matrix_from_flag_matrix {
foreach my $source_transcript (values %{ $self->cache->get_by_name('transcripts_by_id', 'source') }) {
# log progress
$self->logger->log_progress($num_transcripts, ++$i, 20, 1, 0);
$self->logger->log_progress($progress_id, ++$i, 1);
# We are only interested in scoring with exons that are in the target
# transcript. The scored mapping matrix may contain scores for exons that
......@@ -262,8 +258,8 @@ sub score_matrix_from_flag_matrix {
next unless ($target_exons{$target_exon_id});
my $score = $exon_matrix->get_score(
$source_exon->id, $target_exon_id);
my $score = $exon_matrix->get_score($source_exon->id,
$target_exon_id);
$max_source_score = $score if ($score > $max_source_score);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment