Bio-EnsEMBL
view release on metacpan or search on metacpan
lib/Bio/EnsEMBL/IdMapping/ResultAnalyser.pm view on Meta::CPAN
print $fh "</body></html>\n";
close($fh);
}
=head2 create_mapping_summary
Example : $analyser->create_mapping_summary();
Description : Writes a text file containing a summary of the mapping stats.
This will be emailed to the genebuilder for evaluation (you will
have to manually send the email, using the text in
"mapping_summary.txt" as the template).
Return type : none
Exceptions : none
Caller : general
Status : At Risk
: under development
=cut
sub create_mapping_summary {
my $self = shift;
my $fh = $self->get_filehandle('mapping_summary.txt');
#
# title
#
print $fh qq(Stable ID mapping results\n);
print $fh qq(=========================\n\n);
#
# timing
#
print $fh "Run at: ".localtime()."\n";
print $fh "Runtime: ";
print $fh $self->logger->runtime, "\n\n";
#
# parameters used for this run
#
print $fh $self->conf->list_param_values;
print $fh "\n";
#
# mapping stats
#
foreach my $type (qw(exon transcript translation gene gene_detailed)) {
my $filename = "${type}_mapping_stats.txt";
if ($self->file_exists($filename, 'stats')) {
print $fh $self->read_from_file($filename, 'stats');
print $fh "\n\n";
} else {
print $fh "No mapping stats found for $type.\n\n";
}
}
#
# db uploads
#
my @uploads = (
['stable_ids' => 'Stable IDs'],
['events' => 'Stable ID events and mapping session'],
['archive' => 'Gene and peptide archive'],
);
my $fmt1 = "%-40s%-20s\n";
print $fh qq(Data uploaded to db:\n);
print $fh qq(====================\n\n);
if ($self->conf->param('dry_run')) {
print $fh "None (dry run).\n";
} else {
foreach my $u (@uploads) {
my $uploaded = 'no';
$uploaded = 'yes' if ($self->conf->is_true("upload_".$u->[0]));
print $fh sprintf($fmt1, $u->[1], $uploaded);
}
}
print $fh "\n";
#
# stats and clicklist
#
my @output = (
['stats' => 'statistics (including clicklists of deleted IDs)'],
['debug' => 'detailed mapping output for debugging'],
['tables' => 'data files for db upload'],
);
my $fmt2 = "%-20s%-50s\n";
print $fh qq(\nOutput directories:\n);
print $fh qq(===================\n\n);
print $fh sprintf($fmt2, qw(DIRECTORY DESCRIPTION));
print $fh ('-'x72), "\n";
print $fh sprintf($fmt2, 'basedir', $self->conf->param('basedir'));
foreach my $o (@output) {
print $fh sprintf($fmt2, '$basedir/'.$o->[0], $o->[1]);
}
print $fh "\n";
#
# clicklist of first 10 deleted genes
#
print $fh qq(\nFirst 10 deleted known genes:\n);
print $fh qq(=============================\n\n);
my $in_fh = $self->get_filehandle('genes_lost.txt', 'debug', '<');
my $prefix = $self->conf->param('urlprefix');
my $i;
while (<$in_fh>) {
last if (++$i > 10);
chomp;
my ($stable_id, $type) = split(/\s+/);
next unless ($type eq 'known');
print $fh sprintf($fmt2, $stable_id, "${prefix}$stable_id");
}
close($in_fh);
close($fh);
}
=head2 read_from_file
Arg[1] : String $filename - name of file to read
Arg[2] : (optional) String $append - directory name to append to basedir
Example : my $stats_text = $analyser->read_from_file('gene_mapping_stats',
'stats');
Description : Reads mapping stats from a file.
Return type : String
Exceptions : none
Caller : internal
Status : At Risk
: under development
=cut
sub read_from_file {
( run in 2.673 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )