Bio::EnsEMBL::Compara::Production::EPOanchors
RemoveAnchorOverlaps
Toolbar
Summary
Bio::EnsEMBL::Compara::Production::EPOanchors::RemoveAnchorOverlaps
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
parameters
{input_analysis_id=> ?,method_link_species_set_id=> ?,test_method_link_species_set_id=> ?, genome_db_ids => [?],}
Description
Removes the minimum number of overlappping anchors.
Methods
configure_defaults | No description | Code |
fetch_input | No description | Code |
genome_db_ids | No description | Code |
get_params | No description | Code |
input_analysis_id | No description | Code |
method_link_species_set_id | No description | Code |
overlapping_ancs_to_remove | No description | Code |
run | No description | Code |
test_method_link_species_set_id | No description | Code |
write_output | No description | Code |
Methods description
None available.
Methods code
configure_defaults | description | prev | next | Top |
sub configure_defaults
{ my $self = shift;
return 1; } |
sub fetch_input
{ my ($self) = @_;
$self->configure_defaults();
$self->{'comparaDBA'} = Bio::EnsEMBL::Compara::Production::DBSQL::DBAdaptor->new(-DBCONN=>$self->db->dbc);
$self->{'comparaDBA'}->dbc->disconnect_when_inactive(0);
$self->get_params($self->parameters);
return 1; } |
sub genome_db_ids
{ my $self = shift;
if (@_) {
$self->{genome_db_ids} = shift;
}
return $self->{genome_db_ids}; } |
sub get_params
{ my $self = shift;
my $param_string = shift;
return unless($param_string);
print("parsing parameter string : ",$param_string,"\n");
my $params = eval($param_string);
return unless($params);
if(defined($params->{'genome_db_ids'})) {
$self->genome_db_ids($params->{'genome_db_ids'});
}
if(defined($params->{'test_method_link_species_set_id'})) {
$self->test_method_link_species_set_id($params->{'test_method_link_species_set_id'});
}
if(defined($params->{'method_link_species_set_id'})) {
$self->method_link_species_set_id($params->{'method_link_species_set_id'});
}
if(defined($params->{'input_analysis_id'})) {
$self->input_analysis_id($params->{'input_analysis_id'});
}
return 1;
}
1; } |
sub input_analysis_id
{ my $self = shift;
if (@_) {
$self->{input_analysis_id} = shift;
}
return $self->{input_analysis_id}; } |
sub method_link_species_set_id
{ my $self = shift;
if (@_) {
$self->{method_link_species_set_id} = shift;
}
return $self->{method_link_species_set_id}; } |
sub overlapping_ancs_to_remove
{ my $self = shift;
if (@_) {
$self->{overlapping_ancs_to_remove} = shift;
}
return $self->{overlapping_ancs_to_remove}; } |
sub run
{ my ($self) = @_;
my $anchor_align_adaptor = $self->{'comparaDBA'}->get_AnchorAlignAdaptor();
my $dnafrag_ids = $anchor_align_adaptor->fetch_all_dnafrag_ids($self->test_method_link_species_set_id);
my (%Overlappping_anchors, %Anchors_2_remove, %Scores);
my $test_mlssid = $self->test_method_link_species_set_id;
foreach my $genome_db_id(sort keys %{$dnafrag_ids}) {
my %genome_db_dnafrags;
foreach my $genome_db_anchors(@{ $anchor_align_adaptor->fetch_all_anchors_by_genome_db_id_and_mlssid(
$genome_db_id, $test_mlssid) }) {
push(@{ $genome_db_dnafrags{ $genome_db_anchors->[0] } }, [ @{ $genome_db_anchors }[1..4] ]);
}
foreach my $dnafrag_id(sort keys %genome_db_dnafrags) {
my @Dnafrag_anchors = @{ $genome_db_dnafrags{$dnafrag_id} };
for(my$i=0;$i<@Dnafrag_anchors-1;$i++) { for(my$j=$i+1;$j<@Dnafrag_anchors;$j++) {
if($Dnafrag_anchors[$i]->[3] >= $Dnafrag_anchors[$j]->[2]) {
$Overlappping_anchors{$Dnafrag_anchors[$i]->[1]}{$Dnafrag_anchors[$j]->[1]}++;
$Overlappping_anchors{$Dnafrag_anchors[$j]->[1]}{$Dnafrag_anchors[$i]->[1]}++;
}
else {
splice(@Dnafrag_anchors, $i, 1);
$i--;
last;
}
}
}
}
}
foreach my$anchor(sort keys %Overlappping_anchors) {
foreach my $overlapping_anchor(sort keys %{$Overlappping_anchors{$anchor}}) {
$Scores{$anchor} += ($Overlappping_anchors{$anchor}{$overlapping_anchor})**2; }
}
print STDERR "scores: ", scalar(keys %Scores), "\n";
my$flag = 1;
while($flag) {
$flag = 0;
foreach my $anchor(sort {$Scores{$b} <=> $Scores{$a}} keys %Scores) { next unless(exists($Scores{$anchor})); foreach my $anc_with_overlap_2_anchor(sort keys %{$Overlappping_anchors{$anchor}}) { $Scores{$anc_with_overlap_2_anchor} -= ($Overlappping_anchors{$anc_with_overlap_2_anchor}{$anchor})**2; delete $Scores{$anc_with_overlap_2_anchor} unless($Scores{$anc_with_overlap_2_anchor});
delete($Overlappping_anchors{$anc_with_overlap_2_anchor}{$anchor}); }
delete($Overlappping_anchors{$anchor}); delete($Scores{$anchor}); $Anchors_2_remove{$anchor}++; }
$flag = 1 if (scalar(keys %Scores));
}
print STDERR "anchors to remove: ", scalar(keys %Anchors_2_remove), "\n";
$self->overlapping_ancs_to_remove(\%Anchors_2_remove);
return 1; } |
sub test_method_link_species_set_id
{ my $self = shift;
if (@_) {
$self->{test_method_link_species_set_id} = shift;
}
return $self->{test_method_link_species_set_id}; } |
sub write_output
{ my ($self) = @_;
my $anchor_align_adaptor = $self->{'comparaDBA'}->get_AnchorAlignAdaptor();
my $current_analysis_id = $self->input_analysis_id();
my $Anchors_2_remove = $self->overlapping_ancs_to_remove();
my $test_mlssid = $self->test_method_link_species_set_id();
$anchor_align_adaptor->update_failed_anchor($Anchors_2_remove, $current_analysis_id, $test_mlssid);
return 1; } |
General documentation
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _