Bio::Das::ProServer::SourceAdaptor conservation_score
SummaryIncluded librariesPackage variablesGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::Das::ProServer::SourceAdaptor::conservation_score - Extension of the ProServer for e! conservation scores
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Registry
Bio::EnsEMBL::Utils::Exception
Inherit
Bio::Das::ProServer::SourceAdaptor
Synopsis
No synopsis!
Description
No description!
Methods
build_features
No description
Code
das_stylesheet
No description
Code
init
No description
Code
Methods description
None available.
Methods code
build_featuresdescriptionprevnextTop
sub build_features {
    my ($self, $opts) = @_;

    my $daschr      = $opts->{'segment'} || return ( );
    my $dasstart    = $opts->{'start'} || return ( );
    my $dasend      = $opts->{'end'} || return ( );

    my $species1    = $self->config()->{'this_species'};
    my @other_species = split(/\s*\,\s*/, $self->config()->{'other_species'});
    my $chr1        = $daschr;
    my $start1      = $dasstart;
    my $end1        = $dasend;

    my $method_link = $self->config()->{'analysis'};

    my $meta_con    = $self->{'compara'}{'meta_con'};

    my $stored_max_alignment_length;

    my $values = $meta_con->list_value_by_key("max_alignment_length");

    if(@$values) {
        $stored_max_alignment_length = $values->[0];
    }

    my $mlss_adaptor                = $self->{'compara'}{'mlss_adaptor'};
    my $cs_adaptor                  = $self->{'compara'}{'cs_adaptor'};
    my $slice_adaptor               = $self->{'compara'}{'slice_adaptor'};

    my $genomedbs = $self->{'compara'}{'genomedbs'};
    my $species1_genome_db;
    my @other_species_genome_dbs;

    ## Get the Bio::EnsEMBL::Compara::GenomeDB object for the primary species
foreach my $this_genome_db (@$genomedbs){ if ($this_genome_db->name eq $species1) { $species1_genome_db = $this_genome_db; } } if (!defined($species1_genome_db)) { die "No species called $species1 in the database -- check spelling\n"; } ## Get the Bio::EnsEMBL::Compara::GenomeDB objects for the remaining species
foreach my $this_other_species (@other_species) { my $this_other_genome_db; foreach my $this_genome_db (@$genomedbs){ if ($this_genome_db->name eq $this_other_species) { $this_other_genome_db = $this_genome_db; last; } } if (!defined($this_other_genome_db)) { die "No species called $this_other_species in the database -- check spelling\n"; } push(@other_species_genome_dbs, $this_other_genome_db); } ## Fetch the Bio::EnsEMBL::Compara::MethodLinkSpeciesSet object
my $method_link_species_set; $method_link_species_set = $mlss_adaptor->fetch_by_method_link_type_GenomeDBs( $method_link, [$species1_genome_db, @other_species_genome_dbs]); ##Fetch the Bio::EnsEMBL::Slice object
my $slice = $slice_adaptor->fetch_by_region(undef, $chr1, $start1, $end1); #Fetch conservation scores
my $conservation_scores = $cs_adaptor->fetch_all_by_MethodLinkSpeciesSet_Slice($method_link_species_set, $slice); ## Build the results array
my @results = (); foreach my $score (@$conservation_scores) { my $id = $score->genomic_align_block_id; my $label = "Conservation scores"; # note will contain expected and observed scores and window size
my $note = sprintf("Expected %.3f Observed %.3f Window Size %d Max", $score->expected_score, $score->observed_score, $score->window_size); my $start_pos = $start1 + $score->position; my $end_pos = $start1 + $score->position + $score->window_size; my $new_score = $score->diff_score(); push @results, { 'id' => $id, 'label' => $label, 'method'=> $method_link, 'start' => $start_pos, 'end' => $end_pos, 'ori' => '+', 'score' => $new_score, 'note' => $note, 'typecategory' => 'Conservation scores', 'type' => 'Compara' }; } return @results;
}
das_stylesheetdescriptionprevnextTop
sub das_stylesheet {
    my $self = shift;

    return <<EOT;
<!DOCTYPE DASSTYLE SYSTEM "http://www.biodas.org/dtd/dasstyle.dtd">
<DASSTYLE>
<STYLESHEET version="1.0">
<CATEGORY id="Whole genome alignment">
<TYPE id="Compara">
<GLYPH>
<BOX>
<FGCOLOR>blue</FGCOLOR>
<BGCOLOR>aquamarine2</BGCOLOR>
</BOX>
</GLYPH>
</TYPE>
</CATEGORY>
</STYLESHEET>
</DASSTYLE>
EOT
} 1;
}
initdescriptionprevnextTop
sub init {
    my ($self) = @_;

    $self->{'capabilities'} = { 'features' => '1.0',
                                'stylesheet' => '1.0' };

    my $registry = $self->config()->{'registry'};
    unless (defined $registry) {
     throw("registry not defined\n");
    }

    if (not $Bio::EnsEMBL::Registry::registry_register->{'seen'}) {
        Bio::EnsEMBL::Registry->load_all($registry);
    }

    my $db      = "Bio::EnsEMBL::Registry";
    $db->no_version_check(1);
    my $dbname  = $self->config()->{'database'};

    $self->{'compara'}{'meta_con'} =
        $db->get_adaptor($dbname, 'compara', 'MetaContainer') or
            die "no metadbadaptor:$dbname, 'compara','MetaContainer'\n ";

    $self->{'compara'}{'mlss_adaptor'} =
        $db->get_adaptor($dbname, 'compara', 'MethodLinkSpeciesSet') or
            die "can't get $dbname, 'compara', 'MethodLinkSpeciesSet'\n";

    $self->{'compara'}{'cs_adaptor'} =
        $db->get_adaptor($dbname, 'compara', 'ConservationScore') or
            die "can't get $dbname, 'compara', 'ConservationScore'\n";

    my $species  = $self->config()->{'this_species'};
    $self->{'compara'}{'slice_adaptor'} =
        $db->get_adaptor($species, 'core', 'Slice') or
            die "can't get $species, 'core', 'Slice'\n";  

    my $genome_db_adaptor =
        $db->get_adaptor($dbname, 'compara', 'GenomeDB') or
            die "can't get $dbname, 'compara', 'GenomeDB'\n";

    $self->{'compara'}{'genomedbs'} = $genome_db_adaptor->fetch_all();
}
General documentation
INHERITANCETop
This module inherits attributes and methods from Bio::Das::ProServer::SourceAdaptor
DAS CONFIGURATION FILETop
There are some specific parameters for this module you can use in the DAS server configuration file
registryTop
Your registry configuration file to connect to the compara database
databaseTop
The species name in your Registry configuration file.
this_speciesTop
The main species. Features will be shown for this species.
other_speciesTop
The other species. This DAS track will show alignments between this_species and other_species.
You can add more than one other species separated by commas.
analysisTop
The method_link_type. This defines the type of score. E.g. GERP_CONSERVATION_SCORE
See perldoc Bio::EnsEMBL::Compara::MethodLinkSpeciesSet for more details about the
method_link_type
ExampleTop
registry configuration fileTop
  use strict;
use Bio::EnsEMBL::Utils::ConfigRegistry;
use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor;
new Bio::EnsEMBL::Compara::DBSQL::DBAdaptor( -host => 'ensembldb.ensembl.org', -user => 'anonymous', -port => 3306, -species => 'ensembl-compara-41', -dbname => 'ensembl_compara_41');
DAS server configuration fileTop
  [general]
hostname = ecs4b.internal.sanger.ac.uk
prefork = 6
maxclients = 100
port = 9013
[conservation_score] registry = /home/foo/ProServer/eg/reg.pl state = on adaptor = compara database = ensembl-compara-41 this_species = Homo sapiens other_species = Mus musculus, Rattus norvegicus, Canis familiaris, Gallus gallus, Bos taurus, Monodelphis domestica analysis = GERP_CONSTRAINED_ELEMENT description = 7 way mlagan alignment group_type = default